From 4b4fc3304f18cdae25531f34ce7ee6be8a8a8f08 Mon Sep 17 00:00:00 2001 From: jahorton Date: Fri, 12 Jun 2020 10:30:14 +0700 Subject: [PATCH] feat(ios/engine): adjustments after splitting off package-id commit --- ios/engine/KMEI/KeymanEngine/Classes/Migrations.swift | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ios/engine/KMEI/KeymanEngine/Classes/Migrations.swift b/ios/engine/KMEI/KeymanEngine/Classes/Migrations.swift index 2feaae4ac2..36d285b61d 100644 --- a/ios/engine/KMEI/KeymanEngine/Classes/Migrations.swift +++ b/ios/engine/KMEI/KeymanEngine/Classes/Migrations.swift @@ -532,7 +532,6 @@ public enum Migrations { _ resources: [Resource], matchLocal localPackages: [Package]) -> [Resource] { // Step 2 - determine which resources were installed from our locally-available KMPs, // then migrate by reinstalling the KMP. - var processedResources: [Resource] = [] var matched: [Resource] = [] localPackages.forEach { package in @@ -561,9 +560,17 @@ public enum Migrations { return matched.contains(where: { $0.typedFullID == resource.typedFullID }) ? nil : resource } - unmatched.forEach { resource in + let processedUnmatched: [Resource] = unmatched.compactMap { resource in // TODO: Migrate 'em by generating kmp.json files in their folders. // Generated 'package' id: the resource's own ID, since that's where it's stored. + + + + // This can't be done directly. BUT, once the kmp.json is written and loaded as a package, + // we can parse the KMP to get the version with a package ID. + var processedResource = resource + //processedResource.packageID = resource.id + return processedResource } return matched + unmatched