diff --git a/litewallet.xcodeproj/project.pbxproj b/litewallet.xcodeproj/project.pbxproj index f8e100b5b..d5b1f97b3 100644 --- a/litewallet.xcodeproj/project.pbxproj +++ b/litewallet.xcodeproj/project.pbxproj @@ -256,7 +256,6 @@ C3423C242B7904B80051BD6D /* SeedWordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3423C232B7904B80051BD6D /* SeedWordView.swift */; }; C3423C262B7904E30051BD6D /* AnnounceUpdatesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3423C252B7904E30051BD6D /* AnnounceUpdatesView.swift */; }; C3423C2A2B7905330051BD6D /* SafariServices+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3423C272B7905330051BD6D /* SafariServices+Extension.swift */; }; - C3423C2B2B7905330051BD6D /* SignupWebViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3423C282B7905330051BD6D /* SignupWebViewModel.swift */; }; C3423C2C2B7905330051BD6D /* SignupWebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3423C292B7905330051BD6D /* SignupWebView.swift */; }; C3423C3E2B796D820051BD6D /* 日本語.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C3423C302B796D820051BD6D /* 日本語.mp3 */; settings = {ASSET_TAGS = (speakTag, ); }; }; C3423C3F2B796D820051BD6D /* Pt.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C3423C312B796D820051BD6D /* Pt.mp3 */; settings = {ASSET_TAGS = (speakTag, ); }; }; @@ -298,6 +297,9 @@ C3C8973825CD6B9300241FBE /* HostingTransactionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3C8973725CD6B9300241FBE /* HostingTransactionCell.swift */; }; C3D4379F2566EA3E00F423E1 /* LWActivityIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3D4379E2566EA3E00F423E1 /* LWActivityIndicator.swift */; }; C3DBBE312BFE15AF00B95939 /* BuyTileView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3DBBE302BFE15AF00B95939 /* BuyTileView.swift */; }; + C3E587AF2CFC7CB4000592D8 /* SeedWordsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E587AE2CFC7CB4000592D8 /* SeedWordsTests.swift */; }; + C3E587B22CFC81A3000592D8 /* SeedWordContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E587B12CFC81A3000592D8 /* SeedWordContainerView.swift */; }; + C3E587B42CFC84B5000592D8 /* SeedViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E587B32CFC84B5000592D8 /* SeedViewModel.swift */; }; C3E5A9052BFDEEF1002FBE04 /* BuyViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E5A9042BFDEEF1002FBE04 /* BuyViewModel.swift */; }; C3E751C22AF689BA005571CA /* BRKeyExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E751C12AF689BA005571CA /* BRKeyExtension.swift */; }; C3E751C42AF68A50005571CA /* BRAddressExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3E751C32AF68A50005571CA /* BRAddressExtension.swift */; }; @@ -1404,7 +1406,6 @@ C3423C232B7904B80051BD6D /* SeedWordView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SeedWordView.swift; sourceTree = ""; }; C3423C252B7904E30051BD6D /* AnnounceUpdatesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnnounceUpdatesView.swift; sourceTree = ""; }; C3423C272B7905330051BD6D /* SafariServices+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = "SafariServices+Extension.swift"; path = "Extensions/SafariServices+Extension.swift"; sourceTree = ""; }; - C3423C282B7905330051BD6D /* SignupWebViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignupWebViewModel.swift; sourceTree = ""; }; C3423C292B7905330051BD6D /* SignupWebView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SignupWebView.swift; sourceTree = ""; }; C3423C302B796D820051BD6D /* 日本語.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "日本語.mp3"; sourceTree = ""; }; C3423C312B796D820051BD6D /* Pt.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = Pt.mp3; sourceTree = ""; }; @@ -1450,6 +1451,9 @@ C3C8973725CD6B9300241FBE /* HostingTransactionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HostingTransactionCell.swift; sourceTree = ""; }; C3D4379E2566EA3E00F423E1 /* LWActivityIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LWActivityIndicator.swift; sourceTree = ""; }; C3DBBE302BFE15AF00B95939 /* BuyTileView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BuyTileView.swift; sourceTree = ""; }; + C3E587AE2CFC7CB4000592D8 /* SeedWordsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeedWordsTests.swift; sourceTree = ""; }; + C3E587B12CFC81A3000592D8 /* SeedWordContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeedWordContainerView.swift; sourceTree = ""; }; + C3E587B32CFC84B5000592D8 /* SeedViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SeedViewModel.swift; sourceTree = ""; }; C3E5A9042BFDEEF1002FBE04 /* BuyViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BuyViewModel.swift; sourceTree = ""; }; C3E751C12AF689BA005571CA /* BRKeyExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRKeyExtension.swift; sourceTree = ""; }; C3E751C32AF68A50005571CA /* BRAddressExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BRAddressExtension.swift; sourceTree = ""; }; @@ -2079,6 +2083,7 @@ 2465873723A5AAD100A32E9E /* litewalletTests */ = { isa = PBXGroup; children = ( + C3E587AD2CFC7C69000592D8 /* Seed Word Tests */, 584E24FF2951DA97005E0E8B /* Language Selection Tests */, C3EFA9A42651A7C4005C59B5 /* Lock Screen Tests */, C3B7C3EC255FF56100E98A64 /* Constants Tests */, @@ -3027,12 +3032,11 @@ C35ABD07257404C6002BB9BB /* SwiftUI+UIKit */ = { isa = PBXGroup; children = ( + C3E587B02CFC817D000592D8 /* ShowSeed */, C3B419C92BFCF0C900EBD935 /* Buy */, C3423C272B7905330051BD6D /* SafariServices+Extension.swift */, C3423C292B7905330051BD6D /* SignupWebView.swift */, - C3423C282B7905330051BD6D /* SignupWebViewModel.swift */, C3423C252B7904E30051BD6D /* AnnounceUpdatesView.swift */, - C3423C232B7904B80051BD6D /* SeedWordView.swift */, C3423C1D2B7904070051BD6D /* StartHostingController.swift */, C3423C212B79047D0051BD6D /* StartViewModel.swift */, C3423C1F2B79046A0051BD6D /* StartView.swift */, @@ -3096,6 +3100,24 @@ path = "Constants Tests"; sourceTree = ""; }; + C3E587AD2CFC7C69000592D8 /* Seed Word Tests */ = { + isa = PBXGroup; + children = ( + C3E587AE2CFC7CB4000592D8 /* SeedWordsTests.swift */, + ); + path = "Seed Word Tests"; + sourceTree = ""; + }; + C3E587B02CFC817D000592D8 /* ShowSeed */ = { + isa = PBXGroup; + children = ( + C3423C232B7904B80051BD6D /* SeedWordView.swift */, + C3E587B12CFC81A3000592D8 /* SeedWordContainerView.swift */, + C3E587B32CFC84B5000592D8 /* SeedViewModel.swift */, + ); + name = ShowSeed; + sourceTree = ""; + }; C3E751C02AF689A0005571CA /* BRExtensions */ = { isa = PBXGroup; children = ( @@ -3883,6 +3905,7 @@ 2494037623AD35C000369261 /* BuyWKWebVCTests.swift in Sources */, 24470E3223A5F5B100ADDA27 /* NSDataExtensionTests.swift in Sources */, 24470E2C23A5F43B00ADDA27 /* DefaultFiatCurrencyTests.swift in Sources */, + C3E587AF2CFC7CB4000592D8 /* SeedWordsTests.swift in Sources */, C3EFA9A62651A808005C59B5 /* LockScreenTests.swift in Sources */, 24470E4023A6004800ADDA27 /* WalletCreationTests.swift in Sources */, 24470E3823A5FEF200ADDA27 /* SpendingLimitTests.swift in Sources */, @@ -4084,6 +4107,7 @@ 1B3F74241FFB106200CCA50C /* BiometricsSpendingLimitViewController.swift in Sources */, CEC6F8451E886723000795B8 /* PaymentRequest.swift in Sources */, C3FF4D6128AC5AC100713139 /* SendAddressCellViewModel.swift in Sources */, + C3E587B42CFC84B5000592D8 /* SeedViewModel.swift in Sources */, CE4C1CC81ED88B600063E184 /* URLController.swift in Sources */, C3DBBE312BFE15AF00B95939 /* BuyTileView.swift in Sources */, C30029EB25D019BC00F08C2B /* CopyButtonView.swift in Sources */, @@ -4150,7 +4174,6 @@ CEC6AA421DEFC88F00EE5AFD /* ReceiveViewController.swift in Sources */, CEE20C2D1EA288FA0086F724 /* UpdatingLabel.swift in Sources */, CE3D4C591EF743EF0016B1C8 /* Functions.swift in Sources */, - C3423C2B2B7905330051BD6D /* SignupWebViewModel.swift in Sources */, CEE20C341EA5B4550086F724 /* ArticleIds.swift in Sources */, CEE65DF01E39056F0002994D /* Rate.swift in Sources */, CEE20C361EA5B4620086F724 /* Constants+Events.swift in Sources */, @@ -4186,6 +4209,7 @@ 22A9A94B1DF61945000F0016 /* BRCoding.swift in Sources */, CEF3E8361DE60222007C0A9E /* ModalNavigationController.swift in Sources */, CEB909FA1E5FF242001804DC /* RecoverWalletIntroViewController.swift in Sources */, + C3E587B22CFC81A3000592D8 /* SeedWordContainerView.swift in Sources */, CE25BF911DF9ADE700BC67B6 /* UIImage+Utils.swift in Sources */, CEBF33041DDE17A600348FC6 /* Transaction.swift in Sources */, CEAA9E911DC0FDFE0066731D /* UIViewPropertyAnimator+BRWAdditions.swift in Sources */, diff --git a/litewallet/Assets.xcassets/Branding/launchLiteWalletImage.imageset/Contents.json b/litewallet/Assets.xcassets/Branding/launchLiteWalletImage.imageset/Contents.json deleted file mode 100644 index d71802c43..000000000 --- a/litewallet/Assets.xcassets/Branding/launchLiteWalletImage.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "litewalletLaunchLogo.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/litewallet/Assets.xcassets/Branding/launchLiteWalletImage.imageset/litewalletLaunchLogo.png b/litewallet/Assets.xcassets/Branding/launchLiteWalletImage.imageset/litewalletLaunchLogo.png deleted file mode 100644 index 67458df7f..000000000 Binary files a/litewallet/Assets.xcassets/Branding/launchLiteWalletImage.imageset/litewalletLaunchLogo.png and /dev/null differ diff --git a/litewallet/Assets.xcassets/Branding/litecoinFoundationLogo.imageset/Contents.json b/litewallet/Assets.xcassets/Branding/litecoinFoundationLogo.imageset/Contents.json deleted file mode 100644 index 038931264..000000000 --- a/litewallet/Assets.xcassets/Branding/litecoinFoundationLogo.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "filename" : "lfLaunchLogo.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/litewallet/Assets.xcassets/Branding/litecoinFoundationLogo.imageset/lfLaunchLogo.png b/litewallet/Assets.xcassets/Branding/litecoinFoundationLogo.imageset/lfLaunchLogo.png deleted file mode 100644 index 36264e780..000000000 Binary files a/litewallet/Assets.xcassets/Branding/litecoinFoundationLogo.imageset/lfLaunchLogo.png and /dev/null differ diff --git a/litewallet/BartyCrouch.swift b/litewallet/BartyCrouch.swift index af4fa82ad..2adbfb83d 100644 --- a/litewallet/BartyCrouch.swift +++ b/litewallet/BartyCrouch.swift @@ -2,7 +2,13 @@ import Foundation enum BartyCrouch { enum SupportedLanguage: String { - // TODO: remove unsupported languages from the following cases list & add any missing languages + /* NOTE: remove unsupported languages from the following cases list & add any missing languages + When adding more localizations: + 1. Copy the new label here in from the Strings.swift file + 2. Include the English version + 3. Go to a translator and add the localization within the Localizable file + 4. Test + */ case chineseSimplified = "zh-Hans" case chineseTraditional = "zh-Hant" case english = "en" diff --git a/litewallet/Base.lproj/LaunchScreen.storyboard b/litewallet/Base.lproj/LaunchScreen.storyboard index b099ec32e..a1d132cd2 100644 --- a/litewallet/Base.lproj/LaunchScreen.storyboard +++ b/litewallet/Base.lproj/LaunchScreen.storyboard @@ -20,28 +20,18 @@ - + - - - - - - - - - - + + - - - - + + @@ -52,7 +42,6 @@ - diff --git a/litewallet/Constants/Strings.swift b/litewallet/Constants/Strings.swift index 019eae46e..22ab5baf6 100644 --- a/litewallet/Constants/Strings.swift +++ b/litewallet/Constants/Strings.swift @@ -386,6 +386,7 @@ enum S { static let litewalletPartners = Localization(key: "Settings.litewallet.partners", value: "Litewallet Partners:", comment: "Litewallet Partners") static let currentLocale = Localization(key: "Settings.currentLocale", value: "Current Locale:", comment: "Current Locale") static let changeLanguageMessage = Localization(key: "Settings.ChangeLanguage.alertMessage", value: nil, comment: nil) + static let showSeed = Localization(key: "Settings.ShowSeed", value: "Show Seed", comment: "Show Seed") } enum About { @@ -705,10 +706,16 @@ enum S { static let body = Localization(key: "Welcome.body", value: "Litewallet now has a brand new look and some new features.\n\nAll coins are displayed in lites (ł). 1 Litecoin (Ł) = 1000 lites (ł).", comment: "Welcome view body text") } + enum ShowWords { + static let modalTitle = Localization(key: "ShowWords.modalTitle", value: "Show seed phrase", comment: "ShowWords.modalTitle") + static let titleWarning = Localization(key: "ShowWords.titleWarning", value: "These are your seed words. If you show them to anyone, they can take your Litecoin", comment: "ShowWords.titleWarning") + } + enum Fragments { static let or = Localization(key: "Fragment.or", value: "or", comment: "Or") static let confirm = Localization(key: "Fragment.confirm", value: "confirm", comment: "Confirm") static let to = Localization(key: "Fragment.to", value: "to", comment: "to") static let sorry = Localization(key: "Fragment.sorry", value: "sorry", comment: "sorry") + static let back = Localization(key: "Fragment.back", value: "Back", comment: "Back") } } diff --git a/litewallet/MainViewController.swift b/litewallet/MainViewController.swift index 2b9d5f1e3..78a3baae1 100644 --- a/litewallet/MainViewController.swift +++ b/litewallet/MainViewController.swift @@ -66,16 +66,14 @@ class MainViewController: UIViewController, Subscriber, LoginViewControllerDeleg NotificationCenter.default.addObserver(forName: UIApplication.willEnterForegroundNotification, object: nil, - queue: nil) - { _ in + queue: nil) { _ in self.showJailbreakWarnings(isJailbroken: isJailbroken) } } NotificationCenter.default.addObserver(forName: UserDefaults.didChangeNotification, object: nil, - queue: nil) - { _ in + queue: nil) { _ in if UserDefaults.writePaperPhraseDate != nil {} } diff --git a/litewallet/ModalPresenter.swift b/litewallet/ModalPresenter.swift index 8a6ef7f5f..3b565f3cb 100644 --- a/litewallet/ModalPresenter.swift +++ b/litewallet/ModalPresenter.swift @@ -357,6 +357,7 @@ class ModalPresenter: Subscriber, Trackable { guard let walletManager = walletManager else { return } let settingsNav = UINavigationController() let sections = ["About", "Wallet", "Manage", "Support", "Blockchain"] + let rows = [ "About": [Setting(title: S.Settings.litewalletVersion.localize(), accessoryText: { AppVersion.string @@ -377,41 +378,53 @@ class ModalPresenter: Subscriber, Trackable { }), ], - "Wallet": [Setting(title: S.Settings.importTile.localize(), callback: { [weak self] in - guard let myself = self else { return } - guard let walletManager = myself.walletManager else { return } - let importNav = ModalNavigationController() - importNav.setClearNavbar() - importNav.setWhiteStyle() - let start = StartImportViewController(walletManager: walletManager, store: myself.store) - start.addCloseNavigationItem(tintColor: .white) - start.navigationItem.title = S.Import.title.localize() - importNav.viewControllers = [start] - settingsNav.dismiss(animated: true, completion: { - myself.topViewController?.present(importNav, animated: true, completion: nil) - }) - }), - Setting(title: S.Settings.wipe.localize(), callback: { [weak self] in - guard let myself = self else { return } - guard let walletManager = myself.walletManager else { return } - let nc = ModalNavigationController() - nc.setClearNavbar() - nc.setWhiteStyle() - nc.delegate = myself.wipeNavigationDelegate - let start = StartWipeWalletViewController { - let recover = EnterPhraseViewController(store: myself.store, walletManager: walletManager, reason: .validateForWipingWallet { - myself.wipeWallet() - }) - nc.pushViewController(recover, animated: true) - } - start.addCloseNavigationItem(tintColor: .white) - start.navigationItem.title = S.WipeWallet.title.localize() - nc.viewControllers = [start] - settingsNav.dismiss(animated: true, completion: { - myself.topViewController?.present(nc, animated: true, completion: nil) - }) - }), - ], + "Wallet": + [ + Setting(title: S.Settings.importTile.localize(), callback: { [weak self] in + guard let myself = self else { return } + guard let walletManager = myself.walletManager else { return } + let importNav = ModalNavigationController() + importNav.setClearNavbar() + importNav.setWhiteStyle() + let start = StartImportViewController(walletManager: walletManager, store: myself.store) + start.addCloseNavigationItem(tintColor: .white) + start.navigationItem.title = S.Import.title.localize() + importNav.viewControllers = [start] + settingsNav.dismiss(animated: true, completion: { + myself.topViewController?.present(importNav, animated: true, completion: nil) + }) + }), + Setting(title: S.Settings.wipe.localize(), callback: { [weak self] in + guard let myself = self else { return } + guard let walletManager = myself.walletManager else { return } + let nc = ModalNavigationController() + nc.setClearNavbar() + nc.setWhiteStyle() + nc.delegate = myself.wipeNavigationDelegate + let start = StartWipeWalletViewController { + let recover = EnterPhraseViewController(store: myself.store, walletManager: walletManager, reason: .validateForWipingWallet { + myself.wipeWallet() + }) + nc.pushViewController(recover, animated: true) + } + start.addCloseNavigationItem(tintColor: .white) + start.navigationItem.title = S.WipeWallet.title.localize() + nc.viewControllers = [start] + settingsNav.dismiss(animated: true, completion: { + myself.topViewController?.present(nc, animated: true, completion: nil) + }) + }), + Setting(title: S.ShowWords.modalTitle.localize(), callback: { [weak self] in + + guard let myself = self else { return } + guard let walletManager = myself.walletManager else { return } + + let showSeedsView = UIHostingController(rootView: + SeedWordContainerView(walletManager: walletManager)) + settingsNav.pushViewController(showSeedsView, animated: true) + + }), + ], "Manage": [ Setting(title: S.Settings.languages.localize(), callback: strongify(self) { _ in settingsNav.pushViewController(LanguageSelectionViewController(), animated: true) diff --git a/litewallet/SeedViewModel.swift b/litewallet/SeedViewModel.swift new file mode 100644 index 000000000..94fb0eda0 --- /dev/null +++ b/litewallet/SeedViewModel.swift @@ -0,0 +1,44 @@ +import Foundation + +import AVFoundation +import Foundation +import SwiftUI +import UIKit + +class SeedViewModel: ObservableObject { + // MARK: - Combine Variables + + @Published + var seedWords: [SeedWord] = [SeedWord(word: "banana", tagNumber: 0), + SeedWord(word: "banana", tagNumber: 1), + SeedWord(word: "banana", tagNumber: 2), + SeedWord(word: "banana", tagNumber: 3), + SeedWord(word: "banana", tagNumber: 4), + SeedWord(word: "banana", tagNumber: 5), + SeedWord(word: "banana", tagNumber: 6), + SeedWord(word: "banana", tagNumber: 7), + SeedWord(word: "banana", tagNumber: 8), + SeedWord(word: "banana", tagNumber: 9), + SeedWord(word: "banana", tagNumber: 10), + SeedWord(word: "banana", tagNumber: 11)] + + @Binding + var enteredPIN: String + + init(enteredPIN: Binding) { + _enteredPIN = enteredPIN + } + + func fetchWords(walletManager: WalletManager, appPIN: String) -> [SeedWord]? { + if let words = walletManager.seedPhrase(pin: appPIN) { + let wordArray = words.components(separatedBy: " ") + seedWords.removeAll() + + for (index, word) in wordArray.enumerated() { + seedWords.append(SeedWord(word: "\(word)", tagNumber: index + 1)) + } + return seedWords + } + return nil + } +} diff --git a/litewallet/SeedWordContainerView.swift b/litewallet/SeedWordContainerView.swift new file mode 100644 index 000000000..de0e835b8 --- /dev/null +++ b/litewallet/SeedWordContainerView.swift @@ -0,0 +1,105 @@ +import SwiftUI + +struct SeedWordContainerView: View { + let generalPad: CGFloat = 10.0 + let largePad: CGFloat = 80.0 + + let wordPad: CGFloat = 10.0 + + let secureFieldHeight: CGFloat = 45.0 + + let seedWordCount: Int = 12 + + @State + private var viewColumns = [GridItem]() + + @State + private var wordViewWidthRoot = 3 + + @State + private var enteredPIN = "" + + @State + private var shouldShowSeedWords = false + + @State + private var didEnterPINCode = false + + @ObservedObject + var seedViewModel = SeedViewModel(enteredPIN: .constant("")) + + var walletManager: WalletManager + + init(walletManager: WalletManager) { + self.walletManager = walletManager + } + + var body: some View { + GeometryReader { geometry in + + let width = geometry.size.width + let height = geometry.size.height + let wordViewWidth = width / CGFloat(wordViewWidthRoot) - wordPad + ZStack { + VStack { + HStack { + Text(S.ShowWords.titleWarning.localize()) + .font(.barlowSemiBold(size: 24.0)) + .multilineTextAlignment(.center) + .foregroundColor(.litewalletDarkBlue) + .padding() + } + .padding() + Spacer() + if shouldShowSeedWords { + LazyVGrid(columns: viewColumns, spacing: 1.0) { + ForEach(0 ..< seedWordCount, id: \.self) { increment in + SeedWordView(seedWord: seedViewModel.seedWords[increment].word, + wordNumber: seedViewModel.seedWords[increment].tagNumber) + .frame(width: wordViewWidth, + height: height * 0.1) + } + } + Spacer() + } else { + HStack { + SecureField(S.UpdatePin.enterCurrent.localize(), + text: $enteredPIN) + .keyboardType(.numberPad) + .multilineTextAlignment(.center) + .toolbar { + ToolbarItemGroup(placement: .keyboard) { + Spacer() + Button(S.RecoverWallet.done.localize()) { + didEnterPINCode.toggle() + } + } + } + .frame(width: width - largePad, + height: secureFieldHeight, alignment: .center) + .padding() + } + } + Spacer() + } + } + .padding(.all, 10) + .onAppear { + viewColumns = [GridItem](repeating: GridItem(.flexible()), + count: wordViewWidthRoot) + } + .onChange(of: didEnterPINCode) { _ in + if let fetchedWords = seedViewModel.fetchWords(walletManager: self.walletManager, + appPIN: enteredPIN) + { + seedViewModel.seedWords = fetchedWords + shouldShowSeedWords = true + } + } + } + } +} + +// #Preview { +// SeedWordContainerView(walletManager: WalletManager(store: Store())) +// } diff --git a/litewallet/SeedWordView.swift b/litewallet/SeedWordView.swift index be3c17e0a..1eb409355 100644 --- a/litewallet/SeedWordView.swift +++ b/litewallet/SeedWordView.swift @@ -4,33 +4,58 @@ import SwiftUI struct SeedWord: Identifiable { let id = UUID() let word: String + let tagNumber: Int } struct SeedWordView: View { - let seedWord: SeedWord + let seedWord: String + let wordNumber: Int + let genericPad = 55.0 + let cellHeight = 45.0 + let offsetPad = 15.0 + let topPad = -11.0 var body: some View { - GeometryReader { _ in + GeometryReader { geometry in + let width = geometry.size.width + let height = geometry.size.height ZStack { VStack { ZStack { RoundedRectangle(cornerRadius: bigButtonCornerRadius) - .frame(height: 45, alignment: .center) - .foregroundColor(.red) + .frame(height: cellHeight, alignment: .center) + .foregroundColor(.litecoinSilver) .shadow(radius: 3, x: 3.0, y: 3.0) - Text(seedWord.word) - .frame(height: 45, alignment: .center) + Text(seedWord) + .frame(height: cellHeight, alignment: .center) .font(.barlowSemiBold(size: 16.0)) .foregroundColor(.black) + + VStack { + HStack { + Text("\(wordNumber)") + .font(.barlowSemiBold(size: 14.0)) + .foregroundColor(.litecoinDarkSilver) + .frame(width: genericPad, + height: cellHeight, + alignment: .leading) + .offset(x: offsetPad, + y: topPad) + Spacer() + } + } } } + .frame(width: width, height: height) + .padding(.all, genericPad) } + .frame(width: width, height: height) } } } -#Preview { - SeedWordView(seedWord: SeedWord(word: "banana")) -} +// #Preview { +// SeedWordView(seedWord: SeedWord(word: "banana"), wordNumber: 1) +// } diff --git a/litewallet/StartView.swift b/litewallet/StartView.swift index 2c85254a0..3525f5cb8 100644 --- a/litewallet/StartView.swift +++ b/litewallet/StartView.swift @@ -118,23 +118,20 @@ struct StartView: View { alignment: .center) .alert(startViewModel .alertMessage[startViewModel.currentLanguage.rawValue], - isPresented: $delayedSelect) - { - HStack { - Button(startViewModel - .yesLabel[startViewModel.currentLanguage.rawValue], role: .cancel) - { - // Changes and Dismisses - startViewModel.setLanguage(code: startViewModel.currentLanguage.code) - selectedLang = false + isPresented: $delayedSelect) { + HStack { + Button(startViewModel + .yesLabel[startViewModel.currentLanguage.rawValue], role: .cancel) { + // Changes and Dismisses + startViewModel.setLanguage(code: startViewModel.currentLanguage.code) + selectedLang = false + } + Button(startViewModel + .cancelLabel[startViewModel.currentLanguage.rawValue], role: .destructive) { + // Dismisses + selectedLang = false + } } - Button(startViewModel - .cancelLabel[startViewModel.currentLanguage.rawValue], role: .destructive) - { - // Dismisses - selectedLang = false - } - } } Spacer() NavigationLink(destination: diff --git a/litewallet/StartViewModel.swift b/litewallet/StartViewModel.swift index c45a68524..1c379d877 100644 --- a/litewallet/StartViewModel.swift +++ b/litewallet/StartViewModel.swift @@ -15,12 +15,6 @@ class StartViewModel: ObservableObject { @Published var walletCreationDidFail: Bool = false - @Published - var seedWords: [SeedWord] = [SeedWord(word: "indicate"), SeedWord(word: "material"), SeedWord(word: "property"), - SeedWord(word: "banana"), SeedWord(word: "tuition"), SeedWord(word: "lemon"), - SeedWord(word: "banana"), SeedWord(word: "tuition"), SeedWord(word: "lemon"), - SeedWord(word: "banana"), SeedWord(word: "tuition"), SeedWord(word: "surround")] - @Published var pinDigits = "" diff --git a/litewallet/Storyboards/Animate.storyboard b/litewallet/Storyboards/Animate.storyboard index 5f491d00c..c1e4a194d 100644 --- a/litewallet/Storyboards/Animate.storyboard +++ b/litewallet/Storyboards/Animate.storyboard @@ -1,22 +1,17 @@ - + - + - - - BarlowSemiCondensed-Light - - - + @@ -24,54 +19,13 @@ - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - diff --git a/litewallet/Strings/Base.lproj/Localizable.strings b/litewallet/Strings/Base.lproj/Localizable.strings index 385d568fb..507daa180 100644 --- a/litewallet/Strings/Base.lproj/Localizable.strings +++ b/litewallet/Strings/Base.lproj/Localizable.strings @@ -1461,3 +1461,9 @@ /* "Language preference label" */ "Notifications.languagePreference" = "Preferred language:"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "These are your seed words. If you show them to anyone, they can take your Litecoin"; + +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "Show seed phrase"; diff --git a/litewallet/Strings/da.lproj/Localizable.strings b/litewallet/Strings/da.lproj/Localizable.strings index 2c191a0d9..0e1602eb8 100755 --- a/litewallet/Strings/da.lproj/Localizable.strings +++ b/litewallet/Strings/da.lproj/Localizable.strings @@ -1246,6 +1246,9 @@ /* 1 of 3 */ "WritePaperPhrase.step" = "%1$d af %2$d"; +/* "Fragment.back" */ +"Fragment.back" = ""; + /* "Email address label" */ "Notifications.emailLabel" = ""; @@ -1288,5 +1291,11 @@ /* Change language alert message */ "Settings.ChangeLanguage.alertMessage" = ""; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = ""; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = ""; + /* Start view tagline */ "StartViewController.tagline" = ""; diff --git a/litewallet/Strings/de.lproj/Localizable.strings b/litewallet/Strings/de.lproj/Localizable.strings index ac9b82526..2740dc3e0 100755 --- a/litewallet/Strings/de.lproj/Localizable.strings +++ b/litewallet/Strings/de.lproj/Localizable.strings @@ -274,6 +274,9 @@ /* Fee Selector title */ "FeeSelector.title" = "Verarbeitungsgeschwindigkeit"; +/* "Fragment.back" */ +"Fragment.back" = "Zurückkehren"; + /* Confirm */ "Fragment.confirm" = "Bestätigen Sie"; @@ -910,6 +913,12 @@ /* Share data switch label. */ "ShareData.toggleLabel" = "Anonyme Nutzungsdaten übermitteln?"; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "Seed-Phrase anzeigen"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "Dies sind Ihre Seed-Wörter. Wenn Sie sie jemandem zeigen, kann dieser Ihre Litecoin nehmen"; + /* Current spending limit: */ "SpendingLimit.title" = "Aktuelles Ausgabenlimit:"; diff --git a/litewallet/Strings/en.lproj/Localizable.strings b/litewallet/Strings/en.lproj/Localizable.strings index a16a32788..5c5af6e27 100644 --- a/litewallet/Strings/en.lproj/Localizable.strings +++ b/litewallet/Strings/en.lproj/Localizable.strings @@ -274,6 +274,9 @@ /* Fee Selector title */ "FeeSelector.title" = "Processing Speed"; +/* "Fragment.back" */ +"Fragment.back" = "Back"; + /* Confirm */ "Fragment.confirm" = "confirm"; @@ -910,6 +913,12 @@ /* Share data switch label. */ "ShareData.toggleLabel" = "Share Anonymous Data?"; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "Show seed phrase"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "These are your seed words. If you show them to anyone, they can take your Litecoin"; + /* Current spending limit: */ "SpendingLimit.title" = "Current Spending Limit: "; diff --git a/litewallet/Strings/es.lproj/Localizable.strings b/litewallet/Strings/es.lproj/Localizable.strings index 09210630b..9d1e4b97b 100755 --- a/litewallet/Strings/es.lproj/Localizable.strings +++ b/litewallet/Strings/es.lproj/Localizable.strings @@ -275,6 +275,9 @@ /* Fee Selector title */ "FeeSelector.title" = "Velocidad de procesamiento"; +/* "Fragment.back" */ +"Fragment.back" = "Devolver"; + /* Confirm */ "Fragment.confirm" = "Confirmar"; @@ -911,6 +914,12 @@ /* Share data switch label. */ "ShareData.toggleLabel" = "¿Compartir datos anónimos?"; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "Mostrar frase semilla"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "Estas son tus palabras clave. Si se las muestras a alguien, pueden quedarse con tus Litecoin."; + /* Current spending limit: */ "SpendingLimit.title" = "Límite de gasto actual: "; diff --git a/litewallet/Strings/fr.lproj/Localizable.strings b/litewallet/Strings/fr.lproj/Localizable.strings index 566c3e0f1..e973a64f4 100755 --- a/litewallet/Strings/fr.lproj/Localizable.strings +++ b/litewallet/Strings/fr.lproj/Localizable.strings @@ -274,6 +274,9 @@ /* Fee Selector title */ "FeeSelector.title" = "Vitesse de traitement"; +/* "Fragment.back" */ +"Fragment.back" = "Retour"; + /* Confirm */ "Fragment.confirm" = "Confirmer"; @@ -910,6 +913,12 @@ /* Share data switch label. */ "ShareData.toggleLabel" = "Partager des données anonymes ?"; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "Afficher la phrase de départ"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "Ce sont vos mots clés. Si vous les montrez à quelqu'un, il pourra récupérer votre Litecoin"; + /* Current spending limit: */ "SpendingLimit.title" = "Limite de dépenses actuelle: "; diff --git a/litewallet/Strings/id.lproj/Localizable.strings b/litewallet/Strings/id.lproj/Localizable.strings index 44088091d..a239b0dc7 100644 --- a/litewallet/Strings/id.lproj/Localizable.strings +++ b/litewallet/Strings/id.lproj/Localizable.strings @@ -274,6 +274,9 @@ /* Fee Selector title */ "FeeSelector.title" = "Kecepatan pemrosesan"; +/* "Fragment.back" */ +"Fragment.back" = "Kembali"; + /* Confirm */ "Fragment.confirm" = "Mengonfirmasi"; @@ -910,6 +913,12 @@ /* Share data switch label. */ "ShareData.toggleLabel" = "Bagikan Data Anonim?"; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "Tampilkan frase awal"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "Ini adalah kata-kata benih Anda. Jika Anda menunjukkannya kepada siapa pun, mereka dapat mengambil Litecoin Anda"; + /* Current spending limit: */ "SpendingLimit.title" = "Batas Pengeluaran Saat Ini: "; diff --git a/litewallet/Strings/it.lproj/Localizable.strings b/litewallet/Strings/it.lproj/Localizable.strings index 985939b1a..f75cd2b90 100755 --- a/litewallet/Strings/it.lproj/Localizable.strings +++ b/litewallet/Strings/it.lproj/Localizable.strings @@ -1267,6 +1267,9 @@ /* 1 of 3 */ "WritePaperPhrase.step" = "%1$d di %2$d"; +/* "Fragment.back" */ +"Fragment.back" = ""; + /* "Email address label" */ "Notifications.emailLabel" = ""; @@ -1290,3 +1293,9 @@ /* Service */ "Send.serviceFee" = ""; + +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = ""; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = ""; diff --git a/litewallet/Strings/ja.lproj/Localizable.strings b/litewallet/Strings/ja.lproj/Localizable.strings index cbc3c0363..cc5b551cc 100755 --- a/litewallet/Strings/ja.lproj/Localizable.strings +++ b/litewallet/Strings/ja.lproj/Localizable.strings @@ -274,6 +274,9 @@ /* Fee Selector title */ "FeeSelector.title" = "処理速度"; +/* "Fragment.back" */ +"Fragment.back" = "戻る"; + /* Confirm */ "Fragment.confirm" = "確認"; @@ -910,6 +913,12 @@ /* Share data switch label. */ "ShareData.toggleLabel" = "匿名データをシェアしますか?"; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "シードフレーズを表示"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "これらはあなたのシードワードです。これを誰かに見せると、ライトコインを盗まれてしまう可能性があります。"; + /* Current spending limit: */ "SpendingLimit.title" = "現在の支出制限:"; diff --git a/litewallet/Strings/ko.lproj/Localizable.strings b/litewallet/Strings/ko.lproj/Localizable.strings index 26a7b5830..38768c139 100755 --- a/litewallet/Strings/ko.lproj/Localizable.strings +++ b/litewallet/Strings/ko.lproj/Localizable.strings @@ -274,6 +274,9 @@ /* Fee Selector title */ "FeeSelector.title" = "처리 속도"; +/* "Fragment.back" */ +"Fragment.back" = "반품"; + /* Confirm */ "Fragment.confirm" = "확인하다"; @@ -910,6 +913,12 @@ /* Share data switch label. */ "ShareData.toggleLabel" = "익명 데이터를 공유하시겠습니까?"; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "시드 문구 표시"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "이것이 당신의 시드 단어입니다. 이것을 누구에게 보여주면 그들은 당신의 라이트코인을 가져갈 수 있습니다."; + /* Current spending limit: */ "SpendingLimit.title" = "현재 지출 한도"; diff --git a/litewallet/Strings/nl.lproj/Localizable.strings b/litewallet/Strings/nl.lproj/Localizable.strings index b8d2e9ca8..7bbd05da6 100755 --- a/litewallet/Strings/nl.lproj/Localizable.strings +++ b/litewallet/Strings/nl.lproj/Localizable.strings @@ -1246,6 +1246,9 @@ /* 1 of 3 */ "WritePaperPhrase.step" = "%1$d van %2$d"; +/* "Fragment.back" */ +"Fragment.back" = ""; + /* "Email address label" */ "Notifications.emailLabel" = ""; @@ -1288,5 +1291,11 @@ /* Change language alert message */ "Settings.ChangeLanguage.alertMessage" = ""; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = ""; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = ""; + /* Start view tagline */ "StartViewController.tagline" = ""; diff --git a/litewallet/Strings/pt.lproj/Localizable.strings b/litewallet/Strings/pt.lproj/Localizable.strings index ffb427769..315983bef 100755 --- a/litewallet/Strings/pt.lproj/Localizable.strings +++ b/litewallet/Strings/pt.lproj/Localizable.strings @@ -275,6 +275,9 @@ /* Fee Selector title */ "FeeSelector.title" = "Velocidade de processamento"; +/* "Fragment.back" */ +"Fragment.back" = "Retornar"; + /* Confirm */ "Fragment.confirm" = "confirme"; @@ -911,6 +914,12 @@ /* Share data switch label. */ "ShareData.toggleLabel" = "Partilhar Dados Anónimos?"; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "Mostrar frase semente"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "Estas são suas palavras-semente. Se você mostrá-las a qualquer pessoa, eles podem levar seu Litecoin"; + /* Current spending limit: */ "SpendingLimit.title" = "Limite de gastos atual:"; diff --git a/litewallet/Strings/ru.lproj/Localizable.strings b/litewallet/Strings/ru.lproj/Localizable.strings index 4b8192767..236b7c895 100755 --- a/litewallet/Strings/ru.lproj/Localizable.strings +++ b/litewallet/Strings/ru.lproj/Localizable.strings @@ -274,6 +274,9 @@ /* Fee Selector title */ "FeeSelector.title" = "Скорость обработки"; +/* "Fragment.back" */ +"Fragment.back" = "Возвращаться"; + /* Confirm */ "Fragment.confirm" = "Подтверждать"; @@ -910,6 +913,12 @@ /* Share data switch label. */ "ShareData.toggleLabel" = "Поделиться анонимными данными?"; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "Показать начальную фразу"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "Это ваши seed-слова. Если вы покажете их кому-нибудь, они могут забрать ваши Litecoin"; + /* Current spending limit: */ "SpendingLimit.title" = "Текущий лимит расходов:"; diff --git a/litewallet/Strings/sv.lproj/Localizable.strings b/litewallet/Strings/sv.lproj/Localizable.strings index 96bd3b45b..4efeaeb62 100755 --- a/litewallet/Strings/sv.lproj/Localizable.strings +++ b/litewallet/Strings/sv.lproj/Localizable.strings @@ -1246,6 +1246,9 @@ /* 1 of 3 */ "WritePaperPhrase.step" = "%1$d av %2$d"; +/* "Fragment.back" */ +"Fragment.back" = ""; + /* "Email address label" */ "Notifications.emailLabel" = ""; @@ -1288,5 +1291,11 @@ /* Change language alert message */ "Settings.ChangeLanguage.alertMessage" = ""; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = ""; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = ""; + /* Start view tagline */ "StartViewController.tagline" = ""; diff --git a/litewallet/Strings/tr.lproj/Localizable.strings b/litewallet/Strings/tr.lproj/Localizable.strings index a3e6b0e09..ab2e8f0ff 100644 --- a/litewallet/Strings/tr.lproj/Localizable.strings +++ b/litewallet/Strings/tr.lproj/Localizable.strings @@ -274,6 +274,9 @@ /* Fee Selector title */ "FeeSelector.title" = "İşleme Hızı"; +/* "Fragment.back" */ +"Fragment.back" = "Geri dönmek"; + /* Confirm */ "Fragment.confirm" = "Confirm"; @@ -910,6 +913,12 @@ /* Share data switch label. */ "ShareData.toggleLabel" = "Anonim Veriler Paylaşılsın mı?"; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "Tohum cümlesini göster"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "Bunlar sizin tohum sözcüklerinizdir. Bunları herhangi birine gösterirseniz, Litecoin'inizi alabilirler"; + /* Current spending limit: */ "SpendingLimit.title" = "Mevcut Harcama Sınırı:"; diff --git a/litewallet/Strings/uk.lproj/Localizable.strings b/litewallet/Strings/uk.lproj/Localizable.strings index eb3b84c83..d5227c418 100644 --- a/litewallet/Strings/uk.lproj/Localizable.strings +++ b/litewallet/Strings/uk.lproj/Localizable.strings @@ -274,6 +274,9 @@ /* Fee Selector title */ "FeeSelector.title" = "Швидкість обробки"; +/* "Fragment.back" */ +"Fragment.back" = "Повернення"; + /* Confirm */ "Fragment.confirm" = "підтвердити"; @@ -910,6 +913,12 @@ /* Share data switch label. */ "ShareData.toggleLabel" = "Поділитися анонімними даними?"; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "Показати вихідну фразу"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "Це ваші початкові слова. Якщо ви покажете їх комусь, вони можуть забрати ваш Litecoin"; + /* Current spending limit: */ "SpendingLimit.title" = "Поточний ліміт витрат: "; diff --git a/litewallet/Strings/zh-Hans.lproj/Localizable.strings b/litewallet/Strings/zh-Hans.lproj/Localizable.strings index 65eadc5aa..ce364d1dc 100755 --- a/litewallet/Strings/zh-Hans.lproj/Localizable.strings +++ b/litewallet/Strings/zh-Hans.lproj/Localizable.strings @@ -274,6 +274,9 @@ /* Fee Selector title */ "FeeSelector.title" = "处理速度"; +/* "Fragment.back" */ +"Fragment.back" = "后退"; + /* Confirm */ "Fragment.confirm" = "确认"; @@ -910,6 +913,12 @@ /* Share data switch label. */ "ShareData.toggleLabel" = "共享匿名数据?"; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "显示种子短语"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "这些是你的种子词。如果你把它们给任何人看,他们就可以拿走你的莱特币"; + /* Current spending limit: */ "SpendingLimit.title" = "当前支出限额:"; diff --git a/litewallet/Strings/zh-Hant.lproj/Localizable.strings b/litewallet/Strings/zh-Hant.lproj/Localizable.strings index 8ff9890be..ac2ce696f 100755 --- a/litewallet/Strings/zh-Hant.lproj/Localizable.strings +++ b/litewallet/Strings/zh-Hant.lproj/Localizable.strings @@ -274,6 +274,9 @@ /* Fee Selector title */ "FeeSelector.title" = "處理速度"; +/* "Fragment.back" */ +"Fragment.back" = "後退"; + /* Confirm */ "Fragment.confirm" = "確認"; @@ -910,6 +913,12 @@ /* Share data switch label. */ "ShareData.toggleLabel" = "分享匿名資料?"; +/* "ShowWords.modalTitle" */ +"ShowWords.modalTitle" = "顯示種子短語"; + +/* "ShowWords.titleWarning" */ +"ShowWords.titleWarning" = "這些就是你的種子詞。如果您向任何人展示它們,他們就可以拿走您的萊特幣"; + /* Current spending limit: */ "SpendingLimit.title" = "當前支出限額:"; diff --git a/litewallet/ViewControllers/ConfirmPaperPhraseViewController.swift b/litewallet/ViewControllers/ConfirmPaperPhraseViewController.swift index ecac0606f..1ffb7c511 100644 --- a/litewallet/ViewControllers/ConfirmPaperPhraseViewController.swift +++ b/litewallet/ViewControllers/ConfirmPaperPhraseViewController.swift @@ -70,8 +70,7 @@ class ConfirmPaperPhraseViewController: UITableViewController { NotificationCenter.default.addObserver(forName: UIApplication.willResignActiveNotification, object: nil, - queue: nil) - { [weak self] _ in + queue: nil) { [weak self] _ in self?.dismiss(animated: true, completion: nil) } diff --git a/litewallet/ViewControllers/WritePaperPhraseViewController.swift b/litewallet/ViewControllers/WritePaperPhraseViewController.swift index d16f0bdaf..68351a4e3 100644 --- a/litewallet/ViewControllers/WritePaperPhraseViewController.swift +++ b/litewallet/ViewControllers/WritePaperPhraseViewController.swift @@ -62,8 +62,7 @@ class WritePaperPhraseViewController: UIViewController { NotificationCenter.default.addObserver(forName: UIScene.willDeactivateNotification, object: nil, - queue: nil) - { [weak self] _ in + queue: nil) { [weak self] _ in self?.dismiss(animated: true, completion: nil) } } diff --git a/litewallet/src/StartView.swift b/litewallet/src/StartView.swift index 47bc6ffa4..60cacbd9e 100644 --- a/litewallet/src/StartView.swift +++ b/litewallet/src/StartView.swift @@ -118,18 +118,17 @@ struct StartView: View { alignment: .center) .alert(startViewModel .alertMessage[startViewModel.currentLanguage.rawValue], - isPresented: $delayedSelect) - { - HStack { - Button(S.Button.yes.localize(), role: .cancel) { - startViewModel.setLanguage(code: startViewModel.currentLanguage.code) - selectedLang = false - } - Button(S.Button.cancel.localize(), role: .destructive) { - // Dismisses - selectedLang = false + isPresented: $delayedSelect) { + HStack { + Button(S.Button.yes.localize(), role: .cancel) { + startViewModel.setLanguage(code: startViewModel.currentLanguage.code) + selectedLang = false + } + Button(S.Button.cancel.localize(), role: .destructive) { + // Dismisses + selectedLang = false + } } - } } Spacer() NavigationLink(destination: diff --git a/litewallet/src/ViewControllers/ConfirmPaperPhraseViewController.swift b/litewallet/src/ViewControllers/ConfirmPaperPhraseViewController.swift index ecac0606f..1ffb7c511 100644 --- a/litewallet/src/ViewControllers/ConfirmPaperPhraseViewController.swift +++ b/litewallet/src/ViewControllers/ConfirmPaperPhraseViewController.swift @@ -70,8 +70,7 @@ class ConfirmPaperPhraseViewController: UITableViewController { NotificationCenter.default.addObserver(forName: UIApplication.willResignActiveNotification, object: nil, - queue: nil) - { [weak self] _ in + queue: nil) { [weak self] _ in self?.dismiss(animated: true, completion: nil) } diff --git a/litewallet/src/ViewControllers/WritePaperPhraseViewController.swift b/litewallet/src/ViewControllers/WritePaperPhraseViewController.swift index 216b00976..562d46fc3 100644 --- a/litewallet/src/ViewControllers/WritePaperPhraseViewController.swift +++ b/litewallet/src/ViewControllers/WritePaperPhraseViewController.swift @@ -64,8 +64,7 @@ class WritePaperPhraseViewController: UIViewController { NotificationCenter.default.addObserver(forName: UIScene.willDeactivateNotification, object: nil, - queue: nil) - { [weak self] _ in + queue: nil) { [weak self] _ in self?.dismiss(animated: true, completion: nil) } } diff --git a/litewalletTests/Seed Word Tests/SeedWordsTests.swift b/litewalletTests/Seed Word Tests/SeedWordsTests.swift new file mode 100644 index 000000000..607a8d311 --- /dev/null +++ b/litewalletTests/Seed Word Tests/SeedWordsTests.swift @@ -0,0 +1,30 @@ +@testable import litewallet +import XCTest + +final class SeedWordsTests: XCTestCase { + let mockSeeds = MockSeeds() + let mockData = MockData() + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + // Any test you write for XCTest can be annotated as throws and async. + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. + // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + measure { + // Put the code you want to measure the time of here. + } + } +}