Skip to content

Commit 57e7d3f

Browse files
Merge pull request #134 from Automattic/develop
Simplenote Mark 4.4.3
2 parents 43a2fee + f1bd2bf commit 57e7d3f

File tree

7 files changed

+55
-24
lines changed

7 files changed

+55
-24
lines changed

Simplenote/Classes/SPNoteEditorViewController.m

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ - (instancetype)init {
130130
selector:@selector(didReceiveVoiceOverNotification:)
131131
name:UIAccessibilityVoiceOverStatusChanged
132132
object:nil];
133-
[[NSNotificationCenter defaultCenter] addObserver:self
134-
selector:@selector(applicationWillResignActive:)
135-
name:UIApplicationWillResignActiveNotification
136-
object:nil];
137133
}
138134

139135
return self;
@@ -286,10 +282,6 @@ - (void)willTransitionToTraitCollection:(UITraitCollection *)newCollection withT
286282
[self refreshNavBarSizeWithCoordinator:coordinator];
287283
}
288284

289-
- (void)applicationWillResignActive:(NSNotification *)notification {
290-
[self dismissActivityView];
291-
}
292-
293285
- (void)refreshNavBarSizeWithCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
294286
{
295287
[self resetNavigationBarToIdentityWithAnimation:YES completion:nil];

Simplenote/Classes/SPTagsListViewController.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,6 @@
3434

3535
@property (nonatomic, retain) NSFetchedResultsController *fetchedResultsController;
3636

37+
- (void)removeKeyboardObservers;
3738

3839
@end

Simplenote/Classes/SPTagsListViewController.m

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,6 @@ - (void)viewDidLoad
106106
forCellReuseIdentifier:cellWithIconIdentifier];
107107
[self.tableView setTableHeaderView:[self buildTableHeaderView]];
108108

