2.2.0 - Final Builds
All checks were successful
Ascently - Sync Deploy / build-and-push (push) Successful in 2m32s

This commit is contained in:
2025-10-18 23:02:31 -06:00
parent 3b16475dc6
commit 8c4a78ad50
9 changed files with 637 additions and 36 deletions

View File

@@ -465,7 +465,7 @@
CODE_SIGN_ENTITLEMENTS = Ascently/Ascently.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 29;
CURRENT_PROJECT_VERSION = 30;
DEVELOPMENT_TEAM = 4BC9Y2LL4B;
DRIVERKIT_DEPLOYMENT_TARGET = 24.6;
ENABLE_PREVIEWS = YES;
@@ -513,7 +513,7 @@
CODE_SIGN_ENTITLEMENTS = Ascently/Ascently.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 29;
CURRENT_PROJECT_VERSION = 30;
DEVELOPMENT_TEAM = 4BC9Y2LL4B;
DRIVERKIT_DEPLOYMENT_TARGET = 24.6;
ENABLE_PREVIEWS = YES;
@@ -602,7 +602,7 @@
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_ENTITLEMENTS = SessionStatusLiveExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 29;
CURRENT_PROJECT_VERSION = 30;
DEVELOPMENT_TEAM = 4BC9Y2LL4B;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = SessionStatusLive/Info.plist;
@@ -632,7 +632,7 @@
ASSETCATALOG_COMPILER_WIDGET_BACKGROUND_COLOR_NAME = WidgetBackground;
CODE_SIGN_ENTITLEMENTS = SessionStatusLiveExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 29;
CURRENT_PROJECT_VERSION = 30;
DEVELOPMENT_TEAM = 4BC9Y2LL4B;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = SessionStatusLive/Info.plist;

View File

@@ -266,9 +266,25 @@ class SyncService: ObservableObject {
{
let formatter = ISO8601DateFormatter()
// Merge and apply deletions first to prevent resurrection
let allDeletions = dataManager.getDeletedItems() + response.deletedItems
let uniqueDeletions = Array(Set(allDeletions))
print(
"iOS DELTA SYNC: Applying \(uniqueDeletions.count) deletion records before merging data"
)
applyDeletionsToDataManager(deletions: uniqueDeletions, dataManager: dataManager)
// Build deleted item lookup map
let deletedItemSet = Set(uniqueDeletions.map { $0.type + ":" + $0.id })
// Download images for new/modified problems from server
var imagePathMapping: [String: String] = [:]
for problem in response.problems {
if deletedItemSet.contains("problem:" + problem.id) {
continue
}
guard let imagePaths = problem.imagePaths, !imagePaths.isEmpty else { continue }
for (index, imagePath) in imagePaths.enumerated() {
@@ -293,6 +309,10 @@ class SyncService: ObservableObject {
// Merge gyms
for backupGym in response.gyms {
if deletedItemSet.contains("gym:" + backupGym.id) {
continue
}
if let index = dataManager.gyms.firstIndex(where: { $0.id.uuidString == backupGym.id })
{
let existing = dataManager.gyms[index]
@@ -306,6 +326,10 @@ class SyncService: ObservableObject {
// Merge problems
for backupProblem in response.problems {
if deletedItemSet.contains("problem:" + backupProblem.id) {
continue
}
var problemToMerge = backupProblem
if !imagePathMapping.isEmpty, let imagePaths = backupProblem.imagePaths {
let updatedPaths = imagePaths.compactMap { imagePathMapping[$0] ?? $0 }
@@ -341,6 +365,10 @@ class SyncService: ObservableObject {
// Merge sessions
for backupSession in response.sessions {
if deletedItemSet.contains("session:" + backupSession.id) {
continue
}
if let index = dataManager.sessions.firstIndex(where: {
$0.id.uuidString == backupSession.id
}) {
@@ -355,6 +383,10 @@ class SyncService: ObservableObject {
// Merge attempts
for backupAttempt in response.attempts {
if deletedItemSet.contains("attempt:" + backupAttempt.id) {
continue
}
if let index = dataManager.attempts.firstIndex(where: {
$0.id.uuidString == backupAttempt.id
}) {
@@ -367,9 +399,7 @@ class SyncService: ObservableObject {
}
}
// Apply deletions
let allDeletions = dataManager.getDeletedItems() + response.deletedItems
let uniqueDeletions = Array(Set(allDeletions))
// Apply deletions again for safety
applyDeletionsToDataManager(deletions: uniqueDeletions, dataManager: dataManager)
// Save all changes