Skip to content

Commit

Permalink
Merge branch 'master' into chore/core/8800-cxx17
Browse files Browse the repository at this point in the history
  • Loading branch information
srl295 authored May 13, 2024
2 parents 5a45e80 + 72a1901 commit 52c65c2
Show file tree
Hide file tree
Showing 72 changed files with 476 additions and 191 deletions.
46 changes: 46 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# Keyman Version History

## 18.0.34 alpha 2024-05-13

* feat(windows): Don't install desktop shortcut for Keyman for windows on installation (#11401)
* feat(common): improve builder parameter passing for child and dep builds (#11410)
* chore: merge 17.0 beta into master A17S2 (#11431)
* chore(android): Update dependencies (#11393)

## 18.0.33 alpha 2024-05-10

* chore(common): Merge beta to master for Sprint A18S1 (part 2) (#11413)

## 18.0.32 alpha 2024-05-09

* chore(common): Add `minimum-versions.inc.sh` (#11380)
* chore(core): km_core_cp -> km_core_cu (#11341)

## 18.0.31 alpha 2024-05-08

* fix(windows): "Keyboard" should be lower case in UI string for font helper tool (#11392)

## 18.0.30 alpha 2024-05-07

* chore(web): Improve dependencies (#11377)
Expand Down Expand Up @@ -131,6 +151,32 @@
* chore(common): move to 18.0 alpha (#10713)
* chore: move to 18.0 alpha

## 17.0.322 beta 2024-05-10

* fix(web): fixes illegal KMW event state - can't focus a null element (#11385)

## 17.0.321 beta 2024-05-09

* fix(android/engine): Skip updating selection range if invalid (#11384)
* refactor(android/engine): Refactor updateSelection (#11389)

## 17.0.320 beta 2024-05-07

* fix(android): prevents mid-keystroke desynchronization when deleting selected text (#11367)
* fix(web): support SVG elements when checking className (#11365)
* fix(developer): define `lastSelLength` variable (#11366)

## 17.0.319 beta 2024-05-04

* fix(android): inverting a selection range would crash Keyman (#11345)
* fix(developer): handle missing Name element for File element in package compiler (#11352)
* fix(developer): handle missing Description element for File element in package compiler (#11354)

## 17.0.318 beta 2024-05-02

* fix(web): longpress shortcut activation should only consider northward part (#11306)
* chore(ios,mac): support build on Apple Silicon using Xcode 15.3 (#11302)

## 17.0.317 beta 2024-05-01

* (#11322)
Expand Down
2 changes: 1 addition & 1 deletion VERSION.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
18.0.31
18.0.35
4 changes: 2 additions & 2 deletions android/KMAPro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.0'
classpath 'com.android.tools.build:gradle:7.4.2'
// sentry-android-gradle-plugin 2.1.5+ requires AGP 7.0
classpath 'io.sentry:sentry-android-gradle-plugin:2.1.2'
classpath 'io.sentry:sentry-android-gradle-plugin:4.5.1'
classpath 'name.remal:gradle-plugins:1.5.0'

// From jcenter() which could be sunset in future
Expand Down
2 changes: 1 addition & 1 deletion android/KMAPro/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
10 changes: 5 additions & 5 deletions android/KMAPro/kMAPro/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'com.android.application'
id 'io.sentry.android.gradle'
// https://github.com/Triple-T/gradle-play-publisher/issues/947#issuecomment-843634852
id 'com.github.triplet.play' version '3.8.1' apply false
id 'com.github.triplet.play' version '3.9.1' apply false
id 'name.remal.default-plugins'
}

Expand Down Expand Up @@ -150,12 +150,12 @@ repositories {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.6.0-rc01'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.12.0'
implementation 'com.stepstone.stepper:material-stepper:4.3.1'
api(name: 'keyman-engine', ext: 'aar')
implementation 'io.sentry:sentry-android:6.9.2'
implementation 'androidx.preference:preference:1.2.0'
implementation 'io.sentry:sentry-android:7.8.0'
implementation 'androidx.preference:preference:1.2.1'
implementation "com.android.installreferrer:installreferrer:2.2"

// Add dependency for generating QR Codes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public void onCreate() {
if (DependencyUtil.libraryExists(LibraryType.SENTRY) && !Sentry.isEnabled()) {
Log.d(TAG, "Initializing Sentry");
SentryAndroid.init(getApplicationContext(), options -> {
options.setEnableAutoSessionTracking(false);
options.setRelease(com.tavultesoft.kmapro.BuildConfig.VERSION_GIT_TAG);
options.setEnvironment(com.tavultesoft.kmapro.BuildConfig.VERSION_ENVIRONMENT);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ public void onClick(DialogInterface dialog, int which) {

@Override
public void onBackPressed() {
super.onBackPressed();
finish();
overridePendingTransition(0, android.R.anim.fade_out);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ public boolean onSupportNavigateUp() {

@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public boolean onSupportNavigateUp() {

@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ protected void onCreate(Bundle savedInstanceState) {
checkSendCrashReport();
if (KMManager.getMaySendCrashReport()) {
SentryAndroid.init(context, options -> {
options.setEnableAutoSessionTracking(false);
options.setRelease(com.tavultesoft.kmapro.BuildConfig.VERSION_GIT_TAG);
options.setEnvironment(com.tavultesoft.kmapro.BuildConfig.VERSION_ENVIRONMENT);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ protected void onNewIntent(Intent intent) {

@Override
public void onBackPressed() {
super.onBackPressed();
finish();
overridePendingTransition(0, android.R.anim.fade_out);
}
Expand Down
14 changes: 7 additions & 7 deletions android/KMEA/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,17 @@ android {

dependencies {
// 1.6.0-rc01 needed to resolve https://issuetracker.google.com/issues/238425626
implementation 'androidx.appcompat:appcompat:1.6.0-rc01' // 1.5.1
implementation 'androidx.appcompat:appcompat:1.6.1'
// material:1.7.0 will need Gradle plugin 7.1.0+
implementation 'com.google.android.material:material:1.6.0'
implementation 'commons-io:commons-io:2.6'
implementation 'io.sentry:sentry-android:6.9.2'
implementation 'androidx.preference:preference:1.2.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'commons-io:commons-io:2.13.0'
implementation 'io.sentry:sentry-android:7.8.0'
implementation 'androidx.preference:preference:1.2.1'

// Robolectric
testImplementation 'androidx.test:core:1.5.0'
testImplementation 'androidx.test.ext:junit:1.1.4'
testImplementation 'org.robolectric:robolectric:4.8.1'
testImplementation 'androidx.test.ext:junit:1.1.5'
testImplementation 'org.robolectric:robolectric:4.10.3'

// Generate QR Codes
implementation ('com.github.kenglxn.QRGen:android:3.0.1') {
Expand Down
80 changes: 46 additions & 34 deletions android/KMEA/app/src/main/java/com/keyman/engine/KMKeyboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,51 +170,63 @@ protected boolean updateText(String text) {
return result;
}

/**
* Updates the selection range of the current context.
* Returns boolean - true if the selection range was updated successfully
*/
protected boolean updateSelectionRange() {
boolean result = false;

InputConnection ic = KMManager.getInputConnection(this.keyboardType);
if (ic != null) {
ExtractedText icText = ic.getExtractedText(new ExtractedTextRequest(), 0);
if (icText == null) {
return false;
}
if (ic == null) {
// Unable to get connection to the text
return false;
}

String rawText = icText.text.toString();
updateText(rawText.toString());
ExtractedText icText = ic.getExtractedText(new ExtractedTextRequest(), 0);
if (icText == null) {
// Failed to get text becausee either input connection became invalid or client is taking too long to respond
// https://developer.android.com/reference/android/view/inputmethod/InputConnection#getExtractedText(android.view.inputmethod.ExtractedTextRequest,%20int)
return false;
}

int selStart = icText.selectionStart;
int selEnd = icText.selectionEnd;
String rawText = icText.text.toString();
updateText(rawText.toString());

int selMin = selStart, selMax = selEnd;
if (selStart > selEnd) {
// Selection is reversed so "swap"
selMin = selEnd;
selMax = selStart;
}
int selMin = icText.selectionStart, selMax = icText.selectionEnd;

if (selMin < 0 || selMax < 0) {
// There is no selection or cursor
// Reference https://developer.android.com/reference/android/text/Selection#getSelectionEnd(java.lang.CharSequence)
return false;
}

/*
The values of selStart & selEnd provided by the system are in code units,
not code-points. We need to account for surrogate pairs here.
if (selMin > selMax) {
// Selection is reversed so "swap"
selMin = icText.selectionEnd;
selMax = icText.selectionStart;
}

Fortunately, it uses UCS-2 encoding... just like JS.
/*
The values of selStart & selEnd provided by the system are in code units,
not code-points. We need to account for surrogate pairs here.
References:
- https://stackoverflow.com/a/23980211
- https://android.googlesource.com/platform/frameworks/base/+/152944f/core/java/android/view/inputmethod/InputConnection.java#326
*/
Fortunately, it uses UCS-2 encoding... just like JS.
// Count the number of characters which are surrogate pairs.
int pairsAtStart = CharSequenceUtil.countSurrogatePairs(rawText.substring(0, selStart), rawText.length());
String selectedText = rawText.substring(selStart, selEnd);
int pairsSelected = CharSequenceUtil.countSurrogatePairs(selectedText, selectedText.length());
References:
- https://stackoverflow.com/a/23980211
- https://android.googlesource.com/platform/frameworks/base/+/152944f/core/java/android/view/inputmethod/InputConnection.java#326
*/

selStart -= pairsAtStart;
selEnd -= (pairsAtStart + pairsSelected);
this.loadJavascript(KMString.format("updateKMSelectionRange(%d,%d)", selStart, selEnd));
}
result = true;
// Count the number of characters which are surrogate pairs.
int pairsAtStart = CharSequenceUtil.countSurrogatePairs(rawText.substring(0, selMin), rawText.length());
String selectedText = rawText.substring(selMin, selMax);
int pairsSelected = CharSequenceUtil.countSurrogatePairs(selectedText, selectedText.length());

return result;
selMin -= pairsAtStart;
selMax -= (pairsAtStart + pairsSelected);
this.loadJavascript(KMString.format("updateKMSelectionRange(%d,%d)", selMin, selMax));

return true;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ public void run() {
end = temp;
}
if (end > start) {
k.setShouldIgnoreSelectionChange(true);
if (s.length() == 0) {
ic.setSelection(start, start);
ic.deleteSurroundingText(0, end - start);
ic.endBatchEdit();
return;
} else {
k.setShouldIgnoreSelectionChange(true);
ic.setSelection(start, start);
ic.deleteSurroundingText(0, end - start);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ public boolean onSupportNavigateUp() {

@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ public boolean onSupportNavigateUp() {

@Override
public void onBackPressed() {
super.onBackPressed();
finish();
}

Expand Down
4 changes: 2 additions & 2 deletions android/KMEA/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.0'
classpath 'com.android.tools.build:gradle:7.4.2'
// io.sentry:sentry-android-gradle-plugin not available for library project
classpath 'io.sentry:sentry-android:6.9.2'
classpath 'io.sentry:sentry-android:7.8.0'
classpath 'name.remal:gradle-plugins:1.5.0'
}
}
Expand Down
2 changes: 1 addition & 1 deletion android/KMEA/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
8 changes: 4 additions & 4 deletions android/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Keyman Engine for Android library (**keyman-engine.aar**) is now ready to be imp
4. Check that the `android{}` object, includes the following:
```gradle
android {
compileSdkVersion 33
compileSdkVersion 34
// Don't compress kmp files so they can be copied via AssetManager
aaptOptions {
Expand All @@ -154,10 +154,10 @@ repositories {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.6.0-rc01'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.12.0'
api (name:'keyman-engine', ext:'aar')
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.preference:preference:1.2.1'
// Include this if you want to have QR Codes displayed on Keyboard Info
implementation ('com.github.kenglxn.QRGen:android:3.0.1') {
Expand Down
6 changes: 3 additions & 3 deletions android/Samples/KMSample1/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ repositories {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.6.0-rc01'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.12.0'
api(name: 'keyman-engine', ext: 'aar')
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.preference:preference:1.2.1'
}
2 changes: 1 addition & 1 deletion android/Samples/KMSample1/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.0'
classpath 'com.android.tools.build:gradle:7.4.2'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
6 changes: 3 additions & 3 deletions android/Samples/KMSample2/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ repositories {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.6.0-rc01'
implementation 'com.google.android.material:material:1.6.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.12.0'
api (name:'keyman-engine', ext:'aar')
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.preference:preference:1.2.1'
}
Loading

0 comments on commit 52c65c2

Please sign in to comment.