Skip to content

Commit

Permalink
Do not discard migrated profiles in TestFlight (#886)
Browse files Browse the repository at this point in the history
Users would lose those profiles on downgrade to v2.
  • Loading branch information
keeshux authored Nov 17, 2024
1 parent 12b1784 commit e58726d
Showing 1 changed file with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ struct MigrateView: View {
@EnvironmentObject
private var migrationManager: MigrationManager

@EnvironmentObject
private var iapManager: IAPManager

@Environment(\.dismiss)
private var dismiss

Expand Down Expand Up @@ -187,12 +190,18 @@ private extension MigrateView {
model.statuses[$0.id] == .done
}
pp_log(.App.migration, .notice, "Migrated \(migrated.count) profiles")
do {
try await migrationManager.deleteMigratableProfiles(withIds: Set(migrated.map(\.id)))
pp_log(.App.migration, .notice, "Discarded \(migrated.count) migrated profiles from old store")
} catch {
pp_log(.App.migration, .error, "Unable to discard migrated profiles: \(error)")

if !iapManager.isRestricted {
do {
try await migrationManager.deleteMigratableProfiles(withIds: Set(migrated.map(\.id)))
pp_log(.App.migration, .notice, "Discarded \(migrated.count) migrated profiles from old store")
} catch {
pp_log(.App.migration, .error, "Unable to discard migrated profiles: \(error)")
}
} else {
pp_log(.App.migration, .notice, "Restricted build, do not discard migrated profiles")
}

model.step = .migrated(migrated)
} catch {
pp_log(.App.migration, .error, "Unable to migrate profiles: \(error)")
Expand Down

0 comments on commit e58726d

Please sign in to comment.