built basic NSUserDefaults key translation into migrate_ios_v1() function. bundle id changed for ios build.

Tanner Silva committed Sep 21, 2020 at 23:06 UTC ab9c6a0f57bfbec5e3845bb5e52b7feabc57f2a5
6 files changed +74 -65
cw_monero/pubspec.lock
+23 -58
@@ -1,27 +1,13 @@
1 # Generated by pub
2 # See https://dart.dev/tools/pub/glossary#lockfile
3 packages:
4 - archive:
5 - dependency: transitive
6 - description:
7 - name: archive
8 - url: "https://pub.dartlang.org"
9 - source: hosted
10 - version: "2.0.13"
11 - args:
12 - dependency: transitive
13 - description:
14 - name: args
15 - url: "https://pub.dartlang.org"
16 - source: hosted
17 - version: "1.6.0"
4 async:
5 dependency: transitive
6 description:
7 name: async
8 url: "https://pub.dartlang.org"
9 source: hosted
24 - version: "2.4.1"
10 + version: "2.4.2"
11 boolean_selector:
12 dependency: transitive
13 description:
@@ -29,6 +15,13 @@ packages:
15 url: "https://pub.dartlang.org"
16 source: hosted
17 version: "2.0.0"
18 + characters:
19 + dependency: transitive
20 + description:
21 + name: characters
22 + url: "https://pub.dartlang.org"
23 + source: hosted
24 + version: "1.0.0"
25 charcode:
26 dependency: transitive
27 description:
@@ -36,27 +29,27 @@ packages:
29 url: "https://pub.dartlang.org"
30 source: hosted
31 version: "1.1.3"
39 - collection:
32 + clock:
33 dependency: transitive
34 description:
42 - name: collection
35 + name: clock
36 url: "https://pub.dartlang.org"
37 source: hosted
45 - version: "1.14.12"
46 - convert:
38 + version: "1.0.1"
39 + collection:
40 dependency: transitive
41 description:
49 - name: convert
42 + name: collection
43 url: "https://pub.dartlang.org"
44 source: hosted
52 - version: "2.1.1"
53 - crypto:
45 + version: "1.14.13"
46 + fake_async:
47 dependency: transitive
48 description:
56 - name: crypto
49 + name: fake_async
50 url: "https://pub.dartlang.org"
51 source: hosted
59 - version: "2.1.4"
52 + version: "1.1.0"
53 ffi:
54 dependency: "direct main"
55 description:
@@ -74,20 +67,13 @@ packages:
67 description: flutter
68 source: sdk
69 version: "0.0.0"
77 - image:
78 - dependency: transitive
79 - description:
80 - name: image
81 - url: "https://pub.dartlang.org"
82 - source: hosted
83 - version: "2.1.12"
70 matcher:
71 dependency: transitive
72 description:
73 name: matcher
74 url: "https://pub.dartlang.org"
75 source: hosted
90 - version: "0.12.6"
76 + version: "0.12.8"
77 meta:
78 dependency: transitive
79 description:
@@ -101,7 +87,7 @@ packages:
87 name: path
88 url: "https://pub.dartlang.org"
89 source: hosted
104 - version: "1.6.4"
90 + version: "1.7.0"
91 path_provider:
92 dependency: "direct main"
93 description:
@@ -109,13 +95,6 @@ packages:
95 url: "https://pub.dartlang.org"
96 source: hosted
97 version: "1.4.0"
112 - petitparser:
113 - dependency: transitive
114 - description:
115 - name: petitparser
116 - url: "https://pub.dartlang.org"
117 - source: hosted
118 - version: "2.4.0"
98 platform:
99 dependency: transitive
100 description:
@@ -123,13 +102,6 @@ packages:
102 url: "https://pub.dartlang.org"
103 source: hosted
104 version: "2.2.1"
126 - quiver:
127 - dependency: transitive
128 - description:
129 - name: quiver
130 - url: "https://pub.dartlang.org"
131 - source: hosted
132 - version: "2.1.3"
105 sky_engine:
106 dependency: transitive
107 description: flutter
@@ -148,7 +120,7 @@ packages:
120 name: stack_trace
121 url: "https://pub.dartlang.org"
122 source: hosted
151 - version: "1.9.3"
123 + version: "1.9.5"
124 stream_channel:
125 dependency: transitive
126 description:
@@ -176,14 +148,14 @@ packages:
148 name: test_api
149 url: "https://pub.dartlang.org"
150 source: hosted
179 - version: "0.2.15"
151 + version: "0.2.17"
152 typed_data:
153 dependency: transitive
154 description:
155 name: typed_data
156 url: "https://pub.dartlang.org"
157 source: hosted
186 - version: "1.1.6"
158 + version: "1.2.0"
159 vector_math:
160 dependency: transitive
161 description:
@@ -191,13 +163,6 @@ packages:
163 url: "https://pub.dartlang.org"
164 source: hosted
165 version: "2.0.8"
194 - xml:
195 - dependency: transitive
196 - description:
197 - name: xml
198 - url: "https://pub.dartlang.org"
199 - source: hosted
200 - version: "3.6.1"
166 sdks:
202 - dart: ">=2.6.0 <3.0.0"
167 + dart: ">=2.9.0-14.0.dev <3.0.0"
168 flutter: ">=0.1.4 <2.0.0"
ios/Flutter/.last_build_id
+1 -1
@@ -1 +1 @@
1 -a2dce69f54a78f5b00e19850e4b2d402
\ No newline at end of file
1 +f88b397cc50258e916c86427fe071d09
\ No newline at end of file
ios/Podfile.lock
+1 -1
@@ -159,4 +159,4 @@ SPEC CHECKSUMS:
159
160 PODFILE CHECKSUM: c34e2287a9ccaa606aeceab922830efb9a6ff69a
161
162 -COCOAPODS: 1.9.3
162 +COCOAPODS: 1.8.4
ios/Runner.xcodeproj/project.pbxproj
+3 -3
@@ -418,7 +418,7 @@
418 "$(PROJECT_DIR)/Flutter",
419 );
420 MARKETING_VERSION = 3.2.0;
421 - PRODUCT_BUNDLE_IDENTIFIER = com.cakewallet.cakewallet;
421 + PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
422 PRODUCT_NAME = "$(TARGET_NAME)";
423 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
424 SWIFT_VERSION = 5.0;
@@ -552,7 +552,7 @@
552 "$(PROJECT_DIR)/Flutter",
553 );
554 MARKETING_VERSION = 3.2.0;
555 - PRODUCT_BUNDLE_IDENTIFIER = com.cakewallet.cakewallet;
555 + PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
556 PRODUCT_NAME = "$(TARGET_NAME)";
557 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
558 SWIFT_OPTIMIZATION_LEVEL = "-Onone";
@@ -583,7 +583,7 @@
583 "$(PROJECT_DIR)/Flutter",
584 );
585 MARKETING_VERSION = 3.2.0;
586 - PRODUCT_BUNDLE_IDENTIFIER = com.cakewallet.cakewallet;
586 + PRODUCT_BUNDLE_IDENTIFIER = com.fotolockr.cakewallet;
587 PRODUCT_NAME = "$(TARGET_NAME)";
588 SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
589 SWIFT_VERSION = 5.0;
ios/Runner/Info.plist
+2 -2
@@ -2,8 +2,6 @@
2 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3 <plist version="1.0">
4 <dict>
5 - <key>NSFaceIDUsageDescription</key>
6 - <string>Enable Face ID for fast and secure access to wallets and private keys</string>
5 <key>CFBundleDevelopmentRegion</key>
6 <string>$(DEVELOPMENT_LANGUAGE)</string>
7 <key>CFBundleExecutable</key>
@@ -26,6 +24,8 @@
24 <true/>
25 <key>NSCameraUsageDescription</key>
26 <string>Used for scan QR code</string>
27 + <key>NSFaceIDUsageDescription</key>
28 + <string>Enable Face ID for fast and secure access to wallets and private keys</string>
29 <key>UILaunchStoryboardName</key>
30 <string>LaunchScreen</string>
31 <key>UIMainStoryboardFile</key>
lib/src/domain/common/fs_migration.dart
+44
@@ -5,6 +5,8 @@ import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
5 import 'package:cake_wallet/src/domain/common/wallet_info.dart';
6 import 'package:cake_wallet/src/domain/common/wallet_type.dart';
7 import 'package:cake_wallet/src/domain/exchange/trade.dart';
8 +import 'package:flutter_secure_storage/flutter_secure_storage.dart';
9 +import 'package:shared_preferences/shared_preferences.dart';
10 import 'package:flutter/foundation.dart';
11 import 'package:hive/hive.dart';
12 import 'package:path_provider/path_provider.dart';
@@ -20,6 +22,48 @@ Future<void> migrate_android_v1() async {
22
23 Future<void> migrate_ios_v1() async {
24 final appDocDir = await getApplicationDocumentsDirectory();
25 + //get the new shared preferences instance
26 + SharedPreferences prefs = await SharedPreferences.getInstance();
27 +
28 + //translate the node uri
29 + String nodeURI = prefs.getString('node_uri');
30 + await prefs.setString('current_node_id', nodeURI);
31 +
32 + //should we provide default btc node key?
33 + int activeCurrency = prefs.getInt('currency');
34 + await prefs.setInt('current_fiat_currency', activeCurrency);
35 +
36 + //translate fee priority
37 + int activeFeeTier = prefs.getInt('saved_fee_priority');
38 + await prefs.setInt('current_fee_priority', activeFeeTier);
39 +
40 + //translate current balance mode
41 + int currentBalanceMode = prefs.getInt('display_balance_mode');
42 + await prefs.setInt('current_balance_display_mode', currentBalanceMode);
43 +
44 + //translate should save recipient address
45 + bool shouldSave = prefs.getBool('should_save_recipient_address');
46 + await prefs.setBool('save_recipient_address', shouldSave);
47 +
48 + //translate biometric
49 + bool biometricOn = prefs.getBool('biometric_authentication_on');
50 + await prefs.setBool('allow_biometrical_authentication', biometricOn);
51 +
52 + //read the current theme as integer, write it back as a bool
53 + int currentTheme = prefs.getInt('current-theme');
54 + bool isDark = false;
55 + if (currentTheme == 1) {
56 + isDark = true;
57 + }
58 + await prefs.setBool('dark_theme', isDark);
59 +
60 + //assign the pin lenght
61 + int pinLength = prefs.getInt('pin-length');
62 + await prefs.setInt('pin-length', pinLength);
63 +
64 + //default value for display list key?
65 + String walletName = prefs.getString('current_wallet_name');
66 + await prefs.setString('current_wallet_name', walletName);
67 }
68
69 Future<void> migrate_hives({Directory appDocDir}) async {