diff --git a/.flake8 b/.flake8
new file mode 100644
index 0000000000000000000000000000000000000000..c211bcb7f61a0f93e9c06cc7fb3df6a11eb32f7e
--- /dev/null
+++ b/.flake8
@@ -0,0 +1,5 @@
+[flake8]
+max-line-length = 120
+ignore =
+ E402, # module level import not at top of file
+ W504, # line break after binary operator
diff --git a/.github/labeler.yml b/.github/labeler.yml
new file mode 100644
index 0000000000000000000000000000000000000000..7d3b6c5ac081db75f2384ed110033284e7c42dc9
--- /dev/null
+++ b/.github/labeler.yml
@@ -0,0 +1,87 @@
+#
+# This file adds labels based on the scopes in resources/scopes/scopes.json.
+# Currently it must be manually kept up to date. Not all labels are added, only
+# common ones. The others are commented out. There is still some variance between
+# folder names and labels; consider this documentation of that ;-)
+#
+
+android/: android/**
+android/app/: android/KMAPro/**
+#android/browser/:
+android/engine/: android/KMEA/**
+#android/resources/:
+android/samples/: android/Samples/**
+
+common/:
+ - common/**
+ - resources/**
+common/core/: common/core/**
+common/core/desktop/: common/core/desktop/**
+common/core/web/: common/core/web/**
+
+common/models/: common/models/**
+common/models/types/: common/models/types/**
+common/models/templates/: common/models/templates/**
+common/models/wordbreakers/: common/models/wordbreakers/**
+
+common/resources/: resources/**
+
+developer/:
+ - developer/**
+ - windows/src/developer/**
+
+developer/compilers/:
+ - windows/src/developer/kmcomp/**
+ - developer/js/**
+
+developer/ide/:
+ - windows/src/developer/TIKE/**
+
+# developer/resources/
+# developer/tools/
+
+ios/: ios/**
+ios/app/: ios/keyman/**
+# ios/browser/
+ios/engine/: ios/engine/**
+# ios/resources/
+ios/samples/: ios/samples/**
+
+linux/: linux/**
+linux/config/: linux/keyman-config/**
+linux/engine/:
+ - linux/ibus-keyman/**
+ - linux/ibus-kmfl/**
+ - linux/kmflcomp/**
+ - linux/libkmfl/**
+ - linux/scim_kmfl_imengine/**
+# linux/resources/
+# linux/samples/
+
+mac/: mac/**
+# mac/config/:
+mac/engine/: mac/**
+# mac/resources/
+# mac/samples/
+
+oem/: oem/**
+oem/fv/: oem/firstvoices/**
+oem/fv/android/: oem/firstvoices/android/**
+oem/fv/ios/: oem/firstvoices/ios/**
+oem/fv/windows/: oem/firstvoices/windows/**
+
+web/: web/**
+# web/bookmarklet/
+web/engine/: web/source/**
+# web/resources/
+web/ui/: web/source/kmwui*
+web/samples/: web/samples/**
+
+# Somewhat messy since we try and exclude Developer :)
+windows/:
+- any: ['windows/**', '!windows/src/developer/**']
+
+windows/config/: windows/src/desktop/**
+windows/engine/: windows/src/engine/**
+# windows/resources/
+# windows/samples/
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
new file mode 100644
index 0000000000000000000000000000000000000000..1bc2f29742da0fdf29b1f842ca83a6971598e203
--- /dev/null
+++ b/.github/workflows/labeler.yml
@@ -0,0 +1,11 @@
+name: "Pull Request Labeler"
+on:
+- pull_request
+
+jobs:
+ triage:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/labeler@4b52aec09ba832eb9aecccddbccce644ba9ba69d
+ with:
+ repo-token: "${{ secrets.GITHUB_TOKEN }}"
\ No newline at end of file
diff --git a/.gitignore b/.gitignore
index 645439b8400271f619067d3b2db20ef801979a9e..7d3fd45792d832da0ab8815e79dcf48f25710c97 100644
--- a/.gitignore
+++ b/.gitignore
@@ -258,3 +258,9 @@ resources/environment.sh
# Copy of the master VERSION.md used for Linux packaging
/common/core/desktop/VERSION.md
+
+**/node_modules/
+lerna-debug.log
+
+# Cached/auto-compiled Python bytecode
+*.pyc
diff --git a/HISTORY.md b/HISTORY.md
index eca312efce3e82b24823f74b4352e4eb34d19568..a57940e8e92631110df7c14449df9e96a2e4f16f 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -1,5 +1,533 @@
# Keyman Version History
+## 14.0.143 alpha 2020-09-16
+
+* fix(android/app): Validate language selection for "INSTALL" button (#3579)
+
+## 14.0.142 alpha 2020-09-15
+
+* chore(deps): bump node-fetch from 2.6.0 to 2.6.1 in /resources/build/version (#3578)
+
+## 14.0.141 alpha 2020-09-11
+
+* fix(web): default layout shift not changing layer (#3574)
+
+## 14.0.140 alpha 2020-09-09
+
+* feat(common/models): core edit-distance calculation class (#3526)
+* feat(common/models): Edit path derivation (#3547)
+* feat(common/models): low-level correction-algorithm infrastructure (#3527)
+* feat(common/models): correction-search algorithm core (#3534)
+
+## 14.0.139 alpha 2020-09-04
+
+* fix(windows): BCP 47 tag canonicalization (#3545)
+* fix(windows): upgrade of profiles from 13.0 (#3552)
+
+## 14.0.138 alpha 2020-09-02
+
+* feat(windows): map installed bcp47 (#3542)
+* fix(windows): simplify profile uninstall (#3543)
+* fix(android/app): Remove unused intent ACTION_GET_USERDATA (#3551)
+* fix(android/engine): Remove notification after installing kbd package (#3546)
+* fix(android): Re-enable monitoring of Application Not Responding (ANR) (#3550)
+
+## 14.0.137 alpha 2020-08-31
+
+* fix(android/engine): Fix package filename when downloading from cloud (#3541)
+* feat(windows): select language at keyboard install (#3524)
+* feat(windows): add langtags.json data (#3529)
+* fix(windows): add transient profile support to keyman32 (#3539)
+
+## 14.0.136 alpha 2020-08-28
+
+* fix(android/app): Inject meta viewport tag for viewing help (#3523)
+* fix(android/app): Fix overflow menu for hdpi devices (#3532)
+* feat(windows): Rework of profile installation - Engine (#3509)
+* feat(windows): profile installation - Keyman for Windows (#3510)
+* feat(windows): profile installation - Support Tool (#3511)
+* chore(windows): remove stockeditor (#3516)
+* fix(windows): refresh configuration after changes (#3517)
+* feat(windows): split language registration on app install (#3520)
+* fix(linux): Improve robustness when installing ibus-keyman (#3535)
+
+## 14.0.135 alpha 2020-08-27
+
+* feat(common/models): override script defaults: spaces break words (#3506)
+* fix(android/engine): Check asset package version before installing (#3514)
+* feat(android): Use Stepper for navigating package installation steps (#3498)
+
+## 14.0.134 alpha 2020-08-26
+
+* [linux] Add packaging of Linux localization files (#3504)
+
+## 14.0.133 alpha 2020-08-25
+
+* feat(common/models): lexicon traversal (#3479)
+* feat(common/models): actual priority queue for Trie models (#3480)
+* feat(common/models): efficient batch-enqueue (#3486)
+
+## 14.0.132 alpha 2020-08-24
+
+* feat(linux): Small UI improvements (#3495)
+
+## 14.0.131 alpha 2020-08-21
+
+* feat(android/app): Add language picker for keyboard package installation (#3481)
+
+## 14.0.130 alpha 2020-08-19
+
+* fix(android): Fix util to getting the tier on CI builds (#3491)
+
+## 14.0.129 alpha 2020-08-17
+
+* feat(windows): rework download keyboard dialog style (#3463)
+* chore: Add sample vscode settings files (#3249)
+* fix(linux): Lookup language tag from keyboard (#3408)
+
+## 14.0.128 alpha 2020-08-13
+
+* feat(linux): Hook up Sentry for km-config (#3378)
+* chore(linux): Use new staging site names and use variable for downloads.keyman.com (#3406)
+
+## 14.0.127 alpha 2020-08-12
+
+* refactor(common/models): LMLayer state management tweak, persistent ModelCompositor (#3477)
+
+## 14.0.126 alpha 2020-08-10
+
+* fix(android): Add CI script to publish to Play Store (#3469)
+* fix(android): Update sentry plugin to remove obsolete API use (#3471)
+* feat(ios/app): universal links for keyboard installation (#3466)
+* fix(ios/engine): Proper associating-installer deinitialization, cancellation tests (#3468)
+* refactor(ios): error definitions, i18n (#3470)
+* chore: cleanup keyboardprocessor.h.in (#3473)
+
+## 14.0.125 alpha 2020-08-07
+
+* fix(android): Update Gradle wrapper to 5.6.4 (#3467)
+* feat(ios/engine): Associating package installer (#3458)
+* feat(ios/app): Associating package installer use within existing install paths (#3465)
+
+## 14.0.124 alpha 2020-08-06
+
+* feat(windows): set default UI language at install (#3438)
+* feat(windows): i18n for Setup (#3444)
+* feat(windows): add globe icon to Configuration UI (#3446)
+* feat(windows): set UI language from Setup preference on first install (#3447)
+* feat(windows): docs on editing translations (#3448)
+* Modify/android/improve string context (#3457)
+* fix(android/app): Fix environment portion of app version string (#3462)
+
+## 14.0.123 alpha 2020-08-05
+
+* feat(android): Use staging help site for pre-release builds (#3453)
+* fix(android): Cleanup string formatting with strings.xml (#3452)
+* chore(android): Add script to find unused strings. Manually remove them (#3456)
+* feat(ios/engine): LanguagePickAssociator progress tracking, base integration with package lang picker (#3455)
+
+## 14.0.122 alpha 2020-08-04
+
+* feat(android/app): Associate app with /keyboards/install links (#3449)
+* fix(android): Update KMPBrowser to pass external links to user browser (#3439)
+* feat(ios/engine): Language-pick associator (#3451)
+
+## 14.0.121 alpha 2020-08-03
+
+* fix(android): Fix KMTextView to compile on Linux (#3442)
+
+## 14.0.120 alpha 2020-07-31
+
+* feat(android): Use api.keyman-staging.com for pre-release builds (#3423)
+* refactor(ios/engine): merges keyboard & lexical model info views, fixes QR code logic (#3432)
+* feat(android): Add app association to keyman.com (#3431)
+* chore(windows): cleanup comments in strings.xml (#3434)
+* feat(ios/engine): language selection during (file-based) package installation (#3416)
+* feat(ios/engine) Package-installer layout optimizations (#3437)
+
+## 14.0.119 alpha 2020-07-30
+
+* feat(windows): convert locale.xml to strings.xml format (#3424)
+* refactor(windows): add translations to windows install (#3428)
+* refactor(windows): remove old locale links (#3429)
+* chore(windows): remove old locale tools (#3430)
+* feat(ios): Start of engine and app internationalization (#2745)
+
+## 14.0.118 alpha 2020-07-29
+
+* fix(android/app): Use go/android/ links to download cloud keyboards (#3343)
+* fix(windows): i18n of strings in Font Helper (#3414)
+* refactor(windows): refactor Dialog elements (#3421)
+* chore(windows): Remove usage page resources (#3422)
+
+## 14.0.117 alpha 2020-07-28
+
+* feat(windows): i18n groundwork (#3411)
+* feat(windows): Removes unused strings from locale.xml (#3412)
+* refactor(ios/engine): package installer tweaks (#3410)
+* chore(ios/engine): more obsoletions (#3407)
+
+## 14.0.116 alpha 2020-07-24
+
+* refactor(ios/engine): builds package download links (#3383)
+* refactor(ios/engine): chained lexical model install callback, fix (#3388)
+* feat(ios/engine): download queue concurrency (#3395)
+* feat(ios/engine): keyboard search core (#3384)
+* feat(ios/engine): support for deferred chaining of lexical model downloads (#3401)
+* docs(linux): Update readme (#3397)
+* feat(ios/engine): use of Keyman staging sites (#3405)
+* feat(linux): keyman:// protocol handler (#3398)
+* chore(ios/engine): dead code removal + deprecations (#3402)
+
+## 14.0.115 alpha 2020-07-23
+
+* feat(windows): keyman: protocol handler (#3382)
+* feat(developer/compilers): logging errors and warnings in the lexical model compiler (#3385)
+
+## 14.0.114 alpha 2020-07-22
+
+* chore(deps): bump lodash from 4.17.15 to 4.17.19 in /web/testing/regression-tests (#3360)
+
+## 14.0.113 alpha 2020-07-21
+
+* refactor(ios/engine): update detection now based upon packages (#3362)
+* refactor(ios/engine): package download notifications (#3363)
+* refactor(ios/engine): package-based resource updates, cloud resource migration (#3372)
+* fix(ios/engine): engine tier enum, proper detection (#3373)
+* refactor(ios/engine): Centralized Keyman domain definitions (#3381)
+* fix(linux): Use language from search when installing keyboard (#3290)
+* refactor(linux): Small refactorings (#3376)
+* refactor(developer/compilers): reading from a wordlist (#3380)
+
+## 14.0.112 alpha 2020-07-20
+
+* refactor(ios/engine): package-version query caching + package state properties (#3335)
+* refactor(ios/engine): keyboard downloads now retrieve KMPs (#3341)
+* refactor(ios/engine): download queue & download state detection cleanup (#3342)
+* chore(developer): cleanup test constants (#3350)
+* change(common/models/wordbreakers): update word boundary props to 13.0 (#3365)
+* feat(linux): Use staging URLs for alpha version (#3364)
+
+## 14.0.111 alpha 2020-07-16
+
+* fix(android/engine): Update deprecated call to switch system keyboard for Android P (#3353)
+
+## 14.0.110 alpha 2020-07-15
+
+* refactor(developer): hashmap-based wordlist compilation (#3340)
+* chore(linux): Add license details for kmpdetails.* (#3355)
+
+## 14.0.109 alpha 2020-07-14
+
+* refactor(ios/engine): lexical model query & download rework (#3327)
+* refactor(ios/engine): hashable package keys (#3333)
+* fix(ios/engine): version equality (#3334)
+* refactor(linux): make some methods protected (#3291)
+* feat(android/oem): Add nrc.str.sencoten model and update SystemKeyboard from KMAPro (#3332)
+
+## 14.0.108 alpha 2020-07-09
+
+* chore: cleanup global ExtPath (#3315)
+* feat(android): Use build-download-resources.sh for KMApro and FV apps (#3322)
+* refactor(ios/engine): Centralized package download utility function (#3299)
+* fix(android/oem): Add a fallback keyboard to FV Android app (#3323)
+
+## 14.0.107 alpha 2020-07-08
+
+* feat(android): Add additional info on installed keyboards exceptions (#3319)
+
+## 14.0.106 alpha 2020-07-04
+
+* fix(android/app) Download associated dictionary when installing cloud keyboard package (#3307)
+
+## 14.0.105 alpha 2020-07-03
+
+* feat(android): Download default resources at build time (#3300)
+* fix(android/engine): Fix unbound variable in build script (#3308)
+
+## 14.0.104 alpha 2020-07-01
+
+* fix(android): Resize PackageActivity title text (#3297)
+
+## 14.0.103 alpha 2020-06-30
+
+* fix(common/core/web): fixes transcription buffer cap (#3301)
+
+## 14.0.102 alpha 2020-06-29
+
+* fix(android): Use tier to determine keyboard search host (#3296)
+* refactor(ios/engine): Resource download cleanup and mocking prep (#3292)
+* refactor(ios/engine): ID-based download tracking, update notification rework (#3295)
+
+## 14.0.101 alpha 2020-06-26
+
+* feat(linux): address code review comments of #3278 (#3281)
+* fix(linux): Always restart IBus when installing keyboard (#3284)
+* refactor(linux): cleanup code (#3286)
+* fix(linux): Fix crash converting kvk into LDML (#3288)
+* feat(ios/engine): package-version query implementation (#3280)
+
+## 14.0.100 alpha 2020-06-25
+
+* refactor(ios/engine): Download notifications via completion blocks (#3274)
+* refactor(ios/engine): better resource type links (#3276)
+* refactor(ios/engine): Resource-download installation closures (#3277)
+* feat(linux): Install keyboard on Gnome (#3278)
+
+## 14.0.99 alpha 2020-06-24
+
+* feat(ios/engine): adds getInstalledPackage(for:) (#3270)
+* refactor(linux): address code review comments of #3272 (#3275)
+
+## 14.0.98 alpha 2020-06-23
+
+* refactor(ios/engine): reworks download queue objects (#3267)
+* feat(linux): Improve Linux package description (#3268)
+
+## 14.0.97 alpha 2020-06-22
+
+* feat(android): Implement menu to add language for installed keyboard pkg (#3255)
+* fix(mac/resources): altool is failing but we lose the log in CI (#3264)
+* refactor(ios/engine): more notification rework prep (#3262)
+* fix(mac): altool second call report ci errors (#3265)
+* refactor(ios/engine): more dead code removal (#3266)
+
+## 14.0.96 alpha 2020-06-19
+
+* fix(ios/engine): fixes keyboard swapping (#3259)
+* fix(common/resources): shebang for lerna-based Linux builds (#3260)
+* refactor(ios/engine): Notification rework prep, simplification (#3261)
+
+## 14.0.95 alpha 2020-06-19
+
+* feat(android/app): Consolidate install menus (#3245)
+* change(ios/engine): migrates legacy cloud resources to KMP format (#3237)
+* change(ios/engine): Default resource update (#3244)
+* fix(ios/engine): migration of preload-sourced resources (#3247)
+* refactor(common/resources): web-environment package (#3248)
+* chore(linux): Add some unit tests for keyman_config (#3250)
+* chore(linux): Update automatically installed dependencies (#3254)
+* fix(common/resources): web-environment package-lock.json (#3256)
+
+## 14.0.94 alpha 2020-06-16
+
+* feat(linux): Add onboard as recommended package (#3241)
+
+## 14.0.93 alpha 2020-06-15
+
+* fix(developer/ide): double click to change layer update combo (#3240)
+* fix(developer/ide): fix copy and paste in touch editor (#3238)
+
+## 14.0.92 alpha 2020-06-12
+
+* change(ios/engine): Package migration prep (#3229)
+* chore: labeler (#3233)
+* feat(android/engine): Migrate cloud keyboards when updating keyboard package (#3221)
+* refactor(ios/engine): explicitly synchronous Package processing (#3230)
+* feat(ios/engine): KeymanPackage now parses its ID (#3234)
+* fix(windows): sentry exception reports (#3235)
+
+## 14.0.91 alpha 2020-06-11
+
+* chore(android): Remove google-services and update readme (#3228)
+
+## 14.0.90 alpha 2020-06-10
+
+* refactor(ios/engine): Language resource + keying polymorphism (#3220)
+* refactor(ios): Selective resource installation via abstraction (#3207)
+* feat(ios/engine): Generation of kmp.json for non-package resources (#3212)
+
+## 14.0.89 alpha 2020-06-09
+
+* fix(android/engine): Revise updateOldKeyboardsList (#3216)
+* feat(ios/engine): embedded KeymanWeb engine Sentry use (#3218)
+* feat(android): Handle model picker updates (#3209)
+
+## 14.0.88 alpha 2020-06-08
+
+* modify(android/samples): Update addKeyboard syntax for Sample and Test apps (#3213)
+* fix(linux): Restart km-config after installing keyboard (#3214)
+
+## 14.0.87 alpha 2020-06-05
+
+* fix(developer/compilers): normalise touch layout on compile (#3203)
+* feat(android): Add utility to check BCP47 equivalence (#3210)
+* refactor(ios/engine): KMP installation now relies on KeymanPackage class, parses (#3205)
+* refactor(ios/engine): Abstraction of KMP installation methods (#3206)
+* feat(linux): Make two windows modal dialogs (#3211)
+
+## 14.0.86 alpha 2020-06-02
+
+* fix(ios): fixes lerna concurrency workaround and missing func reference (#3192)
+* fix(android/engine): Use available models for ModelPickerActivity() (#3191)
+* feat(android): Add system globe action to show system keyboards (#3197)
+* feat(linux): Open a .kmp file in km-config (#3183)
+* refactor(ios/engine): kmp.json - Keyboard info deserialization (#3193)
+* refactor(ios/engine): kmp.json - Lexical model info deserialization (#3195)
+* feat(ios/engine): kmp.json - full deserialization (#3198)
+* fix(android): Add wrapper for logging errors & exceptions (#3196)
+* fix(oem/fv/ios): new certificate (#3201)
+
+## 14.0.85 alpha 2020-05-30
+
+* modify(android/engine): Clean up naming for formatting QR code URL (#3187)
+
+## 14.0.84 alpha 2020-05-29
+
+* change(web): Selective Sentry uploads (#3163)
+* refactor(ios/engine): Polishes HTTPDownloader to prep for unit testing (#3179)
+* feat(ios/engine): HTTPDownloader unit testing (#3180)
+* fix(linux): Disable buttons if no keyboard installed (#3184)
+* change(ios/engine): Removes unused, deprecated JS/JSON-based adhoc install code (#3186)
+* change(common/lmlayer): move joiner from LMLayer to model compiler (#3071)
+
+## 14.0.83 alpha 2020-05-28
+
+* change(ios): Selective Sentry uploads (#3162)
+* Fix/android/package updates (#3175)
+* fix(common/models/types): fixes models-types build script, sets std header (#3182)
+
+## 14.0.82 alpha 2020-05-27
+
+* fix(ios): fixes build warning on Error coersion, fixes logged error for intermediate embedded state (#3173)
+* fix(linux): Don't fail (un-)install if running multiple ibus (#3169)
+* chore(linux): Update maintainer in package metadata (#3168)
+* feat(linux): Improve appstream metadata (#3176)
+
+## 14.0.81 alpha 2020-05-27
+
+* refactor(resources): convert gosh into npm package 🙃 (#3159)
+* chore(common,web): use consistent TypeScript dep on all packages (#3158)
+* chore(common/resources): add `common/models` to build trigger definitions (#3144)
+* fix(common): adds package-lock.json for gosh package (#3171)
+
+## 14.0.80 alpha 2020-05-25
+
+* fix(android/engine): Remove LanguageListUtil (#3155)
+* refactor(common/lmlayer): create package: @keymanapp/models-templates (#3128)
+
+## 14.0.79 alpha 2020-05-22
+
+* fix(android): Fix system keyboard globe button override (#3140)
+* fix(web/utils): use build script to generate environment.inc.ts (#3146)
+* change(common/core/web,web): update deps to @keymanapp/models-types (#3147)
+
+## 14.0.78 alpha 2020-05-21
+
+* refactor(common/models): factor out word breakers to their own package (#3125)
+* fix(developer): crash when developer starts (#3138)
+* modify(android): Refactor KeyboardPickerActivity (#3113)
+* chore(common/resources): cleanup scopes (#3139)
+* feat(web): starts proper KMW Sentry integration (#3122)
+* refactor(common/models/types): rename @keymanapp/lexical-model-types => @keymanapp/models-types (#3143)
+* change(web/utils): add and distribute type declaration (#3145)
+* fix(common): drops version updates for deprecated common/lexical-model-types (#3148)
+
+## 14.0.77 alpha 2020-05-19
+
+* refactor(web/engine): Moves common utility functions into separate `web-utils` package (#3130)
+* refactor(web/engine): renames DeviceSpec, moves to utils (#3132)
+* fix(ios): Fixes keyboard metadata decoding, tweaks to project files (#3137)
+* feat(windows): Use http: instead of file: for Configuration UI (#3127)
+
+## 14.0.76 alpha 2020-05-15
+
+* fix(windows): use correct name for Sentry in C++ (#3129)
+* chore: Allow to override hook defs (#3112)
+
+## 14.0.75 alpha 2020-05-13
+
+* feat(android): Add Tamil lexical model to KMSample2 (#3123)
+
+## 14.0.74 alpha 2020-05-11
+
+* fix(windows): kmbrowserhost was missing debug info (#3117)
+
+## 14.0.73 alpha 2020-05-11
+
+* fix(windows): force output keystroke failure (#3083)
+* fix(windows): kmshell title and kmbrowserhost sentry (#3115)
+
+## 14.0.72 alpha 2020-05-08
+
+* fix(ios/oem): Fixes FV app's system keyboard (#3105)
+* fix(ios/oem): FV light mode lock and basic banner fix (#3108)
+* fix(windows): sentry cef shutdown interactions (#3107)
+* feat(android): Migrate installed keyboards list to keyboards_list.json (#3091)
+
+## 14.0.71 alpha 2020-05-08
+
+* fix(windows): use consistent sentry db location (#3100)
+
+## 14.0.70 alpha 2020-05-07
+
+* fix(android): Fix back button after System Keyboard dismissed (#3093)
+* fix(android): Back button to dismiss KMSample2 system keyboard (#3095)
+* fix(oem): Back button to dismiss FV Android system keyboard (#3096)
+
+## 14.0.69 alpha 2020-05-06
+
+* fix(common): npm install required for auto inc lerna versions (#3089)
+* fix(windows): sentry x64 stacks truncated pointers (#3087)
+
+## 14.0.68 alpha 2020-05-06
+
+* fix(common): enable build for win x64, use global VERSION.md and fix decxstr() bug (#3076)
+* modify(android): Add methods to go between LanguageResource and JSON (#3079)
+* feat(common): auto-update for package versioning (#3078)
+
+## 14.0.67 alpha 2020-05-05
+
+* fix(ios): Additional libraries for FirstVoices SWKeyboard (#3080)
+
+## 14.0.66 alpha 2020-05-04
+
+* feat(web): test Recorder overhaul, Node-based tests using Recorder for KeyboardProcessor (#3060)
+* fix(ios): fv add sentry framework to carthage build step (#3074)
+
+## 14.0.65 alpha 2020-05-03
+
+* fix(ios): try embed of sentry again for fv (#3072)
+
+## 14.0.64 alpha 2020-05-01
+
+* fix(ios): add sentry framework to fv keyboards (#3069)
+
+## 14.0.63 alpha 2020-05-01
+
+* fix(android): Fix FileUtilsTest to be cross-platform (#3061)
+* fix(windows): add LARGEADDRESSAWARE flag for all CEF processes (#3064)
+* Fix/android/remove more custom (#3051)
+* fix(ios): FV settings bundle for SWKeyboard (#3066)
+* change(common/lmlayer): single-pass join word breaker decorator (#3059)
+
+## 14.0.62 alpha 2020-05-01
+
+* modify(oem): Update DSN for FV Android app (#3050)
+* feat(web/engine): Basic KeyboardProcessor tests (#2994)
+* fix(oem,common): Update FirstVoices build_keyboards.sh script (#3045)
+
+## 14.0.61 alpha 2020-04-30
+
+* chore(deps): bump @actions/http-client from 1.0.3 to 1.0.8 in /resources/build/version (#3047)
+* fix(ios): firstvoices icon and version info (#3044)
+* feat(windows): Sentry integration fixes and polish (#3006)
+* feat(common/lmlayer): compile joinWordsAt property (#3032)
+
+## 14.0.60 alpha 2020-04-29
+
+* feat(common): initial use of lerna (in-repo package links only) (#2997)
+* change(web/engine): spins core/web/keyboard-processor package off from KeymanWeb (#3001)
+* change(web/engine): spins core/web/input-processor package off from KeymanWeb (#3008)
+* chore(common/lmlayer): change author from personal to work affiliation (#3046)
+
+## 14.0.59 alpha 2020-04-29
+
+* chore: merge stable history (#3037)
+* feat(common/lmlayer): create join word breaker decorator (#3021)
+* fix(ios): download fv keyboards (#3040)
+* modify(android): Refactor LanguageResource() and remove "Custom" property (#3033)
+
## 14.0.58 alpha 2020-04-28
* change(common/lmlayer): improvements to default searchTermToKey (#3024)
diff --git a/README.md b/README.md
index f3e24fb61b6ee48b192dc6b85b1bb2bdb237b6ac..819500203d2222d3f30b41a1fa7f62a112643daf 100644
--- a/README.md
+++ b/README.md
@@ -69,3 +69,9 @@ Licensed under the [MIT](./windows/src/LICENSE.md) License.
[linux-master]: https://build.palaso.org/app/rest/builds/buildType:(id:KeymanLinux_Master)/statusIcon
[linux-beta]: https://build.palaso.org/app/rest/builds/buildType:(id:KeymanLinux_Beta)/statusIcon
[linux-stable]: https://build.palaso.org/app/rest/builds/buildType:(id:KeymanLinux_Stable),branch:(default:false)/statusIcon
+
+# Notes for Contributors
+
+When cloning this repo for local development on a Windows machine, take care not to place it overly deep in your file system.
+Some of the paths for compilation can push character lengths around 160 characters long, while certain operations on Windows systems may be limited to paths of 260 characters or less.
+For example, [`git clean` on Windows with msys](https://stackoverflow.com/questions/22575662/filename-too-long-in-git-for-windows/22575737#22575737) is limited due to dependence on older Windows APIs.
\ No newline at end of file
diff --git a/VERSION.md b/VERSION.md
index bee978e91bf3f8ee26b733c61869d54ee32987be..7450c6cae75b7edfa8797ae12cf7e7aa4f6df36d 100644
--- a/VERSION.md
+++ b/VERSION.md
@@ -1 +1 @@
-14.0.59
\ No newline at end of file
+14.0.144
\ No newline at end of file
diff --git a/android/.gitignore b/android/.gitignore
index 86142772fef2471971059e4863a2e69008c92944..a502ae727d269966237c9bf27c041489d63b2fe5 100644
--- a/android/.gitignore
+++ b/android/.gitignore
@@ -34,6 +34,9 @@ gradle_models.ser
KMEA/app/src/main/assets/
KMAPro/assets/keyman.js
+# KMAPRo default packages
+KMAPro/**/assets/*.kmp
+
# Eclipse files
.project
.settings/
diff --git a/android/KMAPro/build.gradle b/android/KMAPro/build.gradle
index 051f23297c9cd0f2ec15d9f07a1ee76043c62503..afcdfe36c087820ce913203fca2aca653476ae35 100644
--- a/android/KMAPro/build.gradle
+++ b/android/KMAPro/build.gradle
@@ -7,9 +7,9 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
- classpath 'com.google.gms:google-services:4.3.2'
- classpath 'io.sentry:sentry-android-gradle-plugin:1.7.31'
+ classpath 'io.sentry:sentry-android-gradle-plugin:1.7.35'
classpath 'name.remal:gradle-plugins:1.0.157'
+ classpath 'com.stepstone.stepper:material-stepper:4.3.1'
}
}
diff --git a/android/KMAPro/build.sh b/android/KMAPro/build.sh
index 86750207e02705565771ddaa69d1f777d6e1ac9e..18982a7c10664e710fc38facf413a44005a8f1f3 100755
--- a/android/KMAPro/build.sh
+++ b/android/KMAPro/build.sh
@@ -1,14 +1,21 @@
#!/bin/bash
# Build KMAPro
-display_usage ( ) {
- echo "build.sh [-no-daemon] [-debug]"
- echo
- echo "Build Keyman for Android"
- echo " -no-daemon Don't start the Gradle daemon. Use for CI"
- echo " -debug Compile only Debug variant"
- exit 1
-}
+# Set sensible script defaults:
+# set -e: Terminate script if a command returns an error
+set -e
+# set -u: Terminate script if an unset variable is used
+set -u
+# set -x: Debugging use, print each statement
+# set -x
+
+## START STANDARD BUILD SCRIPT INCLUDE
+# adjust relative paths as necessary
+THIS_SCRIPT="$(greadlink -f "${BASH_SOURCE[0]}" 2>/dev/null || readlink -f "${BASH_SOURCE[0]}")"
+. "$(dirname "$THIS_SCRIPT")/../../resources/build/build-utils.sh"
+## END STANDARD BUILD SCRIPT INCLUDE
+
+. "$KEYMAN_ROOT/resources/build/build-download-resources.sh"
echo Build KMAPro
@@ -17,8 +24,20 @@ echo Build KMAPro
#
SHLVL=0
+display_usage ( ) {
+ echo "build.sh [-no-daemon] [-debug] [-download-resources]"
+ echo
+ echo "Build Keyman for Android"
+ echo " -no-daemon Don't start the Gradle daemon. Use for CI"
+ echo " -debug Compile only Debug variant"
+ echo " -download-resources Download sil_euro_latin.kmp and nrc.en.mtnt.model.kmp from downloads.keyman.com"
+ exit 1
+}
+
NO_DAEMON=false
ONLY_DEBUG=false
+DO_KEYBOARDS_DOWNLOAD=false
+DO_MODELS_DOWNLOAD=false
# Parse args
while [[ $# -gt 0 ]] ; do
@@ -30,6 +49,10 @@ while [[ $# -gt 0 ]] ; do
-debug)
ONLY_DEBUG=true
;;
+ -download-resources)
+ DO_KEYBOARDS_DOWNLOAD=true
+ DO_MODELS_DOWNLOAD=true
+ ;;
-h|-?)
display_usage
;;
@@ -37,9 +60,27 @@ while [[ $# -gt 0 ]] ; do
shift # past argument
done
+KEYBOARD_PACKAGE_ID="sil_euro_latin"
+KEYBOARDS_TARGET="$KEYMAN_ROOT/android/KMAPro/kMAPro/src/main/assets/${KEYBOARD_PACKAGE_ID}.kmp"
+MODEL_PACKAGE_ID="nrc.en.mtnt"
+MODELS_TARGET="$KEYMAN_ROOT/android/KMAPro/kMAPro/src/main/assets/${MODEL_PACKAGE_ID}.model.kmp"
+
+# Verify default keyboard and dictionary exist
+if [[ ! -f "$KEYBOARDS_TARGET" ]]; then
+ echo "$KEYBOARDS_TARGET doesn't exist. Will download the latest version"
+ DO_KEYBOARDS_DOWNLOAD=true
+fi
+
+if [[ ! -f "$MODELS_TARGET" ]]; then
+ echo "$MODELS_TARGET doesn't exist. Will download the latest version"
+ DO_MODELS_DOWNLOAD=true
+fi
+
echo
echo "NO_DAEMON: $NO_DAEMON"
echo "ONLY_DEBUG: $ONLY_DEBUG"
+echo "DO_KEYBOARDS_DOWNLOAD: $DO_KEYBOARDS_DOWNLOAD"
+echo "DO_MODELS_DOWNLOAD: $DO_MODELS_DOWNLOAD"
echo
if [ "$NO_DAEMON" = true ]; then
@@ -48,6 +89,16 @@ else
DAEMON_FLAG=
fi
+
+# Download default keyboard and dictionary
+if [ "$DO_KEYBOARDS_DOWNLOAD" = true ]; then
+ downloadKeyboardPackage "$KEYBOARD_PACKAGE_ID" "$KEYBOARDS_TARGET"
+fi
+
+if [ "$DO_MODELS_DOWNLOAD" = true ]; then
+ downloadModelPackage "$MODEL_PACKAGE_ID" "$MODELS_TARGET"
+fi
+
if [ "$ONLY_DEBUG" = true ]; then
BUILD_FLAGS="assembleDebug lintDebug"
else
diff --git a/android/KMAPro/gradle/wrapper/gradle-wrapper.jar b/android/KMAPro/gradle/wrapper/gradle-wrapper.jar
index 8c0fb64a8698b08ecc4158d828ca593c4928e9dd..5c2d1cf016b3885f6930543d57b744ea8c220a1a 100644
Binary files a/android/KMAPro/gradle/wrapper/gradle-wrapper.jar and b/android/KMAPro/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/android/KMAPro/gradle/wrapper/gradle-wrapper.properties b/android/KMAPro/gradle/wrapper/gradle-wrapper.properties
index 53d1d37d023c805809fd6b0fb99d8a387f079617..5028f28f8e4755a78a5bf0fef4644577b199c8c4 100644
--- a/android/KMAPro/gradle/wrapper/gradle-wrapper.properties
+++ b/android/KMAPro/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
-#Sat Apr 14 11:26:38 ICT 2018
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
diff --git a/android/KMAPro/gradlew b/android/KMAPro/gradlew
index 91a7e269e19dfc62e27137a0b57ef3e430cee4fd..84fb57da07e013acc8638c8de2aaab4fef16cdcd 100755
--- a/android/KMAPro/gradlew
+++ b/android/KMAPro/gradlew
@@ -1,4 +1,20 @@
-#!/usr/bin/env bash
+#!/bin/bash
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
##############################################################################
##
@@ -6,20 +22,38 @@
##
##############################################################################
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >/dev/null
+APP_HOME="`pwd -P`"
+cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
+
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
-warn ( ) {
+warn () {
echo "$*"
}
-die ( ) {
+die () {
echo
echo "$*"
echo
@@ -30,6 +64,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
+nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
@@ -40,31 +75,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
+ NONSTOP* )
+ nonstop=true
+ ;;
esac
-# For Cygwin, ensure paths are in UNIX format before anything is touched.
-if $cygwin ; then
- [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
-fi
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >&-
-APP_HOME="`pwd -P`"
-cd "$SAVED" >&-
-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
@@ -90,7 +105,7 @@ location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
@@ -110,10 +125,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+ JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
@@ -154,11 +170,19 @@ if $cygwin ; then
esac
fi
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
+# Escape application args
+save () {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+APP_ARGS=$(save "$@")
+
+# Collect all arguments for the java command, following the shell quoting and substitution rules
+eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
+
+# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
+if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
+ cd "$(dirname "$0")"
+fi
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+exec "$JAVACMD" "$@"
diff --git a/android/KMAPro/gradlew.bat b/android/KMAPro/gradlew.bat
index 8a0b282aa6885fb573c106b3551f7275c5f17e8e..9618d8d9607cd91a0efb866bcac4810064ba6fac 100644
--- a/android/KMAPro/gradlew.bat
+++ b/android/KMAPro/gradlew.bat
@@ -1,3 +1,19 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@@ -8,14 +24,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
+@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
+
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
@@ -46,10 +62,9 @@ echo location of your Java installation.
goto fail
:init
-@rem Get command-line arguments, handling Windowz variants
+@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +75,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
diff --git a/android/KMAPro/kMAPro/build.gradle b/android/KMAPro/kMAPro/build.gradle
index eddcf534d34478c434211990fb6f20571355b065..21256f56b256ce113d6aee097006a93eaf9e340a 100644
--- a/android/KMAPro/kMAPro/build.gradle
+++ b/android/KMAPro/kMAPro/build.gradle
@@ -30,21 +30,10 @@ android {
//dumpProperties(project) // Use this to dump all external properties for debugging TeamCity integration
//println "===END DUMP==="
- String env_services_json_file = System.getenv('services_json_file')
-
- if (env_services_json_file != null) {
- env_services_json_file = String.valueOf(env_services_json_file)
- println "Copying production google-services.json and using at kMAPro/"
- copy {
- from env_services_json_file
- include '*.json'
- into './'
- }
- }
-
- // VERSION_CODE and VERSION_NAME from version.gradle
+ // VERSION strings from version.gradle
versionCode VERSION_CODE as Integer
versionName VERSION_NAME
+ buildConfigField 'String', 'VERSION_ENVIRONMENT', '"'+VERSION_ENVIRONMENT+'"'
}
String env_release_store_file = System.getenv("release_store_file")
@@ -130,8 +119,9 @@ repositories {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation 'androidx.appcompat:appcompat:1.2.0-alpha02'
+ implementation 'androidx.appcompat:appcompat:1.3.0-alpha02'
implementation 'com.google.android.material:material:1.0.0'
+ implementation 'com.stepstone.stepper:material-stepper:4.3.1'
api(name: 'keyman-engine', ext: 'aar')
implementation 'io.sentry:sentry-android:2.0.1'
implementation 'androidx.preference:preference:1.1.0'
@@ -156,5 +146,3 @@ dependencies {
println it.properties.entrySet()*.toString()
.sort().toString().replaceAll(", ","\n")
}*/
-
-apply plugin: 'com.google.gms.google-services'
diff --git a/android/KMAPro/kMAPro/src/debug/google-services.json b/android/KMAPro/kMAPro/src/debug/google-services.json
deleted file mode 100644
index 84a3b5b1dee45df13c9e1f867c975f72282ed234..0000000000000000000000000000000000000000
--- a/android/KMAPro/kMAPro/src/debug/google-services.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "project_info": {
- "project_number": "681178123610",
- "firebase_url": "https://kmapro-ee779.firebaseio.com",
- "project_id": "kmapro-ee779",
- "storage_bucket": "kmapro-ee779.appspot.com"
- },
- "client": [
- {
- "client_info": {
- "mobilesdk_app_id": "1:681178123610:android:df408a26aaaf1c9e",
- "android_client_info": {
- "package_name": "com.tavultesoft.kmapro.debug"
- }
- },
- "oauth_client": [
- {
- "client_id": "681178123610-6j7phpt5jqh1mf44oup6lt8mooomd1tn.apps.googleusercontent.com",
- "client_type": 3
- }
- ],
- "api_key": [
- {
- "current_key": "AIzaSyDFeaVAFdwkrVfUq01aVoBQQ2g5bOUfUUI"
- }
- ],
- "services": {
- "analytics_service": {
- "status": 1
- },
- "appinvite_service": {
- "status": 1,
- "other_platform_oauth_client": []
- },
- "ads_service": {
- "status": 2
- }
- }
- }
- ],
- "configuration_version": "1"
-}
\ No newline at end of file
diff --git a/android/KMAPro/kMAPro/src/main/AndroidManifest.xml b/android/KMAPro/kMAPro/src/main/AndroidManifest.xml
index 61f982c88a08e00815714082aa13be7a129dd003..a21575924a784c195786008ab3396b5c19eef9c5 100644
--- a/android/KMAPro/kMAPro/src/main/AndroidManifest.xml
+++ b/android/KMAPro/kMAPro/src/main/AndroidManifest.xml
@@ -29,9 +29,9 @@
-
+
+ android:name="io.sentry.auto-init" android:value="false" />
-
+
@@ -188,7 +188,49 @@
android:sspPrefix="download" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{
+ options.setRelease("release-"+com.tavultesoft.kmapro.BuildConfig.VERSION_NAME);
+ options.setEnvironment(com.tavultesoft.kmapro.BuildConfig.VERSION_ENVIRONMENT);
+ });
}
if (BuildConfig.DEBUG) {
KMManager.setDebugMode(true);
@@ -136,9 +138,9 @@ public class SystemKeyboard extends InputMethodService implements OnKeyboardEven
} else {
// Check if predictions needs to be re-enabled per Settings preference
Context appContext = getApplicationContext();
- HashMap kbInfo = KMManager.getCurrentKeyboardInfo(appContext);
+ Keyboard kbInfo = KMManager.getCurrentKeyboardInfo(appContext);
if (kbInfo != null) {
- String langId = kbInfo.get(KMManager.KMKey_LanguageID);
+ String langId = kbInfo.getLanguageID();
SharedPreferences prefs = appContext.getSharedPreferences(appContext.getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
boolean mayPredict = prefs.getBoolean(LanguageSettingsActivity.getLanguagePredictionPreferenceKey(langId), true);
KMManager.setBannerOptions(mayPredict);
@@ -223,9 +225,12 @@ public class SystemKeyboard extends InputMethodService implements OnKeyboardEven
if (event.getAction() == KeyEvent.ACTION_DOWN) {
switch (keyCode) {
case KeyEvent.KEYCODE_BACK:
- // Dismiss the keyboard
- KMManager.hideSystemKeyboard();
- return true;
+ // Dismiss the keyboard if currently shown
+ if (isInputViewShown()) {
+ KMManager.hideSystemKeyboard();
+ return true;
+ }
+ break;
}
}
diff --git a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/BookmarksActivity.java b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/BookmarksActivity.java
index 3203bd48e4af01590c5c10294a7dba596d54bf6b..d0d41a89483c9a4346f148a533e52af29e4277ca 100644
--- a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/BookmarksActivity.java
+++ b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/BookmarksActivity.java
@@ -15,7 +15,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import android.os.Bundle;
-import android.util.Log;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
@@ -38,8 +37,10 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
-public class BookmarksActivity extends AppCompatActivity {
+import com.tavultesoft.kmea.util.KMLog;
+public class BookmarksActivity extends AppCompatActivity {
+ private static final String TAG = "BookmarksActivity";
private static ListView listView;
private static ArrayList> list = null;
private static String bookmarksFilename = "bookmarks.dat";
@@ -186,7 +187,7 @@ public class BookmarksActivity extends AppCompatActivity {
list = (ArrayList>) inputStream.readObject();
inputStream.close();
} catch (Exception e) {
- Log.e("KMAPro", "Failed to read bookmarks list: " + e.getMessage());
+ KMLog.LogException(TAG, "Failed to read bookmarks list: ", e);
list = null;
}
} else {
@@ -206,7 +207,7 @@ public class BookmarksActivity extends AppCompatActivity {
outputStream.close();
result = true;
} catch (Exception e) {
- Log.e("KMAPro", "Failed to save bookmarks list: " + e.getMessage());
+ KMLog.LogException(TAG, "Failed to save bookmarks list: ", e);
result = false;
}
diff --git a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/GetStartedActivity.java b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/GetStartedActivity.java
index bf09d44a463616c214a8ceeaa186a6106522b23b..52b023f6d0838f495030074ffa463ce1ce471536 100644
--- a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/GetStartedActivity.java
+++ b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/GetStartedActivity.java
@@ -10,6 +10,7 @@ import java.util.List;
import com.tavultesoft.kmea.KMManager;
import com.tavultesoft.kmea.KMPBrowserActivity;
+import com.tavultesoft.kmea.data.Keyboard;
import android.os.Bundle;
import android.provider.Settings;
@@ -114,10 +115,8 @@ public class GetStartedActivity extends AppCompatActivity {
public void onItemClick(AdapterView> parent, View view, int position, long id) {
if (position == 0) {
if (KMManager.hasConnection(context)) {
- // Scenario 1: Connection to keyman.com catalog
- Intent i = new Intent(context, KMPBrowserActivity.class);
- i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
+ // Keyman Settings install activity
+ Intent i = new Intent(context, KeymanSettingsInstallActivity.class);
context.startActivity(i);
}
} else if (position == 1) {
@@ -156,7 +155,7 @@ public class GetStartedActivity extends AppCompatActivity {
String checkbox_on = String.valueOf(android.R.drawable.checkbox_on_background);
String info = String.valueOf(R.drawable.ic_info_outline);
- ArrayList> kbList = KMManager.getKeyboardsList(this);
+ List kbList = KMManager.getKeyboardsList(this);
if (kbList != null && kbList.size() > 1) {
list.get(0).put(iconKey, checkbox_on);
} else {
diff --git a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/InfoActivity.java b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/InfoActivity.java
index 529b6b7548f56048e7c7c75e0b70bbc1e71e4d15..a665e48f4a19011d42dd0943adaae4bd84c71691 100644
--- a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/InfoActivity.java
+++ b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/InfoActivity.java
@@ -4,8 +4,10 @@
package com.tavultesoft.kmapro;
+import com.tavultesoft.kmea.BuildConfig;
import com.tavultesoft.kmea.KMManager;
import com.tavultesoft.kmea.KMManager.FormFactor;
+import com.tavultesoft.kmea.util.KMLog;
import android.content.Context;
import android.graphics.Bitmap;
@@ -24,9 +26,11 @@ import android.content.pm.PackageInfo;
import android.content.pm.PackageManager.NameNotFoundException;
public class InfoActivity extends AppCompatActivity {
-
+ private final static String TAG = "InfoActivity";
private WebView webView;
- private final String kmHelpBaseUrl = "https://help.keyman.com/products/android";
+ private final String HELP_PRODUCTION_HOST = "help.keyman.com";
+ private final String HELP_STAGING_HOST = "help.keyman-staging.com";
+ private final String HELP_BASE_FORMAT_STR = "https://%s/products/android/%s/%s?embed=android&formfactor=%s";
private String kmUrl = "";
private final String htmlPath = "file:///android_asset/info/products/android";
private final String htmlPage = "index.php";
@@ -54,18 +58,10 @@ public class InfoActivity extends AppCompatActivity {
version.setTextSize(getResources().getDimension(R.dimen.titlebar_label_textsize));
version.setGravity(Gravity.CENTER);
- // Parse to create a version title
- String versionStr = "";
- PackageInfo pInfo;
- try {
- pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
- versionStr = pInfo.versionName;
- } catch (NameNotFoundException e) {
- // Fallback to a "current" version. This does not need to be maintained
- versionStr = "12.0.0.0";
- }
+ // Parse app version string to create a version title (Not using KMManager.getVersion() because that's for KMEA)
+ String versionStr = BuildConfig.VERSION_NAME;
- String versionTitle = String.format("%s: %s", getString(R.string.title_version), versionStr);
+ String versionTitle = String.format(getString(R.string.title_version), versionStr);
version.setText(versionTitle);
getSupportActionBar().setCustomView(version);
@@ -83,7 +79,17 @@ public class InfoActivity extends AppCompatActivity {
formFactor = "tablet";
}
- kmUrl = String.format("%s/%s/%s?embed=android&formfactor=%s", kmHelpBaseUrl, majorMinorVersion, htmlPage, formFactor);
+ String helpHost = "";
+ switch (KMManager.getTier(BuildConfig.VERSION_NAME)) {
+ case ALPHA:
+ case BETA:
+ helpHost = HELP_STAGING_HOST;
+ break;
+ default:
+ helpHost = HELP_PRODUCTION_HOST;
+ }
+
+ kmUrl = String.format(HELP_BASE_FORMAT_STR, helpHost, majorMinorVersion, htmlPage, formFactor);
// The offline mirroring process (currently) adds .html to the end of the whole string.
kmOfflineUrl = String.format("%s/%s/%s.html", htmlPath, formFactor, htmlPage);
webView = (WebView) findViewById(R.id.infoWebView);
diff --git a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/KeymanSettingsActivity.java b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/KeymanSettingsActivity.java
index c86d88373e48421e5bbd41faf383dc8053b55cc0..e7d45430597100d0e0740ec5d7e487ac7ebeafef 100644
--- a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/KeymanSettingsActivity.java
+++ b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/KeymanSettingsActivity.java
@@ -7,6 +7,7 @@ import androidx.appcompat.widget.Toolbar;
public class KeymanSettingsActivity extends AppCompatActivity {
protected static final String installedLanguagesKey = "InstalledLanguages";
+ protected static final String installKeyboardOrDictionaryKey = "InstallKeyboardOrDictionary";
protected static final String showBannerKey = "ShowBanner";
protected KeymanSettingsFragment innerFragment;
diff --git a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/KeymanSettingsFragment.java b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/KeymanSettingsFragment.java
index 1b3da0cd13dd0a7666f8d88a19cc66be6a01be11..dfcdf94eb1b58532f3aa4dabe5d4c91e7a565457 100644
--- a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/KeymanSettingsFragment.java
+++ b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/KeymanSettingsFragment.java
@@ -2,7 +2,6 @@ package com.tavultesoft.kmapro;
import android.content.Context;
import android.content.Intent;
-import android.net.Uri;
import android.os.Bundle;
import android.provider.Settings;
import android.view.inputmethod.InputMethodManager;
@@ -20,7 +19,7 @@ public class KeymanSettingsFragment extends PreferenceFragmentCompat {
private static final String TAG = "SettingsFragment";
private static Context context;
- private Preference languagesPreference, addKeyboardFromDevice;
+ private Preference languagesPreference, installKeyboardOrDictionary;
private CheckBoxPreference setSystemKeyboardPreference;
private CheckBoxPreference setDefaultKeyboardPreference;
@@ -41,23 +40,12 @@ public class KeymanSettingsFragment extends PreferenceFragmentCompat {
languagesIntent.putExtra(KMManager.KMKey_DisplayKeyboardSwitcher, false);
languagesPreference.setIntent(languagesIntent);
- // Launch System file browser for user to navigate to local .kmp files
- // Using generic "Add keyboard" title even though this can also install lexical model .kmp's.
- addKeyboardFromDevice = new Preference(context);
- addKeyboardFromDevice.setTitle(getString(R.string.title_add_keyboard_from_device));
- addKeyboardFromDevice.setWidgetLayoutResource(R.layout.preference_file_browser_layout);
- addKeyboardFromDevice.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
- @Override
- public boolean onPreferenceClick(Preference preference) {
- Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
- intent.addCategory(Intent.CATEGORY_OPENABLE);
- intent.putExtra("android.content.extra.SHOW_ADVANCED", false);
- // Unfortunately, we can't filter for a "kmp" mime type
- intent.setType("*/*");
- startActivityForResult(intent, MainActivity.READ_REQUEST_CODE);
- return false;
- }
- });
+ installKeyboardOrDictionary = new Preference(context);
+ installKeyboardOrDictionary.setKey(KeymanSettingsActivity.installKeyboardOrDictionaryKey);
+ installKeyboardOrDictionary.setTitle(getString(R.string.install_keyboard_or_dictionary));
+ installKeyboardOrDictionary.setWidgetLayoutResource(R.layout.preference_add_icon_layout);
+ Intent installIntent = new Intent(context, KeymanSettingsInstallActivity.class);
+ installKeyboardOrDictionary.setIntent(installIntent);
/*
Automatically does the following:
@@ -112,7 +100,7 @@ public class KeymanSettingsFragment extends PreferenceFragmentCompat {
setDefaultKeyboardPreference.setOnPreferenceChangeListener(checkBlocker);
screen.addPreference(languagesPreference);
- screen.addPreference(addKeyboardFromDevice);
+ screen.addPreference(installKeyboardOrDictionary);
screen.addPreference(setSystemKeyboardPreference);
screen.addPreference(setDefaultKeyboardPreference);
@@ -149,16 +137,6 @@ public class KeymanSettingsFragment extends PreferenceFragmentCompat {
// .update() on our behalf.
}
-
- public void onActivityResult(int requestCode, int resultCode, Intent returnIntent) {
- // Handle kmp file selected from file browser
- if ((requestCode == MainActivity.READ_REQUEST_CODE) && (returnIntent != null)) {
- String kmpFilename = returnIntent.getDataString();
- Uri data = Uri.parse(kmpFilename);
- MainActivity.useLocalKMP(this.getContext(), data);
- }
- }
-
public void update() {
setSystemKeyboardPreference.setChecked(SystemIMESettings.isEnabledAsSystemKB(context));
setDefaultKeyboardPreference.setChecked(SystemIMESettings.isDefaultKB(context));
diff --git a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/KeymanSettingsInstallActivity.java b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/KeymanSettingsInstallActivity.java
new file mode 100644
index 0000000000000000000000000000000000000000..dc3f459ae996aa3e1711f290e397ae45c3695f79
--- /dev/null
+++ b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/KeymanSettingsInstallActivity.java
@@ -0,0 +1,184 @@
+/**
+ * Copyright (C) 2020 SIL International. All rights reserved.
+ */
+package com.tavultesoft.kmapro;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import androidx.appcompat.app.AlertDialog;
+import androidx.appcompat.app.AppCompatActivity;
+import androidx.appcompat.widget.Toolbar;
+
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Typeface;
+import android.net.Uri;
+import android.os.Bundle;
+import android.view.View;
+import android.view.Window;
+import android.widget.AdapterView;
+import android.widget.ListAdapter;
+import android.widget.ListView;
+import android.os.Bundle;
+import android.widget.SimpleAdapter;
+import android.widget.TextView;
+
+import com.tavultesoft.kmea.KMManager;
+import com.tavultesoft.kmea.KMPBrowserActivity;
+import com.tavultesoft.kmea.data.KeyboardController;
+import com.tavultesoft.kmea.util.MapCompat;
+
+public class KeymanSettingsInstallActivity extends AppCompatActivity {
+ private static final String TAG = "SettingsInstallActivity";
+ private static ArrayList> installOptionList = null;
+ private static Typeface titleFont = null;
+ private static final String titleKey = "title";
+ private static final String subtitleKey = "subtitle";
+ private static final String iconKey = "icon";
+ private final String isEnabledKey = "isEnabled";
+ private static Context context;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
+ context = this;
+
+ setContentView(R.layout.activity_list_layout);
+ final Toolbar toolbar = findViewById(R.id.list_toolbar);
+ setSupportActionBar(toolbar);
+ getSupportActionBar().setDisplayHomeAsUpEnabled(true);
+ getSupportActionBar().setDisplayShowHomeEnabled(true);
+ getSupportActionBar().setDisplayShowTitleEnabled(false);
+
+ final ListView listView = findViewById(com.tavultesoft.kmea.R.id.listView);
+
+ Bundle bundle = getIntent().getExtras();
+
+ final TextView textView = findViewById(R.id.bar_title);
+ textView.setText(getString(R.string.install_keyboard_or_dictionary));
+ if (titleFont != null) {
+ textView.setTypeface(titleFont, Typeface.BOLD);
+ }
+
+ installOptionList = new ArrayList<>();
+
+ final String noIcon = "0";
+ HashMap hashMap = new HashMap<>();
+ hashMap.put(titleKey, getString(R.string.install_from_keyman_dot_com));
+ String icon = String.valueOf(R.drawable.ic_content_add);
+ hashMap.put(iconKey, icon);
+ installOptionList.add(hashMap);
+
+ hashMap = new HashMap<>();
+ hashMap.put(titleKey, getString(R.string.install_from_local_file));
+ icon = String.valueOf(R.drawable.ic_folder_open);
+ hashMap.put(iconKey, icon);
+ hashMap.put(isEnabledKey, "true");
+ installOptionList.add(hashMap);
+
+ // TODO: Install by scanning QR code
+ /*
+ hashMap = new HashMap<>();
+ hashMap.put(titleKey, getString(R.string.install_from_other_device));
+ icon = String.valueOf(R.drawable.ic_content_add);
+ hashMap.put(iconKey, icon);
+ hashMap.put(isEnabledKey, "false");
+ installOptionList.add(hashMap);
+ */
+
+ hashMap = new HashMap<>();
+ hashMap.put(titleKey, getString(R.string.add_languages_to_installed_keyboard));
+ hashMap.put(subtitleKey, getString(R.string.add_language_subtext));
+ icon = String.valueOf(R.drawable.ic_content_add);
+ hashMap.put(iconKey, icon);
+ hashMap.put(isEnabledKey, "true");
+ installOptionList.add(hashMap);
+
+ String[] from = new String[]{titleKey, subtitleKey, iconKey};
+ int[] to = new int[]{com.tavultesoft.kmea.R.id.text1, com.tavultesoft.kmea.R.id.text2, com.tavultesoft.kmea.R.id.image1};
+
+ ListAdapter adapter = new SimpleAdapter(context, installOptionList, com.tavultesoft.kmea.R.layout.list_row_layout2, from, to) {
+ @Override
+ public boolean isEnabled(int position) {
+ HashMap hashMap = installOptionList.get(position);
+ String itemTitle = MapCompat.getOrDefault(hashMap, titleKey, "");
+ String icon = MapCompat.getOrDefault(hashMap, iconKey, noIcon);
+ if (itemTitle.equals(getString(R.string.install_from_other_device))) {
+ // Scan QR code not implemented yet
+ return false;
+ } else if (itemTitle.equals(getString(R.string.add_languages_to_installed_keyboard))) {
+ if (KeyboardController.getInstance().getInstalledPackagesList() == null) {
+ // Disable if no keyboard packages installed
+ return false;
+ }
+ }
+
+ return super.isEnabled(position);
+ }
+ };
+ listView.setAdapter(adapter);
+ listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+
+ @Override
+ public void onItemClick(AdapterView> parent, View view, int position, long id) {
+ HashMap hashMap = (HashMap) parent.getItemAtPosition(position);
+ String itemTitle = MapCompat.getOrDefault(hashMap, titleKey, "");
+
+ // Install from keyman.com
+ if (itemTitle.equals(getString(R.string.install_from_keyman_dot_com))) {
+ if (KMManager.hasConnection(context)) {
+ Intent i = new Intent(context, KMPBrowserActivity.class);
+ i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+ i.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
+ context.startActivity(i);
+ } else {
+ AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
+ dialogBuilder.setTitle(getString(R.string.title_add_keyboard));
+ dialogBuilder.setMessage(getString(R.string.cannot_connect));
+ dialogBuilder.setPositiveButton(getString(R.string.label_ok), null);
+ AlertDialog dialog = dialogBuilder.create();
+ dialog.show();
+ }
+ // Install from local file
+ } else if (itemTitle.equals(getString(R.string.install_from_local_file))) {
+ Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
+ intent.addCategory(Intent.CATEGORY_OPENABLE);
+ intent.putExtra("android.content.extra.SHOW_ADVANCED", false);
+ // Unfortunately, we can't filter for a "kmp" mime type
+ intent.setType("*/*");
+ startActivityForResult(intent, MainActivity.READ_REQUEST_CODE);
+
+ // Install by scanning QR code
+ } else if (itemTitle.equals(getString(R.string.install_from_other_device))) {
+ // TODO
+
+ // Add language from keyboard package already installed
+ } else if (itemTitle.equals(getString(R.string.add_languages_to_installed_keyboard))) {
+ Intent intent = new Intent(context, SelectPackageActivity.class);
+ context.startActivity(intent);
+ }
+ }
+ });
+ }
+
+ @Override
+ public boolean onSupportNavigateUp() {
+ super.onBackPressed();
+ return true;
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent returnIntent) {
+ super.onActivityResult(requestCode, resultCode, returnIntent);
+
+ // Handle kmp file selected from file browser
+ if ((requestCode == MainActivity.READ_REQUEST_CODE) && (returnIntent != null)) {
+ String kmpFilename = returnIntent.getDataString();
+ Uri data = Uri.parse(kmpFilename);
+ MainActivity.useLocalKMP(context, data);
+ }
+ }
+
+}
diff --git a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/MainActivity.java b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/MainActivity.java
index ff4f3c69de69641240b667431c532d6d09fedb1d..b7e657a0de124de02e62fe63da42221446b3abc8 100644
--- a/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/MainActivity.java
+++ b/android/KMAPro/kMAPro/src/main/java/com/tavultesoft/kmapro/MainActivity.java
@@ -25,17 +25,19 @@ import com.tavultesoft.kmea.KMTextView;
import com.tavultesoft.kmea.KeyboardEventHandler.OnKeyboardDownloadEventListener;
import com.tavultesoft.kmea.KeyboardEventHandler.OnKeyboardEventListener;
import com.tavultesoft.kmea.cloud.CloudApiTypes;
-import com.tavultesoft.kmea.packages.PackageProcessor;
+import com.tavultesoft.kmea.data.CloudRepository;
+import com.tavultesoft.kmea.data.Dataset;
+import com.tavultesoft.kmea.data.Keyboard;
+import com.tavultesoft.kmea.data.LexicalModel;
import com.tavultesoft.kmea.util.FileUtils;
-import com.tavultesoft.kmea.util.FileProviderUtils;
import com.tavultesoft.kmea.util.DownloadIntentService;
+import com.tavultesoft.kmea.util.KMLog;
+import com.tavultesoft.kmea.util.KMPLink;
import android.Manifest;
import android.app.ProgressDialog;
import android.content.ComponentName;
import android.content.pm.PackageManager;
-import android.content.res.AssetManager;
-import android.content.res.Resources;
import android.database.Cursor;
import android.net.Uri;
import android.net.Uri.Builder;
@@ -71,7 +73,6 @@ import android.os.ResultReceiver;
import android.provider.OpenableColumns;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
-import androidx.core.content.FileProvider;
import androidx.appcompat.widget.PopupMenu;
import android.text.Html;
@@ -92,8 +93,6 @@ import android.widget.Toast;
import io.sentry.android.core.SentryAndroid;
import io.sentry.core.Sentry;
-import static com.tavultesoft.kmea.KMKeyboardDownloaderActivity.kKeymanApiModelURL;
-
public class MainActivity extends AppCompatActivity implements OnKeyboardEventListener, OnKeyboardDownloadEventListener,
ActivityCompat.OnRequestPermissionsResultCallback {
public static Context context;
@@ -110,15 +109,15 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
private int textSize = minTextSize;
private static final String defaultKeyboardInstalled = "DefaultKeyboardInstalled";
private static final String defaultDictionaryInstalled = "DefaultDictionaryInstalled";
- private static final String defaultKeyboardPath = "sil_euro_latin.kmp";
- private static final String defaultDictionaryPath = "nrc.en.mtnt.model.kmp";
private static final String userTextKey = "UserText";
private static final String userTextSizeKey = "UserTextSize";
- protected static final String didCheckUserDataKey = "DidCheckUserData";
private Toolbar toolbar;
private Menu menu;
private Uri data;
+ private static Dataset repo;
+ private boolean didExecuteParser = false;
+
DownloadResultReceiver resultReceiver;
private ProgressDialog progressDialog;
@@ -150,18 +149,28 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
packageIntent.putExtras(bundle);
startActivity(packageIntent);
- // Determine if associated lexical model should be downloaded
+ // Determine if associated lexical model for languageID should be downloaded
if (FileUtils.hasKeymanPackageExtension(kmpFilename) && !FileUtils.hasLexicalModelPackageExtension(kmpFilename)
&& (languageID != null) && !languageID.isEmpty()) {
- String keyboardID = kmpFilename.substring(0, kmpFilename.lastIndexOf(FileUtils.KEYMANPACKAGE));
- ArrayList cloudQueries = new ArrayList<>();
- String _remoteLexicalModelUrl = String.format("%s?q=bcp47:%s", kKeymanApiModelURL, languageID);
- cloudQueries.add(new CloudApiTypes.CloudApiParam(
- CloudApiTypes.ApiTarget.KeyboardLexicalModels, _remoteLexicalModelUrl)
- .setType(CloudApiTypes.JSONType.Array));
- // Keyboard package already downloaded, so this will just download associated lexical model.
- // Can't call downloadLexicalModel() because it needs to already know the model ID
- KMKeyboardDownloaderActivity.downloadKeyboard(context, languageID, keyboardID, cloudQueries);
+
+ // Force the cloud catalog to update
+ if (!didExecuteParser) {
+ didExecuteParser = true;
+ repo = CloudRepository.shared.fetchDataset(context);
+ }
+
+ // Check if associated model is available in the cloud, and that it's not already installed
+ LexicalModel modelInfo = CloudRepository.shared.getAssociatedLexicalModel(context, languageID);
+ if ((modelInfo != null) && (KMManager.getAssociatedLexicalModel(languageID) == null)) {
+ String modelID = modelInfo.getLexicalModelID();
+ String url = modelInfo.getUpdateKMP();
+ if (url != null) {
+ ArrayList _params = new ArrayList<>();
+ _params.add(new CloudApiTypes.CloudApiParam(
+ CloudApiTypes.ApiTarget.LexicalModelPackage, url));
+ KMKeyboardDownloaderActivity.downloadLexicalModel(context, modelID, _params);
+ }
+ }
}
break;
@@ -176,7 +185,10 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
super.onCreate(savedInstanceState);
context = this;
- SentryAndroid.init(context);
+ SentryAndroid.init(context, options -> {
+ options.setRelease("release-"+com.tavultesoft.kmapro.BuildConfig.VERSION_NAME);
+ options.setEnvironment(com.tavultesoft.kmapro.BuildConfig.VERSION_ENVIRONMENT);
+ });
checkStoragePermission(null);
resultReceiver = new DownloadResultReceiver(new Handler());
@@ -192,19 +204,10 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
// Add default keyboard
boolean installDefaultKeyboard = prefs.getBoolean(defaultKeyboardInstalled, false);
if (!installDefaultKeyboard) {
- HashMap kbInfo = new HashMap();
- kbInfo.put(KMManager.KMKey_PackageID, KMManager.KMDefault_PackageID);
- kbInfo.put(KMManager.KMKey_KeyboardID, KMManager.KMDefault_KeyboardID);
- kbInfo.put(KMManager.KMKey_LanguageID, KMManager.KMDefault_LanguageID);
- kbInfo.put(KMManager.KMKey_KeyboardName, KMManager.KMDefault_KeyboardName);
- kbInfo.put(KMManager.KMKey_LanguageName, KMManager.KMDefault_LanguageName);
- kbInfo.put(KMManager.KMKey_KeyboardVersion,
- KMManager.getLatestKeyboardFileVersion(context, KMManager.KMDefault_PackageID, KMManager.KMDefault_KeyboardID));
- kbInfo.put(KMManager.KMKey_Font, KMManager.KMDefault_KeyboardFont);
- File welcomeFile = new File(KMManager.getPackagesDir(), KMManager.KMDefault_PackageID + File.separator + FileUtils.WELCOME_HTM);
- kbInfo.put(KMManager.KMKey_CustomHelpLink, welcomeFile.getPath());
- KMManager.addKeyboard(this, kbInfo);
-
+ if (!KMManager.keyboardExists(context, KMManager.KMDefault_PackageID, KMManager.KMDefault_KeyboardID,
+ KMManager.KMDefault_LanguageID)) {
+ KMManager.addKeyboard(this, KMManager.getDefaultKeyboard(getApplicationContext()));
+ }
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean(defaultKeyboardInstalled, true);
editor.commit();
@@ -213,13 +216,13 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
// Add default dictionary
boolean installDefaultDictionary = prefs.getBoolean(defaultDictionaryInstalled, false);
if (!installDefaultDictionary) {
+ LexicalModel defaultLexicalModel = LexicalModel.getDefaultLexicalModel(context);
HashMap lexicalModelInfo = new HashMap();
- lexicalModelInfo.put(KMManager.KMKey_PackageID, KMManager.KMDefault_DictionaryPackageID);
- lexicalModelInfo.put(KMManager.KMKey_LanguageID, KMManager.KMDefault_LanguageID);
- lexicalModelInfo.put(KMManager.KMKey_LexicalModelID, KMManager.KMDefault_DictionaryModelID);
- lexicalModelInfo.put(KMManager.KMKey_LexicalModelName, KMManager.KMDefault_DictionaryModelName);
- lexicalModelInfo.put(KMManager.KMKey_LexicalModelVersion,
- KMManager.getLexicalModelPackageVersion(context, KMManager.KMDefault_DictionaryPackageID));
+ lexicalModelInfo.put(KMManager.KMKey_PackageID, defaultLexicalModel.getPackageID());
+ lexicalModelInfo.put(KMManager.KMKey_LanguageID, defaultLexicalModel.getLanguageID());
+ lexicalModelInfo.put(KMManager.KMKey_LexicalModelID, defaultLexicalModel.getLexicalModelID());
+ lexicalModelInfo.put(KMManager.KMKey_LexicalModelName, defaultLexicalModel.getLexicalModelName());
+ lexicalModelInfo.put(KMManager.KMKey_LexicalModelVersion, defaultLexicalModel.getVersion());
/*
// If welcome.htm exists, add custom help link
welcomeFile = new File(KMManager.getLexicalModelsDir(), KMManager.KMDefault_DictionaryPackageID + File.separator + FileUtils.WELCOME_HTM);
@@ -250,20 +253,7 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
textView.setTextSize((float) textSize);
textView.setSelection(textView.getText().length());
- boolean didCheckUserData = prefs.getBoolean(MainActivity.didCheckUserDataKey, false);
- if (!didCheckUserData && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)) {
- try {
- Intent getUserdataIntent = new Intent("keyman.ACTION_GET_USERDATA");
- startActivityForResult(getUserdataIntent, 0);
- } catch (Exception e) {
- SharedPreferences.Editor editor = prefs.edit();
- editor.putBoolean(MainActivity.didCheckUserDataKey, true);
- editor.commit();
- checkGetStarted();
- }
- } else {
- checkGetStarted();
- }
+ checkGetStarted();
}
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
@@ -275,7 +265,6 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
checkGetStarted();
return;
} else {
- boolean didFail = false;
ClipData userdata = returnIntent.getClipData();
int len = userdata.getItemCount();
for (int i = 0; i < len; i++) {
@@ -306,19 +295,10 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
inputStream.close();
}
} catch (Exception e) {
- didFail = true;
- Log.e(TAG, e.getMessage());
+ KMLog.LogException(TAG, "", e);
}
}
- if (!didFail) {
- KMManager.updateOldKeyboardsList(this);
- SharedPreferences prefs = getSharedPreferences(getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
- SharedPreferences.Editor editor = prefs.edit();
- editor.putBoolean(MainActivity.didCheckUserDataKey, true);
- editor.commit();
- }
-
checkGetStarted();
}
}
@@ -354,11 +334,16 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
break;
case "http" :
case "https" :
+ // Might need to modify link like KMPBrowserActivity
+ String link = data.toString();
+ if (KMPLink.isKeymanInstallLink(link)) {
+ data = KMPLink.getKeyboardDownloadLink(link);
+ }
downloadKMP(scheme);
break;
case "keyman" :
// Only accept download links from Keyman browser activities
- if (FileUtils.isKeymanLink(data.toString()) && caller != null &&
+ if (KMPLink.isKeymanDownloadLink(data.toString()) && caller != null &&
(caller.equalsIgnoreCase("com.tavultesoft.kmea.KMPBrowserActivity") ||
caller.equalsIgnoreCase("com.tavultesoft.kmapro.WebBrowserActivity"))) {
@@ -371,11 +356,13 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
data = Uri.parse(builder.build().toString());
downloadKMP(scheme);
} else {
- Log.e(TAG, "Unrecognized scheme: " + scheme);
+ String msg = "Unrecognized scheme: " + scheme;
+ KMLog.LogError(TAG, msg);
}
break;
default :
- Log.e(TAG, "Unrecognized scheme: " + scheme);
+ String msg = "Unrecognized scheme: " + scheme;
+ KMLog.LogError(TAG, msg);
}
}
intent.setData(null);
@@ -411,92 +398,54 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
invalidateOptionsMenu();
}
-
+ @SuppressLint("RestrictedApi")
@Override
public boolean onPrepareOptionsMenu(final Menu menu) {
final MenuItem _overflowMenuItem = menu.findItem(R.id.action_overflow);
-
- if(_overflowMenuItem!=null) {
- final ViewGroup _rootView = (ViewGroup) _overflowMenuItem.getActionView();
-
- _rootView.findViewById(R.id.counterBackground).setBackground(
- this.getResources().getDrawable(R.drawable.ic_light_action_overflow));
-
- _rootView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- PopupMenu _popup = new PopupMenu(context, _rootView);
- getMenuInflater().inflate(R.menu.overflow_menu, _popup.getMenu());
-
- updateUpdateCountIndicator(
- _popup.getMenu().findItem(R.id.action_update_keyboards),
- KMManager.getUpdateTool().getOpenUpdateCount(),true);
-
- _popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
- public boolean onMenuItemClick(MenuItem theItem) {
- return onOptionsItemSelected(theItem);
- }
- });
-
- MenuPopupHelper _menuHelper = new MenuPopupHelper(context, (MenuBuilder) _popup.getMenu(), _rootView);
- _menuHelper.setForceShowIcon(true);
- _menuHelper.show();
- }
- });
- return super.onPrepareOptionsMenu(menu);
+ if (_overflowMenuItem != null) {
+ MenuItem updateKeyboards = this.menu.findItem(R.id.action_update_keyboards);
+ updateUpdateCountIndicator(updateKeyboards,
+ KMManager.getUpdateTool().getOpenUpdateCount(), true);
}
-
- final MenuItem _keyboardupdate = menu.findItem(R.id.action_update_keyboards);
- if(_keyboardupdate==null)
- return super.onPrepareOptionsMenu(menu);
-
- final ViewGroup _rootView = (ViewGroup) _keyboardupdate.getActionView();
-
- _rootView.findViewById(R.id.counterBackground).setBackground(
- this.getResources().getDrawable(R.drawable.ic_cloud_download));
-
- _rootView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- onOptionsItemSelected(_keyboardupdate);
- }
- });
return super.onPrepareOptionsMenu(menu);
}
private void updateUpdateCountIndicator(int anUpdateCount) {
- if (menu == null)
+ if (menu == null) {
return;
+ }
final MenuItem _overflowMenuItem = menu.findItem(R.id.action_overflow);
- if (_overflowMenuItem != null)
- updateUpdateCountIndicator(_overflowMenuItem,anUpdateCount,false);
+ if (_overflowMenuItem != null) {
+ updateUpdateCountIndicator(_overflowMenuItem, anUpdateCount, false);
+ }
final MenuItem _keyboardupdate = menu.findItem(R.id.action_update_keyboards);
- if (_keyboardupdate != null)
- updateUpdateCountIndicator(_keyboardupdate,anUpdateCount,true);
-
+ if (_keyboardupdate != null) {
+ updateUpdateCountIndicator(_keyboardupdate, anUpdateCount, true);
+ }
}
private void updateUpdateCountIndicator(MenuItem theItem, int anUpdateCount, boolean aHideMenuitem)
{
final ViewGroup _rootView = (ViewGroup) theItem.getActionView();
- if(anUpdateCount==0)
- {
- if(aHideMenuitem)
+ if(anUpdateCount==0) {
+ if (aHideMenuitem) {
theItem.setVisible(false);
- else if(_rootView!=null)
+ } else if (_rootView != null) {
_rootView.findViewById(R.id.update_count_indicator).setVisibility(View.GONE);
- }
- else {
- if(aHideMenuitem)
+ }
+ } else {
+ if(aHideMenuitem) {
theItem.setVisible(true);
- else if(_rootView!=null)
- _rootView.findViewById(R.id.update_count_indicator).setVisibility(View.VISIBLE);
+ } else if(_rootView!=null) {
+ _rootView.findViewById(R.id.update_count_indicator).setVisibility(View.VISIBLE);
+ }
}
- if(_rootView==null)
+ if(_rootView==null) {
return;
+ }
TextView _t = _rootView.findViewById(R.id.update_count_indicator);
_t.setText(String.valueOf(anUpdateCount));
@@ -600,61 +549,61 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
return;
}
try {
+ // Initial try with Keyman 13.0 download link
String url = data.getQueryParameter(KMKeyboardDownloaderActivity.KMKey_URL);
if (url == null) {
url = data.toString();
}
if (url != null) {
- // URL contains KMP to download in background.
- boolean isCustom = FileUtils.isCustomKeyboard(url);
-
- String filename = data.getQueryParameter(KMKeyboardDownloaderActivity.KMKey_Filename);
+ // Create filename by extracting packageID from query or urlNoQuery
+ String filename = data.getQueryParameter("id");
if (filename == null) {
- FileUtils.getFilename(url);
+ String urlNoQuery = data.getPath();
+ filename = FileUtils.getFilename(urlNoQuery);
+ }
+ if (!filename.endsWith(FileUtils.KEYMANPACKAGE)) {
+ filename += FileUtils.KEYMANPACKAGE;
}
- // Parse the url for the BCP 47 language ID
- Uri uri = Uri.parse(url);
- String languageID = uri.getQueryParameter(KMKeyboardDownloaderActivity.KMKey_BCP47);
+ // Parse query for the BCP 47 language ID
+ String languageID = data.getQueryParameter(KMKeyboardDownloaderActivity.KMKey_BCP47);
+ // TODO: Using "tag" for now, but production will be KMKeyboardDownloaderActivity.KMKey_BCP47
+ if (languageID == null) {
+ languageID = data.getQueryParameter("tag");
+ }
- // Keyboard download endpoint:
- // download.php?id=&platform=[&mode=][&cid=xxxx]
url = url.toLowerCase();
-
- // Only handle ad-hoc kmp packages or from keyman.com
- if (FileUtils.hasKeymanPackageExtension(url) || scheme.equals("keyman")) {
- try {
- // Download the KMP to app cache
- Intent downloadIntent = new Intent(MainActivity.this, DownloadIntentService.class);
- downloadIntent.putExtra("url", url);
- downloadIntent.putExtra("filename", filename);
- downloadIntent.putExtra("language", languageID);
- downloadIntent.putExtra("destination", MainActivity.this.getCacheDir().toString());
- downloadIntent.putExtra("receiver", resultReceiver);
-
- progressDialog = new ProgressDialog(MainActivity.this);
- String ellipsisStr = "\u2026";
- progressDialog.setMessage(String.format("%s\n%s%s",
- getString(R.string.downloading_keyboard_package), filename, ellipsisStr));
- progressDialog.setCancelable(false);
- progressDialog.show();
-
- startService(downloadIntent);
- } catch (Exception e) {
- if (progressDialog != null && progressDialog.isShowing()) {
- progressDialog.dismiss();
- }
- progressDialog = null;
- return;//break;
+ try {
+ // Download the KMP to app cache
+ Intent downloadIntent = new Intent(MainActivity.this, DownloadIntentService.class);
+ downloadIntent.putExtra("url", url);
+ downloadIntent.putExtra("filename", filename);
+ downloadIntent.putExtra("language", languageID);
+ downloadIntent.putExtra("destination", MainActivity.this.getCacheDir().toString());
+ downloadIntent.putExtra("receiver", resultReceiver);
+
+ progressDialog = new ProgressDialog(MainActivity.this);
+ progressDialog.setMessage(String.format(getString(R.string.downloading_keyboard_package), filename));
+ progressDialog.setCancelable(false);
+ progressDialog.show();
+
+ startService(downloadIntent);
+ } catch (Exception e) {
+ KMLog.LogException(TAG, "", e);
+ if (progressDialog != null && progressDialog.isShowing()) {
+ progressDialog.dismiss();
}
- } else {
- String message = "Download failed. Not a .kmp keyboard package.";
- Toast.makeText(getApplicationContext(), message,
- Toast.LENGTH_SHORT).show();
+ progressDialog = null;
+ return;//break;
}
+ } else {
+ String message = "Download failed. Not a .kmp keyboard package.";
+ Toast.makeText(getApplicationContext(), message,
+ Toast.LENGTH_SHORT).show();
}
} catch (UnsupportedOperationException e) {
String message = "Download failed. Invalid URL.";
+ KMLog.LogException(TAG, message, e);
Toast.makeText(getApplicationContext(), message,
Toast.LENGTH_SHORT).show();
}
@@ -754,7 +703,7 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
final View textSizeController = inflater.inflate(R.layout.text_size_controller, null);
final AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MainActivity.this);
dialogBuilder.setIcon(R.drawable.ic_light_action_textsize);
- dialogBuilder.setTitle(String.format("%s: %d", getString(R.string.action_text_size), textSize));
+ dialogBuilder.setTitle(String.format(getString(R.string.text_size), textSize));
dialogBuilder.setView(textSizeController);
dialogBuilder.setPositiveButton(getString(R.string.label_ok), new DialogInterface.OnClickListener() {
@Override
@@ -785,7 +734,7 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
textSize = progress + minTextSize;
textView.setTextSize((float) textSize);
- dialog.setTitle(String.format("%s: %d", getString(R.string.action_text_size), textSize));
+ dialog.setTitle(String.format(getString(R.string.text_size), textSize));
}
});
@@ -814,7 +763,7 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(MainActivity.this);
dialogBuilder.setIcon(R.drawable.ic_light_action_trash);
dialogBuilder.setTitle(getString(R.string.action_clear_text));
- dialogBuilder.setMessage(String.format("\n%s\n", getString(R.string.all_text_will_be_cleared)));
+ dialogBuilder.setMessage(getString(R.string.all_text_will_be_cleared));
dialogBuilder.setPositiveButton(getString(R.string.label_ok), new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
@@ -837,7 +786,7 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
boolean showGetStarted = prefs.getBoolean(GetStartedActivity.showGetStartedKey, true);
if (showGetStarted) {
boolean shouldShowGetStarted = false;
- ArrayList> kbList = KMManager.getKeyboardsList(this);
+ List kbList = KMManager.getKeyboardsList(this);
if (kbList != null && kbList.size() < 2)
shouldShowGetStarted = true;
@@ -854,6 +803,7 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PERMISSION_REQUEST_STORAGE) {
// Request for storage permission
if (grantResults.length ==2 &&
@@ -965,8 +915,8 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
} catch (Exception e) {
String message = "Access denied to " + filename +
".\nCheck Android Settings --> Apps --> Keyman to grant storage permissions";
+ KMLog.LogException(TAG, "Unable to copy " + filename + " to app cache ", e);
Toast.makeText(context, message, Toast.LENGTH_LONG).show();
- Log.e(TAG, "Unable to copy " + filename + " to app cache");
return;
}
@@ -1074,17 +1024,23 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
@Override
public void onPackageInstalled(List