109-
// Register for keyboard notifications
110-
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
111-
[nc addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
112-
[nc addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
113-
114109
_tagImage = [[UIImage imageNamed:@"icon_tag"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
115110
_settingsImage = [[UIImage imageNamed:@"icon_settings"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
116111
_allNotesImage = [[UIImage imageNamed:@"icon_allnotes"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
@@ -124,6 +119,7 @@ - (void)viewDidLoad
124119
[[UIMenuController sharedMenuController] setMenuItems:@[renameItem]];
125120
[[UIMenuController sharedMenuController] update];
126121

122+
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
127123
[nc addObserver:self selector:@selector(menuDidChangeVisibility:) name:UIMenuControllerDidHideMenuNotification object:nil];
128124
[nc addObserver:self selector:@selector(menuDidChangeVisibility:) name:UIMenuControllerDidShowMenuNotification object:nil];
129125

@@ -133,6 +129,11 @@ - (void)viewDidLoad
133129
- (void)viewWillAppear:(BOOL)animated
134130
{
135131
[super viewWillAppear:animated];
132+
133+
// Register for keyboard notifications
134+
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
135+
[nc addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
136+
[nc addObserver:self selector:@selector(keyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
136137

137138
CGRect tableViewFrame = self.tableView.frame;
138139
tableViewFrame.size.height = self.view.frame.size.height - SPSettingsButtonHeight;
@@ -146,6 +147,19 @@ - (void)viewWillAppear:(BOOL)animated
146147
[self updateHeaderButtonHighlight];
147148
}
148149

150+
- (void)viewWillDisappear:(BOOL)animated {
151+
[super viewWillDisappear:animated];
152+
153+
[self removeKeyboardObservers];
154+
}
155+
156+
- (void)removeKeyboardObservers
157+
{
158+
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
159+
[nc removeObserver: self name:UIKeyboardWillHideNotification object:nil];
160+
[nc removeObserver: self name:UIKeyboardWillShowNotification object:nil];
161+
}
162+
149163
- (VSTheme *)theme {
150164

151165
return [[VSThemeManager sharedManager] theme];
@@ -733,7 +747,6 @@ - (void)delayedReloadData {
733747
#pragma mark KeyboardNotifications
734748

735749
- (void)keyboardWillShow:(NSNotification *)notification {
736-
737750
CGRect keyboardFrame = [(NSValue *)[notification.userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
738751

739752
CGFloat keyboardHeight = MIN(keyboardFrame.size.height, keyboardFrame.size.width);
@@ -750,7 +763,6 @@ - (void)keyboardWillShow:(NSNotification *)notification {
750763
}
751764

752765
- (void)keyboardWillHide:(NSNotification *)notification {
753-
754766
CGRect newFrame = self.tableView.frame;
755767
newFrame.size.height = self.view.superview.frame.size.height - self.view.frame.origin.y - SPSettingsButtonHeight;
756768

Simplenote/SPAppDelegate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
@interface SPAppDelegate : UIResponder <UIApplicationDelegate>
1919

2020
@property (strong, nonatomic) UIWindow *window;
21+
@property (strong, nonatomic) UIWindow *pinLockWindow;
2122

2223
@property (strong, nonatomic, readonly) Simperium *simperium;
2324
@property (strong, nonatomic, readonly) NSManagedObjectContext *managedObjectContext;

Simplenote/SPAppDelegate.m

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#import "GAI.h"
4040
#import "SPTracker.h"
4141

42+
@import Contacts;
4243
@import SSKeychain;
4344
@import Simperium;
4445
@import WordPress_AppbotX;
@@ -325,6 +326,7 @@ - (void)onboardingDidFinish:(NSNotification *)notification
325326

326327
- (void)applicationWillResignActive:(UIApplication *)application
327328
{
329+
[self.tagListViewController removeKeyboardObservers];
328330
[self showPasscodeLockIfNecessary];
329331
UIViewController *viewController = self.window.rootViewController;
330332
[viewController.view setNeedsLayout];
@@ -850,7 +852,7 @@ -(void)showPasscodeLockIfNecessary
850852

851853
NSString *pin = [self getPin:YES];
852854

853-
if (!pin || pin.length == 0 || [[self topMostController] class] == [DTPinLockController class]) {
855+
if (!pin || pin.length == 0 || [self isPresentingPinLock] || [self isRequestingContactsPermission]) {
854856
return;
855857
}
856858

@@ -861,13 +863,21 @@ -(void)showPasscodeLockIfNecessary
861863
controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
862864

863865
// no animation to cover up app right away
864-
[[self topMostController] presentViewController:controller animated:NO completion:nil];
866+
self.pinLockWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
867+
self.pinLockWindow.rootViewController = controller;
868+
[self.pinLockWindow makeKeyAndVisible];
865869
[controller fixLayout];
866870
}
867871

868872
- (void)pinLockControllerDidFinishUnlocking
869873
{
870-
[[self topMostController] dismissViewControllerAnimated:YES completion:nil];
874+
[UIView animateWithDuration:0.3
875+
animations:^{ self.pinLockWindow.alpha = 0.0; }
876+
completion:^(BOOL finished) {
877+
[self.window makeKeyAndVisible];
878+
[self.pinLockWindow removeFromSuperview];
879+
self.pinLockWindow = nil;
880+
}];
871881
}
872882

873883
- (NSString *)getPin:(BOOL)checkLegacy
@@ -896,6 +906,7 @@ - (void)setPin:(NSString *)newPin
896906
- (void)removePin
897907
{
898908
[SSKeychain deletePasswordForService:kSimplenotePinKey account:kSimplenotePinKey];
909+
[self setAllowTouchIDInsteadOfPin:NO];
899910
}
900911

901912
- (BOOL)allowTouchIDInsteadOfPin
@@ -913,6 +924,20 @@ - (void)setAllowTouchIDInsteadOfPin:(BOOL)allowTouchIDInsteadOfPin
913924
[userDefaults synchronize];
914925
}
915926

927+
- (BOOL)isPresentingPinLock
928+
{
929+
return self.pinLockWindow && [self.pinLockWindow isKeyWindow];
930+
}
931+
932+
-(BOOL)isRequestingContactsPermission
933+
{
934+
NSArray *topChildren = self.topMostController.childViewControllers;
935+
BOOL isShowingCollaborators = [topChildren count] > 0 && [topChildren[0] isKindOfClass:[SPAddCollaboratorsViewController class]];
936+
BOOL isNotDeterminedAuth = [CNContactStore authorizationStatusForEntityType:CNEntityTypeContacts] == CNAuthorizationStatusNotDetermined;
937+
938+
return isShowingCollaborators && isNotDeterminedAuth;
939+
}
940+
916941

917942
#pragma mark ================================================================================
918943
#pragma mark App Tracking

Simplenote/Simplenote-Info.plist

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundlePackageType</key>
1818
<string>APPL</string>
1919
<key>CFBundleShortVersionString</key>
20-
<string>4.4.2</string>
20+
<string>4.4.3</string>
2121
<key>CFBundleSignature</key>
2222
<string>????</string>
2323
<key>CFBundleURLTypes</key>
@@ -32,7 +32,7 @@
3232
</dict>
3333
</array>
3434
<key>CFBundleVersion</key>
35-
<string>4423</string>
35+
<string>4430</string>
3636
<key>Fabric</key>
3737
<dict>
3838
<key>APIKey</key>
@@ -60,10 +60,10 @@
6060
</dict>
6161
<key>NSContactsUsageDescription</key>
6262
<string>This app requires contacts access to properly share data with other users.</string>
63-
<key>UILaunchStoryboardName</key>
64-
<string>LaunchScreen</string>
6563
<key>NSPhotoLibraryUsageDescription</key>
6664
<string>This app does not require Photo Library access.</string>
65+
<key>UILaunchStoryboardName</key>
66+
<string>LaunchScreen</string>
6767
<key>UIPrerenderedIcon</key>
6868
<true/>
6969
<key>UIRequiredDeviceCapabilities</key>

SimplenoteShare/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@
2121
<key>CFBundlePackageType</key>
2222
<string>XPC!</string>
2323
<key>CFBundleShortVersionString</key>
24-
<string>4.4.2</string>
24+
<string>4.4.3</string>
2525
<key>CFBundleSignature</key>
2626
<string>????</string>
2727
<key>CFBundleVersion</key>
28-
<string>4423</string>
28+
<string>4430</string>
2929
<key>NSExtension</key>
3030
<dict>
3131
<key>NSExtensionAttributes</key>

0 commit comments

Comments
 (0)