diff --git a/.crowdin-tmp/.gitkeep b/.crowdin-tmp/.gitkeep
deleted file mode 100644
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000
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 f947efcaaca9cd0f8dffb8554a6ed77002557c70..7d3fd45792d832da0ab8815e79dcf48f25710c97 100644
--- a/.gitignore
+++ b/.gitignore
@@ -256,8 +256,11 @@ compile_flags.txt
# Auto-generated resource script
resources/environment.sh
-# Keyman translations from https://crowdin.com/project/keyman
-.crowdin-tmp/
-crowdin/
-
+# 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 a15d40a958e5c7719c1a2706837cc0a24a611fa5..c06b0f4852f41c012be6cf6163834f7a8a028cdd 100644
--- a/HISTORY.md
+++ b/HISTORY.md
@@ -1,5 +1,539 @@
# Keyman Version History
+## 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)
+
+## 14.0.57 alpha 2020-04-27
+
+* modify(common): Update to Unicode 13.0 (#3029)
+* modify(android): Refactor Keyboard class to not use Map (#3020)
+
+## 14.0.56 alpha 2020-04-24
+
+* fix(android): Clarify label that shows "Get Started" on startup (#3025)
+* feat(common/lmlayer): allow for verbose word breaker specification (#3023)
+
+## 14.0.55 alpha 2020-04-23
+
+* modify(android): Convert LanguageListActivity to utility (#3018)
+* refactor(web/engine): successful web-core compilation (#2992)
+* change(common/lmlayer): always bundle searchTermToKey() with model (#2971)
+* change(common/lmlayer): remove NFD table (#3014)
+
+## 14.0.54 alpha 2020-04-22
+
+* refactor(common/lmlayer): word breaker compilation (#3016)
+
+## 14.0.53 alpha 2020-04-21
+
+* refactor(common/lmlayer): Abstracted connection between LMLayer and Worker initialization (#2986)
+* refactor(common/lmlayer): starts a formal 'headless' mode (#2987)
+* fix(android): predictive banner display bugfix (#3010)
+* fix(android): Fix system keyboard alignment (#3009)
+
+## 14.0.52 alpha 2020-04-17
+
+* refactor(web/engine): precomputation for OSK key events, headless production thereof (#2969)
+* refactor(web/engine): initial ModelManager split (#2974)
+* refactor(web/engine): lm-layer enablement state management rework (#2975)
+* refactor(web/engine): predictive data routing, LanguageProcessor as EventEmitter (#2976)
+* refactor(web/engine): web-core build prep (#2982)
+
+## 14.0.51 alpha 2020-04-16
+
+* modify(android): Update minimum SDK to 21 (#2993)
+
+## 14.0.50 alpha 2020-04-15
+
+* fix(android): Handle default font DejaVuSans.ttf (#2981)
+* feat(android): Download cloud keyboards from https://keyman.com/keyboards (#2953)
+* fix(ios): iOS 13.4 subkey menu workaround (#2959)
+* change(ios): Web-based popup key longpresses (#2968)
+* fix(web): repairs Web regression test suite (#2973)
+* feat(android): Dismiss system keyboard on Back press (#2984)
+
+## 14.0.49 alpha 2020-04-11
+
+* chore(common/lmlayer): do not run tests in IE11 in Windows (#2978)
+
+## 14.0.48 alpha 2020-04-07
+
+* feat(windows): use crashpad and better call stacks (#2931)
+
+## 14.0.47 alpha 2020-04-07
+
+* fix(common/lmlayer): use searchTermToKey() on input (#2954)
+* refactor(web/engine): proper split-off of DOM-reliant code (#2939)
+* refactor(web/engine): InputProcessor/KeyboardProcessor split (#2940)
+* fix(ios): prevents in-app keyboard resets (#2951)
+* refactor(web/engine): headless KeyboardProcessor (#2941)
+
+## 14.0.46 alpha 2020-04-06
+
+* fix(android): Add check for WRITE_EXTERNAL_STORAGE permission (#2946)
+
+## 14.0.45 alpha 2020-04-05
+
+* chore(deps-dev): bump minimist from 1.2.2 to 1.2.3 in /web/testing/regression-tests (#2947)
+
+## 14.0.44 alpha 2020-04-03
+
+* refactor(web/engine): begins formally removing DOM-aware keyboard API functions from web-core KeyboardInterface (#2915)
+* refactor(web/engine): start of system store abstraction (#2919)
+* refactor(web/engine): Processor now manages current layer; OSK listens via callback (#2920)
+* refactor(web/engine): RuleBehavior now headless (#2925)
+* refactor(web/engine): variable store storage abstraction (#2926)
+* fix(web): fixes activeElement typing (#2927)
+* refactor(web/engine): relocates DOM-only parts of Processor (#2938)
+* fix(android): Change KeyboardHarness/build.sh to not rebuild KMEA (#2943)
+* feat(android): Propagate languageID when downloading kmp (#2944)
+
+## 14.0.43 alpha 2020-04-02
+
+* fix(web/engine): default layout fix for chiral keyboards (#2936)
+* fix(android): Fix exception in ResourcesUpdateTool (#2933)
+* modify(android): Update sample and test projects to install asset kmp's (#2935)
+
+## 14.0.42 alpha 2020-04-01
+
+* fix(android): Fix globe button crash on 3rd party apps (#2930)
+* modify(android) Install default asset kmp's (#2928)
+
+## 14.0.41 alpha 2020-03-31
+
+* refactor(web/engine): KeyboardInterface/Processor cleanup and prep (#2901)
+* refactor(web/engine): Preps keyboard layouts definitions for web-core (#2902)
+* refactor(web/engine): layouts now full property of Keyboard wrapper (#2903)
+* feat(android): Specify optional language ID for installing kmp (#2921)
+
+## 14.0.40 alpha 2020-03-30
+
+* fix(developer): use correct registry types for sentry options (#2912)
+* fix(windows): replaces empty eventid with underscore when autoreport errors off (#2913)
+* refactor(web): namespacing DOM-focused management (#2891)
+* refactor(web/engine): starts DOM pre-processor (#2892)
+* refactor(web): starts OSK preprocessor (#2893)
+* refactor(web): headless device representation (#2894)
+* refactor(web): cleanup for Processor.processKeyEvent (#2899)
+* chore(common): Cleanup unused folders and update README (#2916)
+
+## 14.0.39 alpha 2020-03-29
+
+* feat(windows): user control for upload to sentry (#2900)
+
+## 14.0.38 alpha 2020-03-28
+
+* feat(ios): Add Crowdin CLI for iOS strings (#2905)
+
+## 14.0.37 alpha 2020-03-27
+
+* feat(windows): crash reports in CEF (#2887)
+* feat(common): Use Crowdin CLI (v3) for handling l10n files (#2895)
+* fix(windows): show error if tsysinfo fails to start; kmcomapi reporting (#2897)
+
+## 14.0.36 alpha 2020-03-26
+
+* fix(web/engine): Fixes default key lookup returns (#2890)
+
+## 14.0.35 alpha 2020-03-25
+
+* feat(windows): new error notification dialog (#2875)
+* feat(windows): sentry c++ wrappers (#2886)
+* refactor(web/engine): activeKeyboard now tracked on Processor (#2864)
+* refactor(web/engine): Initial definition of typed Keyboard wrapper (#2868)
+* refactor(web/engine): More Keyboard wrapper properties (#2869)
+* refactor(web/engine): headless-friendly keymapping (#2870)
+* refactor(web/engine): relocates keyboard tag code, adds typing (#2883)
+* fix(web): fixes variable stores (#2884)
+
+## 14.0.34 alpha 2020-03-24
+
+* fix(web): fixes embedded kbd initialization (#2879)
+* fix(ios): popup keys over base keys no longer emit base char. (#2881)
+
+## 14.0.33 alpha 2020-03-23
+
+* fix(android): Update min SDK versions for sample apps (#2872)
+* refactor(web/engine): extended abstraction with OutputTarget (#2849)
+* refactor(web/engine): reworks use of embedded's keyman['oninserttext'] (#2850)
+* refactor(web/engine): reworks default output handling to return RuleBehaviors (#2854)
+* refactor(web/engine): removes shiftState parameter (#2859)
+* refactor(web/engine): moves new RuleBehavior type & behaviors to own file (#2861)
+* refactor(web/engine): doInputEvent moved to OutputTarget (#2862)
+* refactor(web/engine): KeyboardInterface now property of Processor (#2863)
+* fix(windows): some sentry symbolication was not working (#2871)
+* fix(linux): Use __release_version__ for downloadkeyboard window (#2877)
+
+## 14.0.32 alpha 2020-03-20
+
+* fix(windows): include sources for sentry (#2866)
+
+## 14.0.31 alpha 2020-03-20
+
+* fix(android): Fix min SDK version for Sample and Test apps (#2860)
+
## 14.0.30 alpha 2020-03-19
* docs(common): minor updates to readme (#2856)
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 b12334e9301e9a026222d7f80832603992df0860..96975388f75cdcf505aac49fdf3e0d8cb146e7a8 100644
--- a/VERSION.md
+++ b/VERSION.md
@@ -1 +1 @@
-14.0.31
\ No newline at end of file
+14.0.117
\ 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..82b157b0e5b0b8b8ee4d7d2df83ec98a38bd4f28 100644
--- a/android/KMAPro/build.gradle
+++ b/android/KMAPro/build.gradle
@@ -7,7 +7,6 @@ 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 'name.remal:gradle-plugins:1.0.157'
}
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/kMAPro/build.gradle b/android/KMAPro/kMAPro/build.gradle
index 1e04eeba7c13830da5f28797d6ce21364c6df5eb..ff618d48f89807a091a04bac19249cc7d9f86f0c 100644
--- a/android/KMAPro/kMAPro/build.gradle
+++ b/android/KMAPro/kMAPro/build.gradle
@@ -12,6 +12,10 @@ android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
+ // Don't compress kmp files so they can be copied via AssetManager
+ aaptOptions {
+ noCompress "kmp"
+ }
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
@@ -19,28 +23,17 @@ android {
defaultConfig {
applicationId "com.tavultesoft.kmapro"
- minSdkVersion 19
+ minSdkVersion 21
targetSdkVersion 29
//println "===DUMPING PROPERTIES==="
//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
versionCode VERSION_CODE as Integer
versionName VERSION_NAME
+ buildConfigField "String", "VERSION_ENVIRONMENT", "\""+VERSION_ENVIRONMENT+"\""
}
String env_release_store_file = System.getenv("release_store_file")
@@ -152,5 +145,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 fb4e55451b9c0a5be14175271821648b8fb4948d..83aad3d6d9f222502df2682d1fa41fad84b7985b 100644
--- a/android/KMAPro/kMAPro/src/main/AndroidManifest.xml
+++ b/android/KMAPro/kMAPro/src/main/AndroidManifest.xml
@@ -6,6 +6,7 @@
+
+
+
-
+
+ android:host="*"
+ android:scheme="keyman"
+ 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);
@@ -220,6 +222,18 @@ public class SystemKeyboard extends InputMethodService implements OnKeyboardEven
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
+ if (event.getAction() == KeyEvent.ACTION_DOWN) {
+ switch (keyCode) {
+ case KeyEvent.KEYCODE_BACK:
+ // Dismiss the keyboard if currently shown
+ if (isInputViewShown()) {
+ KMManager.hideSystemKeyboard();
+ return true;
+ }
+ break;
+ }
+ }
+
return interpreter.onKeyDown(keyCode, event); // if false, will revert to default handling.
}
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 c82178371b046c0dbf03b0edf9ce33d67222e674..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
@@ -9,6 +9,8 @@ import java.util.HashMap;
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;
@@ -69,6 +71,7 @@ public class GetStartedActivity extends AppCompatActivity {
});
final TextView getStartedText = findViewById(R.id.getStartedText);
+ getStartedText.setText(String.format(getString(R.string.show_get_started), getString(R.string.get_started)));
getStartedText.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -111,7 +114,11 @@ public class GetStartedActivity extends AppCompatActivity {
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
if (position == 0) {
- KMManager.showLanguageList(context);
+ if (KMManager.hasConnection(context)) {
+ // Keyman Settings install activity
+ Intent i = new Intent(context, KeymanSettingsInstallActivity.class);
+ context.startActivity(i);
+ }
} else if (position == 1) {
startActivity(new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS));
} else if (position == 2) {
@@ -148,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..1e9b495f6ae9c73f67ca446a16951badc0f415b4 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
@@ -6,6 +6,7 @@ package com.tavultesoft.kmapro;
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,7 +25,7 @@ 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 String kmUrl = "";
@@ -61,6 +62,8 @@ public class InfoActivity extends AppCompatActivity {
pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
versionStr = pInfo.versionName;
} catch (NameNotFoundException e) {
+ KMLog.LogException(TAG, "", e);
+
// Fallback to a "current" version. This does not need to be maintained
versionStr = "12.0.0.0";
}
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 72ba1e7a5055e3bef059c7752945f3920379b806..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:
@@ -73,7 +61,8 @@ public class KeymanSettingsFragment extends PreferenceFragmentCompat {
SwitchPreference getStartedPreference = new SwitchPreference(context);
getStartedPreference.setKey(GetStartedActivity.showGetStartedKey);
- getStartedPreference.setTitle(getString(R.string.show_get_started));
+ getStartedPreference.setTitle(String.format(getString(R.string.show_get_started), getString(R.string.get_started)));
+
getStartedPreference.setDefaultValue(true);
// Blocks the default checkmark interaction; we want to control the checkmark's state separately
@@ -111,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);
@@ -148,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..eeb7cda080bc931b64a4c341713317b81d61fc43
--- /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_language_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_language_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(String.format("\n%s\n", 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_language_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 98f0b3794afc5e36467e251de5d906f4f7bdc522..f92a6cc2c516aac2493536b9e10ee54f9cf0db8f 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
@@ -24,16 +24,22 @@ import com.tavultesoft.kmea.KMManager.KeyboardType;
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.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 android.Manifest;
import android.app.ProgressDialog;
+import android.content.ComponentName;
import android.content.pm.PackageManager;
-import android.content.res.Resources;
import android.database.Cursor;
import android.net.Uri;
+import android.net.Uri.Builder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
@@ -66,7 +72,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;
@@ -94,7 +99,6 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
// Fields used for installing kmp packages
private static final int PERMISSION_REQUEST_STORAGE = 0;
public static final int READ_REQUEST_CODE = 42;
- Uri data;
private static final String TAG = "MainActivity";
@@ -109,7 +113,10 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
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;
@@ -132,13 +139,40 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
break;
case FileUtils.DOWNLOAD_SUCCESS :
String downloadedFilename = resultData.getString("filename");
+ String languageID = resultData.getString("language");
String kmpFilename = resultData.getString("destination") + File.separator + downloadedFilename;
Bundle bundle = new Bundle();
bundle.putString("kmpFile", kmpFilename);
+ bundle.putString("language", languageID);
Intent packageIntent = new Intent(getApplicationContext(), PackageActivity.class);
packageIntent.putExtras(bundle);
startActivity(packageIntent);
+
+ // Determine if associated lexical model for languageID should be downloaded
+ if (FileUtils.hasKeymanPackageExtension(kmpFilename) && !FileUtils.hasLexicalModelPackageExtension(kmpFilename)
+ && (languageID != null) && !languageID.isEmpty()) {
+
+ // 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;
}
super.onReceiveResult(resultCode, resultData);
@@ -151,8 +185,12 @@ 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());
if (BuildConfig.DEBUG) {
@@ -161,6 +199,43 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
KMManager.initialize(getApplicationContext(), KeyboardType.KEYBOARD_TYPE_INAPP);
KMManager.executeResourceUpdate(this);
+
+ SharedPreferences prefs = getSharedPreferences(getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
+ // Add default keyboard
+ boolean installDefaultKeyboard = prefs.getBoolean(defaultKeyboardInstalled, false);
+ if (!installDefaultKeyboard) {
+ 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();
+ }
+
+ // 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, 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);
+ lexicalModelInfo.put(KMManager.KMKey_CustomHelpLink, welcomeFile.getPath());
+ */
+ KMManager.addLexicalModel(context, lexicalModelInfo);
+ KMManager.registerAssociatedLexicalModel(KMManager.KMDefault_LanguageID);
+
+ SharedPreferences.Editor editor = prefs.edit();
+ editor.putBoolean(defaultDictionaryInstalled, true);
+ editor.commit();
+ }
+
setContentView(R.layout.activity_main);
toolbar = (Toolbar) findViewById(R.id.titlebar);
@@ -173,7 +248,6 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
getSupportActionBar().setBackgroundDrawable(getActionBarDrawable(this));
textView = (KMTextView) findViewById(R.id.kmTextView);
- SharedPreferences prefs = getSharedPreferences(getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
textView.setText(prefs.getString(userTextKey, ""));
textSize = prefs.getInt(userTextSizeKey, minTextSize);
textView.setTextSize((float) textSize);
@@ -185,6 +259,7 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
Intent getUserdataIntent = new Intent("keyman.ACTION_GET_USERDATA");
startActivityForResult(getUserdataIntent, 0);
} catch (Exception e) {
+ KMLog.LogException(TAG, "", e);
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean(MainActivity.didCheckUserDataKey, true);
editor.commit();
@@ -235,13 +310,12 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
inputStream.close();
}
} catch (Exception e) {
+ KMLog.LogException(TAG, "", e);
didFail = true;
- Log.e(TAG, e.getMessage());
}
}
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);
@@ -258,42 +332,23 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
KMManager.onResume();
KMManager.hideSystemKeyboard();
- SharedPreferences prefs = getSharedPreferences(getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
- SharedPreferences.Editor editor = prefs.edit();
-
- // Check if default keyboard should be added
- if (!KMManager.keyboardExists(this, KMManager.KMDefault_UndefinedPackageID,
- KMManager.KMDefault_KeyboardID, KMManager.KMDefault_LanguageID)) {
- boolean installDefaultKeyboard = prefs.getBoolean(defaultKeyboardInstalled, false);
- if (!installDefaultKeyboard) {
- HashMap kbInfo = new HashMap();
- kbInfo.put(KMManager.KMKey_PackageID, KMManager.KMDefault_UndefinedPackageID);
- 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(
- this, KMManager.KMDefault_UndefinedPackageID, KMManager.KMDefault_KeyboardID));
- kbInfo.put(KMManager.KMKey_Font, KMManager.KMDefault_KeyboardFont);
- KMManager.addKeyboard(this, kbInfo);
- }
-
- editor.putBoolean(defaultKeyboardInstalled, true);
- editor.commit();
- }
-
KMManager.addKeyboardEventListener(this);
KMKeyboardDownloaderActivity.addKeyboardDownloadEventListener(this);
PackageActivity.addKeyboardDownloadEventListener(this);
- checkAndInstallDefaultDictionary();
+ // Get calling activity
+ ComponentName component = this.getCallingActivity();
+ String caller = null;
+ if (component != null) {
+ caller = component.getClassName();
+ }
Intent intent = getIntent();
data = intent.getData();
if (data != null) {
-
- switch (data.getScheme().toLowerCase()) {
+ String scheme = data.getScheme().toLowerCase();
+ switch (scheme) {
// content:// Android DownloadManager
// file:// Chrome downloads and Filebrowsers
case "content":
@@ -302,13 +357,30 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
break;
case "http" :
case "https" :
- downloadKMP();
+ downloadKMP(scheme);
break;
case "keyman" :
- downloadKMP();
+ // Only accept download links from Keyman browser activities
+ if (FileUtils.isKeymanLink(data.toString()) && caller != null &&
+ (caller.equalsIgnoreCase("com.tavultesoft.kmea.KMPBrowserActivity") ||
+ caller.equalsIgnoreCase("com.tavultesoft.kmapro.WebBrowserActivity"))) {
+
+ // Convert opaque URI to hierarchical URI so the query parameters can be parsed
+ Builder builder = new Uri.Builder();
+ builder.scheme("https")
+ .authority("keyman.com")
+ .appendPath("keyboards")
+ .encodedQuery(data.getEncodedQuery());
+ data = Uri.parse(builder.build().toString());
+ downloadKMP(scheme);
+ } else {
+ String msg = "Unrecognized scheme: " + scheme;
+ KMLog.LogError(TAG, msg);
+ }
break;
default :
- Log.e(TAG, "Unrecognized protocol " + data.getScheme());
+ String msg = "Unrecognized scheme: " + scheme;
+ KMLog.LogError(TAG, msg);
}
}
intent.setData(null);
@@ -519,81 +591,79 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
resizeTextView(false);
}
- private void checkAndInstallDefaultDictionary() {
- SharedPreferences prefs = getSharedPreferences(getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
-
- // Check if default dictionary model package should be installed
- // This also depends on a current keyboard being loaded
- HashMap curKbInfo = KMManager.getCurrentKeyboardInfo(this);
- if (!KMManager.lexicalModelExists(this, KMManager.KMDefault_DictionaryPackageID,
- KMManager.KMDefault_LanguageID, KMManager.KMDefault_DictionaryModelID) && curKbInfo != null) {
- boolean installDefaultDictionary = prefs.getBoolean(defaultDictionaryInstalled, false);
- if (!installDefaultDictionary) {
- File defaultDictionaryKMP = new File(
- new File(KMManager.getResourceRoot(), KMManager.KMDefault_DictionaryKMP).getAbsolutePath());
- Uri uri = FileProvider.getUriForFile(
- context, FileProviderUtils.getAuthority(context), defaultDictionaryKMP);
- useLocalKMP(context, uri, true);
- }
-
- SharedPreferences.Editor editor = prefs.edit();
- editor.putBoolean(defaultDictionaryInstalled, true);
- editor.commit();
- }
- }
-
/**
- * Parse the URI data to determine the URL for the .kmp keyboard package.
+ * Parse the URI data to determine the filename and URL for the .kmp keyboard package.
+ * If URL is valid, download the kmp.
+ * @param scheme String of the URI's scheme.
*
*/
- private void downloadKMP() {
- Intent downloadIntent;
- String url = data.getQueryParameter(KMKeyboardDownloaderActivity.KMKey_URL);
- if (url == null) {
- url = data.toString();
+ private void downloadKMP(String scheme) {
+ if (data == null) {
+ String message = "Download failed. Invalid URL.";
+ Toast.makeText(getApplicationContext(), message,
+ Toast.LENGTH_SHORT).show();
+ return;
}
- if (url != null) {
- // URL contains KMP to download in background.
- boolean isCustom = FileUtils.isCustomKeyboard(url);
-
- String filename = data.getQueryParameter("filename");
- if (filename == null) {
- int index = url.lastIndexOf("/") + 1;
- if (index >= 0 && index <= url.length()) {
- filename = url.substring(index);
- }
+ try {
+ String url = data.getQueryParameter(KMKeyboardDownloaderActivity.KMKey_URL);
+ if (url == null) {
+ url = data.toString();
}
+ if (url != null) {
+ String filename = data.getQueryParameter(KMKeyboardDownloaderActivity.KMKey_Filename);
+ if (filename == null) {
+ FileUtils.getFilename(url);
+ }
- // Only handle ad-hoc kmp packages or from keyman.com
- if (FileUtils.hasKeymanPackageExtension(url) || data.getScheme().toLowerCase().equals("keyman")) {
- try {
- // Download the KMP to app cache
- downloadIntent = new Intent(MainActivity.this, DownloadIntentService.class);
- downloadIntent.putExtra("url", url);
- downloadIntent.putExtra("filename", filename);
- 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();
+ // Parse data 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) {
+ KMLog.LogException(TAG, "", e);
+ if (progressDialog != null && progressDialog.isShowing()) {
+ progressDialog.dismiss();
+ }
+ progressDialog = null;
+ return;//break;
}
- progressDialog = null;
- return;//break;
+ } else {
+ String message = "Download failed. Not a .kmp keyboard package.";
+ Toast.makeText(getApplicationContext(), message,
+ Toast.LENGTH_SHORT).show();
}
- } 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();
}
}
@@ -774,7 +844,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;
@@ -793,7 +863,9 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
if (requestCode == PERMISSION_REQUEST_STORAGE) {
// Request for storage permission
- if (grantResults.length == 1 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
+ if (grantResults.length ==2 &&
+ grantResults[0] == PackageManager.PERMISSION_GRANTED &&
+ grantResults[1] == PackageManager.PERMISSION_GRANTED) {
// Permission has been granted. Resume task needing this permission
useLocalKMP(context, data);
} else {
@@ -808,8 +880,8 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
private void checkStoragePermission(Uri data) {
// Check if the Storage permission has been granted
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
- if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) ==
- PackageManager.PERMISSION_GRANTED) {
+ if ((checkSelfPermission(Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) &&
+ (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED)) {
useLocalKMP(context, data);
} else {
// Permission is missing and must be requested
@@ -822,27 +894,36 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
}
/**
- * Requests the {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} permission
+ * Requests the {@link android.Manifest.permission#READ_EXTERNAL_STORAGE} and
+ * {@link android.Manifest.permission#WRITE_EXTERNAL_STORAGE} permissions
*/
private void requestStoragePermission() {
- if (ActivityCompat.shouldShowRequestPermissionRationale(this,
- Manifest.permission.READ_EXTERNAL_STORAGE)) {
+ if (ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.READ_EXTERNAL_STORAGE) &&
+ ActivityCompat.shouldShowRequestPermissionRationale(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)) {
// Provide additional rationale to the user if the permission was not granted
- String message = "To install keyboard package, allow Keyman permission to read storage.";
+ String message = "To install keyboard packages, allow Keyman permission to read/write storage.";
Toast.makeText(getApplicationContext(), message ,
Toast.LENGTH_LONG).show();
- ActivityCompat.requestPermissions(MainActivity.this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
+ ActivityCompat.requestPermissions(this,
+ new String[]{
+ Manifest.permission.READ_EXTERNAL_STORAGE,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSION_REQUEST_STORAGE);
} else {
- // Request the permission. The result will be received in onRequestPermissionResult().
- ActivityCompat.requestPermissions(this, new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},
+ // Request the permission. The result will be received in onRequestPermissionsResult().
+ ActivityCompat.requestPermissions(this,
+ new String[]{
+ Manifest.permission.READ_EXTERNAL_STORAGE,
+ Manifest.permission.WRITE_EXTERNAL_STORAGE},
PERMISSION_REQUEST_STORAGE);
}
}
// TODO: Move this to KMEA during Keyman 13.0 refactoring
public static void useLocalKMP(Context context, Uri data) {
- useLocalKMP(context, data, false);
+ if (data != null) {
+ useLocalKMP(context, data, false);
+ }
}
public static void useLocalKMP(Context context, Uri data, boolean silentInstall) {
@@ -891,8 +972,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;
}
@@ -993,24 +1074,30 @@ public class MainActivity extends AppCompatActivity implements OnKeyboardEventLi
KMManager.addKeyboard(this, keyboardInfo);
}
} else {
- // Error notifications handled in LanguageListActivity
+ // Error notifications previously handled in LanguageListActivity
}
}
@Override
public void onPackageInstalled(List