Skip to content

Commit

Permalink
change(mac): some minor changes after review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sgschantz committed Aug 27, 2024
1 parent 24f4a61 commit ea6e295
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 18 deletions.
10 changes: 5 additions & 5 deletions mac/Keyman4MacIM/Keyman4MacIM/KMDataRepository.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/*
* Keyman is copyright (C) SIL International. MIT License.
*
* KMDataRepository.h
* Keyman
*
* Created by Shawn Schantz on 2024-07-30.
*
*/
Expand All @@ -13,9 +10,12 @@
NS_ASSUME_NONNULL_BEGIN

@interface KMDataRepository : NSObject
@property (readonly) NSURL *keymanDataDirectory; // '~/Library/Application Support/keyman.inputmethod.Keyman'
// keymanDataDirectory: '~/Library/Application Support/keyman.inputmethod.Keyman'
@property (readonly) NSURL *keymanDataDirectory;

// keymanKeyboardsDirectory: '~/Library/Application Support/keyman.inputmethod.Keyman/Keyman-Keyboards'
@property (readonly) NSURL *keymanKeyboardsDirectory;
// keymanKeyboardsDirectory = '~/Library/Application Support/keyman.inputmethod.Keyman/Keyman-Keyboards'

+ (KMDataRepository *)shared;
- (void)createDataDirectoryIfNecessary;
- (void)createKeyboardsDirectoryIfNecessary;
Expand Down
14 changes: 6 additions & 8 deletions mac/Keyman4MacIM/Keyman4MacIM/KMDataRepository.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/*
* Keyman is copyright (C) SIL International. MIT License.
*
* KMResourcesRepository.m
* Keyman
*
* Created by Shawn Schantz on 2024-07-30.
*
* Singleton object which serves as an abstraction for the reading and writing of Keyman data.
Expand Down Expand Up @@ -39,11 +36,11 @@ @implementation KMDataRepository
@synthesize obsoleteKeymanKeyboardsDirectory = _obsoleteKeymanKeyboardsDirectory;

NSString *const kKeyboardsDirectoryName = @"Keyman-Keyboards";
/*
The name of the subdirectory within '~/Library/Application Support'.
We follow the convention of using the bundle identifier rather than our subsystem id.
(Also, using the subsystem id, "com.keyman.app", is a poor choice because the API
createDirectoryAtPath sees the .app extension and creates an application file.
/**
* The name of the subdirectory within '~/Library/Application Support'.
* We follow the convention of using the bundle identifier rather than our subsystem id.
* (Also, using the subsystem id, "com.keyman.app", is a poor choice because the API
* createDirectoryAtPath sees the .app extension and creates an application file.)
*/
NSString *const kKeymanSubdirectoryName = @"keyman.inputmethod.Keyman";

Expand Down Expand Up @@ -158,6 +155,7 @@ - (NSURL *)obsoleteKeymanKeyboardsDirectory {
}
return _obsoleteKeymanKeyboardsDirectory;
}

/**
* Only called from migrateData.
* Causes user to be prompted for permission to access ~/Documents, but they should already have it.
Expand Down
6 changes: 1 addition & 5 deletions mac/Keyman4MacIM/Keyman4MacIM/KMSettingsRepository.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/*
* Keyman is copyright (C) SIL International. MIT License.
*
* KMSettingsRepository.h
* Keyman
*
* Created by Shawn Schantz on 2024-07-29.
*
* Singleton object for reading and writing Keyman application settings.
Expand Down Expand Up @@ -61,7 +58,7 @@ - (BOOL)settingsExist {
* For versions before version 1, the keyboards were stored under the ~/Documents directory.
*/
- (BOOL)dataModelWithKeyboardsInLibrary {
// NSUserDefaults returns zero if the key does not exist
// [NSUserDefaults integerForKey] returns zero if the key does not exist
NSInteger dataModelVersion = [[NSUserDefaults standardUserDefaults] integerForKey:kDataModelVersion];

return dataModelVersion >= kVersionStoreDataInLibraryDirectory;
Expand Down Expand Up @@ -142,7 +139,6 @@ - (void)convertSelectedKeyboardPathForMigration {
* Convert the path of the keyboard designating the Documents folder to its new location
* in the Application Support folder
*/

- (NSString *)convertOldKeyboardPath:(NSString *)oldPath {
NSString *newPathString = @"";
if(oldPath != nil) {
Expand Down

0 comments on commit ea6e295

Please sign in to comment.