Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
a746d3d
Merge pull request #53 from gruntsoftware/release/v4.4.1
kcw-grunt Mar 30, 2025
ba8ea45
Revert "Updated the APIManager"
kcw-grunt Mar 31, 2025
638ce3a
Reverted the Kotlin APIManager.
kcw-grunt Mar 31, 2025
5344a96
Add version and code to welcome screen
kcw-grunt Mar 31, 2025
ebc3bb9
reset padding
kcw-grunt Mar 31, 2025
03c68b8
Merge pull request #56 from gruntsoftware/feature/add-version-issue-108
kcw-grunt Apr 1, 2025
c770f01
Revert "Updated the APIManager"
kcw-grunt Mar 31, 2025
f8c1bd5
Reverted the Kotlin APIManager.
kcw-grunt Mar 31, 2025
ff58b57
fix: fix crash when FragmentSignal dismissed
andhikayuana Apr 4, 2025
d64ea93
fix: fix sync after wipe
andhikayuana Apr 7, 2025
277f387
Merge branch 'hotfix/api-manager-fix' of https://github.com/brainwall…
kcw-grunt Apr 7, 2025
9a8a20f
fix: fix wrong lifecycle to trigger callback at FragmentSignal
andhikayuana Apr 7, 2025
832fa36
Update issue templates
kcw-grunt Apr 8, 2025
b294cd6
updated core changes
kcw-grunt Apr 8, 2025
4ed8af3
Merge pull request #57 from gruntsoftware/hotfix/api-manager-fix
kcw-grunt Apr 8, 2025
089995a
Rename .java to .kt
andhikayuana Apr 11, 2025
7e85987
chore: refactor BRApiManager & APIClient
andhikayuana Apr 11, 2025
0aa41e7
chore: remove unused part at APIClient
andhikayuana Apr 14, 2025
0cc29cb
feat: wip new peer discovery
andhikayuana Apr 14, 2025
54d2d9e
feat: implement selected peer ip address from cache (fetched from API)
andhikayuana Apr 14, 2025
c6923b1
feat: implement selected peer ip address from cache (fetched from API)
andhikayuana Apr 14, 2025
ef4e6d2
feat: filter out peers with NODE_NETWORK, NODE_BLOOM
andhikayuana Apr 15, 2025
2336939
fix: race condition when clear shared prefs values after wipeAll
andhikayuana Apr 16, 2025
51a4d9a
Merge pull request #62 from gruntsoftware/hotfix/prefs-race-condition
kcw-grunt Apr 16, 2025
62afb9d
Merge pull request #61 from gruntsoftware/feat/new-peer-discovery
kcw-grunt Apr 16, 2025
391e319
Updating the core library
kcw-grunt Apr 16, 2025
836b6f0
Chore/revert pre peer discovery (Android) (#69)
andhikayuana Apr 25, 2025
3caa1a7
feat: remove unused activity (ImportActivity) at AndroidManifest.xml …
andhikayuana Apr 29, 2025
a324444
fix: fix crash IllegalStateException: cannot make a new request becau…
andhikayuana May 2, 2025
1f9c5d0
code bump
kcw-grunt May 2, 2025
7ca17d3
Feat/move tx fee (#74)
andhikayuana May 5, 2025
e7fb2b7
fix: fix dismiss allow state loss (#76)
andhikayuana May 7, 2025
3d8ef98
fix: fix typo at strings.xml (#75)
andhikayuana May 7, 2025
25be1a8
feat: new UI for receive and topup flow (moonpay integration) (#72)
andhikayuana May 12, 2025
18eda46
version and code bump
kcw-grunt May 12, 2025
dbb6a5f
Added support url (#81)
kcw-grunt May 19, 2025
c82a5e3
version and code bump
kcw-grunt May 19, 2025
2981ec6
Revert from eda0f532 & cherry pick (#86)
andhikayuana May 25, 2025
c161fed
build bump
kcw-grunt May 25, 2025
63d7494
chore: open bread activity first then open moonpay widget (#88)
andhikayuana May 26, 2025
f09eb28
Adjustment for circleci (#89)
andhikayuana May 29, 2025
47c69cd
fix: android: Footer version label is obfuscated (#92)
andhikayuana May 29, 2025
a9c4a63
fix: You saved it right screen reset button covers words (#93)
andhikayuana May 29, 2025
d8f08ad
tiny resizing (#94)
kcw-grunt May 29, 2025
ef93585
code and version bump
kcw-grunt May 29, 2025
174d612
change break (#97)
kcw-grunt May 30, 2025
a4521d7
build code number
andhikayuana May 31, 2025
6fec1e2
fix: [#137] fix: Reset fiat options in Buy / Receive modal (#99)
andhikayuana Jun 2, 2025
c8fdf8d
Chore/update device data (#100)
kcw-grunt Jun 2, 2025
3f646df
Add agent string obfuscation (#103)
kcw-grunt Jun 14, 2025
642f9e6
updated metadata (#105)
kcw-grunt Jun 24, 2025
50f44de
chore: remove screen lock detection (#106)
andhikayuana Jun 24, 2025
ea15423
🧰 Fx/seed words UI polish (#108)
kcw-grunt Jun 25, 2025
5b6dff3
❇️ Feat/add polish punjabi farsi (#109)
kcw-grunt Jun 27, 2025
4ff50b8
fix: fix YourSeedProveItState.isWordUsedCorrectly (#111)
andhikayuana Jun 29, 2025
2fd094f
Upgrade targetSdk 36 (#113)
andhikayuana Aug 5, 2025
4efd95f
feat(#195): adopt koin annotation for dependency injection (#120)
JosephSanjaya Aug 18, 2025
5900ed4
Create PULL_REQUEST_TEMPLATE.md
kcw-grunt Aug 19, 2025
3b1f628
bump for test (#121)
kcw-grunt Aug 19, 2025
f11d5a8
feat(#174): initiate games module (#119)
JosephSanjaya Aug 20, 2025
77ed7df
Force pushed the version and code bump and catch up with Prod.
kcw-grunt Aug 20, 2025
ef353e3
πŸš€[Release v4.7.2] Merge into Develop (#127)
kcw-grunt Aug 25, 2025
e25e9e1
Fix(#227): Crash when launching MoonPay Widget (#126)
JosephSanjaya Aug 25, 2025
e0aebb5
feat(#138): Improve Unlock Screen UI and add dark mode toggle (#122)
JosephSanjaya Aug 25, 2025
7d8dd14
Redesign welcome screen (#123)
josikie Aug 25, 2025
18df293
fix(#226): android test failure on RecoverWalletScreenGrabsTest (#130)
JosephSanjaya Aug 26, 2025
9b191b7
fix(#223): fix issue on test environment SLF4J + agent warnings in te…
JosephSanjaya Aug 26, 2025
c9b1ef0
feat(#225): Send sync duration in Firebase Analytics as a custom even…
JosephSanjaya Aug 30, 2025
58f0cd8
feat(#234): Implement language-specific Firebase messaging topics (#132)
JosephSanjaya Aug 30, 2025
4bb06cf
bump code
kcw-grunt Aug 30, 2025
9f4908b
chore(#234): normalize Indonesian language code to "id" (#133)
JosephSanjaya Aug 30, 2025
4a27ae0
Feat: Detekt and Test Plugins, (Including Create Detekt Baseline) (#136)
JosephSanjaya Sep 22, 2025
3285d8e
Chore/renamed gp module (#140)
kcw-grunt Sep 29, 2025
94459d0
create private gp submodule
kcw-grunt Sep 23, 2025
13c39a0
Update settings.gradle.kts
kcw-grunt Sep 23, 2025
c0683ad
chore: Migrate build logic to version catalog and update submodules
JosephSanjaya Sep 24, 2025
2fcb1b2
feat(deps): add kotlin-immutable dependency
JosephSanjaya Oct 5, 2025
631b4f6
refactor(app): Relocate core module imports
JosephSanjaya Oct 8, 2025
0b46614
Merge pull request #141 from gruntsoftware/js/feat/iap
JosephSanjaya Oct 9, 2025
279fa23
build bump
kcw-grunt Oct 9, 2025
5ea5fe9
Merge branch 'main' into release/v4.8.0
kcw-grunt Oct 9, 2025
779f47f
removed cruft
kcw-grunt Oct 9, 2025
05813ad
chore(submodules): remove bugged games repository
JosephSanjaya Oct 10, 2025
67000e9
bump code
kcw-grunt Oct 10, 2025
83f1b85
Release/v4.8.0 (#147)
kcw-grunt Oct 13, 2025
798b7c9
Merge branch 'develop' of https://github.com/brainwallet-co/android i…
kcw-grunt Oct 18, 2025
d5b14db
bug(crashlytics): Remove InputWordsActivity from AndroidManifest
JosephSanjaya Oct 18, 2025
a08c6f6
fix(crashlytics): resolve ReEnterPinActivity crashes and deprecation …
JosephSanjaya Oct 22, 2025
56be50f
Remove resizability and orientation restrictions in our app (#146)
josikie Oct 22, 2025
2f06f5c
build: Build secp256k1 as a static library and add ABI splits (#149)
JosephSanjaya Nov 14, 2025
aeb5ab5
version bump (#159)
kcw-grunt Feb 7, 2026
8cabf2a
Revert "build: Build secp256k1 as a static library and add ABI splits…
kcw-grunt Feb 7, 2026
0a46627
Techdebt/adjust build logic (#161)
kcw-grunt Feb 8, 2026
5738254
Added auto translate (#178)
kcw-grunt Apr 9, 2026
25fcc5d
Add auto-translate workflow for strings.xml
kcw-grunt Apr 12, 2026
34e6d65
Create PR summary workflow with GitHub Copilot
kcw-grunt Apr 12, 2026
914bcd3
Changed the AI completions
kcw-grunt Apr 13, 2026
ca4fcd9
Add more information of the README
kcw-grunt Apr 13, 2026
12a3d83
nit fix
kcw-grunt Apr 13, 2026
5d3a6c2
πŸ¦–πŸ˜± HUGE!! Bento Integration (#192)
kcw-grunt Apr 14, 2026
010be8c
Release/v4.9.0 (#201)
kcw-grunt Apr 16, 2026
ce9d121
Feat/add thai dutch (#197)
kcw-grunt Apr 16, 2026
083027f
update gitignore (#204)
kcw-grunt Apr 17, 2026
9495b47
Add send/receive transaction integration tests (#203)
kcw-grunt Apr 18, 2026
e0b116a
Designdebt/polish main screen (#205)
kcw-grunt Apr 18, 2026
902f8fb
Feat/add gamehub minigame (#206)
kcw-grunt Apr 19, 2026
879ab6f
Moved clipboard test point into event (#207)
kcw-grunt Apr 20, 2026
334ce3b
moved out of the state update (#208)
kcw-grunt Apr 20, 2026
4455c07
Version bump
kcw-grunt Apr 20, 2026
fcc51f9
fix: issue when user tries to send (#210)
kcw-grunt Apr 22, 2026
b220d0f
reformatted the test
kcw-grunt Apr 18, 2026
5d01e5a
Added More comprehensive Send Tests to cover better stability
kcw-grunt Apr 23, 2026
2ad22d0
Add WalletManager; make validateAddress instance
kcw-grunt Apr 23, 2026
f0e16f6
Updated the InstrumentedTest
kcw-grunt Apr 23, 2026
9a88ed3
adjust the config
kcw-grunt Apr 23, 2026
a11b4db
adjust config for running
kcw-grunt Apr 23, 2026
39cb5f4
Further fix
kcw-grunt Apr 23, 2026
b981834
Fixes the bug: BreadActivity.initializeViews
kcw-grunt Apr 23, 2026
7828223
Merge branch 'main' into release/v4.9.1
kcw-grunt Apr 24, 2026
4c0e7d3
updated README
kcw-grunt Apr 24, 2026
0bfe9d7
bump
kcw-grunt Apr 24, 2026
8c3f1b2
chore(i18n): auto-translate missing strings [skip ci] (#213)
kcw-grunt Apr 24, 2026
bc79335
Feat/add tutorial functionality (#214)
kcw-grunt Apr 24, 2026
2af613b
Feat/bitrefill in topsecret (#217)
kcw-grunt Apr 25, 2026
38be6d1
Feat/bitrefill in topsecret (#221)
kcw-grunt Apr 25, 2026
04e8546
added polish
kcw-grunt Apr 25, 2026
7224aff
Merge branch 'main' into develop
kcw-grunt Apr 27, 2026
c792f3e
✨ πŸ›οΈ πŸ› οΈ Fix/sendmodelonevent crash (#224)
kcw-grunt Apr 27, 2026
6efad7a
Fixxed the layout of the LTC fiat picker (#225)
kcw-grunt Apr 27, 2026
2025282
Refactored the analytics (#226)
kcw-grunt Apr 28, 2026
f403751
Merge branch 'main' into develop
kcw-grunt Apr 28, 2026
734b3d7
🧼 Techdebt/sync reduce rate fpf (#228)
kcw-grunt May 1, 2026
a20d678
bump
kcw-grunt May 1, 2026
d046259
Techdebt/sync reduce rate fpf (#229)
kcw-grunt May 3, 2026
9cc425d
Feat/add remote shop (#230)
kcw-grunt May 9, 2026
728f354
version bump
kcw-grunt May 10, 2026
e57563d
add part of test
kcw-grunt May 10, 2026
d0886db
Techdebt/improve shop (#232)
kcw-grunt May 28, 2026
44fcc8f
Added analytics when user shows invoice in shop (#233)
kcw-grunt May 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/notify.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Notify Mirror on PR
name: Notify πŸͺž on PR

on:
pull_request:
types: [opened, synchronize, reopened]

workflow_dispatch:
#pull_request:
# types: [opened, synchronize, reopened]
jobs:
trigger-mirror:
runs-on: ubuntu-latest
Expand All @@ -17,11 +17,11 @@ jobs:
owner: 'gruntsoftware',
repo: 'android',
workflow_id: 'sync.yml',
ref: 'main',
ref: 'develop',
inputs: {
source: '${{ github.event.repository.name }}',
pr_number: '${{ github.event.pull_request.number }}',
pr_title: '${{ github.event.pull_request.title }}',
branch: '${{ github.head_ref }}'
}
})
})
1 change: 1 addition & 0 deletions .github/workflows/pr-summary-copilot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
branches:
- develop
- main
workflow_dispatch:

permissions:
contents: read
Expand Down
10 changes: 6 additions & 4 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ android {
applicationId = "ltd.grunt.brainwallet"
minSdk = 29
targetSdk = 35
versionCode = 202506326
versionName = "v4.9.1"
versionCode = 202506335
versionName = "v4.9.3"
multiDexEnabled = true
base.archivesName.set("${defaultConfig.versionName}(${defaultConfig.versionCode})")
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
Expand Down Expand Up @@ -86,14 +86,14 @@ android {
isDebuggable = true
isMinifyEnabled = false
}
resValue("string", "firebase_analytics_collection_enabled", "false")
}

val release by getting {
signingConfig = signingConfigs.getByName("release")
isDebuggable = false
isMinifyEnabled = true
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")

resValue("string", "firebase_analytics_collection_enabled", "true")
ndk {
isDebuggable = false
isMinifyEnabled = true
Expand Down Expand Up @@ -200,6 +200,7 @@ dependencies {
implementation(project(":iap"))
implementation(project(":core"))
implementation("androidx.webkit:webkit:1.9.0")
implementation(libs.androidx.benchmark.traceprocessor)
testImplementation(testFixtures(project(":app")))
androidTestImplementation(testFixtures(project(":app")))
implementation(grunt.androidx.core.ktx)
Expand Down Expand Up @@ -257,6 +258,7 @@ dependencies {
implementation(libs.android.installreferrer)
implementation("androidx.compose.animation:animation:1.5.0")
implementation("org.jetbrains.kotlinx:kotlinx-collections-immutable:0.3.7")
implementation("io.coil-kt:coil-compose:2.0.0-rc01")
testImplementation(libs.junit)
testImplementation(libs.mockk)
testImplementation(libs.turbine)
Expand Down
7 changes: 2 additions & 5 deletions app/src/main/java/com/brainwallet/constants/BWConstants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ object BWConstants {
*/
const val NATIVE_LIB_NAME: String = "core-lib"

const val _BW_MAIN_OPEN: String = "bw_main_open"

/**
* Permissions
*/
Expand Down Expand Up @@ -106,8 +104,7 @@ object BWConstants {
const val SUPPORT_WEB_LINK: String = "https://www.brainwallet.co/support"
const val TOS_LINK: String = "https://www.brainwallet.co/privacypolicy"
const val LINKTREE_URL: String = "https://linktr.ee/brainwallet"

const val BITREFILL_URL: String = "https://www.bitrefill.com/?ref=bAshL935"
const val BITREFILL_URL: String = "https://www.bitrefill.com/?ref=bw_tk_26"

/**
* API Hosts
Expand All @@ -128,7 +125,7 @@ object BWConstants {
const val _20200112_ERR: String = "brainwallet_android_error"
const val _20200112_DSR: String = "did_start_resync"
const val _20201118_DTGS: String = "did_tap_get_support"
const val _20200217_DUWB: String = "did_unlock_with_biometrics"
const val _20200217_DU: String = "did_unlock"

const val _20250303_DSTU: String = "did_skip_top_up"
const val _20250517_WCINFO: String = "wallet_callback_info"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import com.brainwallet.data.model.Fee
import com.brainwallet.data.model.LtcStats
import com.brainwallet.data.model.MoonpayCurrencyLimit
import com.brainwallet.data.source.response.GetMoonpayBuyQuoteResponse
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.StateFlow

interface LtcRepository {

val rates: StateFlow<List<CurrencyEntity>>
val rates: SharedFlow<List<CurrencyEntity>>
val ltcStats: StateFlow<LtcStats>

suspend fun fetchRates(): List<CurrencyEntity>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,56 @@ import com.brainwallet.data.model.LtcStats
import com.brainwallet.data.model.MoonpayCurrencyLimit
import com.brainwallet.data.repository.LtcRepository.Companion.PREF_KEY_BUY_LIMITS_PREFIX
import com.brainwallet.data.repository.LtcRepository.Companion.PREF_KEY_BUY_LIMITS_PREFIX_CACHED_AT
import com.brainwallet.data.source.PeerManagerSource
import com.brainwallet.data.source.RemoteApiSource
import com.brainwallet.data.source.RemoteConfigSource
import com.brainwallet.data.source.fetchWithCache
import com.brainwallet.data.source.response.GetMoonpayBuyQuoteResponse
import com.brainwallet.di.AppModule.json
import com.brainwallet.tools.manager.BRSharedPrefs
import com.brainwallet.tools.manager.FeeManager
import com.brainwallet.tools.sqlite.CurrencyDataSource
import com.brainwallet.tools.util.Utils
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.MutableSharedFlow
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.SharedFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asSharedFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import org.koin.core.annotation.Single
import timber.log.Timber

@Single(binds = [LtcRepository::class])
class LtcRepositoryImpl(
private val context: Context,
private val remoteApiSource: RemoteApiSource,
private val remoteConfigSource: RemoteConfigSource,
private val currencyDataSource: CurrencyDataSource,
private val peerManagerSource: PeerManagerSource,
private val repositoryScope: CoroutineScope = CoroutineScope(SupervisorJob() + Dispatchers.IO),
private val sharedPreferences: SharedPreferences,
) : LtcRepository {

private val _rates = MutableStateFlow<List<CurrencyEntity>>(emptyList())
override val rates: StateFlow<List<CurrencyEntity>> = _rates.asStateFlow()
// private val _rates = MutableStateFlow<List<CurrencyEntity>>(
// currencyDataSource.getAllCurrencies(true) // seed from cache immediately
// )
private val _rates = MutableSharedFlow<List<CurrencyEntity>>(
replay = 1,
onBufferOverflow = BufferOverflow.DROP_OLDEST
).apply {
// seed with cached values immediately, same as before
tryEmit(currencyDataSource.getAllCurrencies(true))
}
override val rates: SharedFlow<List<CurrencyEntity>> = _rates.asSharedFlow()
private val _ltcStats = MutableStateFlow(
LtcStats(
0,
Expand All @@ -40,12 +68,48 @@ class LtcRepositoryImpl(
0
)
)

private var syncingDelay = 60_000L
private var nonSyncingDelay = 4_000L

@Serializable
private data class SyncPoolerContentWrapper(
@SerialName("sync_delay") val syncDelayValue: Long = 60_000L,
@SerialName("non_sync_delay") val nonSyncDelayValue: Long = 4_000L
)

override val ltcStats: StateFlow<LtcStats> = _ltcStats.asStateFlow()

init {

repositoryScope.launch {
runCatching { remoteConfigSource.fetchAndActivate() }
.onFailure { Timber.e(it, "RemoteConfig fetch failed") }

val rawJson = remoteConfigSource.getString(RemoteConfigSource.KEY_SYNC_POLLER)
runCatching {
val config = json.decodeFromString<SyncPoolerContentWrapper>(rawJson)
syncingDelay = config.syncDelayValue
nonSyncingDelay = config.nonSyncDelayValue
}.onFailure { Timber.e(it, "RemoteConfig parse failed") }

while (isActive) {
runCatching { fetchRates() }
.onFailure { Timber.e(it, "fetchRates failed") }

val delay = if (peerManagerSource.blockInfo.value.syncProgress <= 0.95f) {
syncingDelay
} else {
nonSyncingDelay
}
Timber.d("timber|| duration in fetching $syncingDelay $nonSyncingDelay")
delay(delay)
}
}
}
override suspend fun fetchRates(): List<CurrencyEntity> {
return runCatching {
val rates = remoteApiSource.getRates()

FeeManager.updateFeePerKb(context)
val selectedISO = BRSharedPrefs.getIsoSymbol(context)
rates.forEachIndexed { index, currencyEntity ->
Expand All @@ -62,7 +126,7 @@ class LtcRepositoryImpl(
}.getOrElse {
currencyDataSource.getAllCurrencies(true)
}.also { result ->
_rates.value = result
_rates.emit(result)
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.brainwallet.data.repository
import com.brainwallet.data.source.RemoteConfigSource
import com.brainwallet.presenter.entities.ShopCard
import com.brainwallet.presenter.entities.ShopConfig
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asStateFlow
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import timber.log.Timber

@Serializable
data class ShopProxy(
@SerialName("widget_url") val widget: String = "",
@SerialName("cards") val shopCards: List<ShopCard> = emptyList()
)

interface ShopProxyRepository {
val shopProxy: StateFlow<List<ShopProxy>>
suspend fun refresh()
}

class ShopProxyRepositoryImpl(
private val remoteConfigSource: RemoteConfigSource,
private val json: Json,
) : ShopProxyRepository {

private val _shopProxy = MutableStateFlow<List<ShopProxy>>(emptyList())
override val shopProxy: StateFlow<List<ShopProxy>> = _shopProxy.asStateFlow()

override suspend fun refresh() {
runCatching { remoteConfigSource.fetchAndActivate() }
.onFailure { Timber.e(it, "RemoteConfig fetch failed") }

val rawJson = remoteConfigSource.getString(RemoteConfigSource.PATH_SHOP_CONTENT)
Timber.d("ShopProxy rawJson: '$rawJson'")

runCatching {
val shopConfig = json.decodeFromString<ShopConfig>(rawJson)
Timber.d("ShopConfig parsed: ${shopConfig.shopData}")
_shopProxy.value = listOf(shopConfig.shopData).map {
ShopProxy(
widget = it.widgetUrl,
shopCards = it.cards
)
}
}.onFailure { Timber.e(it, "RemoteConfig parse failed") }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class SyncAnalyticsRepository(
stopSync()

val totalDuration = prefs.getLong(KEY_ACCUMULATED_DURATION, 0L)
if (totalDuration == 0L) return
if (totalDuration <= 8000L) return

val endTimestamp = peerManagerSource.getLastBlockTimestamp()
val endBlockHeight = peerManagerSource.getCurrentBlockHeight()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ interface RemoteConfigSource {
const val KEY_FEATURE_MENU_HIDDEN_EXAMPLE = "feature_menu_hidden_example"
const val KEY_FEATURE_SELECTED_PEERS_ENABLED = "feature_selected_peers_enabled"
const val KEY_FEATURE_GAMEHUB_CONTENT = "feature_gamehub_content"
const val PATH_SHOP_CONTENT = "path_shop_content"
const val KEY_SYNC_POLLER = "key_sync_poller"
const val KEY_API_BASEURL_PROD_NEW_ENABLED = "key_api_baseurl_prod_new_enabled"
const val KEY_FEATURE_LTC_BROWSER_CONTENT = "feature_ltc_browser_content"
const val KEY_KEYSTORE_MANAGER_ENABLED = "key_keystore_manager_enabled"
const val KEY_DEV_API_BASEURL = "key_dev_api_baseurl"
const val KEY_API_BASEURL_DEV_NEW_ENABLED = "key_api_baseurl_dev_new_enabled"
const val KEY_PROD_API_BASEURL = "key_prod_api_baseurl"
}

fun initialize()
Expand Down
8 changes: 7 additions & 1 deletion app/src/main/java/com/brainwallet/di/RemoteConfigModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.brainwallet.di
import com.brainwallet.data.repository.FirebaseRemoteConfigRepositoryImpl
import com.brainwallet.data.repository.HubContentRepository
import com.brainwallet.data.repository.HubContentRepositoryImpl
import com.brainwallet.data.repository.ShopProxyRepository
import com.brainwallet.data.repository.ShopProxyRepositoryImpl
import com.brainwallet.data.source.RemoteConfigSource
import com.google.firebase.remoteconfig.FirebaseRemoteConfig
import org.koin.dsl.module
Expand All @@ -11,10 +13,14 @@ val remoteConfigModule = module {
single {
FirebaseRemoteConfig.getInstance().apply {
setDefaultsAsync(
mapOf(RemoteConfigSource.KEY_FEATURE_GAMEHUB_CONTENT to "[]")
mapOf(
RemoteConfigSource.KEY_FEATURE_GAMEHUB_CONTENT to "[]",
RemoteConfigSource.PATH_SHOP_CONTENT to "{\"shop_data\":{}}"
)
)
}
}
single<RemoteConfigSource> { FirebaseRemoteConfigRepositoryImpl(get()) }
single<HubContentRepository> { HubContentRepositoryImpl(get(), get()) }
single<ShopProxyRepository> { ShopProxyRepositoryImpl(get(), get()) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ fun NavGraphBuilder.mainNavGraph(
}

composable<Route.BitrefillWeb> { navBackStackEntry ->
val route: Route.LinktreeWeb = navBackStackEntry.toRoute()
val route: Route.BitrefillWeb = navBackStackEntry.toRoute()
WebModalScreen(
onNavigate = onNavigate,
url = BWConstants.BITREFILL_URL
url = route.url
)
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/brainwallet/navigation/Route.kt
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ sealed class Route : JavaSerializable {
object MoonPayBuy : Route()

@Serializable
object BitrefillWeb : Route()
data class BitrefillWeb(val url: String) : Route()

@Serializable
object LinktreeWeb : Route()
Expand Down
Loading
Loading