iPad fixes & log initial start-up crashes.
This commit is contained in:
		@@ -713,8 +713,14 @@ PearlAssociatedObjectProperty( NSNumber*, StoreCorrupted, storeCorrupted );
 | 
			
		||||
    MPMarshalledFile *exportFile = NULL;
 | 
			
		||||
    @try {
 | 
			
		||||
        inf( @"Exporting sites, %@, for user: %@", revealPasswords? @"revealing passwords": @"omitting passwords", user.userID );
 | 
			
		||||
        NSString *masterPassword = askExportPassword( user.name );
 | 
			
		||||
        if (!masterPassword) {
 | 
			
		||||
            inf( @"Export cancelled." );
 | 
			
		||||
            return nil;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        exportUser = mpw_marshal_user( user.name.UTF8String,
 | 
			
		||||
                mpw_masterKeyProvider_str( askExportPassword( user.name ).UTF8String ), user.algorithm.version );
 | 
			
		||||
                mpw_masterKeyProvider_str( masterPassword.UTF8String ), user.algorithm.version );
 | 
			
		||||
        exportUser->redacted = !revealPasswords;
 | 
			
		||||
        exportUser->avatar = (unsigned int)user.avatar;
 | 
			
		||||
        exportUser->keyID = mpw_strdup( [user.keyID encodeHex].UTF8String );
 | 
			
		||||
 
 | 
			
		||||
@@ -68,7 +68,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
 | 
			
		||||
 | 
			
		||||
    @try {
 | 
			
		||||
        // Sentry
 | 
			
		||||
        [SentrySDK initWithOptions:@{
 | 
			
		||||
        [SentrySDK startWithOptions:@{
 | 
			
		||||
                @"dsn"                      : NilToNSNull( decrypt( sentryDSN ) ),
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
                @"debug"                    : @(YES),
 | 
			
		||||
@@ -80,7 +80,7 @@ static OSStatus MPHotKeyHander(EventHandlerCallRef nextHandler, EventRef theEven
 | 
			
		||||
                @"debug"                    : @(NO),
 | 
			
		||||
                @"environment"              : @"Private",
 | 
			
		||||
#endif
 | 
			
		||||
                @"enabled"                  : [MPMacConfig get].sendInfo,
 | 
			
		||||
                @"enabled"                  : @([[MPMacConfig get].sendInfo boolValue] || ![[MPMacConfig get].sendInfoDecided boolValue]),
 | 
			
		||||
                @"enableAutoSessionTracking": @(YES),
 | 
			
		||||
        }];
 | 
			
		||||
        [[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) {
 | 
			
		||||
 
 | 
			
		||||
@@ -263,6 +263,7 @@
 | 
			
		||||
 | 
			
		||||
    UIAlertController *controller = [UIAlertController alertControllerWithTitle:strf( @"Delete %@?", site.name ) message:nil
 | 
			
		||||
                                                                 preferredStyle:UIAlertControllerStyleActionSheet];
 | 
			
		||||
    [controller.popoverPresentationController setSourceView:sender];
 | 
			
		||||
    [controller addAction:[UIAlertAction actionWithTitle:@"Delete Site" style:UIAlertActionStyleDestructive
 | 
			
		||||
                                                 handler:^(UIAlertAction *_Nonnull action) {
 | 
			
		||||
                                                     [MPiOSAppDelegate managedObjectContextPerformBlock:^(NSManagedObjectContext *context) {
 | 
			
		||||
@@ -284,6 +285,7 @@
 | 
			
		||||
    MPSiteEntity *mainSite = [self siteInContext:[MPiOSAppDelegate managedObjectContextForMainThreadIfReady]];
 | 
			
		||||
    UIAlertController *controller = [UIAlertController alertControllerWithTitle:@"Change Password Type" message:nil
 | 
			
		||||
                                                                 preferredStyle:UIAlertControllerStyleActionSheet];
 | 
			
		||||
    [controller.popoverPresentationController setSourceView:sender];
 | 
			
		||||
    for (NSNumber *typeNumber in [mainSite.algorithm allTypes]) {
 | 
			
		||||
        MPResultType type = (MPResultType)[typeNumber unsignedIntegerValue];
 | 
			
		||||
        NSString *typeName = [mainSite.algorithm nameOfType:type];
 | 
			
		||||
@@ -425,7 +427,7 @@
 | 
			
		||||
        if (!site || ![site isKindOfClass:[MPGeneratedSiteEntity class]])
 | 
			
		||||
            return;
 | 
			
		||||
 | 
			
		||||
        ((MPGeneratedSiteEntity *)site).counter = 1;
 | 
			
		||||
        ((MPGeneratedSiteEntity *)site).counter = MPCounterValueInitial;
 | 
			
		||||
        [context saveToStore];
 | 
			
		||||
 | 
			
		||||
        [PearlOverlay showTemporaryOverlayWithTitle:@"Counter Reset" dismissAfter:2];
 | 
			
		||||
@@ -444,6 +446,7 @@
 | 
			
		||||
        UIAlertController *controller = [UIAlertController alertControllerWithTitle:@"Create Site" message:
 | 
			
		||||
                        strf( @"Remember site named:\n%@", self.transientSite )
 | 
			
		||||
                                                                     preferredStyle:UIAlertControllerStyleActionSheet];
 | 
			
		||||
        [controller.popoverPresentationController setSourceView:sender];
 | 
			
		||||
        [controller addAction:[UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:
 | 
			
		||||
                ^(UIAlertAction *_Nonnull action) {
 | 
			
		||||
                    [[MPiOSAppDelegate get]
 | 
			
		||||
 
 | 
			
		||||
@@ -432,6 +432,7 @@ referenceSizeForFooterInSection:(NSInteger)section {
 | 
			
		||||
 | 
			
		||||
        NSManagedObjectID *userID = user.permanentObjectID;
 | 
			
		||||
        UIAlertController *controller = [UIAlertController alertControllerWithTitle:user.name message:nil preferredStyle:UIAlertControllerStyleActionSheet];
 | 
			
		||||
        [controller.popoverPresentationController setSourceView:avatarCell];
 | 
			
		||||
        [controller addAction:[UIAlertAction actionWithTitle:@"Delete User" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
 | 
			
		||||
            UIAlertController *controller_ = [UIAlertController alertControllerWithTitle:@"Deleting User" message:
 | 
			
		||||
                    @"The user and its sites will be deleted."            preferredStyle:UIAlertControllerStyleAlert];
 | 
			
		||||
 
 | 
			
		||||
@@ -57,7 +57,7 @@
 | 
			
		||||
 | 
			
		||||
    @try {
 | 
			
		||||
        // Sentry
 | 
			
		||||
        [SentrySDK initWithOptions:@{
 | 
			
		||||
        [SentrySDK startWithOptions:@{
 | 
			
		||||
                @"dsn"                      : NilToNSNull( decrypt( sentryDSN ) ),
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
                @"debug"                    : @(YES),
 | 
			
		||||
@@ -69,7 +69,7 @@
 | 
			
		||||
                @"debug"                    : @(NO),
 | 
			
		||||
                @"environment"              : @"Private",
 | 
			
		||||
#endif
 | 
			
		||||
                @"enabled"                  : [MPiOSConfig get].sendInfo,
 | 
			
		||||
                @"enabled"                  : @([[MPiOSConfig get].sendInfo boolValue] || ![[MPiOSConfig get].sendInfoDecided boolValue]),
 | 
			
		||||
                @"enableAutoSessionTracking": @(YES),
 | 
			
		||||
        }];
 | 
			
		||||
        [[PearlLogger get] registerListener:^BOOL(PearlLogMessage *message) {
 | 
			
		||||
@@ -598,7 +598,7 @@
 | 
			
		||||
                        @"Would you like to make all your passwords visible in the export file?\n\n"
 | 
			
		||||
                        @"A safe export will include all sites but make their passwords invisible.\n"
 | 
			
		||||
                        @"It is great as a backup and remains safe when fallen in the wrong hands."
 | 
			
		||||
                                                                preferredStyle:UIAlertControllerStyleActionSheet];
 | 
			
		||||
                                                                preferredStyle:UIAlertControllerStyleAlert];
 | 
			
		||||
        [sheet addAction:[UIAlertAction actionWithTitle:@"Safe Export" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
 | 
			
		||||
            [self showExportRevealPasswords:NO forVC:viewController];
 | 
			
		||||
        }]];
 | 
			
		||||
@@ -647,14 +647,15 @@
 | 
			
		||||
        } error:&error];
 | 
			
		||||
 | 
			
		||||
        PearlMainQueue( ^{
 | 
			
		||||
            if (!exportedUser || error) {
 | 
			
		||||
            if (error) {
 | 
			
		||||
                MPError( error, @"Failed to export mpsites." );
 | 
			
		||||
                UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Export Error" message:[error localizedDescription]
 | 
			
		||||
                                                                        preferredStyle:UIAlertControllerStyleAlert];
 | 
			
		||||
                [alert addAction:[UIAlertAction actionWithTitle:@"Okay" style:UIAlertActionStyleCancel handler:nil]];
 | 
			
		||||
                [self.navigationController presentViewController:alert animated:YES completion:nil];
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (!exportedUser)
 | 
			
		||||
                return;
 | 
			
		||||
 | 
			
		||||
            NSDateFormatter *exportDateFormatter = [NSDateFormatter new];
 | 
			
		||||
            [exportDateFormatter setDateFormat:@"yyyy'-'MM'-'dd"];
 | 
			
		||||
@@ -662,7 +663,7 @@
 | 
			
		||||
                    [self activeUserForMainThread].name, [exportDateFormatter stringFromDate:[NSDate date]] );
 | 
			
		||||
 | 
			
		||||
            UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Export Destination" message:nil
 | 
			
		||||
                                                                    preferredStyle:UIAlertControllerStyleActionSheet];
 | 
			
		||||
                                                                    preferredStyle:UIAlertControllerStyleAlert];
 | 
			
		||||
            [alert addAction:[UIAlertAction actionWithTitle:@"Send As E-Mail" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
 | 
			
		||||
                NSString *message;
 | 
			
		||||
                if (revealPasswords)
 | 
			
		||||
@@ -724,7 +725,7 @@
 | 
			
		||||
 | 
			
		||||
                UIAlertController *usersSheet = [UIAlertController alertControllerWithTitle:@"Migrate User"
 | 
			
		||||
                                                                                    message:@"Choose a user to migrate out to Volto."
 | 
			
		||||
                                                                             preferredStyle:UIAlertControllerStyleActionSheet];
 | 
			
		||||
                                                                             preferredStyle:UIAlertControllerStyleAlert];
 | 
			
		||||
                [usersSheet addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:nil]];
 | 
			
		||||
                for (MPUserEntity *user_ in users)
 | 
			
		||||
                    [usersSheet addAction:[UIAlertAction actionWithTitle:user_.name style:UIAlertActionStyleDefault handler:
 | 
			
		||||
@@ -759,15 +760,16 @@
 | 
			
		||||
                    } error:&error];
 | 
			
		||||
 | 
			
		||||
            PearlMainQueue( ^{
 | 
			
		||||
                if (!exportedUser || error) {
 | 
			
		||||
                if (error) {
 | 
			
		||||
                    MPError( error, @"Failed to export user." );
 | 
			
		||||
                    UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Export Error"
 | 
			
		||||
                                                                                   message:[error localizedDescription]
 | 
			
		||||
                                                                            preferredStyle:UIAlertControllerStyleAlert];
 | 
			
		||||
                    [alert addAction:[UIAlertAction actionWithTitle:@"Okay" style:UIAlertActionStyleCancel handler:nil]];
 | 
			
		||||
                    [self.navigationController presentViewController:alert animated:YES completion:nil];
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                if (!exportedUser)
 | 
			
		||||
                    return;
 | 
			
		||||
 | 
			
		||||
                NSURLComponents *components = [NSURLComponents new];
 | 
			
		||||
                components.scheme = @"volto";
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user