Updated on 2026-08-14

This commit is contained in:
Tangem 2024-12-30 17:37:13 +03:00
commit 8e1763dee2
3 changed files with 25 additions and 0 deletions

View file

@ -28,6 +28,9 @@ import com.tangem.datasource.local.config.environment.EnvironmentConfigStorage
import com.tangem.datasource.local.config.issuers.IssuersConfigStorage
import com.tangem.datasource.local.logs.AppLogsStore
import com.tangem.datasource.local.preferences.AppPreferencesStore
import com.tangem.datasource.local.preferences.PreferencesKeys.WAS_LOG_FILE_CLEARED
import com.tangem.datasource.local.preferences.utils.getSyncOrDefault
import com.tangem.datasource.local.preferences.utils.store
import com.tangem.domain.appcurrency.repository.AppCurrencyRepository
import com.tangem.domain.apptheme.GetAppThemeModeUseCase
import com.tangem.domain.apptheme.repository.AppThemeModeRepository
@ -66,8 +69,12 @@ import com.tangem.wallet.BuildConfig
import dagger.hilt.EntryPoints
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import org.rekotlin.Store
import kotlin.collections.MutableMap
import kotlin.collections.listOf
import kotlin.collections.set
import com.tangem.tap.domain.walletconnect2.domain.LegacyWalletConnectRepository as WalletConnect2Repository
lateinit var store: Store<AppState>
@ -208,7 +215,17 @@ abstract class TangemApplication : Application(), ImageLoaderFactory {
init()
updateLogFiles()
}
private fun updateLogFiles() {
appLogsStore.deleteOldLogsFile()
scope.launch {
if (!appPreferencesStore.getSyncOrDefault(WAS_LOG_FILE_CLEARED, false)) {
appLogsStore.deleteLastLogFile()
appPreferencesStore.store(WAS_LOG_FILE_CLEARED, true)
}
}
}
fun init() {

View file

@ -90,6 +90,12 @@ class AppLogsStore @Inject constructor(
if (file.exists()) file.delete()
}
fun deleteLastLogFile() {
val file = File(applicationContext.filesDir, NEW_LOG_FILE_NAME)
if (file.exists()) file.delete()
}
private fun writeMessage(vararg messages: String) {
BufferedWriter(FileWriter(file, true)).use { writer ->
writer.append(formatter.print(DateTime.now()))

View file

@ -111,6 +111,8 @@ object PreferencesKeys {
val IS_GOOGLE_PAY_AVAILABLE_KEY by lazy { booleanPreferencesKey(name = "isGooglePayAvailable") }
val WAS_LOG_FILE_CLEARED by lazy { booleanPreferencesKey(name = "wasLogFileCleared") }
// region Permission
fun getShouldShowPermission(permission: String) = booleanPreferencesKey("shouldShowPushPermission_$permission")