Merge pull request #2919 from AlphaWallet/mailchimp

In-app prompt for email list subscription
pull/2920/head
Hwee-Boon Yar 3 years ago committed by GitHub
commit cdf0bbd1d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 86
      AlphaWallet.xcodeproj/project.pbxproj
  2. 4
      AlphaWallet.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
  3. 16
      AlphaWallet.xcworkspace/xcshareddata/swiftpm/Package.resolved
  4. 6
      AlphaWallet/Analytics/Coordinators/AnalyticsService.swift
  5. 26
      AlphaWallet/Core/EmailList.swift
  6. 1
      AlphaWallet/Core/Features.swift
  7. 9
      AlphaWallet/Core/Helpers/Environment.swift
  8. 7
      AlphaWallet/Core/Types/AppTracker.swift
  9. 4
      AlphaWallet/Localization/en.lproj/Localizable.strings
  10. 4
      AlphaWallet/Localization/es.lproj/Localizable.strings
  11. 4
      AlphaWallet/Localization/ja.lproj/Localizable.strings
  12. 4
      AlphaWallet/Localization/ko.lproj/Localizable.strings
  13. 4
      AlphaWallet/Localization/zh-Hans.lproj/Localizable.strings
  14. 32
      AlphaWallet/Settings/Coordinators/HelpUsCoordinator.swift
  15. 2
      AlphaWallet/Settings/Models/AddCustomChain.swift
  16. 1
      AlphaWallet/Settings/Types/Constants+Credentials.swift
  17. 6
      AlphaWallet/Transfer/Coordinators/TransactionConfirmationCoordinator.swift

