Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(common): Merge beta to master for Sprint B17S6 (part 2) #11305

Merged
merged 28 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2e32bd5
fix(android/engine): Escape percent-sign character for Javascript
darcywong00 Apr 11, 2024
99ce1e9
Merge remote-tracking branch 'origin/beta' into fix/android/long-context
darcywong00 Apr 12, 2024
65429bd
chore(developer): replace some fixture paths with constants
markcsinclair Apr 18, 2024
5e14f00
chore(developer): replace khmer_angkor sources with constant
markcsinclair Apr 18, 2024
e6f40ad
chore(developer): simplify a TextDecoder.decode stub
markcsinclair Apr 18, 2024
770c9da
fix(web): osk-view hidden by default on construction
jahorton Apr 19, 2024
54d5d37
fix(android): fixes kbd text zoom to prevent accessibility cross-effects
jahorton Apr 22, 2024
7d18c12
fix(android/engine): URIEncode string for updateText()
darcywong00 Apr 22, 2024
1ae8321
fix(android/engine): Handle setSpacebarText()
darcywong00 Apr 22, 2024
0c3351f
chore(android/engine): Fix comment
darcywong00 Apr 22, 2024
37196b1
chore(web): Merge branch 'beta' into fix/web/visible-empty-osk
jahorton Apr 22, 2024
c79487f
test(android/samples): Add special characters to keyboard harness kmp
darcywong00 Apr 22, 2024
00d7b6c
chore(developer): Merge branch 'beta' into test/developer/keyboard-in…
markcsinclair Apr 22, 2024
e742926
chore(developer): some further elimination of code redundancy
markcsinclair Apr 23, 2024
9cb29b0
chore(developer): Merge branch 'beta' into test/developer/keyboard-in…
markcsinclair Apr 23, 2024
6206fa6
auto: increment beta version to 17.0.314
keyman-server Apr 23, 2024
6504049
Merge pull request #11294 from keymanapp/auto/version-beta-17.0.314
keyman-server Apr 23, 2024
7038fb4
fix(android/app): Update storage permissions for Android 12.0+
darcywong00 Apr 25, 2024
7fc7d0c
Merge pull request #11206 from keymanapp/fix/android/long-context
darcywong00 Apr 25, 2024
343a45c
chore(developer): Merge branch 'beta' into test/developer/keyboard-in…
markcsinclair Apr 25, 2024
32a8632
Merge pull request #11299 from keymanapp/fix/android/storage-permissi…
darcywong00 Apr 25, 2024
4ae7418
Merge pull request #11253 from keymanapp/test/developer/keyboard-info…
markcsinclair Apr 25, 2024
392381a
auto: increment beta version to 17.0.315
keyman-server Apr 25, 2024
a8a59ae
Merge pull request #11304 from keymanapp/auto/version-beta-17.0.315
keyman-server Apr 25, 2024
3838e88
chore(common): Merge beta' into master for Sprint B17S6 (part 2)
darcywong00 Apr 25, 2024
d440116
Merge pull request #11258 from keymanapp/fix/web/visible-empty-osk
jahorton Apr 26, 2024
1de9b0c
Merge pull request #11281 from keymanapp/fix/android/locked-text-zoom
jahorton Apr 26, 2024
12c79fb
chore: Merge remote-tracking branch 'origin/beta' into chore/beta-to-…
darcywong00 Apr 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@
* chore(common): move to 18.0 alpha (#10713)
* chore: move to 18.0 alpha

## 17.0.314 beta 2024-04-25

* fix(android/engine): URIEncode strings passed to Javascript (#11206)
* fix(android/app): Update storage permissions for Android 12.0+ (#11299)
* test(developer): keyboard info compiler messages unit tests 2 (#11253)

## 17.0.313 beta 2024-04-23

* chore(common): Set fetch-latest-cldr.sh executable (#11289)
* chore(common): Fix missing entries in HISTORY.md (#11290)
* fix(developer): report missing help to sentry instead of local xml (#11271)
* fix(developer): "use strict" for downlevel browsers in Server (#11276)

## 17.0.312 beta 2024-04-22

* fix(developer): emit JSON strings as characters, not surrogate pairs (#11243)
Expand Down
4 changes: 4 additions & 0 deletions android/KMAPro/kMAPro/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />

<!-- API 33 and above -->
<uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO" />

<!-- 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 -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,19 @@ public static boolean isPermissionOK(Activity activity) {
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 {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
// < API 30
permissionsOK = checkPermission(activity, Manifest.permission.WRITE_EXTERNAL_STORAGE);
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
// API 30-32
permissionsOK = Environment.isExternalStorageManager() ||
checkPermission(activity, Manifest.permission.READ_EXTERNAL_STORAGE);
} else {
// API 33+
//https://developer.android.com/about/versions/13/behavior-changes-13#granular-media-permissions
// Manifest.permission.READ_MEDIA_AUDIO doesn't seem to be needed
permissionsOK = permissionsOK && checkPermission(activity, Manifest.permission.READ_MEDIA_IMAGES);
permissionsOK = permissionsOK && checkPermission(activity, Manifest.permission.READ_MEDIA_VIDEO);
}

return permissionsOK;
Expand Down
9 changes: 4 additions & 5 deletions android/KMEA/app/src/main/assets/android-host.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,8 @@ function setKeymanLanguage(k) {
}

function setSpacebarText(mode) {
keyman.config.spacebarText = mode;
var text = (mode == undefined) || !mode.text ? '' : mode.text;
keyman.config.spacebarText = text;
}

// #6665: we need to know when the user has pressed a hardware key so we don't
Expand Down Expand Up @@ -234,10 +235,8 @@ function setNumericLayer() {
}
}

function updateKMText(text) {
if(text == undefined) {
text = '';
}
function updateKMText(k) {
var text = (k == undefined) || !k.text ? '' : k.text;

console_debug('updateKMText(text=' + text + ') with: \n' + build_context_string(keyman.context));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import android.content.SharedPreferences;
import android.content.pm.ApplicationInfo;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Handler;
import android.util.DisplayMetrics;
import android.util.Log;
Expand Down Expand Up @@ -149,13 +150,19 @@ protected void setShouldIgnoreSelectionChange(boolean ignore) {

protected boolean updateText(String text) {
boolean result = false;
JSONObject reg = new JSONObject();
String kmText = "";
if (text != null) {
kmText = text.toString().replace("\\", "\\u005C").replace("'", "\\u0027").replace("\n", "\\n");
// Use JSON to handle passing string to Javascript
try {
reg.put("text", text.toString());
} catch (JSONException e) {
KMLog.LogException(TAG, "", e);
}
}

if (KMManager.isKeyboardLoaded(this.keyboardType) && !shouldIgnoreTextChange) {
this.loadJavascript(KMString.format("updateKMText('%s')", kmText));
this.loadJavascript(KMString.format("updateKMText(%s)", reg.toString()));
result = true;
}

Expand Down Expand Up @@ -229,6 +236,7 @@ public void initKMKeyboard(final Context context) {

getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
getSettings().setSupportZoom(false);
getSettings().setTextZoom(100);

getSettings().setUseWideViewPort(true);
getSettings().setLoadWithOverviewMode(true);
Expand Down Expand Up @@ -350,7 +358,8 @@ public void run() {
allCalls.append(";");
}

loadUrl("javascript:" + allCalls.toString());
// Ensure strings safe for Javascript. TODO: font strings
loadUrl("javascript:" + Uri.encode(allCalls.toString()));

if(javascriptAfterLoad.size() > 0 && keyboardSet) {
callJavascriptAfterLoad();
Expand Down Expand Up @@ -1098,8 +1107,17 @@ public void reloadAfterError() {
}

public void setSpacebarText(KMManager.SpacebarText mode) {
String jsString = KMString.format("setSpacebarText('%s')", mode.toString());
loadJavascript(jsString);
JSONObject reg = new JSONObject();
if (mode != null) {
// Use JSON to handle passing string to Javascript
try {
reg.put("text", mode.toString());
} catch (JSONException e) {
KMLog.LogException(TAG, "", e);
}
}

this.loadJavascript(KMString.format("setSpacebarText(%s)", reg.toString()));
}

/* Implement handleTouchEvent to catch long press gesture without using Android system default time
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
</Info>
<Files>
<File>
<Name>..\..\..\..\..\..\..\web\testing\chirality\chirality.js</Name>
<Name>..\..\..\..\..\..\..\web\src\test\manual\web\chirality\chirality.js</Name>
<Description>File chirality.js</Description>
<CopyLocation>0</CopyLocation>
<FileType>.js</FileType>
</File>
<File>
<Name>..\..\..\..\..\..\..\web\testing\platform\platformtest.js</Name>
<Name>..\..\..\..\..\..\..\web\src\test\manual\web\platform\platformtest.js</Name>
<Description>File platformtest.js</Description>
<CopyLocation>0</CopyLocation>
<FileType>.js</FileType>
Expand Down Expand Up @@ -62,7 +62,7 @@
</Languages>
</Keyboard>
<Keyboard>
<Name>longpress</Name>
<Name>longpress '"\|5% +</Name>
<ID>longpress</ID>
<Version>1.0</Version>
<OSKFont>code2001.ttf</OSKFont>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ KeymanWeb.KR(new Keyboard_longpress());

function Keyboard_longpress() {
this.KI = "Keyboard_longpress";
this.KN = "longpress";
this.KN = "longpress '\"\\|5% +";
this.KV = null;
this.KH = '';
this.KM = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected void onCreate(Bundle savedInstanceState) {
Keyboard longpressKBbInfo = new Keyboard(
"keyboardharness",
"longpress",
"Longpress Keyboard",
"longpress '\"\\|5% +",
"en",
"English",
"1.0",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/help/android_images/keyman-storage-permission-ap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 18 additions & 3 deletions android/help/troubleshooting/grant-storage-permission.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,30 @@
title: How To - Granting Storage Permission
---

## Granting storage permission
## Granting Storage Permission
If Keyman for Android is permanently denied storage access, attempts to install custom packages will fail with the
notification "Storage permission request was denied". Perform these steps to grant Keyman for Android access to storage

### Android 11.0 to 12L Devices

Step 1)
Go to Android Settings.

Step 2)
Depending on your device, click "Apps", "Apps & notifications", or "App permissions" and grant Keyman
storage permission. The screenshot below is from Android 9.0 Pie.
permission to access storage / "file and media". The screenshot below is from Android 12.0 S.

![](../android_images/keyman-storage-permission-ap.png)

### Android 13.0+ Devices

Step 1)
Go to Android Settings.

Step 2)
Depending on your device, click "Apps" and grant Keyman permission to the following:
* Photos and videos --> Always allow all

The screenshot below is from Android 14.0.

![](../android_images/keyman-storage-permission-ap.png)
![](../android_images/keyman-storage-permission-34b.png)
Loading
Loading