Skip to content

Commit

Permalink
chore(web): Merge branch 'fix/web/infinite-model-replacement-loop' in…
Browse files Browse the repository at this point in the history
…to fix/web/proper-gesture-match-sequencing
  • Loading branch information
jahorton committed Mar 8, 2024
2 parents b09a1ba + f6fdca2 commit 3075643
Show file tree
Hide file tree
Showing 423 changed files with 14,454 additions and 2,874 deletions.
321 changes: 243 additions & 78 deletions CONTRIBUTING.md

Large diffs are not rendered by default.

138 changes: 138 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,143 @@
# Keyman Version History

## 17.0.284 beta 2024-03-07

* fix(web): globe key highlighting (#10932)
* chore(web): updates mtnt model used by test page (#10935)
* fix(developer): kmc keyboard info compiler no kmp error (#10893)
* fix(developer): Treat Right Shift as Shift in debugger (#10919)
* docs(developer): kmc-model api documentation (#10921)
* docs(developer): kmc-model-info api documentation (#10922)
* docs(developer): kmc-keyboard-info api documentation (#10923)
* docs(developer): kmc-package api documentation (#10924)
* fix(developer): normalize all input paths in .kps compiler (#10950)

## 17.0.283 beta 2024-03-06

* fix(android): fixes context-change detection for repeated-char cases (#10873)
* fix(developer): search-term quote replacement was not global (#10934)
* (#10913)
* fix(developer): fix for errant \uXXXX error (#10946)
* (#10948)
* refactor(oem/fv/android): Install fallback keyboard (#10907)
* refactor(android/app): Move storage permission checks (#10904)
* fix(common): missing script exec bit (#10951)

## 17.0.282 beta 2024-03-05

* fix(developer): move osk.ts from developer-utils to kmc-kmn (#10903)
* fix(developer): hint text special characters (#10927)
* docs(developer): kmc-ldml api documentation (#10917)
* chore(developer): consolidate external links in Developer messages (#10918)
* fix(developer): message export filename was title case (#10941)

## 17.0.281 beta 2024-03-04

* chore(linux): Update debian changelog (#10897)
* fix(ios): cross-paragraph keyboard rules (#10905)
* chore(developer): deploy compiler messages to help site (#10906)

## 17.0.280 beta 2024-03-01

* fix(developer): make sure scroll bar appears when needed in global welcome (#10818)
* chore(common): loosen .keyman-touch-layout schema layer id requirements (#10819)
* docs(developer): kmc-kmn api documentation and some message documentation (#10856)
* refactor(developer): cleanup kmn compiler message namespaces (#10867)
* refactor(developer): reorganize messages for adding details (#10878)
* fix(ios): context-initial diacritic handling (#10589)
* feat(developer): adds kmc message command (#10888)
* test(developer): kmc unit test infrastructure messages (#10825)
* fix(android): handle surrogate pairs in selection range indexing (#10885)
* feat(windows): move the code kmshell.dpr to unit so that only the includes are in dpr (#10871)

## 17.0.279 beta 2024-02-29

* fix(linux): Fix libkeymancore-dev dependencies (#10880)
* chore(resources): update to latest ldml: xmlns, uset (#10865)

## 17.0.278 beta 2024-02-28

* docs(linux): Updated whatsnew for Keyman for Linux 17 (#10858)
* (#10869)
* chore(android/engine): Reduce toast notifications after installations (#10868)
* fix(android/engine): Check selection indexes (#10857)

## 17.0.277 beta 2024-02-27

* fix(developer): exit kmc test data if any failure messages occurred (#10805)
* docs(windows): add whats new Keyman for Windows 17.0 (#10783)
* feat(developer): add api-extractor and api-documenter, config, and build integration (#10839)
* feat(developer): publish api documentation to help.keyman.com (#10841)
* docs(developer): npm package readme files (#10842)
* refactor(developer): move osk module from common-types to developer-utils (#10845)
* chore(linux): Update debian changelog (#10828)
* fix(developer): repeated options in kmc must now be fully specified (#10821)
* docs(developer): add documentation for kmc-analyze (#10854)

## 17.0.276 beta 2024-02-26

* chore(linux): Fix autopkg tests (#10824)

## 17.0.275 beta 2024-02-23

* (#10791)
* fix(developer): publish keymancore-1.dll symbols (#10797)
* fix(developer): improve uploading of sourcemaps to sentry (#10798)
* fix(android/engine): Fix how keyboard picker menu exits (#10806)
* chore(linux): Fix `upload-to-debian.sh` script for beta releases (#10784)
* chore(linux): Fix API verification after adding SONAME (#10813)
* chore(linux): Address comments from Debian mailing list (#10800)
* docs(linux): Update how to build binary package with docker (#10814)
* chore(linux): Update debian changelog (#10785)

## 17.0.274 beta 2024-02-22

* fix(android/engine): Remove logs for uninitialized default keyboard (#10782)
* refactor(android/app): Allow SystemKeyboard to install default keyboard and dictionary (#10794)
* chore(android/app): Remove logging for install referrer details (#10795)
* docs(android/app): Update tablet screenshots (again) (#10796)
* docs(android): Update screenshots for help (#10808)
* chore(web): proper reporting of errors from es5 KMW (#10807)
* fix(android): first keystroke when context is empty (#10809)
* chore(linux): Update Debian `control` file (#10787)

## 17.0.273 beta 2024-02-21

* fix(developer): match kmc console formatting for messages in IDE (#10775)
* fix(developer): ensure fatal errors report message or made non-fatal (#10777)
* chore(developer): add LDML specific text to Project view (#10779)
* fix(developer): reset debugger after ldml keyboard compile (#10780)
* fix(developer): crash opening invalid project (#10781)
* docs(ios): document gestures (#10763)

## 17.0.272 beta 2024-02-20

* fix(core): fix output append logic in any_group::apply_transform (#10758)
* fix(android): Match phone suggestion banner styling on tablet (#10760)
* docs(mac): Document What's New for version 17.0 (#10764)
* (#10773)
* chore(developer): reduce WARN_TouchLayoutUsesUnsupportedGesturesDownlevel to HINT (#10766)
* fix(developer): prevent renaming of new project types in New Project dialog (#10767)
* fix(developer): return an error code if build-test-data fails (#10765)
* fix(developer): allow more parameters in kmc.cmd (#10759)
* chore(linux): Ignore missing .symbols file in stable branch (#10674)
* chore(linux): Update symbols file with current version (#10575)
* docs(linux): Update screenshots and FAQ (#10768)
* chore(linux): Fix `debian.sh` by removing quotes (#10772)

## 17.0.271 beta 2024-02-19

* chore(developer): add infrastructure messages tests (#10756)
* chore(windows): Update more PT strings (#10718)
* docs(android/app): Update tablet screenshots (#10726)
* fix(web): sticky special-key highlighting (#10729)
* fix(web): disables modipress for layer-switch keys with subkeys (#10745)
* fix(web): missing null-guard for hardware keystrokes without active Keyman keyboard (#10740)
* docs(ios): what's new in 17.0 (#10748)
* fix(web): handling of page-elements focused before engine initialization (#10744)
* fix(ios): multitap consistency after new-lines (#10728)
* docs(common): Update website README (#10738)

## 17.0.270 beta 2024-02-17

* (#10735)
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
17.0.271
17.0.285
6 changes: 5 additions & 1 deletion android/KMAPro/kMAPro/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
<!-- Keyman Engine removes INTERNET permission, so add it back -->
<uses-permission android:name="android.permission.INTERNET" tools:node="replace" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />

<!-- Devices running up to Android 12L
Starting in API level 33, this permission has no effect:
https://developer.android.com/reference/android/Manifest.permission#READ_EXTERNAL_STORAGE -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="32" />

<!-- Ideally we would declare this permission so we can get other installed keyboard names.
But would involve a long review process with the Play Store:
https://support.google.com/googleplay/android-developer/answer/9214102#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public static void checkGooglePlayInstallReferrer(MainActivity mainActivity, Con
}

if (!installerInfo.equalsIgnoreCase(GOOGLE_PLAY)) {
KMLog.LogInfo(TAG, "Skipping install referrer. Installed from " + installerInfo);
// Don't log install referrer #10762
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
package com.keyman.android;

import com.tavultesoft.kmapro.BuildConfig;
import com.tavultesoft.kmapro.DefaultLanguageResource;
import com.tavultesoft.kmapro.KeymanSettingsActivity;
import com.keyman.android.BannerController;
import com.keyman.engine.KMManager;
import com.keyman.engine.KMManager.KeyboardType;
import com.keyman.engine.KMHardwareKeyboardInterpreter;
Expand Down Expand Up @@ -64,11 +64,13 @@ public void onCreate() {
KMManager.setDebugMode(true);
}
KMManager.addKeyboardEventListener(this);
KMManager.initialize(getApplicationContext(), KeyboardType.KEYBOARD_TYPE_SYSTEM);
interpreter = new KMHardwareKeyboardInterpreter(getApplicationContext(), KeyboardType.KEYBOARD_TYPE_SYSTEM);
Context context = getApplicationContext();
KMManager.initialize(context, KeyboardType.KEYBOARD_TYPE_SYSTEM);
DefaultLanguageResource.install(context);
interpreter = new KMHardwareKeyboardInterpreter(context, KeyboardType.KEYBOARD_TYPE_SYSTEM);
KMManager.setInputMethodService(this); // for HW interface

SharedPreferences prefs = getApplicationContext().getSharedPreferences(getApplicationContext().getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
SharedPreferences prefs = context.getSharedPreferences(context.getString(R.string.kma_prefs_name), Context.MODE_PRIVATE);
KMManager.SpacebarText spacebarText = KMManager.SpacebarText.fromString(prefs.getString(KeymanSettingsActivity.spacebarTextKey, KMManager.SpacebarText.LANGUAGE_KEYBOARD.toString()));
KMManager.setSpacebarText(spacebarText);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/**
* Copyright 2024 SIL International
*/
package com.tavultesoft.kmapro;

import static com.tavultesoft.kmapro.MainActivity.PERMISSION_REQUEST_STORAGE;

import android.Manifest;
import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Environment;
import android.widget.Toast;

import androidx.appcompat.app.AlertDialog;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

public class CheckPermissions {

public static boolean isPermissionOK(Activity activity) {
boolean permissionsOK = true;

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return permissionsOK;
}

if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) {
permissionsOK = Environment.isExternalStorageManager();
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.TIRAMISU) {
// TODO: Workout scoped storage permission #10659
}
} else {
permissionsOK = checkPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
}

return permissionsOK;
}

public static boolean checkPermission(Activity activity, String permission) {
return ContextCompat.checkSelfPermission(activity.getApplicationContext(), permission) == PackageManager.PERMISSION_GRANTED;
}

public static void requestPermission (Activity activity, Context context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
// Need to request multiple permissions at once
// TODO: request multiple permissions at once #10659
showPermissionDenied(context);
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// TODO: find alternative to below. #10659
// It works, but would need Play Store approval
// For now, show permission denied
showPermissionDenied(context);
/*
try {
Intent intent = new Intent();
intent.setAction(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION);
Uri uri = Uri.fromParts("package", activity.getPackageName(), null);
intent.setData(uri);
activity.startActivity(intent);
} catch (Exception e) {
Intent intent = new Intent();
intent.setAction(Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION);
activity.startActivity(intent);
}
*/
} else if (ActivityCompat.shouldShowRequestPermissionRationale(activity, Manifest.permission.READ_EXTERNAL_STORAGE)) {
// Provide additional rationale to the user if the permission was not granted
String message = activity.getApplicationContext().getString(R.string.request_storage_permission);
Toast.makeText(activity.getApplicationContext(), message ,
Toast.LENGTH_LONG).show();
ActivityCompat.requestPermissions(activity,
new String[]{ Manifest.permission.READ_EXTERNAL_STORAGE },
PERMISSION_REQUEST_STORAGE);
} else {
// Request the permission. The result will be received in onRequestPermissionsResult().
ActivityCompat.requestPermissions(activity,
new String[]{ Manifest.permission.READ_EXTERNAL_STORAGE },
PERMISSION_REQUEST_STORAGE);
}
}

public static void showPermissionDenied(Context context) {
// Permission request denied
AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(context);
dialogBuilder.setTitle(String.format(context.getString(R.string.title_add_keyboard)));
dialogBuilder.setMessage(String.format(context.getString(R.string.storage_permission_denied2)));
dialogBuilder.setPositiveButton(context.getString(R.string.label_ok), null);
AlertDialog dialog = dialogBuilder.create();
dialog.show();

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright (C) 2024 SIL International. All rights reserved.
*/

package com.tavultesoft.kmapro;

import android.content.Context;
import android.content.SharedPreferences;

import com.keyman.engine.KMManager;
import com.keyman.engine.data.LexicalModel;

import java.util.HashMap;

public class DefaultLanguageResource {
private static final String defaultKeyboardInstalled = "DefaultKeyboardInstalled";
private static final String defaultDictionaryInstalled = "DefaultDictionaryInstalled";

/**
* Check if app has installed default keyboard and dictionary. If not, install them
* @param context
*/
public static void install(Context context) {
SharedPreferences prefs = context.getSharedPreferences(context.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(context, KMManager.getDefaultKeyboard(context.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<String, String> lexicalModelInfo = new HashMap<String, String>();
lexicalModelInfo.put(KMManager.KMKey_PackageID, defaultLexicalModel.getPackageID());
lexicalModelInfo.put(KMManager.KMKey_LanguageID, defaultLexicalModel.getLanguageID());
lexicalModelInfo.put(KMManager.KMKey_LanguageName, defaultLexicalModel.getLanguageName());
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();
}
}
}
Loading

0 comments on commit 3075643

Please sign in to comment.