@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 48;
objectVersion = 52;
objects = {
/* Begin PBXBuildFile section */
@ -310,6 +310,7 @@
5E7C730CA247D13ECBCB94ED /* NonFungibleFromJson.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7B38E58247C6A3715BC4 /* NonFungibleFromJson.swift */; };
5E7C7317533D24B6A292F88D /* UIStackView+Array.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C73ED9226646D562B5A3C /* UIStackView+Array.swift */; };
5E7C731D0F6128BE8885A2D3 /* ServersCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7B8FD1E2BCC325DF4EE4 /* ServersCoordinator.swift */; };
5E7C732AA43385E80681B24F /* EmailList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7B097096FC37B68A399B /* EmailList.swift */; };
5E7C732BD09AABEEE6096BF4 /* ServersViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C74C0C1803DD17FE9EBA7 /* ServersViewController.swift */; };
5E7C733638D7596F93DEE2A9 /* OnboardingCollectionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C75CE3F1D6B7993E7A840 /* OnboardingCollectionViewController.swift */; };
5E7C733C6C4DD52495427B66 /* EventsDataStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7EDC84FC2C767ED0C167 /* EventsDataStore.swift */; };
@ -424,6 +425,7 @@
5E7C7751F57FE1B8A563A79B /* WalletSecurityLevelIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7553BB089397B7E74BE0 /* WalletSecurityLevelIndicator.swift */; };
5E7C775B971EFCCEBE9B10A4 /* UITableViewCell+TokenCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C78FF8A5682C27E15B488 /* UITableViewCell+TokenCell.swift */; };
5E7C77649E432A905B836E95 /* DappViewCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7D8C3613A9BD9F147B3C /* DappViewCellViewModel.swift */; };
5E7C776B88B6CDC18CA39D72 /* Environment.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C77DBECDF831CD6C8FF71 /* Environment.swift */; };
5E7C776BE1B19F824954962D /* BaseTokenCardTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7F5C10E3895E805EA7E0 /* BaseTokenCardTableViewCell.swift */; };
5E7C7777BDB574E021D2D6F1 /* LegacyFileBasedKeystore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C7AD8C4F68E49E1A5479A /* LegacyFileBasedKeystore.swift */; };
5E7C7788984F7ADCFE5B4DE0 /* AddressTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E7C75B5AF76279A71395FC7 /* AddressTextField.swift */; };
@ -856,6 +858,7 @@
C601B18D24407F4300C763D9 /* SettingTableViewCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C601B18C24407F4300C763D9 /* SettingTableViewCellViewModel.swift */; };
C6959E32246C1D720095DE91 /* SeedPhraseSuggestionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6959E31246C1D720095DE91 /* SeedPhraseSuggestionViewCell.swift */; };
C80DC77E22AB7FAD009CFA1C /* XDAI-bridge.tsml in Resources */ = {isa = PBXBuildFile; fileRef = C80DC77D22AB7FAD009CFA1C /* XDAI-bridge.tsml */; };
C8630C92268AD9640049B138 /* MailchimpSDK in Frameworks */ = {isa = PBXBuildFile; productRef = C8630C91268AD9640049B138 /* MailchimpSDK */; };
C868C5292053BDE00059672B /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C868C5282053BDE00059672B /* LaunchScreen.storyboard */; };
C868C536205409160059672B /* redeemInfo.html in Resources */ = {isa = PBXBuildFile; fileRef = C868C534205409160059672B /* redeemInfo.html */; };
C876FF79204A79D300B7D0EA /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = C876FF6B204A79D300B7D0EA /* README.md */; };
@ -1320,6 +1323,7 @@
5E7C77B790551456E111ED4F /* PeekOpenSeaNonFungibleTokenViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PeekOpenSeaNonFungibleTokenViewController.swift; sourceTree = "<group>"; };
5E7C77BCBD2C2BE682D384DB /* SeedPhraseCollectionView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SeedPhraseCollectionView.swift; sourceTree = "<group>"; };
5E7C77C2844B3579A59C3F2F /* CallSmartContractFunction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CallSmartContractFunction.swift; sourceTree = "<group>"; };
5E7C77DBECDF831CD6C8FF71 /* Environment.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Environment.swift; sourceTree = "<group>"; };
5E7C77E1E6194F5A1DC8D645 /* ScreenChecker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScreenChecker.swift; sourceTree = "<group>"; };
5E7C77E2559C7C9117C0F75F /* ElevateWalletSecurityViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ElevateWalletSecurityViewModel.swift; sourceTree = "<group>"; };
5E7C77E52AD90BA044CFD67A /* TokenScriptFilterParser.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TokenScriptFilterParser.swift; sourceTree = "<group>"; };
@ -1407,6 +1411,7 @@
5E7C7B06D3FBE83BBC00555F /* Optional.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Optional.swift; sourceTree = "<group>"; };
5E7C7B080E387A79058430B9 /* ConfirmSignMessageTableViewCellViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConfirmSignMessageTableViewCellViewModel.swift; sourceTree = "<group>"; };
5E7C7B089FD4C96810DD10FD /* HelpContentsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HelpContentsViewController.swift; sourceTree = "<group>"; };
5E7C7B097096FC37B68A399B /* EmailList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EmailList.swift; sourceTree = "<group>"; };
5E7C7B19FDDF5D0535243682 /* GasEstimates.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GasEstimates.swift; sourceTree = "<group>"; };
5E7C7B1FB2702A2A8A4EBD76 /* SettingsCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsCoordinator.swift; sourceTree = "<group>"; };
5E7C7B211FF0FE5BE98BB7D0 /* aETH.tsml */ = {isa = PBXFileReference; lastKnownFileType = file.tsml; path = aETH.tsml; sourceTree = "<group>"; };
@ -1812,6 +1817,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
C8630C92268AD9640049B138 /* MailchimpSDK in Frameworks */,
2A669F5585899E890EF26C57 /* Pods_AlphaWallet.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -2957,6 +2963,7 @@
8743CB4F255059780039E469 /* DomainResolver.swift */,
5E7C7A71851FA227231270BD /* DecodedFunctionCall.swift */,
5E7C77BAC05F2F2417098707 /* ViewControllers */,
5E7C7B097096FC37B68A399B /* EmailList.swift */,
);
path = Core;
sourceTree = "<group>";
@ -4299,6 +4306,7 @@
878EE953255BFFB9000210DE /* FeedbackGenerator.swift */,
87FF2E412567F0A3002350EB /* BlockieGenerator.swift */,
5E7C7B80946D854599838AD1 /* RemoteLogger.swift */,
5E7C77DBECDF831CD6C8FF71 /* Environment.swift */,
);
path = Helpers;
sourceTree = "<group>";
@ -4338,6 +4346,9 @@
878EE8F4255ADA49000210DE /* PBXTargetDependency */,
);
name = AlphaWallet;
packageProductDependencies = (
C8630C91268AD9640049B138 /* MailchimpSDK */,
);
productName = etherwallet;
productReference = 2912CCF51F6A830700C6CBE3 /* AlphaWallet.app */;
productType = "com.apple.product-type.application";
@ -4464,6 +4475,9 @@
Base,
);
mainGroup = 2912CCEC1F6A830700C6CBE3;
packageReferences = (
C8630C90268AD9640049B138 /* XCRemoteSwiftPackageReference "Mailchimp-SDK-iOS" */,
);
productRefGroup = 2912CCF61F6A830700C6CBE3 /* Products */;
projectDirPath = "";
projectRoot = "";
@ -5549,6 +5563,8 @@
5E7C7711465975C681496C9C /* EnableChain.swift in Sources */,
5E7C77AC072B44B7E60030B5 /* RestartTaskQueue.swift in Sources */,
5E7C72B4302A10E137EEF94A /* DappRequestSwitchCustomChainCoordinator.swift in Sources */,
5E7C732AA43385E80681B24F /* EmailList.swift in Sources */,
5E7C776B88B6CDC18CA39D72 /* Environment.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -5867,7 +5883,8 @@
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 4.0;
VALIDATE_PRODUCT = YES;
@ -5902,7 +5919,10 @@
"\"$(PODS_ROOT)/libsodium/src/libsodium/include\"",
);
INFOPLIST_FILE = "$(ALPHAWALLET_INFO_PLIST_FILE)";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.24;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" -D DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = "$(ALPHAWALLET_PRODUCT_BUNDLE_IDENTIFIER)";
@ -5944,7 +5964,10 @@
"\"$(PODS_ROOT)/libsodium/src/libsodium/include\"",
);
INFOPLIST_FILE = "$(ALPHAWALLET_INFO_PLIST_FILE)";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.24;
PRODUCT_BUNDLE_IDENTIFIER = "$(ALPHAWALLET_PRODUCT_BUNDLE_IDENTIFIER)";
PRODUCT_NAME = "$(TARGET_NAME)";
@ -5968,7 +5991,11 @@
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = LRAW5PL536;
INFOPLIST_FILE = AlphaWalletTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.stormbird.AlphaWalletTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -5988,7 +6015,11 @@
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = LRAW5PL536;
INFOPLIST_FILE = AlphaWalletTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.stormbird.AlphaWalletTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -6008,7 +6039,11 @@
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = LRAW5PL536;
INFOPLIST_FILE = TrustUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.stormbird.AlphaWalletUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "2869a1ac-b598-45b8-a7c4-7560774c8a2f";
@ -6028,7 +6063,11 @@
CODE_SIGN_STYLE = Manual;
DEVELOPMENT_TEAM = LRAW5PL536;
INFOPLIST_FILE = TrustUITests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.stormbird.AlphaWalletUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE = "2869a1ac-b598-45b8-a7c4-7560774c8a2f";
@ -6051,7 +6090,11 @@
DEVELOPMENT_TEAM = LRAW5PL536;
INFOPLIST_FILE = AlphaWalletShare/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.12;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = NO;
@ -6076,7 +6119,11 @@
DEVELOPMENT_TEAM = LRAW5PL536;
INFOPLIST_FILE = AlphaWalletShare/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 3.12;
MTL_FAST_MATH = NO;
PRODUCT_BUNDLE_IDENTIFIER = com.stormbird.alphawallet.AlphaWalletShare;
@ -6137,6 +6184,25 @@
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
/* Begin XCRemoteSwiftPackageReference section */
C8630C90268AD9640049B138 /* XCRemoteSwiftPackageReference "Mailchimp-SDK-iOS" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/mailchimp/Mailchimp-SDK-iOS";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 2.0.3;
};
};
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
C8630C91268AD9640049B138 /* MailchimpSDK */ = {
isa = XCSwiftPackageProductDependency;
package = C8630C90268AD9640049B138 /* XCRemoteSwiftPackageReference "Mailchimp-SDK-iOS" */;
productName = MailchimpSDK;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = 2912CCED1F6A830700C6CBE3 /* Project object */;
}

