Show What's new UI to let user know about wallet QR code being accessible in Spotlight/Siri

pull/3502/head
Hwee-Boon Yar 3 years ago
parent 3cb19bf54e
commit 23e4d574ea
  1. 4
      AlphaWallet.xcodeproj/project.pbxproj
  2. 19
      AlphaWallet/InCoordinator.swift
  3. 4
      AlphaWallet/Tokens/Coordinators/TokensCoordinator.swift
  4. 2
      AlphaWallet/Tokens/ViewControllers/TokensViewController.swift
  5. 63
      AlphaWallet/WhatsNew/Coordinators/WhatsNewExperimentCoordinator.swift
  6. 1
      AlphaWallet/WhatsNew/ViewControllers/WhatsNewListingViewController.swift

@ -263,6 +263,7 @@
5E7C718043636901114BF76C /* LocalesViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7FB99843529061368DA1 /* LocalesViewModel.swift */; };
5E7C7186B20660F2C1462AA9 /* DiscoverDappsViewControllerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7F840AFFD4459FD3DBD6 /* DiscoverDappsViewControllerViewModel.swift */; };
5E7C7193C577A84710D71F5C /* TokenScriptFilterParser.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C77E52AD90BA044CFD67A /* TokenScriptFilterParser.swift */; };
5E7C71967C34DD3F207F8126 /* WhatsNewExperimentCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7709286B5D5A37D0156B /* WhatsNewExperimentCoordinator.swift */; };
5E7C71A2EAA5124E07AA54B6 /* Favicon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7BAC4E511FE8446D212F /* Favicon.swift */; };
5E7C71A6B0BDF301747A49AE /* ScreenChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C77E1E6194F5A1DC8D645 /* ScreenChecker.swift */; };
5E7C71A7D2BD6FCE3980CC51 /* ImportWalletHelpBubbleViewViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7A16ABC8BD5D508AA641 /* ImportWalletHelpBubbleViewViewModel.swift */; };
@ -1419,6 +1420,7 @@
5E7C76D3CFA12C2236E73E10 /* TransferTokensCardViaWalletAddressViewControllerViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransferTokensCardViaWalletAddressViewControllerViewModel.swift; sourceTree = "<group>"; };
5E7C76EE22984D66A3C18E70 /* DappsAutoCompletionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DappsAutoCompletionViewController.swift; sourceTree = "<group>"; };
5E7C7704A86D685C1B9CF5AF /* SendTransactionError.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendTransactionError.swift; sourceTree = "<group>"; };
5E7C7709286B5D5A37D0156B /* WhatsNewExperimentCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WhatsNewExperimentCoordinator.swift; sourceTree = "<group>"; };
5E7C7716E500124CA910FB2C /* AssetDefinitionStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AssetDefinitionStore.swift; sourceTree = "<group>"; };
5E7C771FE9E98CDEBB012C28 /* EthereumSigner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EthereumSigner.swift; sourceTree = "<group>"; };
5E7C7721E0E4D4EFDD35E196 /* ScanQRCodeCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScanQRCodeCoordinator.swift; sourceTree = "<group>"; };
@ -3965,6 +3967,7 @@
isa = PBXGroup;
children = (
5E7C704366485FF6B6C1D9B8 /* WhatsNewListingCoordinator.swift */,
5E7C7709286B5D5A37D0156B /* WhatsNewExperimentCoordinator.swift */,
);
path = Coordinators;
sourceTree = "<group>";
@ -6200,6 +6203,7 @@
5E7C793EEF16E1689FE62543 /* WhatsNewListingViewController.swift in Sources */,
5E7C7FF312AB61DBEBD86C94 /* WhatsNewViewModels.swift in Sources */,
5E7C7CC1E06FFC3A5BEBF1EC /* WhatsNewViews.swift in Sources */,
5E7C71967C34DD3F207F8126 /* WhatsNewExperimentCoordinator.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

@ -89,6 +89,12 @@ class InCoordinator: NSObject, Coordinator {
HelpUsCoordinator(navigationController: navigationController, appTracker: appTracker, analyticsCoordinator: analyticsCoordinator)
}()
private lazy var whatsNewExperimentCoordinator: WhatsNewExperimentCoordinator = {
let coordinator = WhatsNewExperimentCoordinator(navigationController: navigationController, userDefaults: UserDefaults.standard, analyticsCoordinator: analyticsCoordinator)
coordinator.delegate = self
return coordinator
}()
lazy var filterTokensCoordinator: FilterTokensCoordinator = {
return .init(assetDefinitionStore: assetDefinitionStore, tokenActionsService: tokenActionsService, coinTickersFetcher: coinTickersFetcher)
}()
@ -200,6 +206,13 @@ class InCoordinator: NSObject, Coordinator {
rampBuyService.fetchSupportedTokens()
processRestartQueueAfterRestart(config: config, coordinator: self, restartQueue: restartQueue)
showWhatsNew()
}
private func showWhatsNew() {
whatsNewExperimentCoordinator.start()
addCoordinator(whatsNewExperimentCoordinator)
}
private func donateWalletShortcut() {
@ -1215,4 +1228,10 @@ extension InCoordinator: ReplaceTransactionCoordinatorDelegate {
}
}
}
extension InCoordinator: WhatsNewExperimentCoordinatorDelegate {
func didEnd(in coordinator: WhatsNewExperimentCoordinator) {
removeCoordinator(coordinator)
}
}
// swiftlint:enable file_length

@ -221,7 +221,7 @@ class TokensCoordinator: Coordinator {
}
extension TokensCoordinator: TokensViewControllerDelegate {
private func getWalletName() {
let viewModel = tokensViewController.viewModel
@ -564,4 +564,4 @@ extension TokensCoordinator: AddHideTokensCoordinatorDelegate {
func didClose(coordinator: AddHideTokensCoordinator) {
removeCoordinator(coordinator)
}
}
}

@ -199,7 +199,7 @@ class TokensViewController: UIViewController {
return header
}()
init(sessions: ServerDictionary<WalletSession>,
account: Wallet,
tokenCollection: TokenCollection,

@ -0,0 +1,63 @@
// Copyright © 2021 Stormbird PTE. LTD.
import UIKit
protocol WhatsNewExperimentCoordinatorDelegate: AnyObject {
func didEnd(in coordinator: WhatsNewExperimentCoordinator)
}
class WhatsNewExperimentCoordinator: Coordinator {
static private let key = "experiments.whatsnew.1"
private let navigationController: UINavigationController
private let viewModel = HelpUsViewModel()
private let analyticsCoordinator: AnalyticsCoordinator
private let userDefaults: UserDefaults
var coordinators: [Coordinator] = []
weak var delegate: WhatsNewExperimentCoordinatorDelegate?
//TODO probably need to generalize this. Maybe use AppTracker or a similar, new type
var hasRan: Bool {
get {
userDefaults.bool(forKey: Self.key)
} set {
userDefaults.set(true, forKey: Self.key)
}
}
init(navigationController: UINavigationController, userDefaults: UserDefaults, analyticsCoordinator: AnalyticsCoordinator) {
self.navigationController = navigationController
self.navigationController.modalPresentationStyle = .formSheet
self.userDefaults = userDefaults
self.analyticsCoordinator = analyticsCoordinator
}
func start() {
guard !hasRan else {
delegate?.didEnd(in: self)
return
}
hasRan = true
let coordinator = WhatsNewListingCoordinator(navigationController: navigationController)
addCoordinator(coordinator)
let listings = WhatsNewListing(listing: [
WhatsNew(
//TODO localize later. Might not keep this longer term
title: "You can get to your wallet address QR code from Siri/Spotlight?",
changes: [
"1. Go to homescreen",
"2. Pull down to reveal search bar",
"3. Type: wallet QR",
])
])
coordinator.display(viewModel: .init(model: listings, title: R.string.localizable.whatsNew(), shouldShowCheckmarks: false), delegate: self)
}
}
extension WhatsNewExperimentCoordinator: WhatsNewListingCoordinatorProtocol {
func didDismiss(controller: WhatsNewListingViewController) {
delegate?.didEnd(in: self)
}
}

@ -46,5 +46,6 @@ extension WhatsNewListingViewController: ModalViewControllerDelegate {
func didClose(_ controller: ModalViewController) {
controller.dismiss(animated: true)
whatsNewListingDelegate?.didDismiss(controller: self)
}
}
Loading…
Cancel
Save