-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
105 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 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 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,4 @@ | ||
{ | ||
"name": "Demo SDK", | ||
"type": "demo-auth" | ||
} |
This file contains 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 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
7 changes: 7 additions & 0 deletions
7
...tx-demo-android-sdk/src/main/java/com/stargatex/lib/strgtxdemosdk/config/AccountConfig.kt
This file contains 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,7 @@ | ||
package com.stargatex.lib.strgtxdemosdk.config | ||
|
||
/** | ||
* @author Lahiru J (lahirujay) | ||
* @version 1.0 | ||
*/ | ||
data class AccountConfig(var name: String, var type: String) |
9 changes: 9 additions & 0 deletions
9
...-android-sdk/src/main/java/com/stargatex/lib/strgtxdemosdk/config/AccountConfiguration.kt
This file contains 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 @@ | ||
package com.stargatex.lib.strgtxdemosdk.config | ||
|
||
/** | ||
* @author Lahiru J (lahirujay) | ||
* @version 1.0 | ||
*/ | ||
interface AccountConfiguration { | ||
fun retrieveConfig(resourceId: Int): AccountConfig | ||
} |
14 changes: 14 additions & 0 deletions
14
...oid-sdk/src/main/java/com/stargatex/lib/strgtxdemosdk/config/AccountConfigurationStore.kt
This file contains 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,14 @@ | ||
package com.stargatex.lib.strgtxdemosdk.config | ||
|
||
/** | ||
* @author Lahiru J (lahirujay) | ||
* @version 1.0 | ||
*/ | ||
object AccountConfigurationStore { | ||
|
||
fun loadAccountConfiguration( | ||
accountConfiguration: AccountConfiguration, | ||
resourceId: Int | ||
): AccountConfig = | ||
accountConfiguration.retrieveConfig(resourceId) | ||
} |
27 changes: 27 additions & 0 deletions
27
...d-sdk/src/main/java/com/stargatex/lib/strgtxdemosdk/config/DefaultAccountConfiguration.kt
This file contains 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,27 @@ | ||
package com.stargatex.lib.strgtxdemosdk.config | ||
|
||
|
||
import android.content.Context | ||
import com.google.gson.Gson | ||
import okio.Buffer | ||
import okio.buffer | ||
import okio.source | ||
import java.nio.charset.Charset | ||
|
||
/** | ||
* @author Lahiru J (lahirujay) | ||
* @version 1.0 | ||
*/ | ||
class DefaultAccountConfiguration(private val context: Context) : AccountConfiguration { | ||
override fun retrieveConfig(resourceId: Int): AccountConfig { | ||
val configBuffer = Buffer() | ||
val rawResourceBufferedSource = | ||
context.resources.openRawResource(resourceId).source().buffer() | ||
rawResourceBufferedSource.readAll(configBuffer) | ||
val jsonString = configBuffer.readString(Charset.forName("UTF-8")) | ||
return Gson().fromJson(jsonString, AccountConfig::class.java) | ||
} | ||
|
||
} | ||
|
||
|
This file contains 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,4 @@ | ||
{ | ||
"name": "", | ||
"type": "" | ||
} |