mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
Preserve 'classic' Signal notification and ringtone for legacy users.
This commit is contained in:
parent
390cf3c80a
commit
55b9aa4089
7 changed files with 93 additions and 5 deletions
|
@ -245,6 +245,8 @@
|
|||
34E3EF101EFC2684007F6822 /* DebugUIPage.m in Sources */ = {isa = PBXBuildFile; fileRef = 34E3EF0F1EFC2684007F6822 /* DebugUIPage.m */; };
|
||||
34E8BF381EE9E2FD00F5F4CA /* FingerprintViewScanController.m in Sources */ = {isa = PBXBuildFile; fileRef = 34E8BF371EE9E2FD00F5F4CA /* FingerprintViewScanController.m */; };
|
||||
34F308A21ECB469700BB7697 /* OWSBezierPathView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34F308A11ECB469700BB7697 /* OWSBezierPathView.m */; };
|
||||
34F77040203F55D000C7CBB7 /* OWS107LegacySounds.m in Sources */ = {isa = PBXBuildFile; fileRef = 34F7703E203F55D000C7CBB7 /* OWS107LegacySounds.m */; };
|
||||
34F77041203F55D000C7CBB7 /* OWS107LegacySounds.h in Headers */ = {isa = PBXBuildFile; fileRef = 34F7703F203F55D000C7CBB7 /* OWS107LegacySounds.h */; };
|
||||
34FD93701E3BD43A00109093 /* OWSAnyTouchGestureRecognizer.m in Sources */ = {isa = PBXBuildFile; fileRef = 34FD936F1E3BD43A00109093 /* OWSAnyTouchGestureRecognizer.m */; };
|
||||
4505C2BF1E648EA300CEBF41 /* ExperienceUpgrade.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4505C2BE1E648EA300CEBF41 /* ExperienceUpgrade.swift */; };
|
||||
450998651FD8A34D00D89EB3 /* DeviceSleepManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 348F2EAD1F0D21BC00D4ECE0 /* DeviceSleepManager.swift */; };
|
||||
|
@ -849,6 +851,8 @@
|
|||
34E8BF371EE9E2FD00F5F4CA /* FingerprintViewScanController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FingerprintViewScanController.m; sourceTree = "<group>"; };
|
||||
34F308A01ECB469700BB7697 /* OWSBezierPathView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWSBezierPathView.h; sourceTree = "<group>"; };
|
||||
34F308A11ECB469700BB7697 /* OWSBezierPathView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWSBezierPathView.m; sourceTree = "<group>"; };
|
||||
34F7703E203F55D000C7CBB7 /* OWS107LegacySounds.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = OWS107LegacySounds.m; sourceTree = "<group>"; };
|
||||
34F7703F203F55D000C7CBB7 /* OWS107LegacySounds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OWS107LegacySounds.h; sourceTree = "<group>"; };
|
||||
34FD936E1E3BD43A00109093 /* OWSAnyTouchGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OWSAnyTouchGestureRecognizer.h; path = views/OWSAnyTouchGestureRecognizer.h; sourceTree = "<group>"; };
|
||||
34FD936F1E3BD43A00109093 /* OWSAnyTouchGestureRecognizer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = OWSAnyTouchGestureRecognizer.m; path = views/OWSAnyTouchGestureRecognizer.m; sourceTree = "<group>"; };
|
||||
435EAC2E5E22D3F087EB3192 /* Pods-SignalShareExtension.app store release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SignalShareExtension.app store release.xcconfig"; path = "Pods/Target Support Files/Pods-SignalShareExtension/Pods-SignalShareExtension.app store release.xcconfig"; sourceTree = "<group>"; };
|
||||
|
@ -1386,6 +1390,8 @@
|
|||
346129F31FD5F31400532771 /* OWS105AttachmentFilePaths.h */,
|
||||
346129EA1FD5F31300532771 /* OWS105AttachmentFilePaths.m */,
|
||||
346129F11FD5F31400532771 /* OWS106EnsureProfileComplete.swift */,
|
||||
34F7703F203F55D000C7CBB7 /* OWS107LegacySounds.h */,
|
||||
34F7703E203F55D000C7CBB7 /* OWS107LegacySounds.m */,
|
||||
346129931FD1E30000532771 /* OWSDatabaseMigration.h */,
|
||||
346129941FD1E30000532771 /* OWSDatabaseMigration.m */,
|
||||
346129E51FD5C0C600532771 /* OWSDatabaseMigrationRunner.h */,
|
||||
|
@ -2208,6 +2214,7 @@
|
|||
34480B551FD0A7A400BC14EF /* DebugLogger.h in Headers */,
|
||||
344F248420069E9C00CFB4F4 /* CountryCodeViewController.h in Headers */,
|
||||
346129CA1FD2072E00532771 /* UIImage+OWS.h in Headers */,
|
||||
34F77041203F55D000C7CBB7 /* OWS107LegacySounds.h in Headers */,
|
||||
346129711FD1D74C00532771 /* SignalKeyingStorage.h in Headers */,
|
||||
34612A011FD5F31400532771 /* OWS104CreateRecipientIdentities.h in Headers */,
|
||||
450998691FD8C10200D89EB3 /* AttachmentSharing.h in Headers */,
|
||||
|
@ -2959,6 +2966,7 @@
|
|||
files = (
|
||||
45F59A0A2029140500E8D2B0 /* OWSVideoPlayer.swift in Sources */,
|
||||
344F249B200FD03300CFB4F4 /* SharingThreadPickerViewController.m in Sources */,
|
||||
34F77040203F55D000C7CBB7 /* OWS107LegacySounds.m in Sources */,
|
||||
45194F951FD7216600333B2C /* TSUnreadIndicatorInteraction.m in Sources */,
|
||||
45BE4EA22012AD2000935E59 /* DisappearingTimerConfigurationView.swift in Sources */,
|
||||
346129F71FD5F31400532771 /* OWS105AttachmentFilePaths.m in Sources */,
|
||||
|
|
|
@ -64,6 +64,7 @@ typedef NS_ENUM(NSUInteger, OWSSound) {
|
|||
|
||||
@class AVAudioPlayer;
|
||||
@class TSThread;
|
||||
@class YapDatabaseReadWriteTransaction;
|
||||
|
||||
@interface OWSSounds : NSObject
|
||||
|
||||
|
@ -81,6 +82,7 @@ typedef NS_ENUM(NSUInteger, OWSSound) {
|
|||
|
||||
+ (OWSSound)globalNotificationSound;
|
||||
+ (void)setGlobalNotificationSound:(OWSSound)sound;
|
||||
+ (void)setGlobalNotificationSound:(OWSSound)sound transaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
|
||||
+ (OWSSound)notificationSoundForThread:(TSThread *)thread;
|
||||
+ (void)setNotificationSound:(OWSSound)sound forThread:(TSThread *)thread;
|
||||
|
@ -91,6 +93,7 @@ typedef NS_ENUM(NSUInteger, OWSSound) {
|
|||
|
||||
+ (OWSSound)globalRingtoneSound;
|
||||
+ (void)setGlobalRingtoneSound:(OWSSound)sound;
|
||||
+ (void)setGlobalRingtoneSound:(OWSSound)sound transaction:(YapDatabaseReadWriteTransaction *)transaction;
|
||||
|
||||
+ (OWSSound)ringtoneSoundForThread:(TSThread *)thread;
|
||||
+ (void)setRingtoneSound:(OWSSound)sound forThread:(TSThread *)thread;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#import <SignalServiceKit/TSStorageManager.h>
|
||||
#import <SignalServiceKit/TSThread.h>
|
||||
#import <SignalServiceKit/YapDatabaseConnection+OWS.h>
|
||||
#import <YapDatabase/YapDatabase.h>
|
||||
|
||||
NSString *const kOWSSoundsStorageNotificationCollection = @"kOWSSoundsStorageNotificationCollection";
|
||||
NSString *const kOWSSoundsStorageGlobalNotificationKey = @"kOWSSoundsStorageGlobalNotificationKey";
|
||||
|
@ -388,6 +389,15 @@ NSString *const kOWSSoundsStorageGlobalRingtoneKey = @"kOWSSoundsStorageGlobalRi
|
|||
inCollection:kOWSSoundsStorageNotificationCollection];
|
||||
}
|
||||
|
||||
+ (void)setGlobalNotificationSound:(OWSSound)sound transaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
OWSAssert(transaction);
|
||||
|
||||
[transaction setObject:@(sound)
|
||||
forKey:kOWSSoundsStorageGlobalNotificationKey
|
||||
inCollection:kOWSSoundsStorageNotificationCollection];
|
||||
}
|
||||
|
||||
+ (OWSSound)notificationSoundForThread:(TSThread *)thread
|
||||
{
|
||||
OWSSounds *instance = OWSSounds.sharedManager;
|
||||
|
@ -429,6 +439,16 @@ NSString *const kOWSSoundsStorageGlobalRingtoneKey = @"kOWSSoundsStorageGlobalRi
|
|||
inCollection:kOWSSoundsStorageRingtoneCollection];
|
||||
}
|
||||
|
||||
|
||||
+ (void)setGlobalRingtoneSound:(OWSSound)sound transaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
OWSAssert(transaction);
|
||||
|
||||
[transaction setObject:@(sound)
|
||||
forKey:kOWSSoundsStorageGlobalRingtoneKey
|
||||
inCollection:kOWSSoundsStorageRingtoneCollection];
|
||||
}
|
||||
|
||||
+ (OWSSound)ringtoneSoundForThread:(TSThread *)thread
|
||||
{
|
||||
OWSSounds *instance = OWSSounds.sharedManager;
|
||||
|
|
13
SignalMessaging/environment/migrations/OWS107LegacySounds.h
Normal file
13
SignalMessaging/environment/migrations/OWS107LegacySounds.h
Normal file
|
@ -0,0 +1,13 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWSDatabaseMigration.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface OWS107LegacySounds : OWSDatabaseMigration
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
31
SignalMessaging/environment/migrations/OWS107LegacySounds.m
Normal file
31
SignalMessaging/environment/migrations/OWS107LegacySounds.m
Normal file
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// Copyright (c) 2018 Open Whisper Systems. All rights reserved.
|
||||
//
|
||||
|
||||
#import "OWS107LegacySounds.h"
|
||||
#import "OWSSounds.h"
|
||||
#import <YapDatabase/YapDatabaseTransaction.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// Increment a similar constant for every future DBMigration
|
||||
static NSString *const OWS107LegacySoundsMigrationId = @"107";
|
||||
|
||||
@implementation OWS107LegacySounds
|
||||
|
||||
+ (NSString *)migrationId
|
||||
{
|
||||
return OWS107LegacySoundsMigrationId;
|
||||
}
|
||||
|
||||
- (void)runUpWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
OWSAssert(transaction);
|
||||
|
||||
[OWSSounds setGlobalNotificationSound:OWSSound_ClassicNotification transaction:transaction];
|
||||
[OWSSounds setGlobalRingtoneSound:OWSSound_ClassicRingtone transaction:transaction];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
|
@ -50,10 +50,21 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
{
|
||||
OWSAssert(completion);
|
||||
|
||||
[self.storageManager.newDatabaseConnection
|
||||
asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
[self runUpWithTransaction:transaction];
|
||||
}
|
||||
OWSDatabaseConnection *dbConnection = (OWSDatabaseConnection *)self.storageManager.newDatabaseConnection;
|
||||
// These migrations won't be run until storage registrations are enqueued,
|
||||
// but this transaction might begin before all registrations are marked as
|
||||
// complete, so disable this checking.
|
||||
//
|
||||
// TODO: Once we move "app readiness" into AppSetup, we should explicitly
|
||||
// not start these migrations until storage is ready. We can then remove
|
||||
// this statement which disables checking.
|
||||
#ifdef DEBUG
|
||||
dbConnection.canWriteBeforeStorageReady = YES;
|
||||
#endif
|
||||
|
||||
[dbConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *_Nonnull transaction) {
|
||||
[self runUpWithTransaction:transaction];
|
||||
}
|
||||
completionBlock:^{
|
||||
DDLogInfo(@"Completed migration %@", self.uniqueId);
|
||||
[self save];
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#import "OWS103EnableVideoCalling.h"
|
||||
#import "OWS104CreateRecipientIdentities.h"
|
||||
#import "OWS105AttachmentFilePaths.h"
|
||||
#import "OWS107LegacySounds.h"
|
||||
#import "OWSDatabaseMigration.h"
|
||||
#import <SignalMessaging/SignalMessaging-Swift.h>
|
||||
#import <SignalServiceKit/AppContext.h>
|
||||
|
@ -38,7 +39,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
[[OWS103EnableVideoCalling alloc] initWithStorageManager:storageManager],
|
||||
[[OWS104CreateRecipientIdentities alloc] initWithStorageManager:storageManager],
|
||||
[[OWS105AttachmentFilePaths alloc] initWithStorageManager:storageManager],
|
||||
[[OWS106EnsureProfileComplete alloc] initWithStorageManager:storageManager]
|
||||
[[OWS106EnsureProfileComplete alloc] initWithStorageManager:storageManager],
|
||||
[[OWS107LegacySounds alloc] initWithStorageManager:storageManager],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue