diff --git a/mac/Keyman4MacIM/Keyman4MacIM/KMDataRepository.m b/mac/Keyman4MacIM/Keyman4MacIM/KMDataRepository.m index 4a2f6b5c2e..1c8101ed01 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM/KMDataRepository.m +++ b/mac/Keyman4MacIM/Keyman4MacIM/KMDataRepository.m @@ -325,7 +325,6 @@ NSString *const kContainerKeyboardsPartialPath = @"Library/Application Support/K // only move data if there is something to move if (dataExistsInOldLocation) { - [KMDataRepository.shared createSharedDirectoriesIfNecessary]; [KMDataRepository movePackages:[self keyman17KeyboardsDirectory] to:[self keyman19KeyboardsDirectory]]; // delete the Keyman-Keyboards directory @@ -334,7 +333,7 @@ NSString *const kContainerKeyboardsPartialPath = @"Library/Application Support/K if (error == nil) { os_log_debug([KMLogs dataLog], "deleted obsolete keyboards directory: '%{public}@'", [self keyman17KeyboardsDirectory]); } else { - os_log_error([KMLogs dataLog], "error attempting to delte obsolete keyboards directory: '%{public}@'", [error localizedDescription]); + os_log_error([KMLogs dataLog], "error attempting to delete obsolete keyboards directory: '%{public}@'", [error localizedDescription]); } } } @@ -351,7 +350,6 @@ NSString *const kContainerKeyboardsPartialPath = @"Library/Application Support/K // only move data if there is something to move if (dataExistsInOldLocation) { - [KMDataRepository.shared createSharedDirectoriesIfNecessary]; [KMDataRepository movePackages:[self keyman18KeyboardsDirectory] to:[self keyman19KeyboardsDirectory]]; // delete the Keyman-Keyboards directory @@ -361,7 +359,7 @@ NSString *const kContainerKeyboardsPartialPath = @"Library/Application Support/K if (error == nil) { os_log_debug([KMLogs dataLog], "deleted obsolete keyboards directory: '%{public}@'", [self keyman18KeyboardsDirectory]); } else { - os_log_error([KMLogs dataLog], "error attempting to delte obsolete keyboards directory: '%{public}@'", [error localizedDescription]); + os_log_error([KMLogs dataLog], "error attempting to delete obsolete keyboards directory: '%{public}@'", [error localizedDescription]); } } } diff --git a/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.m b/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.m index 3b7367a340..a4eb680bd3 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.m +++ b/mac/Keyman4MacIM/Keyman4MacIM/KMInputMethodAppDelegate.m @@ -793,9 +793,13 @@ CGEventRef eventTapFunction(CGEventTapProxy proxy, CGEventType type, CGEventRef switch (state) { case KeymanSettingsVersion17: os_log_info([KMLogs dataLog], "prepareStorage, migration needed for Keyman 17 to current"); + [KMDataRepository.shared createSharedDirectoriesIfNecessary]; + [KMDataRepository.shared migrateDataFromKeyman17]; + [KMSettingsRepository.shared migrateSettingsFromKeyman17]; break; case KeymanSettingsVersion18: os_log_info([KMLogs dataLog], "prepareStorage, migration needed for Keyman 18 to current"); + [KMDataRepository.shared createSharedDirectoriesIfNecessary]; [KMDataRepository.shared migrateDataFromKeyman18]; [KMSettingsRepository.shared migrateSettingsFromKeyman18]; break; @@ -803,7 +807,6 @@ CGEventRef eventTapFunction(CGEventTapProxy proxy, CGEventType type, CGEventRef os_log_info([KMLogs dataLog], "prepareStorage, settings not found, create them"); [KMDataRepository.shared createSharedDirectoriesIfNecessary]; [KMSettingsRepository.shared createSharedSettingsIfNecessary]; - // MAC-CONFIG-TODO: are settings created for fresh install? break; case KeymanSettingsVersionCurrent: os_log_info([KMLogs dataLog], "prepareStorage: settings are current, no migration needed"); diff --git a/mac/Keyman4MacIM/Keyman4MacIM/KMSettingsRepository.m b/mac/Keyman4MacIM/Keyman4MacIM/KMSettingsRepository.m index ef3b2a978f..8308af0734 100644 --- a/mac/Keyman4MacIM/Keyman4MacIM/KMSettingsRepository.m +++ b/mac/Keyman4MacIM/Keyman4MacIM/KMSettingsRepository.m @@ -99,7 +99,7 @@ NSInteger const kCurrentDataModelVersionNumber = kVersionStoreDataInGroupContain // settings were moved to share app group beginning in Keyman 19 if ([self settingsExistForAppGroup]) { os_log([KMLogs dataLog], "keyman shared settings exist, version is current"); - SettingsState state = KeymanSettingsVersionCurrent; + state = KeymanSettingsVersionCurrent; } else if ([self settingsExistForInputMethod]) { // In Keyman 18, KMDataModelVersion was added to settings and set to value of 1 // No need to check the value, if it exists in the app UserDefaults, then it needs to be migrated @@ -108,7 +108,7 @@ NSInteger const kCurrentDataModelVersionNumber = kVersionStoreDataInGroupContain state = KeymanSettingsVersion18; } else { // no KMDataModelVersion key is found in the app UserDefaults - os_log([KMLogs dataLog], "lack of keyman settings version indicates Keyman 17 or earlier, packages stored in ~/Documents"); + os_log([KMLogs dataLog], "lack of keyman settings version indicates Keyman 17 or earlier, packages stored in ~/Documents"); state = KeymanSettingsVersion17; } } else { @@ -430,7 +430,7 @@ NSInteger const kCurrentDataModelVersionNumber = kVersionStoreDataInGroupContain } - (void)migrateSettingsFromKeyman18 { - os_log_debug([KMLogs dataLog], "migrating settings in UserDefaults from Keyman 178"); + os_log_debug([KMLogs dataLog], "migrating settings in UserDefaults from Keyman 18"); [self migrateSettingsFromKeyman18ToAppGroup]; // set kDataModelVersion for the current format