mirror of
https://github.com/lil-org/wallet.git
synced 2025-01-04 02:24:39 +03:00
Prompt Safari extension for legacy users
This commit is contained in:
parent
49ade45aa4
commit
8ec9ed5883
@ -26,6 +26,7 @@
|
||||
2C1995472674C4BA00A8E370 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 2C1995452674C4BA00A8E370 /* Main.storyboard */; };
|
||||
2C1995562674D0F300A8E370 /* Ethereum.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C1995552674D0F300A8E370 /* Ethereum.swift */; };
|
||||
2C208A9F26813408005BA500 /* Secrets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C208A9E26813408005BA500 /* Secrets.swift */; };
|
||||
2C3B7F022756A08600931264 /* Identifiers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C3B7F012756A08600931264 /* Identifiers.swift */; };
|
||||
2C528A16267FA8EB00CA3ADD /* Defaults.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C528A15267FA8EB00CA3ADD /* Defaults.swift */; };
|
||||
2C5FF97226C84F7B00B32ACC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C5FF97126C84F7B00B32ACC /* AppDelegate.swift */; };
|
||||
2C5FF97426C84F7B00B32ACC /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C5FF97326C84F7B00B32ACC /* SceneDelegate.swift */; };
|
||||
@ -125,6 +126,7 @@
|
||||
2C1995492674C4BA00A8E370 /* Tokenary.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Tokenary.entitlements; sourceTree = "<group>"; };
|
||||
2C1995552674D0F300A8E370 /* Ethereum.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Ethereum.swift; sourceTree = "<group>"; };
|
||||
2C208A9E26813408005BA500 /* Secrets.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Secrets.swift; sourceTree = "<group>"; };
|
||||
2C3B7F012756A08600931264 /* Identifiers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Identifiers.swift; sourceTree = "<group>"; };
|
||||
2C4E26BD27564EB000265DCC /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
|
||||
2C528A15267FA8EB00CA3ADD /* Defaults.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Defaults.swift; sourceTree = "<group>"; };
|
||||
2C56E8F9274D606100FBC0FB /* rpc.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = rpc.js; path = "web3-provider/rpc.js"; sourceTree = "<group>"; };
|
||||
@ -290,6 +292,7 @@
|
||||
2C528A15267FA8EB00CA3ADD /* Defaults.swift */,
|
||||
2C8A09D32675184700993638 /* Window.swift */,
|
||||
2C901C492689F01700D0926A /* Strings.swift */,
|
||||
2C3B7F012756A08600931264 /* Identifiers.swift */,
|
||||
0DC850E926B73A8200809E82 /* Models */,
|
||||
2CD0668826B213BB00728C20 /* Wallets */,
|
||||
2C6706A7267A6C04006AAEF2 /* Extensions */,
|
||||
@ -724,6 +727,7 @@
|
||||
2CAA412526C7CD93009F3535 /* ReviewRequester.swift in Sources */,
|
||||
2CD0669126B5537B00728C20 /* TokenaryWallet.swift in Sources */,
|
||||
2C0EE4022753874D00AC2AFA /* PeerMeta.swift in Sources */,
|
||||
2C3B7F022756A08600931264 /* Identifiers.swift in Sources */,
|
||||
2C8A09D726751A0C00993638 /* WalletConnect.swift in Sources */,
|
||||
2C9F0B6826BDCB2E008FA3D6 /* EthereumChain.swift in Sources */,
|
||||
2C03D1D2269B407900EF10EA /* NetworkMonitor.swift in Sources */,
|
||||
|
@ -190,8 +190,8 @@ class Agent: NSObject {
|
||||
}
|
||||
}
|
||||
|
||||
@objc private func enableSafariExtension() {
|
||||
SFSafariApplication.showPreferencesForExtension(withIdentifier: "mac.tokenary.io.Safari")
|
||||
@objc func enableSafariExtension() {
|
||||
SFSafariApplication.showPreferencesForExtension(withIdentifier: Identifiers.safariExtensionBundle)
|
||||
}
|
||||
|
||||
@objc private func didSelectMailMenuItem() {
|
||||
|
@ -15,6 +15,15 @@ struct Defaults {
|
||||
}
|
||||
}
|
||||
|
||||
static var shouldPromptSafariForLegacyUsers: Bool {
|
||||
get {
|
||||
return userDefaults.bool(forKey: "shouldPromptSafariForLegacyUsers")
|
||||
}
|
||||
set {
|
||||
userDefaults.set(newValue, forKey: "shouldPromptSafariForLegacyUsers")
|
||||
}
|
||||
}
|
||||
|
||||
static var didMigrateKeychainFromTokenaryV1: Bool {
|
||||
get {
|
||||
return userDefaults.bool(forKey: "didMigrateKeychainFromTokenaryV1")
|
||||
|
9
Tokenary/Identifiers.swift
Normal file
9
Tokenary/Identifiers.swift
Normal file
@ -0,0 +1,9 @@
|
||||
// Copyright © 2021 Tokenary. All rights reserved.
|
||||
|
||||
import Foundation
|
||||
|
||||
struct Identifiers {
|
||||
|
||||
static let safariExtensionBundle = "mac.tokenary.io.Safari"
|
||||
|
||||
}
|
@ -68,6 +68,13 @@ class AccountsListViewController: NSViewController {
|
||||
super.viewDidAppear()
|
||||
blinkNewWalletCellIfNeeded()
|
||||
view.window?.delegate = self
|
||||
promptSafariForLegacyUsersIfNeeded()
|
||||
}
|
||||
|
||||
private func promptSafariForLegacyUsersIfNeeded() {
|
||||
guard Defaults.shouldPromptSafariForLegacyUsers else { return }
|
||||
Defaults.shouldPromptSafariForLegacyUsers = false
|
||||
Alert.showSafariPrompt()
|
||||
}
|
||||
|
||||
private func callCompletion(wallet: TokenaryWallet?) {
|
||||
|
@ -20,4 +20,15 @@ class Alert: NSAlert {
|
||||
_ = alert.runModal()
|
||||
}
|
||||
|
||||
static func showSafariPrompt() {
|
||||
let alert = Alert()
|
||||
alert.messageText = "Would you like to try brand new Tokenary for Safari?"
|
||||
alert.alertStyle = .informational
|
||||
alert.addButton(withTitle: "Enable Safari extension")
|
||||
alert.addButton(withTitle: Strings.cancel)
|
||||
if alert.runModal() == .alertFirstButtonReturn {
|
||||
Agent.shared.enableSafariExtension()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ final class WalletsManager {
|
||||
coin: .ethereum,
|
||||
onlyToKeychain: true)
|
||||
}
|
||||
Defaults.shouldPromptSafariForLegacyUsers = true
|
||||
}
|
||||
Defaults.didMigrateKeychainFromTokenaryV1 = true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user