Merge branch 'dev' into emoji-reacts

This commit is contained in:
Ryan Zhao 2022-08-18 14:38:01 +10:00
commit f7a4c92d38
4 changed files with 49 additions and 14 deletions

View File

@ -6933,7 +6933,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 369;
CURRENT_PROJECT_VERSION = 371;
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@ -6972,7 +6972,7 @@
"$(SRCROOT)",
);
LLVM_LTO = NO;
MARKETING_VERSION = 2.0.2;
MARKETING_VERSION = 2.0.3;
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
@ -7005,7 +7005,7 @@
CODE_SIGN_ENTITLEMENTS = Session/Meta/Signal.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 369;
CURRENT_PROJECT_VERSION = 371;
DEVELOPMENT_TEAM = SUQ8J2PCT7;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@ -7044,7 +7044,7 @@
"$(SRCROOT)",
);
LLVM_LTO = NO;
MARKETING_VERSION = 2.0.2;
MARKETING_VERSION = 2.0.3;
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = "com.loki-project.loki-messenger";
PRODUCT_NAME = Session;

View File

@ -175,7 +175,7 @@ enum _001_InitialSetupMigration: Migration {
.notNull()
}
try db.create(table: GroupMember.self) { t in
try db.create(table: _006_FixHiddenModAdminSupport.PreMigrationGroupMember.self) { t in
// Note: Since we don't know whether this will be stored against a 'ClosedGroup' or
// an 'OpenGroup' we add the foreign key constraint against the thread itself (which
// shares the same 'id' as the 'groupId') so we can cascade delete automatically

View File

@ -647,11 +647,10 @@ enum _003_YDBToGRDBMigration: Migration {
}
try groupModel.groupMemberIds.forEach { memberId in
try GroupMember(
try _006_FixHiddenModAdminSupport.PreMigrationGroupMember(
groupId: threadId,
profileId: memberId,
role: .standard,
isHidden: false
role: .standard
).insert(db)
if !validProfileIds.contains(memberId) {
@ -660,11 +659,10 @@ enum _003_YDBToGRDBMigration: Migration {
}
try groupModel.groupAdminIds.forEach { adminId in
try GroupMember(
try _006_FixHiddenModAdminSupport.PreMigrationGroupMember(
groupId: threadId,
profileId: adminId,
role: .admin,
isHidden: false
role: .admin
).insert(db)
if !validProfileIds.contains(adminId) {
@ -673,11 +671,10 @@ enum _003_YDBToGRDBMigration: Migration {
}
try (closedGroupZombieMemberIds[legacyThread.uniqueId] ?? []).forEach { zombieId in
try GroupMember(
try _006_FixHiddenModAdminSupport.PreMigrationGroupMember(
groupId: threadId,
profileId: zombieId,
role: .zombie,
isHidden: false
role: .zombie
).insert(db)
if !validProfileIds.contains(zombieId) {

View File

@ -28,3 +28,41 @@ enum _006_FixHiddenModAdminSupport: Migration {
Storage.update(progress: 1, for: self, in: target) // In case this is the last migration
}
}
// MARK: - Pre-Migration Types
extension _006_FixHiddenModAdminSupport {
internal struct PreMigrationGroupMember: Codable, PersistableRecord, TableRecord, ColumnExpressible {
public static var databaseTableName: String { "groupMember" }
public typealias Columns = CodingKeys
public enum CodingKeys: String, CodingKey, ColumnExpression {
case groupId
case profileId
case role
}
public enum Role: Int, Codable, DatabaseValueConvertible {
case standard
case zombie
case moderator
case admin
}
public let groupId: String
public let profileId: String
public let role: Role
// MARK: - Initialization
public init(
groupId: String,
profileId: String,
role: Role
) {
self.groupId = groupId
self.profileId = profileId
self.role = role
}
}
}