Updated on 2026-08-14
This commit is contained in:
parent
8922d23eec
commit
f3c2d98214
7 changed files with 962 additions and 30 deletions
|
|
@ -174,6 +174,7 @@ class MainActivity : AppCompatActivity(), ActivityResultCallbackHolder {
|
|||
installAppTheme()
|
||||
|
||||
val splashScreen = installSplashScreen()
|
||||
TangemLogger.i("Splash screen installed")
|
||||
|
||||
enableEdgeToEdge(
|
||||
navigationBarStyle = SystemBarStyle.auto(
|
||||
|
|
@ -350,6 +351,7 @@ class MainActivity : AppCompatActivity(), ActivityResultCallbackHolder {
|
|||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
TangemLogger.i("onNewIntent: data=${intent.data}, extras=${intent.extras?.keySet()}")
|
||||
|
||||
val isFromPush = intent.extras?.containsKey(OPENED_FROM_GCM_PUSH) == true
|
||||
if (isFromPush) {
|
||||
|
|
|
|||
|
|
@ -270,22 +270,6 @@ open class TangemApplication : Application(), ImageLoaderFactory, Configuration.
|
|||
}
|
||||
}
|
||||
|
||||
private fun updateLogFiles() {
|
||||
appLogsStore.deleteOldLogsFile()
|
||||
|
||||
if (!BuildConfig.TESTER_MENU_ENABLED) {
|
||||
appLogsStore.deleteLastLogFile()
|
||||
}
|
||||
|
||||
// Temporally logs are not saved
|
||||
// scope.launch {
|
||||
// if (!appPreferencesStore.getSyncOrDefault(WAS_LOG_FILE_CLEARED, false)) {
|
||||
// appLogsStore.deleteLastLogFile()
|
||||
// appPreferencesStore.store(WAS_LOG_FILE_CLEARED, true)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize components that need to be initialized before [super.onCreate] is called
|
||||
*/
|
||||
|
|
@ -389,6 +373,22 @@ open class TangemApplication : Application(), ImageLoaderFactory, Configuration.
|
|||
)
|
||||
}
|
||||
|
||||
private fun updateLogFiles() {
|
||||
appLogsStore.deleteOldLogsFile()
|
||||
|
||||
if (!BuildConfig.TESTER_MENU_ENABLED) {
|
||||
appLogsStore.deleteLastLogFile()
|
||||
}
|
||||
|
||||
// Temporarily logs are not saved
|
||||
// scope.launch {
|
||||
// if (!appPreferencesStore.getSyncOrDefault(WAS_LOG_FILE_CLEARED, false)) {
|
||||
// appLogsStore.deleteLastLogFile()
|
||||
// appPreferencesStore.store(WAS_LOG_FILE_CLEARED, true)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
override fun newImageLoader(): ImageLoader {
|
||||
return createCoilImageLoader(
|
||||
context = this,
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ internal class MainViewModel @Inject constructor(
|
|||
// await while initial route stack is initialized
|
||||
appRouterConfig.initializedState.first { it }
|
||||
|
||||
TangemLogger.withTag("MainActivity").i("Splash screen dismissed")
|
||||
isSplashScreenShown = false
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.tangem.core.analytics.models.ExceptionAnalyticsEvent
|
|||
import com.tangem.core.decompose.navigation.Router
|
||||
import com.tangem.tap.routing.configurator.AppRouterConfig
|
||||
import com.tangem.utils.coroutines.CoroutineDispatcherProvider
|
||||
import com.tangem.utils.coroutines.runSuspendCatching
|
||||
import com.tangem.utils.logging.TangemLogger
|
||||
import com.tangem.wallet.R
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
|
|
@ -19,6 +20,8 @@ internal class ProxyAppRouter(
|
|||
private val analyticsExceptionHandler: AnalyticsExceptionHandler,
|
||||
) : AppRouter {
|
||||
|
||||
private val logger = TangemLogger.withTag("AppRouter")
|
||||
|
||||
private val routerScope: CoroutineScope
|
||||
get() = requireNotNull(config.routerScope) {
|
||||
"Router scope is not set in config"
|
||||
|
|
@ -47,12 +50,8 @@ internal class ProxyAppRouter(
|
|||
}
|
||||
|
||||
override fun replaceAll(vararg routes: AppRoute, onComplete: (isSuccess: Boolean) -> Unit) {
|
||||
safeNavigate(onComplete, message = "Replace all routes with $routes") {
|
||||
runCatching {
|
||||
innerRouter.replaceAll(*routes, onComplete = onComplete)
|
||||
}.getOrElse {
|
||||
TangemLogger.e("Error", it)
|
||||
}
|
||||
safeNavigate(onComplete, message = "Replace all routes with ${routes.toList().ifEmpty { "<empty>" }}") {
|
||||
innerRouter.replaceAll(*routes, onComplete = onComplete)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -76,21 +75,20 @@ internal class ProxyAppRouter(
|
|||
|
||||
private fun safeNavigate(onComplete: (isSuccess: Boolean) -> Unit, message: String, block: () -> Unit) {
|
||||
routerScope.launch(dispatchers.mainImmediate) {
|
||||
TangemLogger.i(message)
|
||||
logger.i(message)
|
||||
|
||||
try {
|
||||
block()
|
||||
} catch (e: Throwable) {
|
||||
TangemLogger.e("Error", e)
|
||||
onComplete(false)
|
||||
}
|
||||
runSuspendCatching(block = { block() })
|
||||
.onFailure { throwable ->
|
||||
logger.e(messageString = "Error", throwable = throwable)
|
||||
onComplete(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun defaultCompletionHandler(isSuccess: Boolean, errorMessage: String) {
|
||||
if (!isSuccess) {
|
||||
analyticsExceptionHandler.sendException(ExceptionAnalyticsEvent(RuntimeException(errorMessage)))
|
||||
TangemLogger.w(errorMessage)
|
||||
logger.w(errorMessage)
|
||||
|
||||
with(receiver = config.snackbarHandler ?: return) {
|
||||
showSnackbar(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue