session-ios/Signal/src/environment/Migrations/OWSDatabaseMigrationRunner.m
Michael Kirk c2aa17e362 Changed Safety numbers no longer block communication
When your partner changes their identity key (e.g. by reinstalling),
you'll see a notice alongside their message, but it will no longer
prevent the message from showing. aka "non blocking".

Existing users will be opted into the previous blocking behavior.

This is configurable for all users in Settings > Privacy.

// FREEBIE
2016-11-11 09:13:38 -05:00

67 lines
1.6 KiB
Objective-C

// Created by Michael Kirk on 9/28/16.
// Copyright © 2016 Open Whisper Systems. All rights reserved.
#import "OWSDatabaseMigrationRunner.h"
#import "OWS100RemoveTSRecipientsMigration.h"
#import "OWS101ExistingUsersBlockOnIdentityChange.h"
NS_ASSUME_NONNULL_BEGIN
@implementation OWSDatabaseMigrationRunner
- (instancetype)initWithStorageManager:(TSStorageManager *)storageManager
{
self = [super init];
if (!self) {
return self;
}
_storageManager = storageManager;
return self;
}
- (NSArray<OWSDatabaseMigration *> *)allMigrations
{
return @[
[[OWS100RemoveTSRecipientsMigration alloc] initWithStorageManager:self.storageManager],
[[OWS101ExistingUsersBlockOnIdentityChange alloc] initWithStorageManager:self.storageManager]
];
}
- (void)assumeAllExistingMigrationsRun
{
for (OWSDatabaseMigration *migration in self.allMigrations) {
DDLogInfo(@"%@ Skipping migration on new install: %@", self.tag, migration);
[migration save];
}
}
- (void)runAllOutstanding
{
for (OWSDatabaseMigration *migration in self.allMigrations) {
if ([OWSDatabaseMigration fetchObjectWithUniqueID:migration.uniqueId]) {
DDLogDebug(@"%@ Skipping previously run migration: %@", self.tag, migration);
} else {
DDLogWarn(@"%@ Running migration: %@", self.tag, migration);
[migration runUp];
}
}
}
#pragma mark - Logging
+ (NSString *)tag
{
return [NSString stringWithFormat:@"[%@]", self.class];
}
- (NSString *)tag
{
return self.class.tag;
}
@end
NS_ASSUME_NONNULL_END