Skip to content

Commit

Permalink
chore(common): Merge branch 'master' into refactor/common/12347-reorg…
Browse files Browse the repository at this point in the history
…-help
  • Loading branch information
mcdurdin committed Sep 25, 2024
2 parents 0e5fbb2 + 98566b4 commit 4b1e137
Show file tree
Hide file tree
Showing 66 changed files with 1,378 additions and 967 deletions.
29 changes: 29 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Keyman Version History

## 18.0.117 alpha 2024-09-25

* docs(common): Document how to skip generating CDN on websites (#12446)
* fix(android): Remove toggle for "Always Show Banner" (#12430)
* fix(android): Hide suggestion banner on password fields (#12442)
* fix(developer): prevent invalid string ids (#12465)

## 18.0.116 alpha 2024-09-20

* change(mac): remove verbose logging option (#12431)
* chore(common): Allow to build offline (#12439)

## 18.0.115 alpha 2024-09-19

* chore(common): detect ssh remotes in git hooks (#12437)
* fix(common): add proper configure output for hextobin (#12440)
* fix(core): add missing dependency for core (#12438)
* chore(developer): remove .js output from LDML compiler (#12432)

## 18.0.114 alpha 2024-09-17

* fix(developer): rewrite ldml visual keyboard compiler (#12402)
* fix(developer): check vars string usage before definition (#12404)
* change(mac): remove 'Always show OSK' option (#12355)

## 18.0.113 alpha 2024-09-16

* test(developer): kmcmplib compiler unit tests 3 (#11990)

## 18.0.112 alpha 2024-09-14

* chore(deps): bump express from 4.19.2 to 4.20.0 (#12396)
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.0.113
18.0.118
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
public class KeymanSettingsActivity extends BaseActivity {
protected static final String installedLanguagesKey = "InstalledLanguages";
protected static final String installKeyboardOrDictionaryKey = "InstallKeyboardOrDictionary";
protected static final String showBannerKey = "ShowBanner";
protected static final String sendCrashReport = "SendCrashReport";
public static final String spacebarTextKey = "SpacebarText";
public static final String hapticFeedbackKey = "HapticFeedback";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,6 @@ public boolean onPreferenceChange(Preference preference, Object newValue) {
editor.putBoolean(KeymanSettingsActivity.showBannerKey, isChecked);
as part of the default onClick() used by SwitchPreference.
*/
SwitchPreference bannerPreference = new SwitchPreference(context);
bannerPreference.setKey(KeymanSettingsActivity.showBannerKey);
bannerPreference.setTitle(getString(R.string.show_banner));
bannerPreference.setSummaryOn(getString(R.string.show_banner_on));
bannerPreference.setSummaryOff(getString(R.string.show_banner_off));

SwitchPreference getStartedPreference = new SwitchPreference(context);
getStartedPreference.setKey(GetStartedActivity.showGetStartedKey);
getStartedPreference.setTitle(String.format(getString(R.string.show_get_started), getString(R.string.get_started)));
Expand All @@ -207,7 +201,6 @@ as part of the default onClick() used by SwitchPreference.
screen.addPreference(spacebarTextPreference);

screen.addPreference(hapticFeedbackPreference);
screen.addPreference(bannerPreference);
screen.addPreference(getStartedPreference);
screen.addPreference(sendCrashReportPreference);

Expand Down
6 changes: 3 additions & 3 deletions android/KMAPro/kMAPro/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@
<!-- Context: Keyman Settings menu / Haptic feedback -->
<string name="haptic_feedback" comment="haptic feedback on key press">Vibrate when typing</string>

<!-- Context: Keyman Settings menu -->
<!-- Context: Keyman Settings menu. Removed in Keyman 18 -->
<string name="show_banner" comment="text suggestions banner">Always show banner</string>

<!-- Context: Keyman Settings menu -->
<!-- Context: Keyman Settings menu. Removed in Keyman 18 -->
<string name="show_banner_on" comment="Description when toggle is on">To be implemented</string>

<!-- Context: Keyman Settings menu -->
<!-- Context: Keyman Settings menu. Removed in Keyman 18 -->
<string name="show_banner_off" comment="Description when toggle is off">When off, only shown when predictive text is enabled</string>

<!-- Context: Keyman Settings menu -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
// appContext instead of context?
SharedPreferences prefs = context.getSharedPreferences(context.getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
boolean modelPredictionPref = false;
if (KMManager.currentLexicalModel != null) {
if (!KMManager.getMayPredictOverride() && KMManager.currentLexicalModel != null) {
modelPredictionPref = prefs.getBoolean(KMManager.getLanguagePredictionPreferenceKey(KMManager.currentLexicalModel.get(KMManager.KMKey_LanguageID)), true);
}
KMManager.setBannerOptions(modelPredictionPref);
Expand Down
Binary file modified android/docs/help/android_images/settings-screen-ap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions android/docs/help/basic/config/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ Click on this to [change the displayed keyboard name](spacebar-caption) on the s
## Vibrate When Typing
When enabled, the Keyman keyboard will provide haptic feedback (vibrate) when the user presses a key and generates output. The default preference is off.

## Always show banner
This toggle is reserved for future features. When off, the text suggestion banner is only displayed when
the dictionary is enabled. The language associated with the keyboard must match the language associated with
the dictionary.

## Show "Get Started" on startup
When enabled, the Keyman app will display the 'Get Started' screen on app startup.

Expand Down
2 changes: 1 addition & 1 deletion common/tools/hextobin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ THIS_SCRIPT="$(readlink -f "${BASH_SOURCE[0]}")"

builder_describe "Build hextobin" clean configure build
builder_describe_outputs \
configure /node_modules \
configure /common/tools/hextobin/node_modules/commander \
build /common/tools/hextobin/build/index.js

builder_parse "$@"
Expand Down
2 changes: 1 addition & 1 deletion common/web/types/src/kmx/kmx-plus/kmx-plus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export class Vars extends Section {
});
}
findStringVariableValue(id: string): string {
return Vars.findVariable(this.strings, id)?.value?.value; // Unwrap: Variable, StrsItem
return Vars.findVariable(this.strings, id)?.value?.value ?? null; // Unwrap: Variable, StrsItem
}
substituteSetRegex(str: string, sections: DependencySections): string {
return str.replaceAll(VariableParser.SET_REFERENCE, (_entire, id) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
/*
* Keyman is copyright (C) SIL International. MIT License.
*/
import { CompilerErrorNamespace, CompilerErrorSeverity, CompilerMessageDef as def, CompilerMessageSpec as m } from './compiler-interfaces.js';
import { constants } from '@keymanapp/ldml-keyboard-constants';

Expand Down Expand Up @@ -43,4 +46,8 @@ export class CommonTypesMessages {
static Error_TestDataUnexpectedArray = (o: {subtag: string}) =>
m(this.ERROR_TestDataUnexpectedArray,
`Problem reading test data: expected single ${def(o.subtag)} element, found multiple`);

static ERROR_InvalidXml = SevError | 0x0008;
static Error_InvalidXml = (o:{e: any}) =>
m(this.ERROR_InvalidXml, `The XML file could not be read: ${(o.e ?? '').toString()}`);
};
2 changes: 1 addition & 1 deletion developer/src/common/web/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ export { defaultCompilerOptions, CompilerBaseOptions, CompilerCallbacks, Compile

} from './compiler-interfaces.js';

export { CommonTypesMessages } from './common-events.js';
export { CommonTypesMessages } from './common-messages.js';

export * as xml2js from './deps/xml2js/xml2js.js';
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
/*
* Keyman is copyright (C) SIL International. MIT License.
*
* Reads a LDML XML keyboard file into JS object tree and resolves imports
*/
import { SchemaValidators, util } from '@keymanapp/common-types';
import { xml2js } from '../../index.js';
import { CommonTypesMessages } from '../../common-events.js';
import { CommonTypesMessages } from '../../common-messages.js';
import { CompilerCallbacks } from '../../compiler-interfaces.js';
import { LDMLKeyboardXMLSourceFile, LKImport, ImportStatus } from './ldml-keyboard-xml.js';
import { constants } from '@keymanapp/ldml-keyboard-constants';
Expand Down Expand Up @@ -114,6 +119,7 @@ export class LDMLKeyboardXMLSourceFileReader {
for (const sub of obj) {
// retain the same subtag
if (!this.boxImportsAndSpecials(sub, subtag)) {
// resolveImports has already logged a message
return false;
}
}
Expand All @@ -126,13 +132,15 @@ export class LDMLKeyboardXMLSourceFileReader {
boxXmlArray(obj, key);
// Now, resolve the import
if (!this.resolveImports(obj, subtag)) {
// resolveImports has already logged a message
return false;
}
// now delete the import array we so carefully constructed, the caller does not
// want to see it.
delete obj['import'];
} else {
if (!this.boxImportsAndSpecials(obj[key], key)) {
// resolveImports has already logged a message
return false;
}
}
Expand All @@ -152,6 +160,7 @@ export class LDMLKeyboardXMLSourceFileReader {
// first, the explicit imports
for (const asImport of ([...obj['import'] as LKImport[]].reverse())) {
if (!this.resolveOneImport(obj, subtag, asImport)) {
// resolveOneImport has already logged a message
return false;
}
}
Expand All @@ -162,6 +171,7 @@ export class LDMLKeyboardXMLSourceFileReader {
base: constants.cldr_import_base,
path: constants.cldr_implied_keys_import
}, true)) {
// resolveOneImport has already logged a message
return false;
}
} else if (subtag === 'forms') {
Expand All @@ -170,6 +180,7 @@ export class LDMLKeyboardXMLSourceFileReader {
base: constants.cldr_import_base,
path: constants.cldr_implied_forms_import
}, true)) {
// resolveOneImport has already logged a message
return false;
}
}
Expand Down Expand Up @@ -267,7 +278,8 @@ export class LDMLKeyboardXMLSourceFileReader {
// An alternative fix would be to pull xml2js directly from github
// rather than using the version tagged on npmjs.com.
});
parser.parseString(file, (e: unknown, r: unknown) => { a = r as LDMLKeyboardXMLSourceFile }); // TODO-LDML: isn't 'e' the error?
const data = new TextDecoder().decode(file);
parser.parseString(data, (e: unknown, r: unknown) => { if(e) throw e; a = r as LDMLKeyboardXMLSourceFile }); // TODO-LDML: isn't 'e' the error?
return a;
})();
return source;
Expand All @@ -279,14 +291,23 @@ export class LDMLKeyboardXMLSourceFileReader {
*/
public load(file: Uint8Array): LDMLKeyboardXMLSourceFile | null {
if (!file) {
throw new Error(`file parameter must not be null`);
}

let source: LDMLKeyboardXMLSourceFile = null;
try {
source = this.loadUnboxed(file);
} catch(e) {
this.callbacks.reportMessage(CommonTypesMessages.Error_InvalidXml({e}));
return null;
}
const source = this.loadUnboxed(file);
if(this.boxArrays(source)) {

if (this.boxArrays(source)) {
return source;
} else {
return null;
}

// boxArrays ... resolveImports has already logged a message
return null;
}

loadTestDataUnboxed(file: Uint8Array): any {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { LKKey, ImportStatus } from '../../src/types/ldml-keyboard/ldml-keyboard-xml.js';
import 'mocha';
import {assert} from 'chai';
import { CommonTypesMessages } from '../../src/common-events.js';
import { CommonTypesMessages } from '../../src/common-messages.js';
import { testReaderCases } from '../helpers/reader-callback-test.js';
import { Constants } from '@keymanapp/common-types';

Expand Down
4 changes: 3 additions & 1 deletion developer/src/kmc-ldml/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,22 @@
"url": "https://github.com/keymanapp/keyman/issues"
},
"dependencies": {
"@keymanapp/keyman-version": "*",
"@keymanapp/developer-utils": "*",
"@keymanapp/keyman-version": "*",
"@keymanapp/kmc-kmn": "*",
"@keymanapp/ldml-keyboard-constants": "*",
"semver": "^7.5.4"
},
"devDependencies": {
"@keymanapp/developer-test-helpers": "*",
"@keymanapp/resources-gosh": "*",
"@types/common-tags": "^1.8.4",
"@types/mocha": "^5.2.7",
"@types/node": "^20.4.1",
"@types/semver": "^7.3.12",
"c8": "^7.12.0",
"chalk": "^2.4.2",
"common-tags": "^1.8.2",
"mocha": "^8.4.0",
"typescript": "^5.4.5"
},
Expand Down
Loading

0 comments on commit 4b1e137

Please sign in to comment.