diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutModule.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutModule.swift index 0fb16a3df5..b66f225ab8 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutModule.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutModule.swift @@ -1,12 +1,10 @@ import UIKit struct AboutModule { - static func viewController() -> UIViewController { let service = AboutService( - termsManager: App.shared.termsManager, - systemInfoManager: App.shared.systemInfoManager, - rateAppManager: App.shared.rateAppManager + termsManager: App.shared.termsManager, + systemInfoManager: App.shared.systemInfoManager ) let releaseNotesService = ReleaseNotesService(appVersionManager: App.shared.appVersionManager) @@ -14,5 +12,4 @@ struct AboutModule { return AboutViewController(viewModel: viewModel, urlManager: UrlManager(inApp: true)) } - } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutService.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutService.swift index ed97f366a6..cf3a0401b2 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutService.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutService.swift @@ -3,18 +3,14 @@ import RxSwift class AboutService { private let termsManager: TermsManager private let systemInfoManager: SystemInfoManager - private let rateAppManager: RateAppManager - init(termsManager: TermsManager, systemInfoManager: SystemInfoManager, rateAppManager: RateAppManager) { + init(termsManager: TermsManager, systemInfoManager: SystemInfoManager) { self.termsManager = termsManager self.systemInfoManager = systemInfoManager - self.rateAppManager = rateAppManager } - } extension AboutService { - var termsAccepted: Bool { termsManager.termsAccepted } @@ -26,9 +22,4 @@ extension AboutService { var appVersion: String { systemInfoManager.appVersion.description } - - func rateApp() { - rateAppManager.forceShow() - } - } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutViewController.swift index 8c97f47dd8..858edc5337 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutViewController.swift @@ -1,5 +1,4 @@ import ComponentKit -import MessageUI import RxCocoa import RxSwift import SafariServices @@ -71,48 +70,6 @@ class AboutViewController: ThemeViewController { tableView.deselectCell(withCoordinator: transitionCoordinator, animated: animated) } - private func openTellFriends() { - let text = "settings_tell_friends.text".localized + "\n" + AppConfig.appWebPageLink - let activityViewController = UIActivityViewController(activityItems: [text], applicationActivities: []) - present(activityViewController, animated: true, completion: nil) - } - - private func handleEmailContact() { - let email = AppConfig.reportEmail - - if MFMailComposeViewController.canSendMail() { - let controller = MFMailComposeViewController() - controller.setToRecipients([email]) - controller.mailComposeDelegate = self - - present(controller, animated: true) - } else { - CopyHelper.copyAndNotify(value: email) - } - } - - private func handleTelegramContact() { - navigationController?.pushViewController(PersonalSupportModule.viewController(), animated: true) - } - - private func handleContact() { - let viewController = BottomSheetModule.viewController( - image: .local(image: UIImage(named: "at_24")?.withTintColor(.themeJacob)), - title: "settings.contact.title".localized, - items: [], - buttons: [ - .init(style: .yellow, title: "settings.contact.via_email".localized, actionType: .afterClose) { [weak self] in - self?.handleEmailContact() - }, - .init(style: .gray, title: "settings.contact.via_telegram".localized, actionType: .afterClose) { [weak self] in - self?.handleTelegramContact() - }, - ] - ) - - present(viewController, animated: true) - } - private func openTwitter() { let account = AppConfig.appTwitterAccount @@ -256,52 +213,6 @@ extension AboutViewController: SectionsDataSource { ), ] ), - Section( - id: "share", - footerState: .margin(height: .margin32), - rows: [ - row( - id: "rate-us", - image: "rate_24", - title: "settings.about_app.rate_us".localized, - isFirst: true, - action: { [weak self] in - self?.viewModel.onTapRateApp() - } - ), - row( - id: "tell-friends", - image: "share_1_24", - title: "settings.about_app.tell_friends".localized, - isLast: true, - action: { [weak self] in - self?.openTellFriends() - } - ), - ] - ), - Section( - id: "contact", - footerState: .margin(height: .margin32), - rows: [ - row( - id: "email", - image: "mail_24", - title: "settings.about_app.contact".localized, - isFirst: true, - isLast: true, - action: { [weak self] in - self?.handleContact() - } - ), - ] - ), ] } } - -extension AboutViewController: MFMailComposeViewControllerDelegate { - func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith _: MFMailComposeResult, error _: Error?) { - controller.dismiss(animated: true) - } -} diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutViewModel.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutViewModel.swift index 705c3a762c..405ed8cf9f 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutViewModel.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/About/AboutViewModel.swift @@ -1,7 +1,7 @@ import Foundation -import RxSwift -import RxRelay import RxCocoa +import RxRelay +import RxSwift class AboutViewModel { private let service: AboutService @@ -18,17 +18,15 @@ class AboutViewModel { termsAlertRelay = BehaviorRelay(value: !service.termsAccepted) service.termsAcceptedObservable - .subscribeOn(ConcurrentDispatchQueueScheduler(qos: .userInitiated)) - .subscribe(onNext: { [weak self] accepted in - self?.termsAlertRelay.accept(!accepted) - }) - .disposed(by: disposeBag) + .subscribeOn(ConcurrentDispatchQueueScheduler(qos: .userInitiated)) + .subscribe(onNext: { [weak self] accepted in + self?.termsAlertRelay.accept(!accepted) + }) + .disposed(by: disposeBag) } - } extension AboutViewModel { - var openLinkSignal: Signal { openLinkRelay.asSignal() } @@ -52,9 +50,4 @@ extension AboutViewModel { func onTapWebPageLink() { openLinkRelay.accept(AppConfig.appWebPageLink) } - - func onTapRateApp() { - service.rateApp() - } - } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsModule.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsModule.swift index 8acf2796b6..5e00970a00 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsModule.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsModule.swift @@ -13,7 +13,8 @@ struct MainSettingsModule { systemInfoManager: App.shared.systemInfoManager, currencyKit: App.shared.currencyKit, walletConnectSessionManager: App.shared.walletConnectSessionManager, - subscriptionManager: App.shared.subscriptionManager + subscriptionManager: App.shared.subscriptionManager, + rateAppManager: App.shared.rateAppManager ) let viewModel = MainSettingsViewModel(service: service) diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsService.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsService.swift index e4e43ec873..a177681203 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsService.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsService.swift @@ -20,12 +20,13 @@ class MainSettingsService { private let currencyKit: CurrencyKit.Kit private let walletConnectSessionManager: WalletConnectSessionManager private let subscriptionManager: SubscriptionManager + private let rateAppManager: RateAppManager private let iCloudAvailableErrorRelay = BehaviorRelay(value: false) private let noWalletRequiredActionsRelay = BehaviorRelay(value: false) init(backupManager: BackupManager, cloudAccountBackupManager: CloudBackupManager, accountRestoreWarningManager: AccountRestoreWarningManager, accountManager: AccountManager, contactBookManager: ContactBookManager, passcodeManager: PasscodeManager, termsManager: TermsManager, - systemInfoManager: SystemInfoManager, currencyKit: CurrencyKit.Kit, walletConnectSessionManager: WalletConnectSessionManager, subscriptionManager: SubscriptionManager) + systemInfoManager: SystemInfoManager, currencyKit: CurrencyKit.Kit, walletConnectSessionManager: WalletConnectSessionManager, subscriptionManager: SubscriptionManager, rateAppManager: RateAppManager) { self.cloudAccountBackupManager = cloudAccountBackupManager self.backupManager = backupManager @@ -38,6 +39,7 @@ class MainSettingsService { self.currencyKit = currencyKit self.walletConnectSessionManager = walletConnectSessionManager self.subscriptionManager = subscriptionManager + self.rateAppManager = rateAppManager subscribe(disposeBag, contactBookManager.iCloudErrorObservable) { [weak self] error in if error != nil, self?.contactBookManager.remoteSync ?? false { @@ -149,6 +151,10 @@ extension MainSettingsService { var analyticsLink: String { AppConfig.analyticsLink } + + func rateApp() { + rateAppManager.forceShow() + } } extension MainSettingsService { diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewController.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewController.swift index ca2b3a3f78..603a5c2141 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewController.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewController.swift @@ -1,13 +1,14 @@ -import UIKit +import ComponentKit +import MessageUI +import ModuleKit +import RxCocoa +import RxSwift +import SafariServices import SectionsTableView import SnapKit import ThemeKit import UIExtensions -import ModuleKit -import RxSwift -import RxCocoa -import SafariServices -import ComponentKit +import UIKit class MainSettingsViewController: ThemeViewController { private let viewModel: MainSettingsViewModel @@ -41,7 +42,8 @@ class MainSettingsViewController: ThemeViewController { tabBarItem = UITabBarItem(title: "settings.tab_bar_item".localized, image: UIImage(named: "filled_settings_2_24"), tag: 0) } - required init?(coder aDecoder: NSCoder) { + @available(*, unavailable) + required init?(coder _: NSCoder) { fatalError("init(coder:) has not been implemented") } @@ -135,33 +137,33 @@ class MainSettingsViewController: ThemeViewController { private func buildTitleImage(cell: BaseThemeCell, image: UIImage?, title: String, alertImage: UIImage? = nil) { CellBuilderNew.buildStatic(cell: cell, rootElement: .hStack([ - .image24 { (component: ImageComponent) -> () in + .image24 { (component: ImageComponent) in component.imageView.image = image }, - .text { (component: TextComponent) -> () in + .text { (component: TextComponent) in component.font = .body component.textColor = .themeLeah component.text = title }, - .image20 { (component: ImageComponent) -> () in + .image20 { (component: ImageComponent) in component.isHidden = alertImage == nil component.imageView.image = alertImage component.imageView.tintColor = .themeLucian }, .margin8, - .image20 { (component: ImageComponent) -> () in + .image20 { (component: ImageComponent) in component.imageView.image = UIImage(named: "arrow_big_forward_20") - } + }, ])) } private func syncWalletConnectCell(text: String? = nil, highlighted: Bool = false) { buildTitleValue( - cell: walletConnectCell, - image: UIImage(named: "wallet_connect_24"), - title: "wallet_connect.title".localized, - value: !highlighted ? text : nil, - badge: highlighted ? text : nil + cell: walletConnectCell, + image: UIImage(named: "wallet_connect_24"), + title: "wallet_connect.title".localized, + value: !highlighted ? text : nil, + badge: highlighted ? text : nil ) } @@ -174,26 +176,26 @@ class MainSettingsViewController: ThemeViewController { .image24 { (component: ImageComponent) in component.imageView.image = image }, - .text { (component: TextComponent) -> () in + .text { (component: TextComponent) in component.font = .body component.textColor = .themeLeah component.text = title }, - .text { (component: TextComponent) -> () in + .text { (component: TextComponent) in component.font = .subhead1 component.textColor = .themeGray component.text = value }, .margin8, - .badge { (component: BadgeComponent) -> () in + .badge { (component: BadgeComponent) in component.badgeView.set(style: .medium) component.isHidden = badge == nil component.badgeView.text = badge }, .margin8, - .image20 { (component: ImageComponent) -> () in + .image20 { (component: ImageComponent) in component.imageView.image = UIImage(named: "arrow_big_forward_20") - } + }, ])) } @@ -207,155 +209,192 @@ class MainSettingsViewController: ThemeViewController { private var accountRows: [RowProtocol] { [ StaticRow( - cell: manageAccountsCell, - id: "manage-accounts", - height: .heightCell48, - action: { [weak self] in - self?.navigationController?.pushViewController(ManageAccountsModule.viewController(mode: .manage), animated: true) - } + cell: manageAccountsCell, + id: "manage-accounts", + height: .heightCell48, + action: { [weak self] in + self?.navigationController?.pushViewController(ManageAccountsModule.viewController(mode: .manage), animated: true) + } ), tableView.universalRow48( - id: "blockchain-settings", - image: .local(UIImage(named: "blocks_24")), - title: .body("settings.blockchain_settings".localized), - accessoryType: .disclosure, - isLast: false, - action: { [weak self] in - let viewController = BlockchainSettingsModule.view().toViewController(title: "blockchain_settings.title".localized) - self?.navigationController?.pushViewController(viewController, animated: true) - } + id: "blockchain-settings", + image: .local(UIImage(named: "blocks_24")), + title: .body("settings.blockchain_settings".localized), + accessoryType: .disclosure, + isLast: false, + action: { [weak self] in + let viewController = BlockchainSettingsModule.view().toViewController(title: "blockchain_settings.title".localized) + self?.navigationController?.pushViewController(viewController, animated: true) + } ), tableView.universalRow48( - id: "backup-manager", - image: .local(UIImage(named: "icloud_24")), - title: .body("settings.backup_manager".localized), - accessoryType: .disclosure, - isLast: true, - action: { [weak self] in - let viewController = BackupManagerModule.view().toViewController(title: "backup_manager.title".localized) - self?.navigationController?.pushViewController(viewController, animated: true) - } - ) + id: "backup-manager", + image: .local(UIImage(named: "icloud_24")), + title: .body("settings.backup_manager".localized), + accessoryType: .disclosure, + isLast: true, + action: { [weak self] in + let viewController = BackupManagerModule.view().toViewController(title: "backup_manager.title".localized) + self?.navigationController?.pushViewController(viewController, animated: true) + } + ), ] } private var walletConnectRows: [RowProtocol] { [ StaticRow( - cell: walletConnectCell, - id: "wallet-connect", - height: .heightCell48, - autoDeselect: true, - action: { [weak self] in - self?.viewModel.onTapWalletConnect() - } - ) + cell: walletConnectCell, + id: "wallet-connect", + height: .heightCell48, + autoDeselect: true, + action: { [weak self] in + self?.viewModel.onTapWalletConnect() + } + ), ] } private var appearanceRows: [RowProtocol] { [ StaticRow( - cell: securityCell, - id: "security", - height: .heightCell48, - action: { [weak self] in - let viewController = SecuritySettingsModule.view().toViewController(title: "settings_security.title".localized) - self?.navigationController?.pushViewController(viewController, animated: true) - } + cell: securityCell, + id: "security", + height: .heightCell48, + action: { [weak self] in + let viewController = SecuritySettingsModule.view().toViewController(title: "settings_security.title".localized) + self?.navigationController?.pushViewController(viewController, animated: true) + } ), StaticRow( - cell: contactBookCell, - id: "address-book", - height: .heightCell48, - action: { [weak self] in - guard let viewController = ContactBookModule.viewController(mode: .edit) else { - return - } - self?.navigationController?.pushViewController(viewController, animated: true) + cell: contactBookCell, + id: "address-book", + height: .heightCell48, + action: { [weak self] in + guard let viewController = ContactBookModule.viewController(mode: .edit) else { + return } + self?.navigationController?.pushViewController(viewController, animated: true) + } ), StaticRow( - cell: appearanceCell, - id: "launch-screen", - height: .heightCell48, - action: { [weak self] in - let viewController = AppearanceModule.view().toViewController(title: "appearance.title".localized) - self?.navigationController?.pushViewController(viewController, animated: true) - } + cell: appearanceCell, + id: "launch-screen", + height: .heightCell48, + action: { [weak self] in + let viewController = AppearanceModule.view().toViewController(title: "appearance.title".localized) + self?.navigationController?.pushViewController(viewController, animated: true) + } ), StaticRow( - cell: baseCurrencyCell, - id: "base-currency", - height: .heightCell48, - action: { [weak self] in - self?.navigationController?.pushViewController(BaseCurrencySettingsModule.viewController(), animated: true) - } + cell: baseCurrencyCell, + id: "base-currency", + height: .heightCell48, + action: { [weak self] in + self?.navigationController?.pushViewController(BaseCurrencySettingsModule.viewController(), animated: true) + } ), StaticRow( - cell: languageCell, - id: "language", - height: .heightCell48, - action: { [weak self] in - let module = LanguageSettingsRouter.module { MainModule.instance(presetTab: .settings) } - self?.navigationController?.pushViewController(module, animated: true) - } - ) + cell: languageCell, + id: "language", + height: .heightCell48, + action: { [weak self] in + let module = LanguageSettingsRouter.module { MainModule.instance(presetTab: .settings) } + self?.navigationController?.pushViewController(module, animated: true) + } + ), ] } private var experimentalRows: [RowProtocol] { [ tableView.universalRow48( - id: "experimental-features", - image: .local(UIImage(named: "flask_24")), - title: .body("settings.experimental_features".localized), - accessoryType: .disclosure, - isFirst: true, - isLast: true, - action: { [weak self] in - let viewController = ExperimentalFeaturesView().toViewController(title: "settings.experimental_features.title".localized) - self?.navigationController?.pushViewController(viewController, animated: true) - } - ) + id: "experimental-features", + image: .local(UIImage(named: "flask_24")), + title: .body("settings.experimental_features".localized), + accessoryType: .disclosure, + isFirst: true, + isLast: true, + action: { [weak self] in + let viewController = ExperimentalFeaturesView().toViewController(title: "settings.experimental_features.title".localized) + self?.navigationController?.pushViewController(viewController, animated: true) + } + ), ] } private var knowledgeRows: [RowProtocol] { [ tableView.universalRow48( - id: "faq", - image: .local(UIImage(named: "message_square_24")), - title: .body("settings.faq".localized), - accessoryType: .disclosure, - isFirst: true, - action: { [weak self] in - self?.navigationController?.pushViewController(FaqModule.viewController(), animated: true) - } + id: "faq", + image: .local(UIImage(named: "message_square_24")), + title: .body("settings.faq".localized), + accessoryType: .disclosure, + isFirst: true, + action: { [weak self] in + self?.navigationController?.pushViewController(FaqModule.viewController(), animated: true) + } ), tableView.universalRow48( - id: "academy", - image: .local(UIImage(named: "academy_1_24")), - title: .body("guides.title".localized), - accessoryType: .disclosure, - isLast: true, - action: { [weak self] in - self?.navigationController?.pushViewController(GuidesModule.instance(), animated: true) - } - ) + id: "academy", + image: .local(UIImage(named: "academy_1_24")), + title: .body("guides.title".localized), + accessoryType: .disclosure, + isLast: true, + action: { [weak self] in + self?.navigationController?.pushViewController(GuidesModule.instance(), animated: true) + } + ), ] } private var aboutRows: [RowProtocol] { [ StaticRow( - cell: aboutCell, - id: "about", - height: .heightCell48, - action: { [weak self] in - self?.navigationController?.pushViewController(AboutModule.viewController(), animated: true) - } - ) + cell: aboutCell, + id: "about", + height: .heightCell48, + action: { [weak self] in + self?.navigationController?.pushViewController(AboutModule.viewController(), animated: true) + } + ), + ] + } + + private var feedbackRows: [RowProtocol] { + [ + tableView.universalRow48( + id: "rate-us", + image: .local(UIImage(named: "rate_24")), + title: .body("settings.rate_us".localized), + accessoryType: .disclosure, + autoDeselect: true, + isFirst: true, + action: { [weak self] in + self?.viewModel.onTapRateApp() + } + ), + tableView.universalRow48( + id: "tell-friends", + image: .local(UIImage(named: "share_1_24")), + title: .body("settings.tell_friends".localized), + accessoryType: .disclosure, + autoDeselect: true, + action: { [weak self] in + self?.openTellFriends() + } + ), + tableView.universalRow48( + id: "contact-us", + image: .local(UIImage(named: "mail_24")), + title: .body("settings.contact_us".localized), + accessoryType: .disclosure, + autoDeselect: true, + isLast: true, + action: { [weak self] in + self?.handleContact() + } + ), ] } @@ -370,33 +409,73 @@ class MainSettingsViewController: ThemeViewController { isFirst: true, isLast: true, action: { [weak self] in self?.onDonateTapped() } - ) + ), ] } private var footerRows: [RowProtocol] { [ StaticRow( - cell: footerCell, - id: "footer", - height: footerCell.cellHeight - ) + cell: footerCell, + id: "footer", + height: footerCell.cellHeight + ), ] } private func openWalletConnect(mode: MainSettingsViewModel.WalletConnectOpenMode) { switch mode { - case .errorDialog(let error): + case let .errorDialog(error): WalletConnectAppShowView.showWalletConnectError(error: error, sourceViewController: self) case .list: navigationController?.pushViewController(WalletConnectListModule.viewController(), animated: true) } } + private func openTellFriends() { + let text = "settings_tell_friends.text".localized + "\n" + AppConfig.appWebPageLink + let activityViewController = UIActivityViewController(activityItems: [text], applicationActivities: []) + present(activityViewController, animated: true, completion: nil) + } + + private func handleEmailContact() { + let email = AppConfig.reportEmail + + if MFMailComposeViewController.canSendMail() { + let controller = MFMailComposeViewController() + controller.setToRecipients([email]) + controller.mailComposeDelegate = self + + present(controller, animated: true) + } else { + CopyHelper.copyAndNotify(value: email) + } + } + + private func handleTelegramContact() { + navigationController?.pushViewController(PersonalSupportModule.viewController(), animated: true) + } + + private func handleContact() { + let viewController = BottomSheetModule.viewController( + image: .local(image: UIImage(named: "at_24")?.withTintColor(.themeJacob)), + title: "settings.contact.title".localized, + items: [], + buttons: [ + .init(style: .yellow, title: "settings.contact.via_email".localized, actionType: .afterClose) { [weak self] in + self?.handleEmailContact() + }, + .init(style: .gray, title: "settings.contact.via_telegram".localized, actionType: .afterClose) { [weak self] in + self?.handleTelegramContact() + }, + ] + ) + + present(viewController, animated: true) + } } extension MainSettingsViewController: SectionsDataSource { - func buildSections() -> [SectionProtocol] { var sections: [SectionProtocol] = [ Section(id: "donate", headerState: .margin(height: .margin12), rows: donateRows), @@ -406,33 +485,39 @@ extension MainSettingsViewController: SectionsDataSource { Section(id: "experimental", headerState: .margin(height: .margin32), rows: experimentalRows), Section(id: "knowledge", headerState: .margin(height: .margin32), rows: knowledgeRows), Section(id: "about", headerState: .margin(height: .margin32), rows: aboutRows), - Section(id: "footer", headerState: .margin(height: .margin32), footerState: .margin(height: .margin32), rows: footerRows) + Section(id: "feedback", headerState: .margin(height: .margin32), rows: feedbackRows), + Section(id: "footer", headerState: .margin(height: .margin32), footerState: .margin(height: .margin32), rows: footerRows), ] if showTestNetSwitcher { sections.append( - Section( + Section( + id: "test-net-switcher", + footerState: .margin(height: .margin32), + rows: [ + tableView.universalRow48( id: "test-net-switcher", - footerState: .margin(height: .margin32), - rows: [ - tableView.universalRow48( - id: "test-net-switcher", - title: .body("TestNet Enabled"), - accessoryType: .switch( - isOn: App.shared.testNetManager.testNetEnabled, - onSwitch: { enabled in - App.shared.testNetManager.set(testNetEnabled: enabled) - } - ), - isFirst: true, - isLast: true - ) - ] - ) + title: .body("TestNet Enabled"), + accessoryType: .switch( + isOn: App.shared.testNetManager.testNetEnabled, + onSwitch: { enabled in + App.shared.testNetManager.set(testNetEnabled: enabled) + } + ), + isFirst: true, + isLast: true + ), + ] + ) ) } return sections } +} +extension MainSettingsViewController: MFMailComposeViewControllerDelegate { + func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith _: MFMailComposeResult, error _: Error?) { + controller.dismiss(animated: true) + } } diff --git a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewModel.swift b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewModel.swift index 5afa0c8089..bac41071cd 100644 --- a/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewModel.swift +++ b/UnstoppableWallet/UnstoppableWallet/Modules/Settings/Main/MainSettingsViewModel.swift @@ -149,6 +149,9 @@ extension MainSettingsViewModel { openLinkRelay.accept(AppConfig.companyWebPageLink) } + func onTapRateApp() { + service.rateApp() + } } extension MainSettingsViewModel { diff --git a/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings b/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings index f216362df5..04e2f6fbcb 100644 --- a/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings +++ b/UnstoppableWallet/UnstoppableWallet/en.lproj/Localizable.strings @@ -1020,6 +1020,9 @@ Go to Settings - > %@ and allow access to the camera."; "settings.info_subtitle" = "decentralized app"; "settings.donate.description" = "Together, with your support, we can make this app even better!"; "settings.donate.title" = "Donate"; +"settings.rate_us" = "Rate Us"; +"settings.tell_friends" = "Tell Friends"; +"settings.contact_us" = "Contact Us"; // Settings -> Base Currency @@ -1233,9 +1236,6 @@ Go to Settings - > %@ and allow access to the camera."; "settings.about_app.description" = "The %@ wallet is built for those looking to invest and store cryptocurrencies in a private and independent manner.\n\nIt's a non-custodial, peer-to-peer wallet where only the user has control over the funds. It doesn't collect any data and keeps the user independent by not locking the user's funds to a specific wallet app.\n\nThe %@ wallet is fully open-source and anyone can confirm the app works exactly as it claims to."; "settings.about_app.whats_new" = "What's New"; "settings.about_app.website" = "Website"; -"settings.about_app.contact" = "Contact Us"; -"settings.about_app.rate_us" = "Rate Us"; -"settings.about_app.tell_friends" = "Tell Friends"; // Settings -> About App -> Contact