Push notifications support & remove Test configuration.
This commit is contained in:
@@ -23,8 +23,6 @@
|
||||
|
||||
@interface MPStoreViewController : UITableViewController
|
||||
|
||||
+ (NSString *)latestStoreFeatures;
|
||||
|
||||
@end
|
||||
|
||||
@interface MPStoreProductCell : UITableViewCell
|
||||
|
@@ -35,25 +35,6 @@ PearlEnum( MPDevelopmentFuelConsumption,
|
||||
|
||||
@implementation MPStoreViewController
|
||||
|
||||
+ (NSString *)latestStoreFeatures {
|
||||
|
||||
NSMutableString *features = [NSMutableString string];
|
||||
NSArray *storeVersions = @[
|
||||
@"Generated Usernames\nSecurity Question Answers",
|
||||
@"Biometrics Support",
|
||||
];
|
||||
NSInteger storeVersion = [[NSUserDefaults standardUserDefaults] integerForKey:@"storeVersion"];
|
||||
for (; storeVersion < [storeVersions count]; ++storeVersion)
|
||||
[features appendFormat:@"%@\n", storeVersions[(NSUInteger)storeVersion]];
|
||||
if (![features length])
|
||||
return nil;
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] setInteger:storeVersion forKey:@"storeVersion"];
|
||||
if (![[NSUserDefaults standardUserDefaults] synchronize])
|
||||
wrn( @"Couldn't synchronize store version update." );
|
||||
return features;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
|
||||
[super viewDidLoad];
|
||||
|
@@ -216,11 +216,12 @@ typedef NS_ENUM( NSUInteger, MPActiveUserState ) {
|
||||
self.entryField.enabled = NO;
|
||||
MPAvatarCell *avatarCell = [self selectedAvatar];
|
||||
avatarCell.spinnerActive = YES;
|
||||
NSIndexPath *avatarPath = [self.avatarCollectionView indexPathForCell:avatarCell];
|
||||
NSUInteger newUserAvatar = avatarCell.avatar;
|
||||
NSString *newUserName = avatarCell.name;
|
||||
if (![MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
|
||||
BOOL isNew = NO;
|
||||
MPUserEntity *user = [self userForAvatar:avatarCell inContext:context isNew:&isNew];
|
||||
MPUserEntity *user = [self userForIndexPath:avatarPath inContext:context isNew:&isNew];
|
||||
if (isNew) {
|
||||
user = [MPUserEntity insertNewObjectInContext:context];
|
||||
user.algorithm = MPAlgorithmDefault;
|
||||
@@ -424,7 +425,8 @@ referenceSizeForFooterInSection:(NSInteger)section {
|
||||
NSManagedObjectContext *mainContext = [MPiOSAppDelegate managedObjectContextForMainThreadIfReady];
|
||||
|
||||
BOOL isNew = NO;
|
||||
MPUserEntity *user = [self userForAvatar:avatarCell inContext:mainContext isNew:&isNew];
|
||||
MPUserEntity *user = [self userForIndexPath:[self.avatarCollectionView indexPathForCell:avatarCell]
|
||||
inContext:mainContext isNew:&isNew];
|
||||
if (isNew || !user)
|
||||
return;
|
||||
|
||||
@@ -577,12 +579,7 @@ referenceSizeForFooterInSection:(NSInteger)section {
|
||||
return nil;
|
||||
}
|
||||
|
||||
return [self userForAvatar:selectedAvatar inContext:context isNew:isNew];
|
||||
}
|
||||
|
||||
- (MPUserEntity *)userForAvatar:(MPAvatarCell *)cell inContext:(NSManagedObjectContext *)context isNew:(BOOL *)isNew {
|
||||
|
||||
return [self userForIndexPath:[self.avatarCollectionView indexPathForCell:cell] inContext:context isNew:isNew];
|
||||
return [self userForIndexPath:[self.avatarCollectionView indexPathForCell:selectedAvatar] inContext:context isNew:isNew];
|
||||
}
|
||||
|
||||
- (MPUserEntity *)userForIndexPath:(NSIndexPath *)indexPath inContext:(NSManagedObjectContext *)context isNew:(BOOL *)isNew {
|
||||
|
@@ -209,20 +209,31 @@ void mpw_log_sink_pearl(const MPLogEvent *record) {
|
||||
}
|
||||
} );
|
||||
|
||||
PearlMainQueue( ^{
|
||||
if (@available( iOS 12, * )) {
|
||||
[Countly.sharedInstance askForNotificationPermissionWithOptions:UNAuthorizationOptionProvisional completionHandler:
|
||||
^(BOOL granted, NSError *error) {
|
||||
inf( @"provisional: %d: %@", granted, error );
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
PearlMainQueueOperation( ^{
|
||||
if ([[MPiOSConfig get].showSetup boolValue])
|
||||
[self.navigationController performSegueWithIdentifier:@"setup" sender:self];
|
||||
} );
|
||||
|
||||
NSString *latestFeatures = [MPStoreViewController latestStoreFeatures];
|
||||
if (latestFeatures) {
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"New Features" message:
|
||||
strf( @"The following features are now available in the store:\n\n%@•••\n\n"
|
||||
@"Find the store from the user pull‑down after logging in.", latestFeatures )
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alert addAction:[UIAlertAction actionWithTitle:@"Thanks" style:UIAlertActionStyleCancel handler:nil]];
|
||||
[self.navigationController presentViewController:alert animated:YES completion:nil];
|
||||
}
|
||||
if (![[NSUserDefaults standardUserDefaults] boolForKey:@"notificationsDecided"]) {
|
||||
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Coming Soon" message:
|
||||
@"Master Password is rolling out a new modern personal security platform and we're excited to bring you along.\n\n"
|
||||
@"When it's time, we'll send you a notification to help you make an effortless transition."
|
||||
preferredStyle:UIAlertControllerStyleAlert];
|
||||
[alert addAction:[UIAlertAction actionWithTitle:@"Thanks" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
|
||||
[Countly.sharedInstance askForNotificationPermission];
|
||||
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"notificationsDecided"];
|
||||
}]];
|
||||
[(self.navigationController.presentedViewController?: (UIViewController *)self.navigationController)
|
||||
presentViewController:alert animated:YES completion:nil];
|
||||
}
|
||||
} );
|
||||
}
|
||||
@catch (id exception) {
|
||||
err( @"During Post-Startup: %@", exception );
|
||||
|
@@ -12,6 +12,8 @@
|
||||
<key>CFBundleTypeIconFiles</key>
|
||||
<array>
|
||||
<string>Icon-Small</string>
|
||||
<string>Icon-64.png</string>
|
||||
<string>Icon-320.png</string>
|
||||
</array>
|
||||
<key>CFBundleTypeName</key>
|
||||
<string>Master Password sites</string>
|
||||
@@ -51,6 +53,10 @@
|
||||
<string>SourceCodePro-Regular.otf</string>
|
||||
<string>SourceCodePro-ExtraLight.otf</string>
|
||||
</array>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Storyboard</string>
|
||||
<key>UIStatusBarHidden</key>
|
||||
@@ -100,8 +106,9 @@
|
||||
<string>Master Password sites</string>
|
||||
<key>UTTypeIconFiles</key>
|
||||
<array>
|
||||
<string>Icon-320.png</string>
|
||||
<string>Icon-Small.png</string>
|
||||
<string>Icon-64.png</string>
|
||||
<string>Icon-320.png</string>
|
||||
</array>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>com.lyndir.masterpassword.sites</string>
|
||||
|
@@ -2,6 +2,8 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
<key>com.apple.developer.default-data-protection</key>
|
||||
<string>NSFileProtectionComplete</string>
|
||||
</dict>
|
||||
|
Reference in New Issue
Block a user