2
0

Build fixes, improvements and project cleanup.

This commit is contained in:
Maarten Billemont
2018-02-10 23:29:55 -05:00
parent b5134a9faf
commit e40a442a30
16 changed files with 154 additions and 114 deletions

View File

@@ -225,7 +225,7 @@
- (void)copyAnswer:(NSString *)answer {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
if ([pasteboard respondsToSelector:@selector( setItems:options: )]) {
if (@available(iOS 10.0, *)) {
[pasteboard setItems:@[ @{ UIPasteboardTypeAutomatic: answer } ]
options:@{
UIPasteboardOptionLocalOnly : @NO,

View File

@@ -55,20 +55,21 @@
[self.views[self.nextView++] setVisible:YES];
}];
self.viewTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 block:^(NSTimer *timer) {
self.viewProgress.progress += 1.0f / 50;
if (self.viewProgress.progress == 1)
[UIView animateWithDuration:0.3f animations:^{
self.viewProgress.progress = 0;
[self.views[self.nextView++] setVisible:YES];
if (self.nextView >= [self.views count]) {
[self.viewTimer invalidate];
self.viewProgress.visible = NO;
}
}];
} repeats:YES];
if (@available(iOS 10.0, *))
self.viewTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 repeats:YES block:^(NSTimer *timer) {
self.viewProgress.progress += 1.0f / 50;
if (self.viewProgress.progress == 1)
[UIView animateWithDuration:0.3f animations:^{
self.viewProgress.progress = 0;
[self.views[self.nextView++] setVisible:YES];
if (self.nextView >= [self.views count]) {
[self.viewTimer invalidate];
self.viewProgress.visible = NO;
}
}];
}];
}
- (UIStatusBarStyle)preferredStatusBarStyle {

View File

@@ -92,7 +92,7 @@
return;
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
if ([pasteboard respondsToSelector:@selector( setItems:options: )])
if (@available(iOS 10.0, *))
[pasteboard setItems:@[ @{ UIPasteboardTypeAutomatic: sitePassword } ]
options:@{
UIPasteboardOptionLocalOnly : @NO,

View File

@@ -677,7 +677,7 @@
[self.window endEditing:YES];
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
if ([pasteboard respondsToSelector:@selector( setItems:options: )]) {
if (@available(iOS 10.0, *)) {
[pasteboard setItems:@[ @{ UIPasteboardTypeAutomatic: password } ]
options:@{
UIPasteboardOptionLocalOnly : @NO,

View File

@@ -83,7 +83,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
NSURL *pasteboardURL = nil;
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
if ([pasteboard respondsToSelector:@selector( hasURLs )])
if (@available(iOS 10.0, *))
pasteboardURL = pasteboard.hasURLs? pasteboard.URL: nil;
else
pasteboardURL = [NSURL URLWithString:pasteboard.string];
@@ -352,7 +352,7 @@ typedef NS_OPTIONS( NSUInteger, MPPasswordsTips ) {
} );
} );
[MPiOSAppDelegate managedObjectContextChanged:^(NSDictionary<NSManagedObjectID *, NSString *> *affectedObjects) {
[[MPiOSAppDelegate get] managedObjectContextChanged:^(NSDictionary<NSManagedObjectID *, NSString *> *affectedObjects) {
[MPiOSAppDelegate managedObjectContextForMainThreadPerformBlock:^(NSManagedObjectContext *mainContext) {
// TODO: either move this into the app delegate or remove the duplicate signOutAnimated: call from the app delegate.
if (![[MPiOSAppDelegate get] activeUserInContext:mainContext])

View File

@@ -697,7 +697,7 @@ referenceSizeForFooterInSection:(NSInteger)section {
} );
if ((self.contextChangedObserver
= [MPiOSAppDelegate managedObjectContextChanged:^(NSDictionary<NSManagedObjectID *, NSString *> *affectedObjects) {
= [[MPiOSAppDelegate get] managedObjectContextChanged:^(NSDictionary<NSManagedObjectID *, NSString *> *affectedObjects) {
if ([[[affectedObjects allKeys] filteredArrayUsingPredicate:
[NSPredicate predicateWithBlock:^BOOL(NSManagedObjectID *objectID, NSDictionary *bindings) {
return [objectID.entity.name isEqualToString:NSStringFromClass( [MPUserEntity class] )];