diff --git a/app/build.gradle b/app/build.gradle index 4ca155727..18ab52d97 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -72,14 +72,6 @@ android { } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildFeatures { viewBinding true buildConfig true @@ -128,6 +120,10 @@ android { } } + kotlin { + jvmToolchain(11) + } + applicationVariants.all { variant -> variant.outputs.all { output -> outputFileName = new File("Sora_" + variant.versionName + "_" + variant.flavorName + "_" + buildType.name + ".apk") diff --git a/build.gradle b/build.gradle index 2ff662d1a..a1b75837e 100644 --- a/build.gradle +++ b/build.gradle @@ -50,7 +50,8 @@ buildscript { jna : '5.8.0', accompanist : '0.30.1', xserializationjson : '1.5.0', - ktor : '2.3.1' + ktor : '2.3.1', + xbackup : '0.0.2-20231002.173502-3' ] ext { @@ -117,7 +118,6 @@ buildscript { webSocketLibDep = "com.neovisionaries:nv-websocket-client:$versions.webSocketLib" uiCoreDep = "jp.co.soramitsu:ui-core:$versions.uiCore" sharedUtilsDep = "jp.co.soramitsu.shared_features:core:$versions.sharedUtils" - sharedFeaturesBackupDep = "jp.co.soramitsu.shared_features:backup:$versions.sharedUtils" sharedFeaturesModelsDep = "jp.co.soramitsu.shared_features:models:$versions.sharedUtils" soraCardDep = "jp.co.soramitsu:android-sora-card:$versions.soraCard" @@ -146,6 +146,8 @@ buildscript { web3jDep = "org.web3j:core:$versions.web3j" + xbackupDep = "jp.co.soramitsu:xbackup:$versions.xbackup" + permissionsAccompanistDep = "com.google.accompanist:accompanist-permissions:$versions.accompanist" permissionsRuntimeDep = "com.guolindev.permissionx:permissionx:1.7.1" diff --git a/common/build.gradle b/common/build.gradle index b7d63f577..d442031cc 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -28,14 +28,6 @@ android { } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - composeOptions { kotlinCompilerExtensionVersion versions.composeCompiler } @@ -113,6 +105,7 @@ android { buildConfigField "String", "GOOGLE_API_TOKEN", readSecretInQuotes("SORA_GOOGLE_TOKEN_PROD") } } + namespace 'jp.co.soramitsu.common' } @@ -157,7 +150,7 @@ dependencies { implementation navigationFragmentDep implementation navigationUiDep - implementation sharedFeaturesBackupDep + implementation xbackupDep implementation sharedUtilsDep implementation gsonDep diff --git a/common/src/main/java/jp/co/soramitsu/common/di/modules/CommonModule.kt b/common/src/main/java/jp/co/soramitsu/common/di/modules/CommonModule.kt index 60e84d80e..b71c5c463 100644 --- a/common/src/main/java/jp/co/soramitsu/common/di/modules/CommonModule.kt +++ b/common/src/main/java/jp/co/soramitsu/common/di/modules/CommonModule.kt @@ -53,7 +53,6 @@ import java.util.Locale import java.util.TimeZone import javax.inject.Singleton import jp.co.soramitsu.androidfoundation.phone.BasicClipboardManager -import jp.co.soramitsu.backup.BackupService import jp.co.soramitsu.common.BuildConfig import jp.co.soramitsu.common.account.AccountAvatarGenerator import jp.co.soramitsu.common.data.AppStateProviderImpl @@ -83,6 +82,7 @@ import jp.co.soramitsu.common.util.json_decoder.JsonAccountsEncoder import jp.co.soramitsu.common.vibration.DeviceVibrator import jp.co.soramitsu.crypto.ed25519.Ed25519Sha3 import jp.co.soramitsu.shared_utils.encrypt.json.JsonSeedEncoder +import jp.co.soramitsu.xbackup.BackupService import jp.co.soramitsu.xnetworking.networkclient.SoramitsuHttpClientProvider import jp.co.soramitsu.xnetworking.networkclient.SoramitsuHttpClientProviderImpl import jp.co.soramitsu.xnetworking.networkclient.SoramitsuNetworkClient diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index fe0944dbd..56e1530cd 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -43,6 +43,7 @@ Minimum six characters. Optionally, for better security, include uppercase letters, numbers and non-alphabetic characters. Setting a password will encrypt your Google backup. You’ll need to enter this when restoring your wallet.\nMinimum password length is 6 characters. Setting a password will encrypt your Google backup. You’ll need to enter this when restoring your wallet. + Backup failed. Not enough space on your Google Drive. Free some space and try again. Authenticate Block hash Buy XOR token diff --git a/common_wallet/build.gradle b/common_wallet/build.gradle index 4c1a0ac97..8d7f2498d 100644 --- a/common_wallet/build.gradle +++ b/common_wallet/build.gradle @@ -24,14 +24,6 @@ android { } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - composeOptions { kotlinCompilerExtensionVersion versions.composeCompiler } diff --git a/core_db/build.gradle b/core_db/build.gradle index 7e75b6e3c..f37517717 100644 --- a/core_db/build.gradle +++ b/core_db/build.gradle @@ -18,14 +18,6 @@ android { minSdkVersion minVersion targetSdkVersion targetVersion -// javaCompileOptions { -// annotationProcessorOptions { -// arguments += [ -// "room.schemaLocation":"$projectDir/schemas".toString(), -// "room.incremental":"true"] -// } -// } - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } @@ -36,14 +28,6 @@ android { } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - flavorDimensions "default" productFlavors { diff --git a/core_di/build.gradle b/core_di/build.gradle index a6daa6cee..085b2c6ea 100644 --- a/core_di/build.gradle +++ b/core_di/build.gradle @@ -15,14 +15,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - flavorDimensions "default" productFlavors { diff --git a/demeter/build.gradle b/demeter/build.gradle index 2c210e430..ce799d2a3 100644 --- a/demeter/build.gradle +++ b/demeter/build.gradle @@ -25,13 +25,7 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = '1.8' -// } + composeOptions { kotlinCompilerExtensionVersion versions.composeCompiler } diff --git a/feature_account_api/build.gradle b/feature_account_api/build.gradle index 3cd9be1c8..073e050d5 100644 --- a/feature_account_api/build.gradle +++ b/feature_account_api/build.gradle @@ -17,14 +17,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildTypes { release { minifyEnabled soraMinifyRelease diff --git a/feature_account_impl/build.gradle b/feature_account_impl/build.gradle index 7d3b6ea9d..c96deb69c 100644 --- a/feature_account_impl/build.gradle +++ b/feature_account_impl/build.gradle @@ -25,14 +25,6 @@ android { } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - flavorDimensions "default" productFlavors { diff --git a/feature_assets_api/build.gradle b/feature_assets_api/build.gradle index b0692bd1a..6a2c75f1a 100644 --- a/feature_assets_api/build.gradle +++ b/feature_assets_api/build.gradle @@ -19,14 +19,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildTypes { release { minifyEnabled soraMinifyRelease diff --git a/feature_assets_impl/build.gradle b/feature_assets_impl/build.gradle index 975ad8a24..6b58b4180 100644 --- a/feature_assets_impl/build.gradle +++ b/feature_assets_impl/build.gradle @@ -19,14 +19,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildTypes { release { minifyEnabled soraMinifyRelease diff --git a/feature_blockexplorer_api/build.gradle b/feature_blockexplorer_api/build.gradle index a26e4f790..886ef841c 100644 --- a/feature_blockexplorer_api/build.gradle +++ b/feature_blockexplorer_api/build.gradle @@ -21,14 +21,6 @@ android { consumerProguardFiles "consumer-rules.pro" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildFeatures { viewBinding true compose true diff --git a/feature_blockexplorer_impl/build.gradle b/feature_blockexplorer_impl/build.gradle index f79de6c26..095e86864 100644 --- a/feature_blockexplorer_impl/build.gradle +++ b/feature_blockexplorer_impl/build.gradle @@ -21,14 +21,6 @@ android { consumerProguardFiles "consumer-rules.pro" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildFeatures { viewBinding true compose true diff --git a/feature_ecosystem_api/build.gradle b/feature_ecosystem_api/build.gradle index 26366d49e..9fd1a1ae7 100644 --- a/feature_ecosystem_api/build.gradle +++ b/feature_ecosystem_api/build.gradle @@ -19,14 +19,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildTypes { release { minifyEnabled soraMinifyRelease diff --git a/feature_ecosystem_impl/build.gradle b/feature_ecosystem_impl/build.gradle index fca4ef242..4e5e152d3 100644 --- a/feature_ecosystem_impl/build.gradle +++ b/feature_ecosystem_impl/build.gradle @@ -26,14 +26,6 @@ android { } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildFeatures { viewBinding true compose true diff --git a/feature_ethereum_api/build.gradle b/feature_ethereum_api/build.gradle index d0cc4708e..05cc9ac46 100644 --- a/feature_ethereum_api/build.gradle +++ b/feature_ethereum_api/build.gradle @@ -24,14 +24,6 @@ android { } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - flavorDimensions "default" productFlavors { diff --git a/feature_ethereum_impl/build.gradle b/feature_ethereum_impl/build.gradle index 2ac930c20..d10eac73c 100644 --- a/feature_ethereum_impl/build.gradle +++ b/feature_ethereum_impl/build.gradle @@ -24,14 +24,6 @@ android { } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - flavorDimensions "default" productFlavors { diff --git a/feature_main_api/build.gradle b/feature_main_api/build.gradle index 2cb96d4d5..d5bca2c7c 100644 --- a/feature_main_api/build.gradle +++ b/feature_main_api/build.gradle @@ -17,14 +17,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildTypes { release { minifyEnabled soraMinifyRelease diff --git a/feature_main_impl/build.gradle b/feature_main_impl/build.gradle index 5e26c0235..fad73026e 100644 --- a/feature_main_impl/build.gradle +++ b/feature_main_impl/build.gradle @@ -25,14 +25,6 @@ android { } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - flavorDimensions "default" productFlavors { @@ -99,9 +91,9 @@ dependencies { implementation googlePlayServiceAuth implementation googleApiServicesDrive - implementation sharedFeaturesBackupDep + implementation xbackupDep implementation sharedFeaturesModelsDep - + implementation composeUiDep implementation composeThemeAdapterDep implementation composeFoundationDep diff --git a/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/presentation/profile/debugmenu/DebugMenuViewModel.kt b/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/presentation/profile/debugmenu/DebugMenuViewModel.kt index 86b7e449e..39531311b 100644 --- a/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/presentation/profile/debugmenu/DebugMenuViewModel.kt +++ b/feature_main_impl/src/main/java/jp/co/soramitsu/feature_main_impl/presentation/profile/debugmenu/DebugMenuViewModel.kt @@ -42,7 +42,6 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.viewModelScope import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject -import jp.co.soramitsu.backup.BackupService import jp.co.soramitsu.common.BuildConfig import jp.co.soramitsu.common.config.BuildConfigWrapper import jp.co.soramitsu.common.domain.OptionsProvider @@ -51,6 +50,7 @@ import jp.co.soramitsu.common.presentation.compose.components.initSmallTitle2 import jp.co.soramitsu.common.presentation.trigger import jp.co.soramitsu.common.presentation.viewmodel.BaseViewModel import jp.co.soramitsu.sora.substrate.runtime.RuntimeManager +import jp.co.soramitsu.xbackup.BackupService import kotlinx.coroutines.launch @HiltViewModel @@ -73,21 +73,46 @@ class DebugMenuViewModel @Inject constructor( state = state.copy( settings = mutableListOf().apply { add(SettingOption(name = "App ID:", value = OptionsProvider.APPLICATION_ID)) - add(SettingOption(name = "Version Name:", value = OptionsProvider.CURRENT_VERSION_NAME)) - add(SettingOption(name = "Version Code:", value = OptionsProvider.CURRENT_VERSION_CODE.toString())) + add( + SettingOption( + name = "Version Name:", + value = OptionsProvider.CURRENT_VERSION_NAME + ) + ) + add( + SettingOption( + name = "Version Code:", + value = OptionsProvider.CURRENT_VERSION_CODE.toString() + ) + ) add(SettingOption(name = "Manufacturer:", value = Build.MANUFACTURER)) add(SettingOption(name = "Model:", value = Build.MODEL)) add(SettingOption(name = "Version:", value = Build.VERSION.RELEASE)) add(SettingOption(name = "API level:", value = Build.VERSION.SDK_INT.toString())) add(SettingOption(name = "Arch:", value = Build.SUPPORTED_ABIS.joinToString(","))) - add(SettingOption(name = "Java:", value = System.getProperty("java.specification.version").orEmpty())) - add(SettingOption(name = "Java:", value = System.getProperty("java.vm.name").orEmpty())) + add( + SettingOption( + name = "Java:", + value = System.getProperty("java.specification.version").orEmpty() + ) + ) + add( + SettingOption( + name = "Java:", + value = System.getProperty("java.vm.name").orEmpty() + ) + ) add(SettingOption(name = "Build Type:", value = BuildConfig.BUILD_TYPE)) add(SettingOption(name = "Build Flavor:", value = BuildConfig.FLAVOR)) add(SettingOption(name = "X1:", value = BuildConfig.X1_WIDGET_ID)) add(SettingOption(name = "X1:", value = BuildConfig.X1_ENDPOINT_URL)) - add(SettingOption(name = "SoraCard Backend:", value = BuildConfigWrapper.getSoraCardBackEndUrl())) + add( + SettingOption( + name = "SoraCard Backend:", + value = BuildConfigWrapper.getSoraCardBackEndUrl() + ) + ) } ) } diff --git a/feature_multiaccount_api/build.gradle b/feature_multiaccount_api/build.gradle index e26a92f5a..9fb3b67c8 100644 --- a/feature_multiaccount_api/build.gradle +++ b/feature_multiaccount_api/build.gradle @@ -17,14 +17,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildTypes { release { minifyEnabled soraMinifyRelease diff --git a/feature_multiaccount_impl/build.gradle b/feature_multiaccount_impl/build.gradle index a3cf4fb43..451fe176d 100644 --- a/feature_multiaccount_impl/build.gradle +++ b/feature_multiaccount_impl/build.gradle @@ -19,12 +19,7 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 freeCompilerArgs += ["-Xstring-concat=inline"] } @@ -119,8 +114,8 @@ dependencies { implementation composeConstraintLayoutDep implementation composeLiveDataDep implementation navigationComposeDep - //implementation accompanistNavAnimationDep - implementation sharedFeaturesBackupDep + + implementation xbackupDep implementation sharedFeaturesModelsDep debugImplementation composeToolingDep diff --git a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/OnboardingFlowState.kt b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/OnboardingFlowState.kt index 436724b09..ea784f0c7 100644 --- a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/OnboardingFlowState.kt +++ b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/OnboardingFlowState.kt @@ -33,9 +33,9 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package jp.co.soramitsu.feature_multiaccount_impl.presentation import android.graphics.drawable.Drawable -import jp.co.soramitsu.backup.domain.models.BackupAccountMeta import jp.co.soramitsu.common.presentation.compose.webview.WebViewState import jp.co.soramitsu.ui_core.component.input.InputTextState +import jp.co.soramitsu.xbackup.domain.models.BackupAccountMeta data class RecoveryState( val recoveryType: RecoveryType, diff --git a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/OnboardingViewModel.kt b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/OnboardingViewModel.kt index 9a790f877..d582d505a 100644 --- a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/OnboardingViewModel.kt +++ b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/OnboardingViewModel.kt @@ -46,16 +46,6 @@ import androidx.navigation.NavOptions import dagger.hilt.android.lifecycle.HiltViewModel import java.net.SocketException import javax.inject.Inject -import jp.co.soramitsu.backup.BackupService -import jp.co.soramitsu.backup.domain.exceptions.AuthConsentException -import jp.co.soramitsu.backup.domain.exceptions.DecodingException -import jp.co.soramitsu.backup.domain.exceptions.DecryptionException -import jp.co.soramitsu.backup.domain.exceptions.UnauthorizedException -import jp.co.soramitsu.backup.domain.models.BackupAccountMeta -import jp.co.soramitsu.backup.domain.models.BackupAccountType -import jp.co.soramitsu.backup.domain.models.DecryptedBackupAccount -import jp.co.soramitsu.backup.domain.models.Json -import jp.co.soramitsu.backup.domain.models.Seed import jp.co.soramitsu.common.R import jp.co.soramitsu.common.account.AccountAvatarGenerator import jp.co.soramitsu.common.account.SoraAccount @@ -72,7 +62,6 @@ import jp.co.soramitsu.common.util.Const.SORA_PRIVACY_PAGE import jp.co.soramitsu.common.util.Const.SORA_TERMS_PAGE import jp.co.soramitsu.common.util.ext.isAccountNameLongerThen32Bytes import jp.co.soramitsu.common.util.ext.isPasswordSecure -import jp.co.soramitsu.core.models.CryptoType import jp.co.soramitsu.feature_main_api.launcher.MainStarter import jp.co.soramitsu.feature_multiaccount_impl.domain.MultiaccountInteractor import jp.co.soramitsu.feature_multiaccount_impl.presentation.export_account.model.BackupScreenState @@ -80,6 +69,18 @@ import jp.co.soramitsu.feature_multiaccount_impl.presentation.export_account.mod import jp.co.soramitsu.feature_multiaccount_impl.presentation.export_account.model.ExportProtectionSelectableModel import jp.co.soramitsu.ui_core.component.input.InputTextState import jp.co.soramitsu.ui_core.resources.Dimens +import jp.co.soramitsu.xbackup.BackupService +import jp.co.soramitsu.xbackup.domain.exceptions.AuthConsentException +import jp.co.soramitsu.xbackup.domain.exceptions.DecodingException +import jp.co.soramitsu.xbackup.domain.exceptions.DecryptionException +import jp.co.soramitsu.xbackup.domain.exceptions.StorageQuotaExceeded +import jp.co.soramitsu.xbackup.domain.exceptions.UnauthorizedException +import jp.co.soramitsu.xbackup.domain.models.BackupAccountMeta +import jp.co.soramitsu.xbackup.domain.models.BackupAccountType +import jp.co.soramitsu.xbackup.domain.models.CryptoType +import jp.co.soramitsu.xbackup.domain.models.DecryptedBackupAccount +import jp.co.soramitsu.xbackup.domain.models.Json +import jp.co.soramitsu.xbackup.domain.models.Seed import kotlin.random.Random import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.asStateFlow @@ -644,6 +645,12 @@ class OnboardingViewModel @Inject constructor( createBackupPasswordState.copy(isLoading = false) _consentExceptionHandler.value = e.intent } + } catch (e: StorageQuotaExceeded) { + withContext(coroutineManager.main) { + _createBackupPasswordState.value = + createBackupPasswordState.copy(isLoading = false) + onError(R.string.backup_not_enough_space_error) + } } } } diff --git a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/account_details/AccountDetailsViewModel.kt b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/account_details/AccountDetailsViewModel.kt index 829bfdbeb..2193723fe 100644 --- a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/account_details/AccountDetailsViewModel.kt +++ b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/account_details/AccountDetailsViewModel.kt @@ -43,13 +43,6 @@ import dagger.assisted.AssistedFactory import dagger.assisted.AssistedInject import java.net.SocketException import jp.co.soramitsu.androidfoundation.phone.BasicClipboardManager -import jp.co.soramitsu.backup.BackupService -import jp.co.soramitsu.backup.domain.exceptions.AuthConsentException -import jp.co.soramitsu.backup.domain.exceptions.FileNotFoundException -import jp.co.soramitsu.backup.domain.models.BackupAccountType -import jp.co.soramitsu.backup.domain.models.DecryptedBackupAccount -import jp.co.soramitsu.backup.domain.models.Json -import jp.co.soramitsu.backup.domain.models.Seed import jp.co.soramitsu.common.R import jp.co.soramitsu.common.account.SoraAccount import jp.co.soramitsu.common.domain.CoroutineManager @@ -61,12 +54,20 @@ import jp.co.soramitsu.common.presentation.trigger import jp.co.soramitsu.common.presentation.viewmodel.BaseViewModel import jp.co.soramitsu.common.resourses.ResourceManager import jp.co.soramitsu.common.util.ext.isPasswordSecure -import jp.co.soramitsu.core.models.CryptoType import jp.co.soramitsu.feature_main_api.launcher.MainRouter import jp.co.soramitsu.feature_multiaccount_impl.domain.MultiaccountInteractor import jp.co.soramitsu.feature_multiaccount_impl.presentation.CreateBackupPasswordState import jp.co.soramitsu.feature_multiaccount_impl.presentation.export_account.model.AccountDetailsScreenState import jp.co.soramitsu.ui_core.component.input.InputTextState +import jp.co.soramitsu.xbackup.BackupService +import jp.co.soramitsu.xbackup.domain.exceptions.AuthConsentException +import jp.co.soramitsu.xbackup.domain.exceptions.FileNotFoundException +import jp.co.soramitsu.xbackup.domain.exceptions.StorageQuotaExceeded +import jp.co.soramitsu.xbackup.domain.models.BackupAccountType +import jp.co.soramitsu.xbackup.domain.models.CryptoType +import jp.co.soramitsu.xbackup.domain.models.DecryptedBackupAccount +import jp.co.soramitsu.xbackup.domain.models.Json +import jp.co.soramitsu.xbackup.domain.models.Seed import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.debounce @@ -262,8 +263,8 @@ class AccountDetailsViewModel @AssistedInject constructor( fun onBackupPasswordClicked() { _createBackupPasswordState.value?.let { createBackupPasswordState -> _createBackupPasswordState.value = createBackupPasswordState.copy(isLoading = true) - try { - viewModelScope.launch(coroutineManager.io) { + viewModelScope.launch(coroutineManager.io) { + try { _accountDetailsScreenState.value?.let { accountDetailsScreenState -> account?.let { account -> val passphrase = @@ -312,11 +313,20 @@ class AccountDetailsViewModel @AssistedInject constructor( } } } + } catch (e: SocketException) { + withContext(coroutineManager.main) { + onError(SoraException.networkError(resourceManager, e)) + } + } catch (e: AuthConsentException) { + withContext(coroutineManager.main) { + _consentExceptionHandler.value = e.intent + } + } catch (e: StorageQuotaExceeded) { + withContext(coroutineManager.main) { + onError(R.string.backup_not_enough_space_error) + _createBackupPasswordState.value = createBackupPasswordState.copy(isLoading = false) + } } - } catch (e: SocketException) { - onError(SoraException.networkError(resourceManager, e)) - } catch (e: AuthConsentException) { - _consentExceptionHandler.value = e.intent } } } diff --git a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/import_account_list/import_account_password/ImportAccountPasswordScreen.kt b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/import_account_list/import_account_password/ImportAccountPasswordScreen.kt index dc963a6c0..b4af02b98 100644 --- a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/import_account_list/import_account_password/ImportAccountPasswordScreen.kt +++ b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/import_account_list/import_account_password/ImportAccountPasswordScreen.kt @@ -55,7 +55,6 @@ import androidx.compose.ui.text.input.TextFieldValue import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp -import jp.co.soramitsu.backup.domain.models.BackupAccountMeta import jp.co.soramitsu.common.R import jp.co.soramitsu.common.presentation.compose.AccountIcon import jp.co.soramitsu.feature_multiaccount_impl.presentation.BackupAccountMetaWithIcon @@ -69,6 +68,7 @@ import jp.co.soramitsu.ui_core.component.input.InputText import jp.co.soramitsu.ui_core.resources.Dimens import jp.co.soramitsu.ui_core.theme.customColors import jp.co.soramitsu.ui_core.theme.customTypography +import jp.co.soramitsu.xbackup.domain.models.BackupAccountMeta @Composable fun ImportAccountPasswordScreen( diff --git a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/import_account_list/import_account_success/ImportAccountSuccessScreen.kt b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/import_account_list/import_account_success/ImportAccountSuccessScreen.kt index cbf3011e6..43fc92b73 100644 --- a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/import_account_list/import_account_success/ImportAccountSuccessScreen.kt +++ b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/import_account_list/import_account_success/ImportAccountSuccessScreen.kt @@ -45,7 +45,6 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.tooling.preview.Preview -import jp.co.soramitsu.backup.domain.models.BackupAccountMeta import jp.co.soramitsu.common.R import jp.co.soramitsu.feature_multiaccount_impl.presentation.BackupAccountMetaWithIcon import jp.co.soramitsu.feature_multiaccount_impl.presentation.ImportAccountPasswordState @@ -59,6 +58,7 @@ import jp.co.soramitsu.ui_core.component.card.ContentCard import jp.co.soramitsu.ui_core.resources.Dimens import jp.co.soramitsu.ui_core.theme.customColors import jp.co.soramitsu.ui_core.theme.customTypography +import jp.co.soramitsu.xbackup.domain.models.BackupAccountMeta @Composable fun ImportAccountSuccessScreen( diff --git a/feature_multiaccount_impl/src/test/java/jp/co/soramitsu/feature_multiaccount_impl/OnboardingViewModelTest.kt b/feature_multiaccount_impl/src/test/java/jp/co/soramitsu/feature_multiaccount_impl/OnboardingViewModelTest.kt index c20054941..f9516eacd 100644 --- a/feature_multiaccount_impl/src/test/java/jp/co/soramitsu/feature_multiaccount_impl/OnboardingViewModelTest.kt +++ b/feature_multiaccount_impl/src/test/java/jp/co/soramitsu/feature_multiaccount_impl/OnboardingViewModelTest.kt @@ -32,14 +32,11 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package jp.co.soramitsu.feature_multiaccount_impl -import android.content.Intent -import androidx.activity.result.ActivityResultLauncher import androidx.arch.core.executor.testing.InstantTaskExecutorRule import androidx.navigation.NavController -import jp.co.soramitsu.backup.BackupService +import jp.co.soramitsu.xbackup.BackupService import jp.co.soramitsu.common.R import jp.co.soramitsu.common.account.AccountAvatarGenerator -import jp.co.soramitsu.common.account.SoraAccount import jp.co.soramitsu.common.domain.CoroutineManager import jp.co.soramitsu.common.domain.InvitationHandler import jp.co.soramitsu.common.resourses.ResourceManager diff --git a/feature_multiaccount_impl/src/test/java/jp/co/soramitsu/feature_multiaccount_impl/export/account_details/AccountDetailsViewModelTest.kt b/feature_multiaccount_impl/src/test/java/jp/co/soramitsu/feature_multiaccount_impl/export/account_details/AccountDetailsViewModelTest.kt index fcfbda0d3..f312ed00d 100644 --- a/feature_multiaccount_impl/src/test/java/jp/co/soramitsu/feature_multiaccount_impl/export/account_details/AccountDetailsViewModelTest.kt +++ b/feature_multiaccount_impl/src/test/java/jp/co/soramitsu/feature_multiaccount_impl/export/account_details/AccountDetailsViewModelTest.kt @@ -38,16 +38,15 @@ import androidx.arch.core.executor.testing.InstantTaskExecutorRule import androidx.compose.ui.text.input.TextFieldValue import androidx.navigation.NavController import jp.co.soramitsu.androidfoundation.phone.BasicClipboardManager -import jp.co.soramitsu.backup.BackupService -import jp.co.soramitsu.backup.domain.models.BackupAccountType -import jp.co.soramitsu.backup.domain.models.DecryptedBackupAccount -import jp.co.soramitsu.backup.domain.models.Json -import jp.co.soramitsu.backup.domain.models.Seed +import jp.co.soramitsu.xbackup.BackupService +import jp.co.soramitsu.xbackup.domain.models.BackupAccountType +import jp.co.soramitsu.xbackup.domain.models.DecryptedBackupAccount +import jp.co.soramitsu.xbackup.domain.models.Json +import jp.co.soramitsu.xbackup.domain.models.Seed import jp.co.soramitsu.common.R import jp.co.soramitsu.common.account.SoraAccount import jp.co.soramitsu.common.domain.CoroutineManager import jp.co.soramitsu.common.resourses.ResourceManager -import jp.co.soramitsu.core.models.CryptoType import jp.co.soramitsu.feature_main_api.launcher.MainRouter import jp.co.soramitsu.feature_multiaccount_impl.domain.MultiaccountInteractor import jp.co.soramitsu.feature_multiaccount_impl.presentation.export_account.account_details.AccountDetailsViewModel @@ -56,6 +55,7 @@ import jp.co.soramitsu.test_shared.MainCoroutineRule import jp.co.soramitsu.test_shared.getOrAwaitValue import jp.co.soramitsu.ui_core.component.input.InputTextState import jp.co.soramitsu.ui_core.component.toolbar.SoramitsuToolbarType +import jp.co.soramitsu.xbackup.domain.models.CryptoType import kotlinx.coroutines.CoroutineDispatcher import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi diff --git a/feature_polkaswap_api/build.gradle b/feature_polkaswap_api/build.gradle index d87aa6c02..34bba50e2 100644 --- a/feature_polkaswap_api/build.gradle +++ b/feature_polkaswap_api/build.gradle @@ -19,14 +19,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildTypes { release { minifyEnabled soraMinifyRelease diff --git a/feature_polkaswap_impl/build.gradle b/feature_polkaswap_impl/build.gradle index cf10f89b4..3f10ba943 100644 --- a/feature_polkaswap_impl/build.gradle +++ b/feature_polkaswap_impl/build.gradle @@ -26,14 +26,6 @@ android { } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildFeatures { viewBinding true compose true diff --git a/feature_referral_api/build.gradle b/feature_referral_api/build.gradle index 431482e7f..0179f217e 100644 --- a/feature_referral_api/build.gradle +++ b/feature_referral_api/build.gradle @@ -17,14 +17,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildTypes { release { minifyEnabled soraMinifyRelease diff --git a/feature_referral_impl/build.gradle b/feature_referral_impl/build.gradle index 54b252730..3064f3bad 100644 --- a/feature_referral_impl/build.gradle +++ b/feature_referral_impl/build.gradle @@ -18,14 +18,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildFeatures { viewBinding true compose true diff --git a/feature_select_node_api/build.gradle b/feature_select_node_api/build.gradle index e5cce0841..bfeb5171e 100644 --- a/feature_select_node_api/build.gradle +++ b/feature_select_node_api/build.gradle @@ -17,14 +17,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildTypes { release { minifyEnabled soraMinifyRelease diff --git a/feature_select_node_impl/build.gradle b/feature_select_node_impl/build.gradle index 75ff96f3d..f8eeab74b 100644 --- a/feature_select_node_impl/build.gradle +++ b/feature_select_node_impl/build.gradle @@ -18,14 +18,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - composeOptions { kotlinCompilerExtensionVersion versions.composeCompiler } diff --git a/feature_sora_card_api/build.gradle b/feature_sora_card_api/build.gradle index b261be80f..07c69b0fc 100644 --- a/feature_sora_card_api/build.gradle +++ b/feature_sora_card_api/build.gradle @@ -18,14 +18,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildTypes { release { minifyEnabled soraMinifyRelease diff --git a/feature_sora_card_impl/build.gradle b/feature_sora_card_impl/build.gradle index 853315378..495eba692 100644 --- a/feature_sora_card_impl/build.gradle +++ b/feature_sora_card_impl/build.gradle @@ -19,14 +19,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - composeOptions { kotlinCompilerExtensionVersion versions.composeCompiler } diff --git a/feature_wallet_api/build.gradle b/feature_wallet_api/build.gradle index 6de82bffe..f61f7b9cd 100644 --- a/feature_wallet_api/build.gradle +++ b/feature_wallet_api/build.gradle @@ -19,14 +19,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildTypes { release { minifyEnabled soraMinifyRelease diff --git a/feature_wallet_impl/build.gradle b/feature_wallet_impl/build.gradle index fae60d8d5..18dcbbbf0 100644 --- a/feature_wallet_impl/build.gradle +++ b/feature_wallet_impl/build.gradle @@ -26,12 +26,7 @@ android { } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 freeCompilerArgs += ["-Xstring-concat=inline"] } diff --git a/network/build.gradle b/network/build.gradle index 6ffb98e6f..d31922afc 100644 --- a/network/build.gradle +++ b/network/build.gradle @@ -24,14 +24,6 @@ android { } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - flavorDimensions "default" productFlavors { diff --git a/soracrypro/build.gradle b/soracrypro/build.gradle index 35a74c4f9..34ffe7c58 100644 --- a/soracrypro/build.gradle +++ b/soracrypro/build.gradle @@ -25,13 +25,7 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = '1.8' -// } + flavorDimensions "default" productFlavors { diff --git a/sorasubstrate/build.gradle b/sorasubstrate/build.gradle index 5c2b7acac..80e4acf97 100644 --- a/sorasubstrate/build.gradle +++ b/sorasubstrate/build.gradle @@ -28,13 +28,6 @@ android { proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = '1.8' -// } flavorDimensions "default" productFlavors { diff --git a/test_data/build.gradle b/test_data/build.gradle index 2690422a6..b702690ba 100644 --- a/test_data/build.gradle +++ b/test_data/build.gradle @@ -15,14 +15,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildTypes { release { minifyEnabled false diff --git a/test_shared/build.gradle b/test_shared/build.gradle index a50f56ceb..e5745ffcb 100644 --- a/test_shared/build.gradle +++ b/test_shared/build.gradle @@ -15,14 +15,6 @@ android { testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } -// compileOptions { -// sourceCompatibility JavaVersion.VERSION_1_8 -// targetCompatibility JavaVersion.VERSION_1_8 -// } -// kotlinOptions { -// jvmTarget = JavaVersion.VERSION_1_8 -// } - buildTypes { release { minifyEnabled false