refactor: lazy-load Namecoin services on Desktop (not kept in memory from start)
Move Namecoin service initialization from App-level (eager, on every startup) to inside the LoggedIn branch (only created when user logs in and screens that use Namecoin are reachable). Matches the Android lazy pattern in AppModules. Also deduplicate NamecoinSettings: Android module now uses a typealias to the commons module version, matching the original PR intent.
This commit is contained in:
@@ -719,10 +719,6 @@ fun App(
|
||||
}
|
||||
|
||||
val localCache = remember { DesktopLocalCache() }
|
||||
val namecoinPreferences = remember { DesktopNamecoinPreferences() }
|
||||
val namecoinService = remember {
|
||||
DesktopNamecoinNameService(preferencesProvider = { namecoinPreferences.current })
|
||||
}
|
||||
val accountState by accountManager.accountState.collectAsState()
|
||||
val scope = remember { CoroutineScope(SupervisorJob() + Dispatchers.Main) }
|
||||
|
||||
@@ -900,10 +896,6 @@ fun App(
|
||||
ProvideMaterialSymbols(
|
||||
weight = com.vitorpamplona.amethyst.desktop.platform.PlatformIconWeight.current,
|
||||
) {
|
||||
CompositionLocalProvider(
|
||||
LocalNamecoinPreferences provides namecoinPreferences,
|
||||
LocalNamecoinService provides namecoinService,
|
||||
) {
|
||||
Surface(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
color = MaterialTheme.colorScheme.background,
|
||||
@@ -1068,7 +1060,6 @@ fun App(
|
||||
}
|
||||
}
|
||||
}
|
||||
} // end CompositionLocalProvider
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user