mgrLM // Allow in-place writing to UserExclPhraseData.
This commit is contained in:
parent
50f0d9883f
commit
c0494ae432
|
@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||||
+ (BOOL)checkIfUserDataFolderExists;
|
+ (BOOL)checkIfUserDataFolderExists;
|
||||||
|
|
||||||
+ (BOOL)checkIfUserPhraseExist:(NSString *)userPhrase inputMode:(InputMode)mode key:(NSString *)key NS_SWIFT_NAME(checkIfUserPhraseExist(userPhrase:mode:key:));
|
+ (BOOL)checkIfUserPhraseExist:(NSString *)userPhrase inputMode:(InputMode)mode key:(NSString *)key NS_SWIFT_NAME(checkIfUserPhraseExist(userPhrase:mode:key:));
|
||||||
+ (BOOL)writeUserPhrase:(NSString *)userPhrase inputMode:(InputMode)mode areWeDuplicating:(BOOL)areWeDuplicating;
|
+ (BOOL)writeUserPhrase:(NSString *)userPhrase inputMode:(InputMode)mode areWeDuplicating:(BOOL)areWeDuplicating areWeDeleting:(BOOL)areWeDeleting;
|
||||||
+ (void)setPhraseReplacementEnabled:(BOOL)phraseReplacementEnabled;
|
+ (void)setPhraseReplacementEnabled:(BOOL)phraseReplacementEnabled;
|
||||||
+ (void)setCNSEnabled:(BOOL)cnsEnabled;
|
+ (void)setCNSEnabled:(BOOL)cnsEnabled;
|
||||||
+ (void)setSymbolEnabled:(BOOL)symbolEnabled;
|
+ (void)setSymbolEnabled:(BOOL)symbolEnabled;
|
||||||
|
|
|
@ -235,14 +235,14 @@ static void LTLoadLanguageModelFile(NSString *filenameWithoutExtension, vChewing
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (BOOL)writeUserPhrase:(NSString *)userPhrase inputMode:(InputMode)mode areWeDuplicating:(BOOL)areWeDuplicating
|
+ (BOOL)writeUserPhrase:(NSString *)userPhrase inputMode:(InputMode)mode areWeDuplicating:(BOOL)areWeDuplicating areWeDeleting:(BOOL)areWeDeleting
|
||||||
{
|
{
|
||||||
if (![self checkIfUserLanguageModelFilesExist]) {
|
if (![self checkIfUserLanguageModelFilesExist]) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// BOOL addLineBreakAtFront = NO;
|
// BOOL addLineBreakAtFront = NO;
|
||||||
NSString *path = [self userPhrasesDataPath:mode];
|
NSString *path = areWeDeleting ? [self excludedPhrasesDataPath:mode] : [self userPhrasesDataPath:mode];
|
||||||
|
|
||||||
// if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
|
// if ([[NSFileManager defaultManager] fileExistsAtPath:path]) {
|
||||||
// NSError *error = nil;
|
// NSError *error = nil;
|
||||||
|
@ -267,7 +267,7 @@ static void LTLoadLanguageModelFile(NSString *filenameWithoutExtension, vChewing
|
||||||
// [currentMarkedPhrase appendString:@"\n"];
|
// [currentMarkedPhrase appendString:@"\n"];
|
||||||
// }
|
// }
|
||||||
[currentMarkedPhrase appendString:userPhrase];
|
[currentMarkedPhrase appendString:userPhrase];
|
||||||
if (areWeDuplicating) {
|
if (areWeDuplicating && !areWeDeleting) {
|
||||||
// Do not use ASCII characters to comment here.
|
// Do not use ASCII characters to comment here.
|
||||||
// Otherwise, it will be scrambled by HYPY2BPMF module shipped in the vChewing Phrase Editor.
|
// Otherwise, it will be scrambled by HYPY2BPMF module shipped in the vChewing Phrase Editor.
|
||||||
[currentMarkedPhrase appendString:@"\t#𝙾𝚟𝚎𝚛𝚛𝚒𝚍𝚎"];
|
[currentMarkedPhrase appendString:@"\t#𝙾𝚟𝚎𝚛𝚛𝚒𝚍𝚎"];
|
||||||
|
|
Loading…
Reference in New Issue