@@ -21,31 +21,108 @@ @interface AutoFillPreferencesViewController ()
21
21
22
22
@property (weak , nonatomic ) IBOutlet UISwitch *switchAutoFill;
23
23
@property (weak , nonatomic ) IBOutlet UISwitch *switchQuickTypeAutoFill;
24
- @property (weak , nonatomic ) IBOutlet UITableViewCell *cellQuickTypeFormat;
25
24
@property (weak , nonatomic ) IBOutlet UILabel *labelQuickTypeFormat;
26
- @property (weak , nonatomic ) IBOutlet UITableViewCell *cellConvenienceAutoUnlock;
27
25
@property (weak , nonatomic ) IBOutlet UILabel *labelConvenienceAutoUnlockTimeout;
28
26
@property (weak , nonatomic ) IBOutlet UISwitch *switchCopyTOTP;
29
27
@property (weak , nonatomic ) IBOutlet UISwitch *switchAutoLaunchSingle;
30
28
@property (weak , nonatomic ) IBOutlet UISwitch *switchShowPinned;
31
29
30
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *cellSystemLevelEnabled;
31
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *cellSystemLevelDisabled;
32
+
33
+
34
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *howTo1;
35
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *howTo2;
36
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *howTo3;
37
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *howTo4;
38
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *howTo5;
39
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *howTo6;
40
+
41
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *cellAllowAutoFill;
42
+
43
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *cellAllowQuickType;
44
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *cellQuickTypeFormat;
45
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *cellCopyTotp;
46
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *cellAutoLaunchDatabase;
47
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *cellAutoSelectSingle;
48
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *cellShowPinned;
49
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *cellConvenienceAutoUnlock;
50
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *cellUseHostOnly;
51
+ @property (weak , nonatomic ) IBOutlet UITableViewCell *cellAddServiceIds;
52
+
32
53
@end
33
54
34
55
@implementation AutoFillPreferencesViewController
35
56
57
+ - (void )dealloc {
58
+ [NSNotificationCenter .defaultCenter removeObserver: self ];
59
+ }
60
+
36
61
- (void )viewDidLoad {
37
62
[super viewDidLoad ];
38
63
64
+ [NSNotificationCenter .defaultCenter addObserver: self
65
+ selector: @selector (bind )
66
+ name: UIApplicationDidBecomeActiveNotification
67
+ object: nil ];
68
+
39
69
[self bind ];
40
70
}
41
71
42
72
- (void )bind {
43
- self.autoProceed .on = AppPreferences.sharedInstance .autoProceedOnSingleMatch ;
44
- self.addServiceIds .on = AppPreferences.sharedInstance .storeAutoFillServiceIdentifiersInNotes ;
45
- self.useHostOnlyUrl .on = !AppPreferences.sharedInstance .useFullUrlAsURLSuggestion ;
73
+ BOOL onForStrongbox = AutoFillManager.sharedInstance .isOnForStrongbox ;
74
+
75
+
76
+
77
+ UIImage* check;
78
+ UIImage* notCheck;
79
+
80
+ if (@available (iOS 13.0 , *)) {
81
+ check = [UIImage systemImageNamed: @" checkmark.circle" ];
82
+ notCheck = [UIImage systemImageNamed: @" exclamationmark.triangle" ];
83
+ } else {
84
+ check = [UIImage imageNamed: @" ok" ];
85
+ notCheck = [UIImage imageNamed: @" error" ];
86
+ }
87
+
88
+ self.cellSystemLevelEnabled .imageView .image = check;
89
+ self.cellSystemLevelEnabled .imageView .tintColor = UIColor.systemGreenColor ;
90
+
91
+ self.cellSystemLevelDisabled .imageView .image = notCheck;
92
+ self.cellSystemLevelDisabled .imageView .tintColor = UIColor.systemOrangeColor ;
93
+
94
+ [self cell: self .cellSystemLevelEnabled setHidden: !onForStrongbox];
95
+ [self cell: self .cellSystemLevelDisabled setHidden: onForStrongbox];
96
+
97
+
46
98
99
+ [self cell: self .howTo1 setHidden: onForStrongbox];
100
+ [self cell: self .howTo2 setHidden: onForStrongbox];
101
+ [self cell: self .howTo3 setHidden: onForStrongbox];
102
+ [self cell: self .howTo4 setHidden: onForStrongbox];
103
+ [self cell: self .howTo5 setHidden: onForStrongbox];
104
+ [self cell: self .howTo6 setHidden: onForStrongbox];
105
+
106
+
107
+
108
+ [self cell: self .cellAllowAutoFill setHidden: !onForStrongbox];
109
+
47
110
self.switchAutoFill .on = self.viewModel .metadata .autoFillEnabled ;
48
111
112
+ BOOL on = onForStrongbox && self.viewModel .metadata .autoFillEnabled ;
113
+
114
+
115
+
116
+ [self cell: self .cellAllowQuickType setHidden: !on];
117
+ [self cell: self .cellQuickTypeFormat setHidden: !on];
118
+ [self cell: self .cellCopyTotp setHidden: !on];
119
+ [self cell: self .cellAutoLaunchDatabase setHidden: !on];
120
+ [self cell: self .cellAutoSelectSingle setHidden: !on];
121
+ [self cell: self .cellShowPinned setHidden: !on];
122
+ [self cell: self .cellConvenienceAutoUnlock setHidden: !on];
123
+ [self cell: self .cellUseHostOnly setHidden: !on];
124
+ [self cell: self .cellAddServiceIds setHidden: !on];
125
+
49
126
50
127
51
128
self.switchQuickTypeAutoFill .on = self.viewModel .metadata .autoFillEnabled && self.viewModel .metadata .quickTypeEnabled ;
@@ -62,6 +139,14 @@ - (void)bind {
62
139
self.labelQuickTypeFormat .textColor = self.switchQuickTypeAutoFill .on ? UIColor.blackColor : UIColor.lightGrayColor ;
63
140
}
64
141
142
+
143
+
144
+
145
+ self.autoProceed .on = AppPreferences.sharedInstance .autoProceedOnSingleMatch ;
146
+ self.switchCopyTOTP .on = self.viewModel .metadata .autoFillCopyTotp ;
147
+ self.switchAutoLaunchSingle .on = AppPreferences.sharedInstance .autoFillAutoLaunchSingleDatabase ;
148
+ self.switchShowPinned .on = AppPreferences.sharedInstance .autoFillShowPinned ;
149
+
65
150
66
151
67
152
self.cellConvenienceAutoUnlock .userInteractionEnabled = self.viewModel .metadata .autoFillEnabled ;
@@ -76,15 +161,10 @@ - (void)bind {
76
161
77
162
78
163
79
- self.switchAutoLaunchSingle .on = AppPreferences.sharedInstance .autoFillAutoLaunchSingleDatabase ;
80
-
81
-
82
-
83
- self.switchCopyTOTP .on = self.viewModel .metadata .autoFillCopyTotp ;
84
-
85
-
164
+ self.addServiceIds .on = AppPreferences.sharedInstance .storeAutoFillServiceIdentifiersInNotes ;
165
+ self.useHostOnlyUrl .on = !AppPreferences.sharedInstance .useFullUrlAsURLSuggestion ;
86
166
87
- self. switchShowPinned . on = AppPreferences. sharedInstance . autoFillShowPinned ;
167
+ [ self reloadDataAnimated: YES ] ;
88
168
}
89
169
90
170
static NSString * stringForConvenienceAutoUnlock (NSInteger val) {
0 commit comments