-
Notifications
You must be signed in to change notification settings - Fork 13
feat(superposition): integrate /sdk-configs endpoint for dynamic field rendering #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Pradeep-kumar1202
wants to merge
1
commit into
main
Choose a base branch
from
superposition-phase-1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,3 +40,4 @@ scancardVersion=1.0.0 | |
| webviewVersion=1.0.5 | ||
| rnlibVersion=1.0.1 | ||
| airBorneVersion=1.0.0 | ||
| superpositionVersion=1.0.0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,4 +26,5 @@ android { | |
| dependencies { | ||
| api libs.playServicesWallet | ||
| api libs.eventBus | ||
| implementation libs.okhttp | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| /build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| plugins { | ||
| id 'com.android.library' | ||
| id 'org.jetbrains.kotlin.android' | ||
| } | ||
|
|
||
| group = "io.hyperswitch" | ||
| version = superpositionVersion | ||
|
|
||
| android { | ||
| namespace 'io.hyperswitch.superposition' | ||
| compileSdk rootProject.ext.compileSdkVersion | ||
|
|
||
| defaultConfig { | ||
| minSdk rootProject.ext.minSdkVersion | ||
| consumerProguardFiles "consumer-rules.pro" | ||
| } | ||
|
|
||
| buildTypes { | ||
| release { | ||
| minifyEnabled false | ||
| proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' | ||
| } | ||
| } | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation project(':hyperswitch-sdk-android-common') | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| # Add project specific ProGuard rules here. | ||
| # You can control the set of applied configuration files using the | ||
| # proguardFiles setting in build.gradle. | ||
| # | ||
| # For more details, see | ||
| # http://developer.android.com/guide/developing/tools/proguard.html | ||
|
|
||
| # Keep SuperpositionManager public API | ||
| -keep class io.hyperswitch.superposition.SuperpositionManager { *; } |
5 changes: 5 additions & 0 deletions
5
...android-superposition/src/main/kotlin/io/hyperswitch/superposition/SuperpositionConfig.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| package io.hyperswitch.superposition | ||
|
|
||
| data class SuperpositionConfig( | ||
| val configJson: String? = null | ||
| ) |
42 changes: 42 additions & 0 deletions
42
...ndroid-superposition/src/main/kotlin/io/hyperswitch/superposition/SuperpositionManager.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package io.hyperswitch.superposition | ||
|
|
||
| import android.util.Log | ||
| import io.hyperswitch.networking.HyperNetworking | ||
|
|
||
| object SuperpositionManager { | ||
|
|
||
| private const val TAG = "SuperpositionManager" | ||
|
|
||
| private var host: String? = null | ||
| private var profileId: String? = null | ||
| private var apiKey: String? = null | ||
| @Volatile private var cachedConfig: SuperpositionConfig? = null | ||
|
|
||
| fun initialise(host: String, profileId: String, apiKey: String) { | ||
| this.host = host | ||
| this.profileId = profileId | ||
| this.apiKey = apiKey | ||
| cachedConfig = null | ||
| } | ||
|
|
||
| fun fetchConfig() { | ||
| val h = host ?: return | ||
| val pid = profileId ?: return | ||
| val ak = apiKey ?: return | ||
|
|
||
| val url = "$h/v1/sdk/configs/$pid/web/sandbox.json" | ||
| Log.d(TAG, "Fetching superposition config from: $url") | ||
| HyperNetworking.makeGetRequest(url, mapOf("Content-Type" to "application/json", "api-key" to ak)) { result -> | ||
| result.onSuccess { json -> | ||
| if (json.isNotBlank()) { | ||
| cachedConfig = SuperpositionConfig(configJson = json) | ||
| Log.d(TAG, "Config fetched successfully") | ||
| Log.d(TAG, "Superposition config response: $json") | ||
| } | ||
| } | ||
| result.onFailure { e -> Log.e(TAG, "Config fetch failed: ${e.message}") } | ||
| } | ||
| } | ||
|
|
||
| fun getCachedConfig(): SuperpositionConfig? = cachedConfig | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.