mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
One time thumbnail generation
// FREEBIE
This commit is contained in:
parent
a0bd2c2324
commit
96e5a8f4b7
3 changed files with 29 additions and 1 deletions
|
@ -1147,6 +1147,18 @@ static NSString *const kURLHostVerifyPrefix = @"verify";
|
|||
[[OWSMessageReceiver sharedInstance] handleAnyUnprocessedEnvelopesAsync];
|
||||
[[OWSBatchMessageProcessor sharedInstance] handleAnyUnprocessedEnvelopesAsync];
|
||||
|
||||
if (!Environment.preferences.hasGeneratedThumbnails) {
|
||||
[OWSPrimaryStorage.sharedManager.newDatabaseConnection
|
||||
asyncReadWithBlock:^(YapDatabaseReadTransaction *_Nonnull transaction) {
|
||||
[TSAttachmentStream enumerateCollectionObjectsUsingBlock:^(id _Nonnull obj, BOOL *_Nonnull stop){
|
||||
// no-op. It's sufficient to initWithCoder: each object.
|
||||
}];
|
||||
}
|
||||
completionBlock:^{
|
||||
[Environment.preferences setHasGeneratedThumbnails:YES];
|
||||
}];
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// A bug in orphan cleanup could be disastrous so let's only
|
||||
// run it in DEBUG builds for a few releases.
|
||||
|
|
|
@ -61,6 +61,9 @@ extern NSString *const OWSPreferencesCallLoggingDidChangeNotification;
|
|||
- (void)setIOSUpgradeNagDate:(NSDate *)value;
|
||||
- (nullable NSDate *)iOSUpgradeNagDate;
|
||||
|
||||
- (BOOL)hasGeneratedThumbnails;
|
||||
- (void)setHasGeneratedThumbnails:(BOOL)value;
|
||||
|
||||
#pragma mark - Calling
|
||||
|
||||
#pragma mark Callkit
|
||||
|
|
|
@ -4,11 +4,11 @@
|
|||
|
||||
#import "OWSPreferences.h"
|
||||
#import <SignalServiceKit/AppContext.h>
|
||||
#import <SignalServiceKit/NSNotificationCenter+OWS.h>
|
||||
#import <SignalServiceKit/NSUserDefaults+OWS.h>
|
||||
#import <SignalServiceKit/TSStorageHeaders.h>
|
||||
#import <SignalServiceKit/YapDatabaseConnection+OWS.h>
|
||||
#import <SignalServiceKit/YapDatabaseTransaction+OWS.h>
|
||||
#import <SignalServiceKit/NSNotificationCenter+OWS.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
@ -28,6 +28,7 @@ NSString *const OWSPreferencesKeyCallKitPrivacyEnabled = @"CallKitPrivacyEnabled
|
|||
NSString *const OWSPreferencesKeyCallsHideIPAddress = @"CallsHideIPAddress";
|
||||
NSString *const OWSPreferencesKeyRemoveMetadata = @"Remove Metadata Key";
|
||||
NSString *const OWSPreferencesKeyHasDeclinedNoContactsView = @"hasDeclinedNoContactsView";
|
||||
NSString *const OWSPreferencesKeyHasGeneratedThumbnails = @"OWSPreferencesKeyHasGeneratedThumbnails";
|
||||
NSString *const OWSPreferencesKeyIOSUpgradeNagDate = @"iOSUpgradeNagDate";
|
||||
NSString *const OWSPreferencesKey_IsReadyForAppExtensions = @"isReadyForAppExtensions_5";
|
||||
NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySystemCallLogEnabled";
|
||||
|
@ -194,6 +195,18 @@ NSString *const OWSPreferencesKeySystemCallLogEnabled = @"OWSPreferencesKeySyste
|
|||
[self setValueForKey:OWSPreferencesKeyHasDeclinedNoContactsView toValue:@(value)];
|
||||
}
|
||||
|
||||
- (BOOL)hasGeneratedThumbnails
|
||||
{
|
||||
NSNumber *preference = [self tryGetValueForKey:OWSPreferencesKeyHasGeneratedThumbnails];
|
||||
// Default to NO.
|
||||
return preference ? [preference boolValue] : NO;
|
||||
}
|
||||
|
||||
- (void)setHasGeneratedThumbnails:(BOOL)value
|
||||
{
|
||||
[self setValueForKey:OWSPreferencesKeyHasGeneratedThumbnails toValue:@(value)];
|
||||
}
|
||||
|
||||
- (void)setIOSUpgradeNagDate:(NSDate *)value
|
||||
{
|
||||
[self setValueForKey:OWSPreferencesKeyIOSUpgradeNagDate toValue:value];
|
||||
|
|
Loading…
Reference in a new issue