@ -2,7 +2,7 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildSystemType</key>
<string>Original</string>
<key>PreviewsEnabled</key>
<false/>
</dict>
</plist>

@ -0,0 +1,16 @@
{
"object": {
"pins": [
{
"package": "MailchimpSDK",
"repositoryURL": "https://github.com/mailchimp/Mailchimp-SDK-iOS",
"state": {
"branch": null,
"revision": "08efbae235367c1349b76bc6053cdc7964d6fa93",
"version": "2.0.3"
}
}
]
},
"version": 1
}

@ -21,13 +21,9 @@ protocol AnalyticsServiceType: AnalyticsCoordinator {
class AnalyticsService: NSObject, AnalyticsServiceType {
private var mixpanelService: MixpanelCoordinator?
private static var isTestFlight: Bool {
Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
}
override init() {
super.init()
if Constants.Credentials.analyticsKey.nonEmpty && !Self.isTestFlight {
if Constants.Credentials.analyticsKey.nonEmpty && !Environment.isTestFlight {
mixpanelService = MixpanelCoordinator(withKey: Constants.Credentials.analyticsKey)
}
}

@ -0,0 +1,26 @@
// Copyright © 2021 Stormbird PTE. LTD.
import Foundation
import MailchimpSDK
class EmailList {
private let listSpecificKey: String
init(listSpecificKey: String) {
self.listSpecificKey = listSpecificKey
}
///We skip email validation since MailChimp does it, and this is low volume
func subscribe(email: String) {
guard Features.isPromptForEmailListSubscriptionEnabled else { return }
do {
try Mailchimp.initialize(token: listSpecificKey, autoTagContacts: true, debugMode: false)
var contact: Contact = Contact(emailAddress: email)
contact.status = .subscribed
Mailchimp.createOrUpdate(contact: contact)
} catch {
//TODO log to remote server
//no-op
}
}
}

@ -11,4 +11,5 @@ enum Features {
static let isRenameWalletEnabledWhileLongPress = true
static let shouldPrintCURLForOutgoingRequest = false
static let isEip3085AddEthereumChainEnabled = true
static let isPromptForEmailListSubscriptionEnabled = true
}

@ -0,0 +1,9 @@
// Copyright © 2021 Stormbird PTE. LTD.
import Foundation
class Environment {
static var isTestFlight: Bool {
Bundle.main.appStoreReceiptURL?.lastPathComponent == "sandboxReceipt"
}
}

@ -8,6 +8,7 @@ class AppTracker {
static let launchCountForCurrentBuild = "launchCountForCurrentBuild-" + String(Bundle.main.buildNumberInt)
static let completedSharing = "completedSharing"
static let completedRating = "completedRating"
static let completedPromptForNewsletter = "completedPromptForNewsletter"
}
let defaults: UserDefaults
@ -27,6 +28,11 @@ class AppTracker {
set { return defaults.set(newValue, forKey: Keys.completedRating) }
}
var hasCompletedPromptForNewsletter: Bool {
get { defaults.bool(forKey: Keys.completedPromptForNewsletter) }
set { defaults.set(newValue, forKey: Keys.completedPromptForNewsletter) }
}
var completedSharing: Bool {
get { return defaults.bool(forKey: Keys.completedSharing) }
set { return defaults.set(newValue, forKey: Keys.completedSharing) }
@ -49,6 +55,7 @@ class AppTracker {
launchCountForCurrentBuild: \(launchCountForCurrentBuild)
completedRating: \(completedRating)
completedSharing: \(completedSharing)
completedPromptForNewsletter: \(hasCompletedPromptForNewsletter)
"""
}
}

@ -641,3 +641,7 @@ You can check the latest gas price on gasnow.org";
"addrpcServer.chainIdAlreadySupported" = "Already supported. Enable this server instead";
"addrpcServer.rpcUrl.placeholder" = "New RPC Network";
"addrpcServer.blockExplorerUrl.placeholder" = "Block Explorer";
"emailList.prompt.title" = "Stay Updated";
"emailList.prompt.message" = "We send an email announcing major features. Would you like to receive such emails?\n\n(We do not spam)";
"emailList.prompt.subscribeButtonTitle" = "I want to receive such emails";
"emailList.prompt.email.placeholder" = "Email";

@ -639,3 +639,7 @@ You can check the latest gas price on gasnow.org";
"addrpcServer.chainIdAlreadySupported" = "Already supported. Enable this server instead";
"addrpcServer.rpcUrl.placeholder" = "New RPC Network";
"addrpcServer.blockExplorerUrl.placeholder" = "Block Explorer";
"emailList.prompt.title" = "Stay Updated";
"emailList.prompt.message" = "We send an email announcing major features. Would you like to receive such emails?\n\n(We do not spam)";
"emailList.prompt.subscribeButtonTitle" = "I want to receive such emails";
"emailList.prompt.email.placeholder" = "Email";

@ -639,3 +639,7 @@ You can check the latest gas price on gasnow.org";
"addrpcServer.chainIdAlreadySupported" = "Already supported. Enable this server instead";
"addrpcServer.rpcUrl.placeholder" = "New RPC Network";
"addrpcServer.blockExplorerUrl.placeholder" = "Block Explorer";
"emailList.prompt.title" = "Stay Updated";
"emailList.prompt.message" = "We send an email announcing major features. Would you like to receive such emails?\n\n(We do not spam)";
"emailList.prompt.subscribeButtonTitle" = "I want to receive such emails";
"emailList.prompt.email.placeholder" = "Email";

@ -639,3 +639,7 @@ You can check the latest gas price on gasnow.org";
"addrpcServer.chainIdAlreadySupported" = "Already supported. Enable this server instead";
"addrpcServer.rpcUrl.placeholder" = "New RPC Network";
"addrpcServer.blockExplorerUrl.placeholder" = "Block Explorer";
"emailList.prompt.title" = "Stay Updated";
"emailList.prompt.message" = "We send an email announcing major features. Would you like to receive such emails?\n\n(We do not spam)";
"emailList.prompt.subscribeButtonTitle" = "I want to receive such emails";
"emailList.prompt.email.placeholder" = "Email";

@ -639,3 +639,7 @@ You can check the latest gas price on gasnow.org";
"addrpcServer.chainIdAlreadySupported" = "Already supported. Enable this server instead";
"addrpcServer.rpcUrl.placeholder" = "New RPC Network";
"addrpcServer.blockExplorerUrl.placeholder" = "Block Explorer";
"emailList.prompt.title" = "Stay Updated";
"emailList.prompt.message" = "We send an email announcing major features. Would you like to receive such emails?\n\n(We do not spam)";
"emailList.prompt.subscribeButtonTitle" = "I want to receive such emails";
"emailList.prompt.email.placeholder" = "Email";

@ -22,14 +22,42 @@ class HelpUsCoordinator: Coordinator {
func start() {
switch appTracker.launchCountForCurrentBuild {
case 6 where !appTracker.completedRating:
rateUs()
rateUsOrSubscribeToNewsletter()
case 12 where !appTracker.completedSharing:
wellDone()
default: break
}
}
func rateUs() {
func rateUsOrSubscribeToNewsletter() {
if Features.isPromptForEmailListSubscriptionEnabled && appTracker.launchCountForCurrentBuild > 3 && !appTracker.hasCompletedPromptForNewsletter {
promptSubscribeToNewsletter()
} else {
rateUs()
}
}
private func promptSubscribeToNewsletter() {
guard !appTracker.hasCompletedPromptForNewsletter else { return }
appTracker.hasCompletedPromptForNewsletter = true
let controller = UIAlertController.alertController(title: R.string.localizable.emailListPromptTitle(), message: R.string.localizable.emailListPromptMessage(), style: .alert, in: navigationController)
controller.addTextField { textField in
textField.placeholder = R.string.localizable.emailListPromptEmailPlaceholder()
}
//Intentionally hold strong reference to self for UIAlertAction to work. Making `self` weak requires current coordinator to be retained; too easy to forgot
let subscribeAction = UIAlertAction(title: R.string.localizable.emailListPromptSubscribeButtonTitle(), style: .default, handler: { action in
guard let email = controller.textFields?.first?.text else { return }
EmailList(listSpecificKey: Constants.Credentials.mailChimpListSpecificKey).subscribe(email: email)
})
controller.addAction(subscribeAction)
let cancelAction = UIAlertAction(title: R.string.localizable.cancel(), style: .cancel)
controller.addAction(cancelAction)
navigationController.present(controller, animated: true, completion: nil)
}
private func rateUs() {
SKStoreReviewController.requestReview()
appTracker.completedRating = true
}

@ -206,4 +206,4 @@ extension AddCustomChain.functional {
}
}
}
}
}

@ -9,5 +9,6 @@ extension Constants {
static let analyticsKey = ""
static let paperTrail = (host: "", port: UInt(0))
static let taiChiRPCKey = ""
static let mailChimpListSpecificKey = ""
}
}

@ -161,9 +161,9 @@ class TransactionConfirmationCoordinator: Coordinator {
}
}
private func askUserToRateApp() {
private func askUserToRateAppOrSubscribeToNewsletter() {
let coordinator = HelpUsCoordinator(navigationController: navigationController, appTracker: AppTracker())
coordinator.rateUs()
coordinator.rateUsOrSubscribeToNewsletter()
}
}
@ -186,7 +186,7 @@ extension TransactionConfirmationCoordinator: TransactionConfirmationViewControl
}.done { result in
self.showSuccess(result: result)
self.logCompleteActionSheetForTransactionConfirmationSuccessfully()
self.askUserToRateApp()
self.askUserToRateAppOrSubscribeToNewsletter()
}.catch { error in
self.logActionSheetForTransactionConfirmationFailed()
//TODO remove delay which is currently needed because the starting animation may not have completed and internal state (whether animation is running) is in correct

Loading…
Cancel
Save