Fix one-time crash when opening thread without having a local profile
// FREEBIE
This commit is contained in:
parent
2bd50a7bf1
commit
04bf548a7b
@ -473,6 +473,7 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
||||
// Clean up any messages that expired since last launch immediately
|
||||
// and continue cleaning in the background.
|
||||
[[OWSDisappearingMessagesJob sharedJob] startIfNecessary];
|
||||
[[OWSProfileManager sharedManager] ensureLocalProfileCached];
|
||||
|
||||
// Mark all "attempting out" messages as "unsent", i.e. any messages that were not successfully
|
||||
// sent before the app exited should be marked as failures.
|
||||
|
||||
@ -36,6 +36,7 @@ extern const NSUInteger kOWSProfileManager_MaxAvatarDiameter;
|
||||
- (BOOL)hasLocalProfile;
|
||||
- (nullable NSString *)localProfileName;
|
||||
- (nullable UIImage *)localProfileAvatarImage;
|
||||
- (void)ensureLocalProfileCached;
|
||||
|
||||
// This method is used to update the "local profile" state on the client
|
||||
// and the service. Client state is only updated if service state is
|
||||
|
||||
@ -270,6 +270,13 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)ensureLocalProfileCached
|
||||
{
|
||||
// Since localUserProfile can create a transaction, we want to make sure it's not called for the first
|
||||
// time unexpectedly (e.g. in a nested transaction.)
|
||||
__unused UserProfile *profile = [self localUserProfile];
|
||||
}
|
||||
|
||||
#pragma mark - Local Profile
|
||||
|
||||
- (UserProfile *)localUserProfile
|
||||
@ -652,7 +659,6 @@ const NSUInteger kOWSProfileManager_MaxAvatarDiameter = 640;
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: The exact API & encryption scheme for profiles is not yet settled.
|
||||
- (void)updateServiceWithProfileName:(nullable NSString *)localProfileName
|
||||
success:(void (^)())successBlock
|
||||
failure:(void (^)())failureBlock
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
#import "NSDate+millisecondTimeStamp.h"
|
||||
#import "OWSContactsManager.h"
|
||||
#import "OWSNavigationController.h"
|
||||
#import "OWSProfileManager.h"
|
||||
#import "ProfileViewController.h"
|
||||
#import "PropertyListPreferences.h"
|
||||
#import "PushManager.h"
|
||||
@ -491,6 +492,7 @@ typedef NS_ENUM(NSInteger, CellState) { kArchiveState, kInboxState };
|
||||
// Start running the disappearing messages job in case the newly registered user
|
||||
// enables this feature
|
||||
[[OWSDisappearingMessagesJob sharedJob] startIfNecessary];
|
||||
[[OWSProfileManager sharedManager] ensureLocalProfileCached];
|
||||
} else if (!self.viewHasEverAppeared) {
|
||||
[self displayAnyUnseenUpgradeExperience];
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user