diff --git a/app/src/main/java/jp/co/soramitsu/sora/navigation/Navigator.kt b/app/src/main/java/jp/co/soramitsu/sora/navigation/Navigator.kt index c80aec33a..874bcfd53 100644 --- a/app/src/main/java/jp/co/soramitsu/sora/navigation/Navigator.kt +++ b/app/src/main/java/jp/co/soramitsu/sora/navigation/Navigator.kt @@ -136,7 +136,7 @@ class Navigator : } override fun popBackStackToAccountDetails() { - navController?.popBackStack(R.id.accoundDetailsFragment, false) + navController?.popBackStack(R.id.accountDetailsFragment, false) } override fun showSelectLanguage() { @@ -317,7 +317,7 @@ class Navigator : override fun showAccountList() { navController?.navigate( - R.id.export_account_nav_graph, + R.id.accountListFragment, null, ) } @@ -355,7 +355,7 @@ class Navigator : override fun showAccountDetails(address: String) { navController?.navigate( - R.id.accoundDetailsFragment, + R.id.accountDetailsFragment, withArgs { this.address = address }, diff --git a/app/src/main/res/navigation/main_nav_graph.xml b/app/src/main/res/navigation/main_nav_graph.xml index 74ae770a8..f21e84fbf 100644 --- a/app/src/main/res/navigation/main_nav_graph.xml +++ b/app/src/main/res/navigation/main_nav_graph.xml @@ -77,11 +77,35 @@ android:id="@+id/soraCardDetailsFragment" android:name="jp.co.soramitsu.feature_sora_card_impl.presentation.details.SoraCardDetailsFragment" /> + + + + + + + + + + - 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 ab7a70d12..41d82951b 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 @@ -173,7 +173,7 @@ class CommonModule { @Singleton @Provides fun provideSoramitsuNetworkClient(): SoramitsuNetworkClient = - SoramitsuNetworkClient(logging = BuildConfig.DEBUG) + SoramitsuNetworkClient(logging = BuildConfig.DEBUG, timeout = 20000) @Singleton @Provides diff --git a/common/src/main/java/jp/co/soramitsu/common/domain/CardHub.kt b/common/src/main/java/jp/co/soramitsu/common/domain/CardHub.kt index 670be3bd5..412a9de73 100644 --- a/common/src/main/java/jp/co/soramitsu/common/domain/CardHub.kt +++ b/common/src/main/java/jp/co/soramitsu/common/domain/CardHub.kt @@ -40,6 +40,7 @@ const val POOLS_HUB_NAME = "pools" const val GET_SORA_CARD_HUB_NAME = "get sora card" const val BUY_XOR_TOKEN_HUB_NAME = "buy xor token" const val REFERRAL_SYSTEM_HUB_NAME = "referral system" +const val BACKUP_WALLET_HUB_NAME = "backup wallet" data class CardHub( val cardType: CardHubType, @@ -73,6 +74,7 @@ enum class CardHubType( R.string.referral_toolbar_title, ), + BACKUP(BACKUP_WALLET_HUB_NAME, order = -1, boundToAccount = true, R.string.wallet_backup), ASSETS(ASSETS_HUB_NAME, order = 0, boundToAccount = true, R.string.liquid_assets), POOLS(POOLS_HUB_NAME, order = 1, boundToAccount = true, R.string.pooled_assets), } diff --git a/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/BasicBannerCard.kt b/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/BasicBannerCard.kt index ce0c49ced..347bf5db3 100644 --- a/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/BasicBannerCard.kt +++ b/common/src/main/java/jp/co/soramitsu/common/presentation/compose/components/BasicBannerCard.kt @@ -71,6 +71,7 @@ fun BasicBannerCard( description: String, button: String, onButtonClicked: () -> Unit, + closeEnabled: Boolean, onCloseCard: () -> Unit, ) { ContentCard( @@ -117,18 +118,20 @@ fun BasicBannerCard( ) } - BleachedButton( - modifier = Modifier - .wrapContentWidth() - .align(Alignment.TopEnd) - .padding(Dimens.x1) - .alpha(0.8f), - size = Size.ExtraSmall, - order = Order.TERTIARY, - shape = CircleShape, - onClick = onCloseCard, - leftIcon = painterResource(R.drawable.ic_cross), - ) + if (closeEnabled) { + BleachedButton( + modifier = Modifier + .wrapContentWidth() + .align(Alignment.TopEnd) + .padding(Dimens.x1) + .alpha(0.8f), + size = Size.ExtraSmall, + order = Order.TERTIARY, + shape = CircleShape, + onClick = onCloseCard, + leftIcon = painterResource(R.drawable.ic_cross), + ) + } } } } @@ -183,6 +186,7 @@ private fun PreviewBasicBannerCard1() { title = "Some title of banner card, let it be longeeerr", description = "Long description of banner card, The quick brown fox jumps over the lazy dog, The quick brown fox jumps over the lazy dog.And I, even I Artaxerxes the king, do make a decree to all the treasurers which are beyond the river, that whatsoever Ezra the priest, the scribe of the law of the God of heaven, shall require of you, it be done speedily", button = "Just button title", + closeEnabled = true, onCloseCard = {}, onButtonClicked = {}, ) @@ -196,6 +200,7 @@ private fun PreviewBasicBannerCard12() { title = "Some title", description = "Long description of banner", button = "Just button title", + closeEnabled = false, onCloseCard = {}, onButtonClicked = {}, ) @@ -209,6 +214,7 @@ private fun PreviewBasicBannerCard2() { title = "Title", description = "Description", button = "Button", + closeEnabled = true, onCloseCard = {}, onButtonClicked = {}, ) diff --git a/common/src/main/res/drawable-hdpi/ic_banner_backup.png b/common/src/main/res/drawable-hdpi/ic_banner_backup.png new file mode 100644 index 000000000..efd19d4f5 Binary files /dev/null and b/common/src/main/res/drawable-hdpi/ic_banner_backup.png differ diff --git a/common/src/main/res/drawable-mdpi/ic_banner_backup.png b/common/src/main/res/drawable-mdpi/ic_banner_backup.png new file mode 100644 index 000000000..4c1c509a3 Binary files /dev/null and b/common/src/main/res/drawable-mdpi/ic_banner_backup.png differ diff --git a/common/src/main/res/drawable-xhdpi/ic_banner_backup.png b/common/src/main/res/drawable-xhdpi/ic_banner_backup.png new file mode 100644 index 000000000..0d59ca729 Binary files /dev/null and b/common/src/main/res/drawable-xhdpi/ic_banner_backup.png differ diff --git a/common/src/main/res/drawable-xxhdpi/ic_banner_backup.png b/common/src/main/res/drawable-xxhdpi/ic_banner_backup.png new file mode 100644 index 000000000..2d39e4660 Binary files /dev/null and b/common/src/main/res/drawable-xxhdpi/ic_banner_backup.png differ diff --git a/common/src/main/res/drawable-xxxhdpi/ic_banner_backup.png b/common/src/main/res/drawable-xxxhdpi/ic_banner_backup.png new file mode 100644 index 000000000..8fcf1a490 Binary files /dev/null and b/common/src/main/res/drawable-xxxhdpi/ic_banner_backup.png differ diff --git a/common/src/main/res/drawable-xxxhdpi/ic_banner_sora_card_referral.png b/common/src/main/res/drawable-xxxhdpi/sora_card_referral_banner.png similarity index 100% rename from common/src/main/res/drawable-xxxhdpi/ic_banner_sora_card_referral.png rename to common/src/main/res/drawable-xxxhdpi/sora_card_referral_banner.png diff --git a/common/src/main/res/values-ar/strings.xml b/common/src/main/res/values-ar/strings.xml index 0c96dd521..e4338f139 100644 --- a/common/src/main/res/values-ar/strings.xml +++ b/common/src/main/res/values-ar/strings.xml @@ -41,6 +41,7 @@ الأصول المراد إرسالها Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -410,6 +411,7 @@ %s ثواني انتهى %s + Protect yourself from losing access to your funds رمز الاستجابة السريعة QR التحميل من معرض الصور تلقي العملات @@ -514,7 +516,6 @@ Card management is coming soon Card details اصدار بطاقة مجاني - أو 20 € رسوم الطلب إذا كنت تحتفظ أو تشارك أو توفر السيولة لما لا يقل عن 100 يورو من XOR في حساب SORA الخاص بك احصل على المزيد من XOR IBAN account details @@ -559,6 +560,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. تم اصدار تحديث تطبيق SORA وهو جاهز للتثبيت.\n\nمن المهم استخدام أحدث إصدار من التطبيق.\n\nلتحديث التطبيق، يلزمك إعادة التشغيل. هل تود تثبيت التحديث الآن؟ + Wallet backup المقفل المدخر المسند diff --git a/common/src/main/res/values-az/strings.xml b/common/src/main/res/values-az/strings.xml index 4d065ebc3..3354937d4 100644 --- a/common/src/main/res/values-az/strings.xml +++ b/common/src/main/res/values-az/strings.xml @@ -41,6 +41,7 @@ Asset to send Yedək artıq mövcuddur. Yenidən yazmağa davam edin. Yedəkləmə alınmadı. Google Diskinizdə kifayət qədər yer yoxdur. Bir az yer boşaltın və yenidən cəhd edin. + İndi yedəkləyin Parol üçün məcburi tələb yerinə yetirildi Minimum altı simvol. İsteğe bağlı olaraq, daha yaxşı təhlükəsizlik üçün böyük hərflər, rəqəmlər və qeyri-əlifba simvolları daxil edin. Parolun təyin edilməsi Google ehtiyat nüsxənizi şifrələyəcək. Pul kisəsini bərpa edərkən bunu daxil etməlisiniz.\n Minimum parol uzunluğu 6 simvoldur. @@ -238,7 +239,7 @@ Hovuz yaradın Likvidliyi təmin edin və mükafatlar qazanın SORA şəbəkəsində tokenləri dəyişdirin - If you loose access to this device, your funds will be lost, unless you back up! + Bu cihaza girişi itirsəniz, ehtiyat nüsxəsini çıxarmasanız, vəsaitiniz itiriləcək! Yedəkləmə seçimləri Parol ifadəsini göstərin Xam Toxumu göstərin @@ -390,6 +391,7 @@ saniyələr qalıb Tamamlandı + Özünüzü pulunuza girişi itirməkdən qoruyun QR kodu Qalereyadan yükləyin Receive tokens @@ -490,7 +492,6 @@ Kart idarəçiliyi tezliklə gələcək Kart təfərrüatları Free card issuance - və ya €20 ərizə haqqı If you hold, stake or provide liquidity for at least €100 worth of XOR in your SORA account Get more XOR IBAN hesabı təfərrüatları @@ -535,6 +536,7 @@ Gözlənilməz xəta baş verdi. \n\n Siz @SORAhappiness Telegram çatında SORA icmasında bu problemi həll edə bilərsiniz. SORA tətbiqi üçün yeniləmə endirilib və quraşdırılmağa hazırdır. \n\n Proqramın ən son versiyasından istifadə etmək vacibdir. \n\n Proqramı yeniləmək üçün yenidən başladın tələb olunur. Güncəlləməni indi quraşdırmaq istərdinizmi? + Pulqabı ehtiyat nüsxəsi Kilidlənmiş Rezerv edilmiş Bağlı diff --git a/common/src/main/res/values-de/strings.xml b/common/src/main/res/values-de/strings.xml index 02fe233d0..da8b7c146 100644 --- a/common/src/main/res/values-de/strings.xml +++ b/common/src/main/res/values-de/strings.xml @@ -41,6 +41,7 @@ Asset to send Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -390,6 +391,7 @@ Es verbleiben noch %s Sekunden %s ist beendet + Protect yourself from losing access to your funds QR-Code Aus Galerie hochladen Receive tokens @@ -490,7 +492,6 @@ Card management is coming soon Card details Free card issuance - or €20 application fee If you hold, stake or provide liquidity for at least €100 worth of XOR in your SORA account Get more XOR IBAN account details @@ -535,6 +536,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. Ein Update für die SORA-App wurde heruntergeladen und kann nun installiert werden.\n\nEs ist wichtig, die neueste Version der App zu verwenden.\n\nUm die App zu aktualisieren, ist ein Neustart erforderlich. Möchtest du das Update jetzt installieren? + Wallet backup Gesperrt Reserviert Zugeordnet diff --git a/common/src/main/res/values-es/strings.xml b/common/src/main/res/values-es/strings.xml index ba8254ca8..3794e795c 100644 --- a/common/src/main/res/values-es/strings.xml +++ b/common/src/main/res/values-es/strings.xml @@ -41,6 +41,7 @@ Activo a enviar Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -238,7 +239,7 @@ Create pool Provide liquidity and earn rewards Swap tokens on SORA network - If you loose access to this device, your funds will be lost, unless you back up! + If you lose access to this device, your funds will be lost, unless you back up! Backup options Show Passphrase Show Raw Seed @@ -390,6 +391,7 @@ %s segundos restantes Terminado %s + Protect yourself from losing access to your funds Código QR Subir desde la galería Recibir tokens @@ -490,7 +492,6 @@ Card management is coming soon Card details Emisión de tarjeta gratuita - o tarifa de inscripción 20 € If you hold, stake or provide liquidity for at least €100 worth of XOR in your SORA account Conseguir más XOR IBAN account details @@ -535,6 +536,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. An update for the SORA application has been downloaded and is ready to be installed.\n\nIt is important to use the latest version of the application.\n\nIn order to update the app, a restart is required. Would you like to install the update now? + Wallet backup Bloqueado Reservado Vinculado diff --git a/common/src/main/res/values-fa/strings.xml b/common/src/main/res/values-fa/strings.xml index 42b8c7acd..f69e6e438 100644 --- a/common/src/main/res/values-fa/strings.xml +++ b/common/src/main/res/values-fa/strings.xml @@ -41,6 +41,7 @@ Asset to send Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -238,7 +239,7 @@ Create pool Provide liquidity and earn rewards Swap tokens on SORA network - If you loose access to this device, your funds will be lost, unless you back up! + If you lose access to this device, your funds will be lost, unless you back up! Backup options Show Passphrase Show Raw Seed @@ -390,6 +391,7 @@ %s ثانیه باقی مانده پایان یافت + Protect yourself from losing access to your funds کد QR بارگیری از گالری Receive tokens @@ -490,7 +492,6 @@ Card management is coming soon Card details Free card issuance - or €20 application fee If you hold, stake or provide liquidity for at least €100 worth of XOR in your SORA account Get more XOR IBAN account details @@ -535,6 +536,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. بروز رسانی برنامه SORA دانلود شده و آماده نصب است. \n\n مهم است که از آخرین نسخه برنامه استفاده کنید. \n\n برای به روز رسانی، برنامه نیازمند راه‌اندازی مجدد است. آیا می‌خواهید هم اکنون آپدیت را نصب کنید؟ + Wallet backup قفل شده رزرو شده ادغام شده diff --git a/common/src/main/res/values-fi/strings.xml b/common/src/main/res/values-fi/strings.xml index f90468ebb..67f610133 100644 --- a/common/src/main/res/values-fi/strings.xml +++ b/common/src/main/res/values-fi/strings.xml @@ -41,6 +41,7 @@ Asset to send Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -238,7 +239,7 @@ Create pool Provide liquidity and earn rewards Swap tokens on SORA network - If you loose access to this device, your funds will be lost, unless you back up! + If you lose access to this device, your funds will be lost, unless you back up! Backup options Show Passphrase Show Raw Seed @@ -390,6 +391,7 @@ %s sekuntia jäljellä Päättyi %s + Protect yourself from losing access to your funds QR-koodi Lataa galleriasta Receive tokens @@ -490,7 +492,6 @@ Card management is coming soon Card details Free card issuance - or €20 application fee If you hold, stake or provide liquidity for at least €100 worth of XOR in your SORA account Get more XOR IBAN account details @@ -535,6 +536,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. SORA-sovelluksen päivitys on ladattu ja se on valmis asennettavaksi.\n\nOn tärkeää käyttää sovelluksen uusinta versiota.\n\nSovelluksen päivittäminen edellyttää uudelleenkäynnistystä. Haluatko asentaa päivityksen nyt? + Wallet backup Lukittu Varattu Bonded diff --git a/common/src/main/res/values-fr/strings.xml b/common/src/main/res/values-fr/strings.xml index 1ba47a01c..a15328427 100644 --- a/common/src/main/res/values-fr/strings.xml +++ b/common/src/main/res/values-fr/strings.xml @@ -41,6 +41,7 @@ Actif à envoyer Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Critères de sécurité obligatoires remplis Minimum six caractères. Pour une meilleure sécurité, inclure des lettres majuscules, des nombres et des caractères spéciaux. Définir un mot de passe va encrypter votre sauvegarde. Vous devred entrer le mot de passe pour restaurer votre portefeuille.\nLe mot de passe doit être d\'au moins six caractères. @@ -390,6 +391,7 @@ %s secondes restantes Terminé %s + Protect yourself from losing access to your funds QR Code Depuis la galerie Recevoir des jetons @@ -490,7 +492,6 @@ Card management is coming soon Card details Émission gratuite de la carte - ou 20€ de frais de demande Si vous détenez, stakez, ou fournissez des liquidités pour un montant d\'au moins 100€ de XOR avec votre compte SORA Obtenir plus de XOR IBAN account details @@ -535,6 +536,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. Une mise à jour de l\'application SORA a été téléchargée et est prête à être installée.\n\nIl est important d\'utiliser la dernière version de l\'application.\n\nAfin de mettre à jour l\'application, un redémarrage est requis. Voulez-vous installer la mise à jour maintenant ? + Wallet backup Bloqué Réservé Lié diff --git a/common/src/main/res/values-hi-rIN/strings.xml b/common/src/main/res/values-hi-rIN/strings.xml index 2c293bbb5..17884f5ff 100644 --- a/common/src/main/res/values-hi-rIN/strings.xml +++ b/common/src/main/res/values-hi-rIN/strings.xml @@ -41,6 +41,7 @@ भेजने के लिए संपत्ति Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -390,6 +391,7 @@ सेकंड्‌स शेष समाप्त%s + Protect yourself from losing access to your funds क्यूआर कोड गैलरी से टोकन प्राप्त करें @@ -490,7 +492,6 @@ Card management is coming soon Card details नि: शुल्क कार्ड जारी करना - या 20 € आवेदन शुल्क यदि आप अपने SORA खाते में कम से कम €100 मूल्य के XOR को रखते हैं, Staking पर लगाते हैं या Liquidity प्रदान करते हैं अधिक XOR प्राप्त करें IBAN account details @@ -535,6 +536,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. SORA एप्लिकेशन के लिए एक अपडेट डाउनलोड किया गया है और इंस्टॉल करने के लिए तैयार है। \n\n एप्लिकेशन के नवीनतम संस्करण का उपयोग करना महत्वपूर्ण है। \n\n ऐप को अपडेट करने के लिए, पुनरारंभ करना आवश्यक है। क्या आप Update अभी Install करना चाहेंगे? + Wallet backup अवरोधित आरक्षित बॉन्डेड diff --git a/common/src/main/res/values-in/strings.xml b/common/src/main/res/values-in/strings.xml index d1eaa408d..dfaa4c213 100644 --- a/common/src/main/res/values-in/strings.xml +++ b/common/src/main/res/values-in/strings.xml @@ -41,6 +41,7 @@ Asset to send Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -237,7 +238,7 @@ Create pool Provide liquidity and earn rewards Swap tokens on SORA network - If you loose access to this device, your funds will be lost, unless you back up! + If you lose access to this device, your funds will be lost, unless you back up! Backup options Show Passphrase Show Raw Seed @@ -385,6 +386,7 @@ %s detik yang tersisa Berakhir %s + Protect yourself from losing access to your funds Kode QR Unggah dari galeri Receive tokens @@ -485,7 +487,6 @@ Card management is coming soon Card details Free card issuance - or €20 application fee If you hold, stake or provide liquidity for at least €100 worth of XOR in your SORA account Get more XOR IBAN account details @@ -530,6 +531,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. An update for the SORA application has been downloaded and is ready to be installed.\n\nIt is important to use the latest version of the application.\n\nIn order to update the app, a restart is required. Would you like to install the update now? + Wallet backup Terkunci Dipesan Terikat diff --git a/common/src/main/res/values-iw/strings.xml b/common/src/main/res/values-iw/strings.xml index 82d95945d..9ee23f9e9 100644 --- a/common/src/main/res/values-iw/strings.xml +++ b/common/src/main/res/values-iw/strings.xml @@ -41,6 +41,7 @@ נכס לשליחה גיבוי כבר קיים. המשך לשכתב אותו. הגיבוי נכשל. אין מספיק מקום בגוגל דרייב שלך. פנה קצת מקום ונסה שוב. + Backup now דרישת חובה למילוי הסיסמה מינימום שישה תווים. לחלופין, לאבטחה טובה יותר, כלול אותיות רישיות, מספרים ותווים שאינם אלפביתיים. הגדרת סיסמה תצפין את גיבוי הגוגל שלך. יהיה עליך להזין אותה בעת שחזור הארנק שלך. @@ -400,6 +401,7 @@ %s שניות נותרו הסתיים %s + Protect yourself from losing access to your funds קוד QR מתוך גלריה קבל טוקנים @@ -502,7 +504,6 @@ ניהול כרטיסים יגיע בקרוב פרטי כרטיס הנפקת כרטיס חינם - או 20 € דמי רישום אם אתה מחזיק, נועל או מספק נזילות בשווי של לפחות 100 אירו של XOR בחשבון סורה שלך השג עוד XOR פרטי חשבון IBAN @@ -547,6 +548,7 @@ אירעה שגיאה בלתי צפויה. \n\n אתה יכול לפתור בעיה זו בצ\'אט הטלגרם של קהילת סורה @SORAhappiness. עדכון עבור אפליקצית סורה הורד והוא מוכן להתקנה.\n\nחשוב להשתמש בגירסה העדכנית ביותר של האפליקציה.\n\nכדי לעדכן את האפליקציה, נדרשת הפעלה מחדש. האם ברצונך להתקין את העדכון כעת? + Wallet backup נעול שמור צורף למאגר diff --git a/common/src/main/res/values-ja/strings.xml b/common/src/main/res/values-ja/strings.xml index ba2a23722..38a4d41dd 100644 --- a/common/src/main/res/values-ja/strings.xml +++ b/common/src/main/res/values-ja/strings.xml @@ -41,6 +41,7 @@ 送信するアセット Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -385,6 +386,7 @@ 残り%s秒 %sに終了しました + Protect yourself from losing access to your funds QRコード ギャラリーからアップロード トークンを受け取る @@ -484,7 +486,6 @@ Card management is coming soon Card details 無料カード発行 - または20€の申請料 SORAアカウントに少なくとも€100相当のXORを、保有、ステーキング、または流動性供給している場合 XOR をさらに取得する IBAN account details @@ -529,6 +530,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. SORAアプリのアップデートがダウンロードされ、インストールできるようになりました。\n\n最新バージョンのアプリを使用することが重要です。\n\nアプリをアップデートするためには再起動が必要です。 今すぐアップデートをインストールしますか? + Wallet backup ロック済み 予約済み ボンド済み diff --git a/common/src/main/res/values-ms-rMY/strings.xml b/common/src/main/res/values-ms-rMY/strings.xml index 33cb9bf97..a48337644 100644 --- a/common/src/main/res/values-ms-rMY/strings.xml +++ b/common/src/main/res/values-ms-rMY/strings.xml @@ -41,6 +41,7 @@ Aset untuk dihantar Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled Minimum six characters. Optionally, for better security, include uppercase letters, numbers and non-alphabetic characters. Menetapkan kata laluan akan menyulitkan sandaran Google anda. Anda perlu memasukkannya semasa memulihkan dompet anda. @@ -385,6 +386,7 @@ %s saat lagi Tamat %s + Protect yourself from losing access to your funds Kod QR Muat naik dari galeri Terima token @@ -484,7 +486,6 @@ Card management is coming soon Card details Pengeluaran kad percuma - atau 20 € yuran permohonan Jika anda memegang, mempertaruhkan atau menyediakan kecairan untuk sekurang-kurangnya €100 nilai XOR dalam akaun SORA anda Dapatkan lebih banyak XOR IBAN account details @@ -529,6 +530,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. Kemas kini untuk aplikasi SORA telah dimuat turun dan sedia untuk dipasang.\n\nAdalah penting untuk menggunakan versi terkini aplikasi.\n\nUntuk mengemas kini aplikasi, mulakan semula diperlukan. Adakah anda ingin memasang kemas kini sekarang? + Wallet backup Dikunci Ditempah Terikat diff --git a/common/src/main/res/values-nb/strings.xml b/common/src/main/res/values-nb/strings.xml index 064ef9eb4..914223db1 100644 --- a/common/src/main/res/values-nb/strings.xml +++ b/common/src/main/res/values-nb/strings.xml @@ -41,6 +41,7 @@ Asset to send Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -238,7 +239,7 @@ Create pool Provide liquidity and earn rewards Swap tokens on SORA network - If you loose access to this device, your funds will be lost, unless you back up! + If you lose access to this device, your funds will be lost, unless you back up! Backup options Show Passphrase Show Raw Seed @@ -390,6 +391,7 @@ sekunder gjenstår Avsluttet %s + Protect yourself from losing access to your funds QR-kode Last opp fra galleriet Receive tokens @@ -490,7 +492,6 @@ Card management is coming soon Card details Free card issuance - or €20 application fee If you hold, stake or provide liquidity for at least €100 worth of XOR in your SORA account Get more XOR IBAN account details @@ -535,6 +536,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. An update for the SORA application has been downloaded and is ready to be installed.\n\nIt is important to use the latest version of the application.\n\nIn order to update the app, a restart is required. Would you like to install the update now? + Wallet backup Låst Reservert Bundet diff --git a/common/src/main/res/values-nl/strings.xml b/common/src/main/res/values-nl/strings.xml index 7862bc668..f0f57a2fa 100644 --- a/common/src/main/res/values-nl/strings.xml +++ b/common/src/main/res/values-nl/strings.xml @@ -41,6 +41,7 @@ Asset to send Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -390,6 +391,7 @@ resterende seconden Beëindigd %s + Protect yourself from losing access to your funds QR Code Uploaden vanuit galerij Ontvang Tokens @@ -490,7 +492,6 @@ Card management is coming soon Card details Gratis kaartuitgifte - of €20 applicatie kosten Als u voor ten minste € 100 aan XOR op uw SORA-rekening bezit, inzet of liquiditeit verschaft. Get more XOR IBAN account details @@ -535,6 +536,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. Een update voor de SORA-toepassing is gedownload en is klaar om te worden geïnstalleerd.\n\nHet is belangrijk om de nieuwste versie van de applicatie te gebruiken.\n\nOm de app bij te werken, is een herstart vereist. Wil je de update nu installeren? + Wallet backup Vergrendeld Gereserveerd Gebonden diff --git a/common/src/main/res/values-pt/strings.xml b/common/src/main/res/values-pt/strings.xml index 75e38d06f..6eb8378a1 100644 --- a/common/src/main/res/values-pt/strings.xml +++ b/common/src/main/res/values-pt/strings.xml @@ -41,6 +41,7 @@ Asset to send Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -238,7 +239,7 @@ Create pool Provide liquidity and earn rewards Swap tokens on SORA network - If you loose access to this device, your funds will be lost, unless you back up! + If you lose access to this device, your funds will be lost, unless you back up! Backup options Show Passphrase Show Raw Seed @@ -390,6 +391,7 @@ %s segundos restantes Terminou %s + Protect yourself from losing access to your funds Código QR Da galeria Receive tokens @@ -490,7 +492,6 @@ Card management is coming soon Card details Free card issuance - or €20 application fee If you hold, stake or provide liquidity for at least €100 worth of XOR in your SORA account Get more XOR IBAN account details @@ -535,6 +536,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. Uma atualização para a aplicação SORA foi descarregada e está pronta para ser instalada.\n\nÉ importante utilizar a versão mais recente da aplicação.\n\nDe modo a atualizar a aplicação, é necessário reiniciar o sistema. Deseja instalar a atualização agora? + Wallet backup Trancado Reservado Vinculado diff --git a/common/src/main/res/values-ru/strings.xml b/common/src/main/res/values-ru/strings.xml index f60614d2a..fe7d0d098 100644 --- a/common/src/main/res/values-ru/strings.xml +++ b/common/src/main/res/values-ru/strings.xml @@ -41,6 +41,7 @@ Отправляемый ассет Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Сделать сейчас Обязательное требование к паролю выполнено Минимум шесть символов. По желанию, для повышения безопасности, можно включить заглавные буквы, цифры и неалфавитные символы. Установка пароля зашифрует резервную копию Google. Его нужно будет ввести при восстановлении кошелька.\nМинимальная длина пароля - 6 символов. @@ -405,6 +406,7 @@ осталось %s секунд Завершился %s + Защитите себя от потери доступа к своим средствам QR код Из галереи Получить токены @@ -508,7 +510,6 @@ Card management is coming soon Card details Бесплатный выпуск карты - или плата €20 за подачу заявки Если вы держите, ставите или предоставляете ликвидность XOR на сумму не менее 100 евро на своем счете SORA. Get more XOR IBAN account details @@ -553,6 +554,7 @@ Произошла непредвиденная ошибка.\n\nВы можете решить эту проблему в сообществе SORA в Telegram чате @SORAhappiness. Обновление для приложения SORA было загружено и готово к установке. \n\n Важно использовать последнюю версию приложения. \n\n Чтобы обновить приложение, требуется перезагрузка. Хотите установить обновление сейчас? + Сделайте резервную копию Заблокировано Резерв В обеспечении diff --git a/common/src/main/res/values-sr/strings.xml b/common/src/main/res/values-sr/strings.xml index 6bd4cb62b..4909ebdb6 100644 --- a/common/src/main/res/values-sr/strings.xml +++ b/common/src/main/res/values-sr/strings.xml @@ -41,6 +41,7 @@ Asset to send Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -395,6 +396,7 @@ секунди преостало Завршено %s + Protect yourself from losing access to your funds QR kod Пренос из галерије Receive tokens @@ -495,7 +497,6 @@ Card management is coming soon Card details Free card issuance - or €20 application fee If you hold, stake or provide liquidity for at least €100 worth of XOR in your SORA account Get more XOR IBAN account details @@ -540,6 +541,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. Ажурирање за апликацију SORA је преузето и спремно за инсталирање. \n\nВажно је да користите најновију верзију апликације. \n\nДа бисте ажурирали апликацију, потребно је поновно покретање. Да ли желите да инсталирате ажурирање сада? + Wallet backup Zaključano Rezervisano Vezano diff --git a/common/src/main/res/values-tr/strings.xml b/common/src/main/res/values-tr/strings.xml index aa8ee92cb..66c46569f 100644 --- a/common/src/main/res/values-tr/strings.xml +++ b/common/src/main/res/values-tr/strings.xml @@ -41,6 +41,7 @@ Asset to send Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -238,7 +239,7 @@ Create pool Provide liquidity and earn rewards Swap tokens on SORA network - If you loose access to this device, your funds will be lost, unless you back up! + If you lose access to this device, your funds will be lost, unless you back up! Backup options Show Passphrase Show Raw Seed @@ -390,6 +391,7 @@ saniye kaldı %s Sona erdi + Protect yourself from losing access to your funds QR Kodu Galeriden Receive tokens @@ -490,7 +492,6 @@ Card management is coming soon Card details Free card issuance - or €20 application fee If you hold, stake or provide liquidity for at least €100 worth of XOR in your SORA account Get more XOR IBAN account details @@ -535,6 +536,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. SORA uygulaması için bir güncelleme indirildi ve yüklenmek için hazır.\n\nUygulamanın son sürümünü kullanmak önemlidir.\n\nUygulamayı güncellemek için yeniden başlatma gereklidir. Güncellemeyi şimdi yüklemek Istiyor musunuz? + Wallet backup Kilitli Rezerve edilmiş Bond edilmiş diff --git a/common/src/main/res/values-vi/strings.xml b/common/src/main/res/values-vi/strings.xml index ed96206f9..21bdbdd36 100644 --- a/common/src/main/res/values-vi/strings.xml +++ b/common/src/main/res/values-vi/strings.xml @@ -41,6 +41,7 @@ Tài sản cần gửi Sao lưu đã tồn tại. Tiến hành viết lại nó. Sao lưu không thành công. Không đủ dung lượng trên Google Drive của bạn. Hãy giải phóng một số dung lượng và thử lại. + Sao lưu ngay Yêu cầu bắt buộc đối với mật khẩu được đáp ứng Tối thiểu sáu ký tự. Tùy chọn, để bảo mật tốt hơn, hãy bao gồm các chữ cái viết hoa, số và các ký tự không phải bảng chữ cái. Đặt mật khẩu sẽ mã hóa bản sao lưu Google của bạn. Bạn sẽ cần nhập thông tin này khi khôi phục ví của mình.\nĐộ dài mật khẩu tối thiểu là 6 ký tự. @@ -50,7 +51,7 @@ Mua token XOR Mua hoặc bán XOR bằng euro Mua XOR bằng tiền pháp định - Can\'t load balance + Không thể tải số dư Thay đổi ngôn ngữ Thay đổi mã PIN Chọn token @@ -385,6 +386,7 @@ Còn lại %s giây Đã kết thúc %s + Bảo vệ bạn khỏi mất quyền truy cập vào tiền của bạn Mã QR Từ bộ sưu tập Nhận token @@ -484,7 +486,6 @@ Quản lý thẻ sắp ra mắt Chi tiết thẻ Miễn phí phát hành thẻ - hoặc phí đăng ký 20 € Nếu bạn nắm giữ, stake hoặc cung cấp thanh khoản cho XOR trị giá ít nhất €100 trong tài khoản SORA của mình Nhận thêm XOR Chi tiết tài khoản IBAN @@ -511,7 +512,7 @@ Thành công Trạng thái Bạn đã nhập thành công một tài khoản - Support chat + Trò chuyện với hỗ trợ Đảm bảo rằng bạn còn %s sau giao dịch này. Nếu không, bạn sẽ không thể thực hiện một giao dịch khác. Chuyển node Hệ thống hiển thị @@ -529,6 +530,7 @@ Đã xảy ra lỗi không mong muốn. \n\n Bạn có thể khắc phục sự cố này trong cộng đồng SORA tại cuộc trò chuyện Telegram @SORAhappiness. Bản cập nhật cho ứng dụng SORA đã được tải xuống và sẵn sàng cài đặt. \n\n Hãy sử dụng phiên bản mới nhất của ứng dụng. \n\n Để cập nhật ứng dụng thành công, bạn cần khởi động lại ứng dụng. Bạn có muốn cài đặt bản cập nhật ngay bây giờ không? + Sao lưu ví Đã khóa Dự trữ Được bảo lãnh diff --git a/common/src/main/res/values-zh-rCN/strings.xml b/common/src/main/res/values-zh-rCN/strings.xml index ae146573f..6fb57ff37 100644 --- a/common/src/main/res/values-zh-rCN/strings.xml +++ b/common/src/main/res/values-zh-rCN/strings.xml @@ -41,6 +41,7 @@ 待发送的资产 备份已存在。继续覆盖它。 备份失败。您的Google Drive空间不足,请释放一些空间并重试。 + Backup now 密码的强制要求已满足 至少六个字符。为了更好的安全性,可以包含大写字母、数字和非字母字符。 设置密码将加密您的Google备份。在恢复钱包时,您需要输入此密码。\n最小密码长度为6个字符。 @@ -385,6 +386,7 @@ %s 秒剩余 结束%s + Protect yourself from losing access to your funds QR 代码 从相册 接收代币 @@ -484,7 +486,6 @@ 即将推出卡片管理功能 卡片详情 免费发卡 - 或 20 欧元的申请费 如果您在SORA账户中持有、质押或提供流动性达到至少价值100欧元的XOR 获取更多的XOR IBAN账户详情 @@ -529,6 +530,7 @@ 发生了意外错误。\n\n您可以在SORA社区的@SORAhappiness Telegram聊天中解决此问题。 SORA 应用程序的更新已下载并可以安装。 \n\n使用最新版本的应用程序很重要。 \n\n为了更新应用程序,需要重新启动。 您想现在安装更新吗? + Wallet backup 已被锁定 已保留 已绑定 diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index 847b70231..36e370dab 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -41,6 +41,7 @@ Asset to send Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -385,6 +386,7 @@ %s 秒剩餘 已結束%s + Protect yourself from losing access to your funds QR 代碼 從圖庫上傳 Receive tokens @@ -485,7 +487,6 @@ Card management is coming soon Card details Free card issuance - or €20 application fee If you hold, stake or provide liquidity for at least €100 worth of XOR in your SORA account Get more XOR IBAN account details @@ -530,6 +531,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. SORA 應用程序的更新已下載並可以安裝。 \n\n使用最新版本的應用程序很重要。 \n\n為了更新應用程序,需要重新啟動。 您想要現在安裝更新嗎? + Wallet backup 已鎖定 已保留 已綁定 diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index 52fe01341..d6b9584b5 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -41,6 +41,7 @@ Asset to send Backup already exists. Proceed to rewrite it. Backup failed. Not enough space on your Google Drive. Free some space and try again. + Backup now Mandatory requirement for the password fulfilled 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. @@ -238,7 +239,7 @@ Create pool Provide liquidity and earn rewards Swap tokens on SORA network - If you loose access to this device, your funds will be lost, unless you back up! + If you lose access to this device, your funds will be lost, unless you back up! Backup options Show Passphrase Show Raw Seed @@ -390,6 +391,7 @@ %s seconds left Ended %s + Protect yourself from losing access to your funds QR code From gallery Receive tokens @@ -490,7 +492,6 @@ Card management is coming soon Card details Free card issuance - or €20 application fee If you hold, stake or provide liquidity for at least €100 worth of XOR in your SORA account Get more XOR IBAN account details @@ -535,6 +536,7 @@ An unexpected error has occured.\n\nYou may troubleshoot this issue in SORA community at the @SORAhappiness Telegram chat. An update for the SORA application has been downloaded and is ready to be installed.\n\nIt is important to use the latest version of the application.\n\nIn order to update the app, a restart is required. Would you like to install the update now? + Wallet backup Locked Reserved Bonded diff --git a/common_wallet/src/main/java/jp/co/soramitsu/common_wallet/presentation/compose/components/PoolsList.kt b/common_wallet/src/main/java/jp/co/soramitsu/common_wallet/presentation/compose/components/PoolsList.kt index ba654e92e..4c07bc575 100644 --- a/common_wallet/src/main/java/jp/co/soramitsu/common_wallet/presentation/compose/components/PoolsList.kt +++ b/common_wallet/src/main/java/jp/co/soramitsu/common_wallet/presentation/compose/components/PoolsList.kt @@ -42,13 +42,19 @@ import androidx.compose.foundation.layout.wrapContentSize import androidx.compose.material.MaterialTheme import androidx.compose.material.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.CompositionLocalProvider import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier +import androidx.compose.ui.platform.LocalLayoutDirection import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.tooling.preview.Preview +import androidx.compose.ui.unit.LayoutDirection import androidx.compose.ui.unit.dp import androidx.constraintlayout.compose.ConstraintLayout +import jp.co.soramitsu.common.domain.DEFAULT_ICON_URI import jp.co.soramitsu.common.presentation.compose.TokenIcon import jp.co.soramitsu.common.util.StringPair +import jp.co.soramitsu.common_wallet.presentation.compose.states.PoolsListItemState import jp.co.soramitsu.common_wallet.presentation.compose.states.PoolsListState import jp.co.soramitsu.ui_core.component.asset.changePriceColor import jp.co.soramitsu.ui_core.component.button.properties.Size @@ -70,26 +76,28 @@ fun PoolsList( .padding(horizontal = Dimens.x3) .clickable { onPoolClick?.invoke(poolState.tokenIds) } ) { - ConstraintLayout( - modifier = Modifier.wrapContentSize() - ) { - val (token1, token2) = createRefs() - TokenIcon( - uri = poolState.token1Icon, size = Size.Small, - modifier = Modifier - .constrainAs(token1) { - top.linkTo(parent.top) - start.linkTo(parent.start) - } - ) - TokenIcon( - uri = poolState.token2Icon, size = Size.Small, - modifier = Modifier - .constrainAs(token2) { - top.linkTo(parent.top) - start.linkTo(token1.start, margin = 24.dp) - } - ) + CompositionLocalProvider(LocalLayoutDirection provides LayoutDirection.Ltr) { + ConstraintLayout( + modifier = Modifier.wrapContentSize() + ) { + val (token1, token2) = createRefs() + TokenIcon( + uri = poolState.token1Icon, size = Size.Small, + modifier = Modifier + .constrainAs(token1) { + top.linkTo(parent.top) + start.linkTo(parent.start) + } + ) + TokenIcon( + uri = poolState.token2Icon, size = Size.Small, + modifier = Modifier + .constrainAs(token2) { + top.linkTo(parent.top) + start.linkTo(token1.start, margin = 24.dp) + } + ) + } } Column( modifier = Modifier @@ -132,3 +140,35 @@ fun PoolsList( } } } + +@Composable +@Preview +private fun PreviewPoolsList() { + Column { + PoolsList( + onPoolClick = {}, + cardState = PoolsListState( + pools = listOf( + PoolsListItemState( + token1Icon = DEFAULT_ICON_URI, + token2Icon = DEFAULT_ICON_URI, + poolAmounts = "123.456", + poolName = "XOR - VAL", + fiat = "$7908", + fiatChange = "+23.1 %", + tokenIds = "" to "", + ), + PoolsListItemState( + token1Icon = DEFAULT_ICON_URI, + token2Icon = DEFAULT_ICON_URI, + poolAmounts = "98.76", + poolName = "DAI - PSWAP", + fiat = "$ 0.00123", + fiatChange = "-9.88 %", + tokenIds = "" to "", + ), + ), + ), + ) + } +} diff --git a/common_wallet/src/main/java/jp/co/soramitsu/common_wallet/presentation/compose/states/CardState.kt b/common_wallet/src/main/java/jp/co/soramitsu/common_wallet/presentation/compose/states/CardState.kt index 1a53997dc..810cd3a84 100644 --- a/common_wallet/src/main/java/jp/co/soramitsu/common_wallet/presentation/compose/states/CardState.kt +++ b/common_wallet/src/main/java/jp/co/soramitsu/common_wallet/presentation/compose/states/CardState.kt @@ -46,6 +46,7 @@ import jp.co.soramitsu.common.domain.printFiatChange import jp.co.soramitsu.common.util.NumbersFormatter data class CardsState( + val accountAddress: String, val curAccount: String, val loading: Boolean = false, val cards: List = emptyList(), @@ -55,6 +56,10 @@ sealed class CardState( open val loading: Boolean, ) +sealed class BasicBannerCardState( + override val loading: Boolean, +) : CardState(loading) + sealed interface AssetCardState data class TitledAmountCardState( @@ -124,19 +129,14 @@ data class SoraCardState( val success: Boolean, val ibanBalance: String?, val kycStatus: String?, - val visible: Boolean = false, override val loading: Boolean, -) : CardState(loading) +) : BasicBannerCardState(loading) -data class BuyXorState( - val visible: Boolean = false, - override val loading: Boolean, -) : CardState(loading) +data object BuyXorState : BasicBannerCardState(false) -data class ReferralState( - val visible: Boolean = false, - override val loading: Boolean, -) : CardState(loading) +data object ReferralState : BasicBannerCardState(false) + +data object BackupWalletState : BasicBannerCardState(false) class FavoritePoolsCardState( val state: PoolsListState, diff --git a/core_db/schemas/jp.co.soramitsu.core_db.AppDatabase/73.json b/core_db/schemas/jp.co.soramitsu.core_db.AppDatabase/73.json new file mode 100644 index 000000000..d421add6a --- /dev/null +++ b/core_db/schemas/jp.co.soramitsu.core_db.AppDatabase/73.json @@ -0,0 +1,638 @@ +{ + "formatVersion": 1, + "database": { + "version": 73, + "identityHash": "f11930401f4296d64355e44fbf2c9e2f", + "entities": [ + { + "tableName": "assets", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`tokenId` TEXT NOT NULL, `accountAddress` TEXT NOT NULL, `displayAsset` INTEGER NOT NULL, `position` INTEGER NOT NULL, `free` TEXT NOT NULL, `reserved` TEXT NOT NULL, `miscFrozen` TEXT NOT NULL, `feeFrozen` TEXT NOT NULL, `bonded` TEXT NOT NULL, `redeemable` TEXT NOT NULL, `unbonding` TEXT NOT NULL, `visibility` INTEGER NOT NULL DEFAULT 0, PRIMARY KEY(`tokenId`, `accountAddress`), FOREIGN KEY(`tokenId`) REFERENCES `tokens`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`accountAddress`) REFERENCES `accounts`(`substrateAddress`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "tokenId", + "columnName": "tokenId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "accountAddress", + "columnName": "accountAddress", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "displayAsset", + "columnName": "displayAsset", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "position", + "columnName": "position", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "free", + "columnName": "free", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "reserved", + "columnName": "reserved", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "miscFrozen", + "columnName": "miscFrozen", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "feeFrozen", + "columnName": "feeFrozen", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "bonded", + "columnName": "bonded", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "redeemable", + "columnName": "redeemable", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "unbonding", + "columnName": "unbonding", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "visibility", + "columnName": "visibility", + "affinity": "INTEGER", + "notNull": true, + "defaultValue": "0" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "tokenId", + "accountAddress" + ] + }, + "indices": [ + { + "name": "index_assets_accountAddress", + "unique": false, + "columnNames": [ + "accountAddress" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_assets_accountAddress` ON `${TABLE_NAME}` (`accountAddress`)" + } + ], + "foreignKeys": [ + { + "table": "tokens", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "tokenId" + ], + "referencedColumns": [ + "id" + ] + }, + { + "table": "accounts", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "accountAddress" + ], + "referencedColumns": [ + "substrateAddress" + ] + } + ] + }, + { + "tableName": "tokens", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `name` TEXT NOT NULL, `symbol` TEXT NOT NULL, `precision` INTEGER NOT NULL, `isMintable` INTEGER NOT NULL, `whitelistName` TEXT NOT NULL, `isHidable` INTEGER NOT NULL, PRIMARY KEY(`id`))", + "fields": [ + { + "fieldPath": "id", + "columnName": "id", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "symbol", + "columnName": "symbol", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "precision", + "columnName": "precision", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "isMintable", + "columnName": "isMintable", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "whitelistName", + "columnName": "whitelistName", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "isHidable", + "columnName": "isHidable", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "id" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "fiatTokenPrices", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`tokenIdFiat` TEXT NOT NULL, `currencyId` TEXT NOT NULL, `fiatPrice` REAL NOT NULL, `fiatPriceTime` INTEGER NOT NULL, `fiatPricePrevH` REAL NOT NULL, `fiatPricePrevHTime` INTEGER NOT NULL, `fiatPricePrevD` REAL NOT NULL, `fiatPricePrevDTime` INTEGER NOT NULL, `fiatChange` REAL DEFAULT null, PRIMARY KEY(`tokenIdFiat`, `currencyId`), FOREIGN KEY(`tokenIdFiat`) REFERENCES `tokens`(`id`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "tokenIdFiat", + "columnName": "tokenIdFiat", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "currencyId", + "columnName": "currencyId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "fiatPrice", + "columnName": "fiatPrice", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "fiatPriceTime", + "columnName": "fiatPriceTime", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "fiatPricePrevH", + "columnName": "fiatPricePrevH", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "fiatPricePrevHTime", + "columnName": "fiatPricePrevHTime", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "fiatPricePrevD", + "columnName": "fiatPricePrevD", + "affinity": "REAL", + "notNull": true + }, + { + "fieldPath": "fiatPricePrevDTime", + "columnName": "fiatPricePrevDTime", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "fiatChange", + "columnName": "fiatChange", + "affinity": "REAL", + "notNull": false, + "defaultValue": "null" + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "tokenIdFiat", + "currencyId" + ] + }, + "indices": [], + "foreignKeys": [ + { + "table": "tokens", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "tokenIdFiat" + ], + "referencedColumns": [ + "id" + ] + } + ] + }, + { + "tableName": "allpools", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`tokenIdBase` TEXT NOT NULL, `tokenIdTarget` TEXT NOT NULL, `reserveBase` TEXT NOT NULL, `reserveTarget` TEXT NOT NULL, `totalIssuance` TEXT NOT NULL, `reservesAccount` TEXT NOT NULL, PRIMARY KEY(`tokenIdBase`, `tokenIdTarget`))", + "fields": [ + { + "fieldPath": "tokenIdBase", + "columnName": "tokenIdBase", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "tokenIdTarget", + "columnName": "tokenIdTarget", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "reserveBase", + "columnName": "reserveBase", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "reserveTarget", + "columnName": "reserveTarget", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "totalIssuance", + "columnName": "totalIssuance", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "reservesAccount", + "columnName": "reservesAccount", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "tokenIdBase", + "tokenIdTarget" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "userpools", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`userTokenIdBase` TEXT NOT NULL, `userTokenIdTarget` TEXT NOT NULL, `accountAddress` TEXT NOT NULL, `poolProvidersBalance` TEXT NOT NULL, `favorite` INTEGER NOT NULL, `sortOrder` INTEGER NOT NULL, PRIMARY KEY(`userTokenIdBase`, `userTokenIdTarget`, `accountAddress`), FOREIGN KEY(`accountAddress`) REFERENCES `accounts`(`substrateAddress`) ON UPDATE NO ACTION ON DELETE CASCADE , FOREIGN KEY(`userTokenIdBase`, `userTokenIdTarget`) REFERENCES `allpools`(`tokenIdBase`, `tokenIdTarget`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "userTokenIdBase", + "columnName": "userTokenIdBase", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "userTokenIdTarget", + "columnName": "userTokenIdTarget", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "accountAddress", + "columnName": "accountAddress", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "poolProvidersBalance", + "columnName": "poolProvidersBalance", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "favorite", + "columnName": "favorite", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "sortOrder", + "columnName": "sortOrder", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "userTokenIdBase", + "userTokenIdTarget", + "accountAddress" + ] + }, + "indices": [ + { + "name": "index_userpools_accountAddress", + "unique": false, + "columnNames": [ + "accountAddress" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_userpools_accountAddress` ON `${TABLE_NAME}` (`accountAddress`)" + } + ], + "foreignKeys": [ + { + "table": "accounts", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "accountAddress" + ], + "referencedColumns": [ + "substrateAddress" + ] + }, + { + "table": "allpools", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "userTokenIdBase", + "userTokenIdTarget" + ], + "referencedColumns": [ + "tokenIdBase", + "tokenIdTarget" + ] + } + ] + }, + { + "tableName": "poolBaseTokens", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`tokenId` TEXT NOT NULL, `dexId` INTEGER NOT NULL, PRIMARY KEY(`tokenId`))", + "fields": [ + { + "fieldPath": "tokenId", + "columnName": "tokenId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "dexId", + "columnName": "dexId", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "tokenId" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "accounts", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`substrateAddress` TEXT NOT NULL, `accountName` TEXT NOT NULL, PRIMARY KEY(`substrateAddress`))", + "fields": [ + { + "fieldPath": "substrateAddress", + "columnName": "substrateAddress", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "accountName", + "columnName": "accountName", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "substrateAddress" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "referrals", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`address` TEXT NOT NULL, `amount` TEXT NOT NULL, PRIMARY KEY(`address`))", + "fields": [ + { + "fieldPath": "address", + "columnName": "address", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "amount", + "columnName": "amount", + "affinity": "TEXT", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "address" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "nodes", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`address` TEXT NOT NULL, `chain` TEXT NOT NULL, `name` TEXT NOT NULL, `isDefault` INTEGER NOT NULL, `isSelected` INTEGER NOT NULL, PRIMARY KEY(`address`))", + "fields": [ + { + "fieldPath": "address", + "columnName": "address", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "chain", + "columnName": "chain", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "name", + "columnName": "name", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "isDefault", + "columnName": "isDefault", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "isSelected", + "columnName": "isSelected", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "address" + ] + }, + "indices": [], + "foreignKeys": [] + }, + { + "tableName": "cardsHub", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cardId` TEXT NOT NULL, `accountAddress` TEXT NOT NULL, `visibility` INTEGER NOT NULL, `sortOrder` INTEGER NOT NULL, `collapsed` INTEGER NOT NULL, PRIMARY KEY(`cardId`, `accountAddress`), FOREIGN KEY(`accountAddress`) REFERENCES `accounts`(`substrateAddress`) ON UPDATE NO ACTION ON DELETE CASCADE )", + "fields": [ + { + "fieldPath": "cardId", + "columnName": "cardId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "accountAddress", + "columnName": "accountAddress", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "visibility", + "columnName": "visibility", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "sortOrder", + "columnName": "sortOrder", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "collapsed", + "columnName": "collapsed", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "cardId", + "accountAddress" + ] + }, + "indices": [ + { + "name": "index_cardsHub_accountAddress", + "unique": false, + "columnNames": [ + "accountAddress" + ], + "orders": [], + "createSql": "CREATE INDEX IF NOT EXISTS `index_cardsHub_accountAddress` ON `${TABLE_NAME}` (`accountAddress`)" + } + ], + "foreignKeys": [ + { + "table": "accounts", + "onDelete": "CASCADE", + "onUpdate": "NO ACTION", + "columns": [ + "accountAddress" + ], + "referencedColumns": [ + "substrateAddress" + ] + } + ] + }, + { + "tableName": "globalCardsHub", + "createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`cardId` TEXT NOT NULL, `visibility` INTEGER NOT NULL, `sortOrder` INTEGER NOT NULL, `collapsed` INTEGER NOT NULL, PRIMARY KEY(`cardId`))", + "fields": [ + { + "fieldPath": "cardId", + "columnName": "cardId", + "affinity": "TEXT", + "notNull": true + }, + { + "fieldPath": "visibility", + "columnName": "visibility", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "sortOrder", + "columnName": "sortOrder", + "affinity": "INTEGER", + "notNull": true + }, + { + "fieldPath": "collapsed", + "columnName": "collapsed", + "affinity": "INTEGER", + "notNull": true + } + ], + "primaryKey": { + "autoGenerate": false, + "columnNames": [ + "cardId" + ] + }, + "indices": [], + "foreignKeys": [] + } + ], + "views": [], + "setupQueries": [ + "CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", + "INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'f11930401f4296d64355e44fbf2c9e2f')" + ] + } +} \ No newline at end of file diff --git a/core_db/src/main/java/jp/co/soramitsu/core_db/AppDatabase.kt b/core_db/src/main/java/jp/co/soramitsu/core_db/AppDatabase.kt index 7f1ee93b3..15ecc7d4f 100644 --- a/core_db/src/main/java/jp/co/soramitsu/core_db/AppDatabase.kt +++ b/core_db/src/main/java/jp/co/soramitsu/core_db/AppDatabase.kt @@ -53,6 +53,7 @@ import jp.co.soramitsu.core_db.migrations.migration_CardHub_65_66 import jp.co.soramitsu.core_db.migrations.migration_CardHub_66_67 import jp.co.soramitsu.core_db.migrations.migration_PoolOrderReservesAccount_64_65 import jp.co.soramitsu.core_db.migrations.migration_PoolsTables_69_70 +import jp.co.soramitsu.core_db.migrations.migration_addBackupCardHub_72_73 import jp.co.soramitsu.core_db.migrations.migration_addReferralCardHub_71_72 import jp.co.soramitsu.core_db.migrations.migration_poolsBaseToken_61_62 import jp.co.soramitsu.core_db.migrations.migration_reorderBaseToken_62_63 @@ -70,7 +71,7 @@ import jp.co.soramitsu.core_db.model.UserPoolLocal @TypeConverters(BigDecimalNullableConverter::class) @Database( - version = 72, + version = 73, entities = [ AssetLocal::class, TokenLocal::class, @@ -121,6 +122,7 @@ abstract class AppDatabase : RoomDatabase() { .addMigrations(migration_CardHub_66_67) .addMigrations(migration_PoolsTables_69_70) .addMigrations(migration_addReferralCardHub_71_72) + .addMigrations(migration_addBackupCardHub_72_73) .build() } } diff --git a/core_db/src/main/java/jp/co/soramitsu/core_db/migrations/AddBackupCardHubMigration73.kt b/core_db/src/main/java/jp/co/soramitsu/core_db/migrations/AddBackupCardHubMigration73.kt new file mode 100644 index 000000000..2ac3f5c81 --- /dev/null +++ b/core_db/src/main/java/jp/co/soramitsu/core_db/migrations/AddBackupCardHubMigration73.kt @@ -0,0 +1,64 @@ +/* +This file is part of the SORA network and Polkaswap app. + +Copyright (c) 2020, 2021, Polka Biome Ltd. All rights reserved. +SPDX-License-Identifier: BSD-4-Clause + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list +of conditions and the following disclaimer. +Redistributions in binary form must reproduce the above copyright notice, this +list of conditions and the following disclaimer in the documentation and/or other +materials provided with the distribution. + +All advertising materials mentioning features or use of this software must display +the following acknowledgement: This product includes software developed by Polka Biome +Ltd., SORA, and Polkaswap. + +Neither the name of the Polka Biome Ltd. nor the names of its contributors may be used +to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY Polka Biome Ltd. AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Polka Biome Ltd. BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package jp.co.soramitsu.core_db.migrations + +import android.content.ContentValues +import android.database.sqlite.SQLiteDatabase +import androidx.room.migration.Migration +import androidx.sqlite.db.SupportSQLiteDatabase +import jp.co.soramitsu.common.domain.CardHubType +import jp.co.soramitsu.core_db.converters.map + +val migration_addBackupCardHub_72_73 = object : Migration(72, 73) { + + override fun migrate(database: SupportSQLiteDatabase) { + database.beginTransaction() + val cursor = database.query("select substrateAddress from accounts") + val addresses = cursor.map { + getString(getColumnIndexOrThrow("substrateAddress")) + } + addresses.forEach { address -> + val type = CardHubType.BACKUP + val values = ContentValues().apply { + put("cardId", type.hubName) + put("accountAddress", address) + put("visibility", true) + put("collapsed", false) + put("sortOrder", type.order) + } + database.insert("cardsHub", SQLiteDatabase.CONFLICT_REPLACE, values) + } + database.setTransactionSuccessful() + database.endTransaction() + } +} diff --git a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/domain/MultiaccountInteractor.kt b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/domain/MultiaccountInteractor.kt index 3e5ddf59b..8c3abb243 100644 --- a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/domain/MultiaccountInteractor.kt +++ b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/domain/MultiaccountInteractor.kt @@ -35,27 +35,32 @@ package jp.co.soramitsu.feature_multiaccount_impl.domain import android.net.Uri import javax.inject.Inject import jp.co.soramitsu.common.account.SoraAccount +import jp.co.soramitsu.common.domain.CardHubType import jp.co.soramitsu.common.io.FileManager import jp.co.soramitsu.feature_account_api.domain.interfaces.CredentialsRepository import jp.co.soramitsu.feature_account_api.domain.interfaces.UserRepository import jp.co.soramitsu.feature_account_api.domain.model.OnboardingState -import jp.co.soramitsu.feature_assets_api.domain.AssetsInteractor +import jp.co.soramitsu.feature_wallet_api.domain.interfaces.WalletRepository import jp.co.soramitsu.shared_utils.encrypt.keypair.Keypair import jp.co.soramitsu.sora.substrate.runtime.RuntimeManager import kotlinx.coroutines.flow.Flow class MultiaccountInteractor @Inject constructor( - private val assetsInteractor: AssetsInteractor, private val userRepository: UserRepository, private val credentialsRepository: CredentialsRepository, private val fileManager: FileManager, - private val runtimeManager: RuntimeManager + private val runtimeManager: RuntimeManager, + private val walletRepository: WalletRepository, ) { private companion object { const val MULTIPLE_ACCOUNT_COUNT = 2 } + suspend fun anyBackupStarted() { + walletRepository.updateCardVisibilityOnCardsHub(CardHubType.BACKUP.hubName, false) + } + suspend fun isMnemonicValid(mnemonic: String) = credentialsRepository.isMnemonicValid(mnemonic) suspend fun isRawSeedValid(rawSeed: String) = credentialsRepository.isRawSeedValid(rawSeed) 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 2193723fe..d309e98a5 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 @@ -168,19 +168,28 @@ class AccountDetailsViewModel @AssistedInject constructor( } } + private fun startBackup() { + viewModelScope.launch { + interactor.anyBackupStarted() + } + } + fun onShowPassphrase() { + startBackup() _accountDetailsScreenState.value?.let { router.showExportPassphraseProtection(address) } } fun onShowRawSeed() { + startBackup() _accountDetailsScreenState.value?.let { router.showExportSeedProtection(address) } } fun onExportJson() { + startBackup() _accountDetailsScreenState.value?.let { router.showExportJSONProtection(mutableListOf(address)) } @@ -334,6 +343,7 @@ class AccountDetailsViewModel @AssistedInject constructor( fun onBackupClicked( launcher: ActivityResultLauncher ) { + startBackup() viewModelScope.launch { try { _accountDetailsScreenState.value?.let { diff --git a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/BackupFragment.kt b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/BackupFragment.kt index 6a38d254f..545303326 100644 --- a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/BackupFragment.kt +++ b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/BackupFragment.kt @@ -32,9 +32,12 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package jp.co.soramitsu.feature_multiaccount_impl.presentation.export_account.backup -import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.foundation.ScrollState +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.livedata.observeAsState +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier import androidx.fragment.app.viewModels import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -62,7 +65,6 @@ class BackupFragment : SoraBaseFragment() { } } - @OptIn(ExperimentalAnimationApi::class) override fun NavGraphBuilder.content( scrollState: ScrollState, navController: NavHostController @@ -71,10 +73,15 @@ class BackupFragment : SoraBaseFragment() { route = theOnlyRoute, ) { viewModel.backupScreenState.observeAsState().value?.let { - BackupScreen( - state = it, - onButtonPressed = viewModel::backupPressed, - ) + Box( + modifier = Modifier.fillMaxSize(), + contentAlignment = Alignment.TopCenter, + ) { + BackupScreen( + state = it, + onButtonPressed = viewModel::backupPressed, + ) + } } } } diff --git a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/BackupScreen.kt b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/BackupScreen.kt index 8347afa0f..99a7e1408 100644 --- a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/BackupScreen.kt +++ b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/BackupScreen.kt @@ -80,7 +80,7 @@ internal fun BackupScreen( onBackupWithGoogleButtonPressed: (() -> Unit)? = null, ) { ContentCard( - modifier = Modifier.padding(horizontal = Dimens.x2, vertical = Dimens.x1), + modifier = Modifier.padding(horizontal = Dimens.x2, vertical = Dimens.x1).fillMaxWidth().wrapContentHeight(), ) { Column( modifier = Modifier diff --git a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/json/BackupJsonFragment.kt b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/json/BackupJsonFragment.kt index 6447e6e5e..45663c055 100644 --- a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/json/BackupJsonFragment.kt +++ b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/json/BackupJsonFragment.kt @@ -38,7 +38,11 @@ import android.view.View import android.view.ViewGroup import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.foundation.ScrollState +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.livedata.observeAsState +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier import androidx.fragment.app.viewModels import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -87,12 +91,17 @@ class BackupJsonFragment : SoraBaseFragment() { route = theOnlyRoute, ) { viewModel.backupJsonScreenState.observeAsState().value?.let { - BackupJsonScreen( - state = it, - onChange = viewModel::passwordInputChanged, - onConfirmChange = viewModel::confirmationInputChanged, - onDownloadClick = viewModel::downloadJsonClicked, - ) + Box( + modifier = Modifier.fillMaxSize(), + contentAlignment = Alignment.TopCenter, + ) { + BackupJsonScreen( + state = it, + onChange = viewModel::passwordInputChanged, + onConfirmChange = viewModel::confirmationInputChanged, + onDownloadClick = viewModel::downloadJsonClicked, + ) + } } } } diff --git a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/json/BackupJsonScreen.kt b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/json/BackupJsonScreen.kt index 3b80ca0f8..25980b771 100644 --- a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/json/BackupJsonScreen.kt +++ b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/backup/json/BackupJsonScreen.kt @@ -74,7 +74,7 @@ internal fun BackupJsonScreen( onDownloadClick: () -> Unit, ) { ContentCard( - modifier = Modifier.padding(horizontal = Dimens.x2), + modifier = Modifier.padding(horizontal = Dimens.x2).fillMaxWidth().wrapContentHeight(), ) { Column( modifier = Modifier diff --git a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/protection/ExportProtectionFragment.kt b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/protection/ExportProtectionFragment.kt index 5bde0bc31..cb518ad74 100644 --- a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/protection/ExportProtectionFragment.kt +++ b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/protection/ExportProtectionFragment.kt @@ -32,9 +32,12 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. package jp.co.soramitsu.feature_multiaccount_impl.presentation.export_account.protection -import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.foundation.ScrollState +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.runtime.livedata.observeAsState +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier import androidx.fragment.app.viewModels import androidx.navigation.NavGraphBuilder import androidx.navigation.NavHostController @@ -64,7 +67,6 @@ class ExportProtectionFragment : SoraBaseFragment() { } } - @OptIn(ExperimentalAnimationApi::class) override fun NavGraphBuilder.content( scrollState: ScrollState, navController: NavHostController @@ -73,11 +75,16 @@ class ExportProtectionFragment : SoraBaseFragment() { route = theOnlyRoute, ) { viewModel.exportProtectionScreenState.observeAsState().value?.let { - ExportProtection( - state = it, - onItemClicked = viewModel::onItemClicked, - continueClicked = viewModel::continueClicked, - ) + Box( + modifier = Modifier.fillMaxSize(), + contentAlignment = Alignment.TopCenter, + ) { + ExportProtection( + state = it, + onItemClicked = viewModel::onItemClicked, + continueClicked = viewModel::continueClicked, + ) + } } } } diff --git a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/protection/ExportProtectionScreen.kt b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/protection/ExportProtectionScreen.kt index 9c8ae5176..17d90b1c4 100644 --- a/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/protection/ExportProtectionScreen.kt +++ b/feature_multiaccount_impl/src/main/java/jp/co/soramitsu/feature_multiaccount_impl/presentation/export_account/protection/ExportProtectionScreen.kt @@ -64,7 +64,7 @@ internal fun ExportProtection( continueClicked: () -> Unit ) { ContentCard( - modifier = Modifier.padding(horizontal = Dimens.x2, vertical = Dimens.x1) + modifier = Modifier.padding(horizontal = Dimens.x2, vertical = Dimens.x1).fillMaxWidth().wrapContentHeight() ) { Column( modifier = Modifier diff --git a/feature_multiaccount_impl/src/main/res/navigation/export_account_nav_graph.xml b/feature_multiaccount_impl/src/main/res/navigation/export_account_nav_graph.xml deleted file mode 100644 index 06e151783..000000000 --- a/feature_multiaccount_impl/src/main/res/navigation/export_account_nav_graph.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - diff --git a/feature_multiaccount_impl/src/test/java/jp/co/soramitsu/feature_multiaccount_impl/domain/MultiaccountInteractorTest.kt b/feature_multiaccount_impl/src/test/java/jp/co/soramitsu/feature_multiaccount_impl/domain/MultiaccountInteractorTest.kt index b593d9c31..c1d439a02 100644 --- a/feature_multiaccount_impl/src/test/java/jp/co/soramitsu/feature_multiaccount_impl/domain/MultiaccountInteractorTest.kt +++ b/feature_multiaccount_impl/src/test/java/jp/co/soramitsu/feature_multiaccount_impl/domain/MultiaccountInteractorTest.kt @@ -45,6 +45,7 @@ import jp.co.soramitsu.feature_account_api.domain.interfaces.CredentialsReposito import jp.co.soramitsu.feature_account_api.domain.interfaces.UserRepository import jp.co.soramitsu.feature_account_api.domain.model.OnboardingState import jp.co.soramitsu.feature_assets_api.domain.AssetsInteractor +import jp.co.soramitsu.feature_wallet_api.domain.interfaces.WalletRepository import jp.co.soramitsu.shared_utils.encrypt.keypair.substrate.Sr25519Keypair import jp.co.soramitsu.sora.substrate.runtime.RuntimeManager import jp.co.soramitsu.test_shared.MainCoroutineRule @@ -68,7 +69,6 @@ class MultiaccountInteractorTest { @get:Rule var mockKRule = MockKRule(this) - private lateinit var multiaccountInteractor: MultiaccountInteractor @MockK @@ -81,7 +81,7 @@ class MultiaccountInteractorTest { lateinit var fileManager: FileManager @MockK - lateinit var assetsInteractor: AssetsInteractor + lateinit var walletRepository: WalletRepository @MockK lateinit var runtimeManager: RuntimeManager @@ -95,7 +95,6 @@ class MultiaccountInteractorTest { coEvery { credentialsRepository.isRawSeedValid(any()) } returns true coEvery { userRepository.insertSoraAccount(any()) } returns Unit coEvery { userRepository.setCurSoraAccount(any()) } returns Unit - coEvery { assetsInteractor.updateWhitelistBalances() } returns Unit coEvery { userRepository.saveRegistrationState(any()) } returns Unit coEvery { credentialsRepository.restoreUserCredentialsFromMnemonic(any(), any()) } returns account coEvery { credentialsRepository.restoreUserCredentialsFromRawSeed(any(), any()) } returns account @@ -104,11 +103,11 @@ class MultiaccountInteractorTest { coEvery { userRepository.updateAccountName(any(), any()) } returns Unit coEvery { fileManager.writeExternalCacheText(any(), any()) } returns uri multiaccountInteractor = MultiaccountInteractor( - assetsInteractor, userRepository, credentialsRepository, fileManager, runtimeManager, + walletRepository ) } diff --git a/feature_sora_card_impl/src/main/java/jp/co/soramitsu/feature_sora_card_impl/presentation/details/SoraCardDetailsScreen.kt b/feature_sora_card_impl/src/main/java/jp/co/soramitsu/feature_sora_card_impl/presentation/details/SoraCardDetailsScreen.kt index d68351f5f..b6aeec99b 100644 --- a/feature_sora_card_impl/src/main/java/jp/co/soramitsu/feature_sora_card_impl/presentation/details/SoraCardDetailsScreen.kt +++ b/feature_sora_card_impl/src/main/java/jp/co/soramitsu/feature_sora_card_impl/presentation/details/SoraCardDetailsScreen.kt @@ -99,6 +99,7 @@ fun SoraCardDetailsScreen( title = stringResource(id = R.string.sora_card_referral_headline), description = "", button = stringResource(id = R.string.sora_card_refer_and_earn_action), + closeEnabled = false, onButtonClicked = onReferralBannerClick, onCloseCard = onCloseReferralBannerClick, ) diff --git a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/BackupCard.kt b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/BackupCard.kt new file mode 100644 index 000000000..69fbabae4 --- /dev/null +++ b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/BackupCard.kt @@ -0,0 +1,62 @@ +/* +This file is part of the SORA network and Polkaswap app. + +Copyright (c) 2020, 2021, Polka Biome Ltd. All rights reserved. +SPDX-License-Identifier: BSD-4-Clause + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list +of conditions and the following disclaimer. +Redistributions in binary form must reproduce the above copyright notice, this +list of conditions and the following disclaimer in the documentation and/or other +materials provided with the distribution. + +All advertising materials mentioning features or use of this software must display +the following acknowledgement: This product includes software developed by Polka Biome +Ltd., SORA, and Polkaswap. + +Neither the name of the Polka Biome Ltd. nor the names of its contributors may be used +to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY Polka Biome Ltd. AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Polka Biome Ltd. BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE +USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +package jp.co.soramitsu.feature_wallet_impl.presentation.cardshub + +import androidx.compose.runtime.Composable +import androidx.compose.ui.res.stringResource +import androidx.compose.ui.tooling.preview.Preview +import jp.co.soramitsu.common.R +import jp.co.soramitsu.common.presentation.compose.components.BasicBannerCard + +@Composable +fun BackupCard( + onStartClicked: () -> Unit, +) { + BasicBannerCard( + imageContent = R.drawable.ic_banner_backup, + title = stringResource(id = R.string.wallet_backup), + description = stringResource(id = R.string.protect_loss_access_funds), + button = stringResource(id = R.string.backup_now), + closeEnabled = false, + onButtonClicked = onStartClicked, + onCloseCard = {}, + ) +} + +@Preview +@Composable +private fun PreviewBackupCard() { + BackupCard( + onStartClicked = {}, + ) +} diff --git a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/BuyXorCard.kt b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/BuyXorCard.kt index 66926b5ce..15daa0795 100644 --- a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/BuyXorCard.kt +++ b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/BuyXorCard.kt @@ -50,6 +50,7 @@ fun BuyXorCard( title = stringResource(id = R.string.buy_crypto_buy_xor_banner_title), description = stringResource(id = R.string.buy_crypto_buy_xor_with_fiat_subtitle), button = stringResource(id = R.string.common_buy_xor), + closeEnabled = true, onButtonClicked = onBuyXorClicked, onCloseCard = onCloseCard, ) diff --git a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/CardsHubFragment.kt b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/CardsHubFragment.kt index ab9a2e68f..23f429afa 100644 --- a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/CardsHubFragment.kt +++ b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/CardsHubFragment.kt @@ -66,6 +66,8 @@ import jp.co.soramitsu.common.base.theOnlyRoute import jp.co.soramitsu.common.domain.BottomBarController import jp.co.soramitsu.common.util.StringPair import jp.co.soramitsu.common_wallet.presentation.compose.components.PoolsList +import jp.co.soramitsu.common_wallet.presentation.compose.states.BackupWalletState +import jp.co.soramitsu.common_wallet.presentation.compose.states.BasicBannerCardState import jp.co.soramitsu.common_wallet.presentation.compose.states.BuyXorState import jp.co.soramitsu.common_wallet.presentation.compose.states.CardsState import jp.co.soramitsu.common_wallet.presentation.compose.states.FavoriteAssetsCardState @@ -129,6 +131,7 @@ class CardsHubFragment : SoraBaseFragment() { onBuyXorClose = viewModel::onRemoveBuyXorToken, onReferralClick = viewModel::onStartReferral, onReferralClose = viewModel::onRemoveReferralCard, + onBackupBannerClick = viewModel::onBackupBannerClick, onEdit = viewModel::onEditViewClick, ) } @@ -150,6 +153,7 @@ private fun CardsMainScreen( onBuyXorClose: () -> Unit, onReferralClick: () -> Unit, onReferralClose: () -> Unit, + onBackupBannerClick: () -> Unit, onEdit: () -> Unit, ) { TopBar( @@ -193,26 +197,33 @@ private fun CardsMainScreen( } } - is SoraCardState -> { - SoraCard( - state = cardState, - onCardStateClicked = onSoraCardClick, - onCloseClicked = onSoraCardClose, - ) - } - - is BuyXorState -> { - BuyXorCard( - onBuyXorClicked = onBuyXorClick, - onCloseCard = onBuyXorClose, - ) - } - - is ReferralState -> { - ReferralCard( - onStartClicked = onReferralClick, - onCloseCard = onReferralClose, - ) + is BasicBannerCardState -> { + when (cardState) { + BackupWalletState -> { + BackupCard( + onStartClicked = onBackupBannerClick, + ) + } + BuyXorState -> { + BuyXorCard( + onBuyXorClicked = onBuyXorClick, + onCloseCard = onBuyXorClose, + ) + } + ReferralState -> { + ReferralCard( + onStartClicked = onReferralClick, + onCloseCard = onReferralClose, + ) + } + is SoraCardState -> { + SoraCard( + state = cardState, + onCardStateClicked = onSoraCardClick, + onCloseClicked = onSoraCardClose, + ) + } + } } } Spacer(modifier = Modifier.size(size = 16.dp)) @@ -239,10 +250,13 @@ private fun PreviewCardsMainScreen() { scrollState = rememberScrollState(), state = CardsState( curAccount = "cnVko", + accountAddress = "", loading = true, - cards = emptyList(), + cards = listOf( + BuyXorState, ReferralState, BackupWalletState, + ), ), - {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, + {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {} ) } } diff --git a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/CardsHubViewModel.kt b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/CardsHubViewModel.kt index 5baa76c07..cd6079ca0 100644 --- a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/CardsHubViewModel.kt +++ b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/CardsHubViewModel.kt @@ -52,6 +52,7 @@ import jp.co.soramitsu.common.util.StringPair import jp.co.soramitsu.common.util.ext.safeCast import jp.co.soramitsu.common_wallet.domain.model.CommonUserPoolData import jp.co.soramitsu.common_wallet.domain.model.fiatSymbol +import jp.co.soramitsu.common_wallet.presentation.compose.states.BackupWalletState import jp.co.soramitsu.common_wallet.presentation.compose.states.BuyXorState import jp.co.soramitsu.common_wallet.presentation.compose.states.CardState import jp.co.soramitsu.common_wallet.presentation.compose.states.CardsState @@ -115,6 +116,7 @@ class CardsHubViewModel @Inject constructor( loading = true, cards = emptyList(), curAccount = "", + accountAddress = "", ) ) val state = _state.asStateFlow() @@ -137,6 +139,7 @@ class CardsHubViewModel @Inject constructor( .distinctUntilChanged() .flatMapLatest { data -> _state.value = _state.value.copy( + accountAddress = data.first.substrateAddress, curAccount = data.first.accountTitle(), loading = false, ) @@ -167,7 +170,6 @@ class CardsHubViewModel @Inject constructor( .map { status -> val mapped = mapKycStatus(status) cardHub to SoraCardState( - visible = cardHub.visibility, kycStatus = mapped.first, loading = false, success = mapped.second, @@ -179,7 +181,6 @@ class CardsHubViewModel @Inject constructor( cardHub to SoraCardState( success = false, kycStatus = null, - visible = cardHub.visibility, loading = true, ibanBalance = null, ) @@ -189,19 +190,17 @@ class CardsHubViewModel @Inject constructor( CardHubType.REFERRAL_SYSTEM -> { flowOf( - cardHub to ReferralState( - visible = cardHub.visibility, - loading = false, - ) + cardHub to ReferralState ) } + CardHubType.BACKUP -> { + flowOf(cardHub to BackupWalletState) + } + CardHubType.BUY_XOR_TOKEN -> { flowOf( - cardHub to BuyXorState( - visible = cardHub.visibility, - loading = false, - ) + cardHub to BuyXorState ) } } @@ -307,6 +306,7 @@ class CardsHubViewModel @Inject constructor( it.second as List ) + CardHubType.BACKUP -> (it.second as BackupWalletState) CardHubType.GET_SORA_CARD -> (it.second as SoraCardState) CardHubType.BUY_XOR_TOKEN -> (it.second as BuyXorState) CardHubType.REFERRAL_SYSTEM -> (it.second as ReferralState) @@ -404,6 +404,10 @@ class CardsHubViewModel @Inject constructor( referralRouter.showReferrals() } + fun onBackupBannerClick() { + mainRouter.showAccountDetails(_state.value.accountAddress) + } + fun onBuyCrypto() { if (!connectionManager.isConnected) return assetsRouter.showBuyCrypto() diff --git a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/ReferralCard.kt b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/ReferralCard.kt index 1a8acad62..0eecd506f 100644 --- a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/ReferralCard.kt +++ b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/ReferralCard.kt @@ -48,6 +48,7 @@ fun ReferralCard( title = stringResource(id = R.string.settings_invite_title), description = stringResource(id = R.string.referral_title), button = stringResource(id = R.string.referral_start_inviting), + closeEnabled = true, onButtonClicked = onStartClicked, onCloseCard = onCloseCard, ) diff --git a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/SoraCard.kt b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/SoraCard.kt index 0b1b3707b..4238cce04 100644 --- a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/SoraCard.kt +++ b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/cardshub/SoraCard.kt @@ -176,7 +176,6 @@ private fun PreviewSoraCard1() { kycStatus = "", // ibanBalance = "${euroSign}345.3", ibanBalance = null, - visible = true, loading = false, success = true, ), @@ -194,7 +193,6 @@ private fun PreviewSoraCard2() { state = SoraCardState( kycStatus = "Pending", ibanBalance = null, - visible = true, loading = false, success = false, ), @@ -213,7 +211,6 @@ private fun PreviewSoraCard3() { state = SoraCardState( kycStatus = null, ibanBalance = null, - visible = true, loading = false, success = false, ), @@ -232,7 +229,6 @@ private fun PreviewSoraCard4() { state = SoraCardState( kycStatus = null, ibanBalance = null, - visible = true, loading = true, success = false, ), diff --git a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/editcardshub/EditCardsHubScreen.kt b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/editcardshub/EditCardsHubScreen.kt index 1a70592b9..6f50d17e3 100644 --- a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/editcardshub/EditCardsHubScreen.kt +++ b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/editcardshub/EditCardsHubScreen.kt @@ -64,6 +64,7 @@ enum class HubCardVisibility { VISIBLE_AND_ENABLED, VISIBLE_AND_DISABLED, NOT_VISIBLE_ENABLED, + NOT_VISIBLE_DISABLED, } class HubCardState( @@ -77,6 +78,7 @@ class HubCardState( HubCardVisibility.VISIBLE_AND_ENABLED, HubCardVisibility.VISIBLE_AND_DISABLED -> R.drawable.ic_selected_accent_pin_24 + HubCardVisibility.NOT_VISIBLE_DISABLED, HubCardVisibility.NOT_VISIBLE_ENABLED -> R.drawable.ic_selected_pin_empty_24 } @@ -85,6 +87,7 @@ class HubCardState( HubCardVisibility.VISIBLE_AND_ENABLED, HubCardVisibility.NOT_VISIBLE_ENABLED -> 1f + HubCardVisibility.NOT_VISIBLE_DISABLED, HubCardVisibility.VISIBLE_AND_DISABLED -> .3f } @@ -93,6 +96,7 @@ class HubCardState( HubCardVisibility.VISIBLE_AND_ENABLED, HubCardVisibility.NOT_VISIBLE_ENABLED -> true + HubCardVisibility.NOT_VISIBLE_DISABLED, HubCardVisibility.VISIBLE_AND_DISABLED -> false } } diff --git a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/editcardshub/EditCardsHubViewModel.kt b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/editcardshub/EditCardsHubViewModel.kt index d27096c81..4c36fbb1b 100644 --- a/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/editcardshub/EditCardsHubViewModel.kt +++ b/feature_wallet_impl/src/main/java/jp/co/soramitsu/feature_wallet_impl/presentation/editcardshub/EditCardsHubViewModel.kt @@ -84,6 +84,7 @@ class EditCardsHubViewModel @Inject constructor( CardHubType.GET_SORA_CARD -> if (isVisible) HubCardVisibility.VISIBLE_AND_ENABLED else HubCardVisibility.NOT_VISIBLE_ENABLED CardHubType.BUY_XOR_TOKEN -> if (isVisible) HubCardVisibility.VISIBLE_AND_ENABLED else HubCardVisibility.NOT_VISIBLE_ENABLED CardHubType.REFERRAL_SYSTEM -> if (isVisible) HubCardVisibility.VISIBLE_AND_ENABLED else HubCardVisibility.NOT_VISIBLE_ENABLED + CardHubType.BACKUP -> if (isVisible) HubCardVisibility.VISIBLE_AND_DISABLED else HubCardVisibility.NOT_VISIBLE_DISABLED } init {