Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
sds100 committed Oct 7, 2023
2 parents 0dabf6d + f79d8f1 commit 6000845
Show file tree
Hide file tree
Showing 193 changed files with 2,686 additions and 779 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
Expand All @@ -27,10 +27,12 @@ jobs:
restore-keys: |
${{ runner.os }}-gradle-
- name: set up JDK 1.17
uses: actions/setup-java@v1
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 1.17
distribution: 'oracle'
java-version: 17
cache: 'gradle'

- name: Setup Android SDK
uses: android-actions/setup-android@v2
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Pull request

on:
pull_request:

jobs:
apk:
name: Build APK
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'oracle'
java-version: 17
cache: 'gradle'

- name: Setup Android SDK
uses: android-actions/setup-android@v2

- name: set up Ruby for fastlane
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'

- name: Create debug keystore
env:
CI_KEYSTORE: ${{ secrets.CI_KEYSTORE }}
run: |
echo "$CI_KEYSTORE" | base64 --decode > /home/runner/.android/debug.keystore
- name: Install bundle
run: bundle install

- name: Build apk with fastlane
run: bundle exec fastlane testing
15 changes: 9 additions & 6 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v3

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
Expand All @@ -32,10 +32,12 @@ jobs:
property: VERSION_NUM
value: ${{ github.run_number }}

- name: set up JDK 1.17
uses: actions/setup-java@v1
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 1.17
distribution: 'oracle'
java-version: 17
cache: 'gradle'

- name: Setup Android SDK
uses: android-actions/setup-android@v2
Expand All @@ -46,9 +48,10 @@ jobs:
ruby-version: '2.7'

- name: Create debug keystore
env:
CI_KEYSTORE: ${{ secrets.CI_KEYSTORE }}
run: |
echo "${{ secrets.CI_KEYSTORE }}" > debug.keystore.asc
gpg -d --passphrase "${{ secrets.CI_KEYSTORE_DECRYPT }}" --batch debug.keystore.asc > /home/runner/.android/debug.keystore
echo "$CI_KEYSTORE" | base64 --decode > /home/runner/.android/debug.keystore
- name: Install bundle
run: bundle install
Expand Down
16 changes: 8 additions & 8 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="com.termux.permission.RUN_COMMAND" />
<uses-permission android:name="com.termux.permission.RUN_COMMAND" />

<!-- This permission is in each build variant's AndroidManifest -->
<!-- <permission android:name="io.github.sds100.keymapper.KEY_EVENT_RECEIVER">-->
Expand Down Expand Up @@ -58,7 +58,7 @@
<uses-feature
android:name="android.hardware.telephony"
android:required="false" />

<uses-feature
android:name="android.hardware.bluetooth"
android:required="false" />
Expand Down Expand Up @@ -102,10 +102,10 @@
<activity
android:name=".api.LaunchKeyMapShortcutActivity"
android:excludeFromRecents="true"
android:exported="true"
android:finishOnTaskLaunch="true"
android:launchMode="singleInstance"
android:taskAffinity=""
android:exported="true"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -115,8 +115,8 @@
<!-- Use a different task affinity so this activity can be opened at the same time as others -->
<activity
android:name=".mappings.keymaps.CreateKeyMapShortcutActivity"
android:label="@string/shortcut_label_action"
android:exported="true"
android:label="@string/shortcut_label_action"
android:taskAffinity="">
<intent-filter>
<action android:name="android.intent.action.CREATE_SHORTCUT" />
Expand Down Expand Up @@ -189,8 +189,8 @@

<service
android:name=".system.inputmethod.KeyMapperImeService"
android:label="@string/ime_service_label"
android:exported="true"
android:label="@string/ime_service_label"
android:permission="android.permission.BIND_INPUT_METHOD">
<intent-filter>
<action android:name="android.view.InputMethod" />
Expand All @@ -202,9 +202,9 @@

<service
android:name=".system.tiles.ToggleMappingsTile"
android:exported="true"
android:icon="@drawable/ic_tile_pause"
android:label="@string/tile_pause"
android:exported="true"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
Expand All @@ -213,9 +213,9 @@

<service
android:name=".system.tiles.ToggleKeyMapperKeyboardTile"
android:exported="true"
android:icon="@drawable/ic_tile_keyboard"
android:label="@string/tile_toggle_keymapper_keyboard"
android:exported="true"
android:permission="android.permission.BIND_QUICK_SETTINGS_TILE">
<intent-filter>
<action android:name="android.service.quicksettings.action.QS_TILE" />
Expand All @@ -224,8 +224,8 @@

<service
android:name="io.github.sds100.keymapper.system.notifications.NotificationReceiver"
android:label="Key Mapper Notification Receiver"
android:exported="true"
android:label="Key Mapper Notification Receiver"
android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE">
<intent-filter>
<action android:name="android.service.notification.NotificationListenerService" />
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/whats-new.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Action for doing swipe gestures on the screen with 1 or more fingers. Many thanks to Tino (@pixel-shock) for working on this feature. 馃槉
Action for doing pinches and swipes on the screen with 2 or more fingers. Many thanks to Tino (@pixel-shock) for working on this feature. 馃槉
62 changes: 31 additions & 31 deletions app/src/main/java/io/github/sds100/keymapper/KeyMapperApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ class KeyMapperApp : MultiDexApplication() {

val packageManagerAdapter by lazy {
AndroidPackageManagerAdapter(
this,
this,
appCoroutineScope
)
}

val inputMethodAdapter by lazy {
AndroidInputMethodAdapter(
this,
appCoroutineScope,
accessibilityServiceAdapter,
permissionAdapter,
suAdapter
this,
appCoroutineScope,
accessibilityServiceAdapter,
permissionAdapter,
suAdapter
)
}
val devicesAdapter by lazy {
Expand All @@ -103,10 +103,10 @@ class KeyMapperApp : MultiDexApplication() {
val cameraAdapter by lazy { AndroidCameraAdapter(this) }
val permissionAdapter by lazy {
AndroidPermissionAdapter(
this,
appCoroutineScope,
suAdapter,
notificationReceiverAdapter
this,
appCoroutineScope,
suAdapter,
notificationReceiverAdapter
)
}

Expand Down Expand Up @@ -144,18 +144,18 @@ class KeyMapperApp : MultiDexApplication() {

val autoGrantPermissionController by lazy {
AutoGrantPermissionController(
appCoroutineScope,
permissionAdapter,
popupMessageAdapter,
resourceProvider
appCoroutineScope,
permissionAdapter,
popupMessageAdapter,
resourceProvider
)
}

private val loggingTree by lazy {
KeyMapperLoggingTree(
appCoroutineScope,
ServiceLocator.settingsRepository(this),
ServiceLocator.logRepository(this)
appCoroutineScope,
ServiceLocator.settingsRepository(this),
ServiceLocator.logRepository(this)
)
}

Expand All @@ -167,10 +167,10 @@ class KeyMapperApp : MultiDexApplication() {
Thread.setDefaultUncaughtExceptionHandler { thread, exception ->
//log in a blocking manner and always log regardless of whether the setting is turned on
val entry = LogEntryEntity(
id = 0,
time = Calendar.getInstance().timeInMillis,
severity = LogEntryEntity.SEVERITY_ERROR,
message = exception.stackTraceToString()
id = 0,
time = Calendar.getInstance().timeInMillis,
severity = LogEntryEntity.SEVERITY_ERROR,
message = exception.stackTraceToString()
)

runBlocking {
Expand All @@ -195,8 +195,8 @@ class KeyMapperApp : MultiDexApplication() {
else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
}
}
.onEach { mode -> AppCompatDelegate.setDefaultNightMode(mode) }
.launchIn(appCoroutineScope)
.onEach { mode -> AppCompatDelegate.setDefaultNightMode(mode) }
.launchIn(appCoroutineScope)

if (BuildConfig.BUILD_TYPE == "debug" || BuildConfig.BUILD_TYPE == "debug_release") {
Timber.plant(Timber.DebugTree())
Expand All @@ -222,14 +222,14 @@ class KeyMapperApp : MultiDexApplication() {
)

autoSwitchImeController = AutoSwitchImeController(
appCoroutineScope,
ServiceLocator.settingsRepository(this),
ServiceLocator.inputMethodAdapter(this),
UseCases.pauseMappings(this),
devicesAdapter,
popupMessageAdapter,
resourceProvider,
ServiceLocator.accessibilityServiceAdapter(this)
appCoroutineScope,
ServiceLocator.settingsRepository(this),
ServiceLocator.inputMethodAdapter(this),
UseCases.pauseMappings(this),
devicesAdapter,
popupMessageAdapter,
resourceProvider,
ServiceLocator.accessibilityServiceAdapter(this)
)

processLifecycleOwner.lifecycle.addObserver(object : LifecycleObserver {
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/java/io/github/sds100/keymapper/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class MainActivity : AppCompatActivity() {

companion object {
const val ACTION_SHOW_ACCESSIBILITY_SETTINGS_NOT_FOUND_DIALOG =
"$PACKAGE_NAME.ACTION_SHOW_ACCESSIBILITY_SETTINGS_NOT_FOUND_DIALOG"
"$PACKAGE_NAME.ACTION_SHOW_ACCESSIBILITY_SETTINGS_NOT_FOUND_DIALOG"
}

private val viewModel by viewModels<ActivityViewModel> {
Expand All @@ -51,14 +51,14 @@ class MainActivity : AppCompatActivity() {
requestPermissionDelegate = RequestPermissionDelegate(this, showDialogs = true)

ServiceLocator.permissionAdapter(this@MainActivity).request
.flowWithLifecycle(lifecycle, Lifecycle.State.STARTED)
.onEach { permission ->
requestPermissionDelegate.requestPermission(
permission,
findNavController(R.id.container)
)
}
.launchIn(lifecycleScope)
.flowWithLifecycle(lifecycle, Lifecycle.State.STARTED)
.onEach { permission ->
requestPermissionDelegate.requestPermission(
permission,
findNavController(R.id.container)
)
}
.launchIn(lifecycleScope)

if (intent.action == ACTION_SHOW_ACCESSIBILITY_SETTINGS_NOT_FOUND_DIALOG) {
viewModel.onCantFindAccessibilitySettings()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import io.github.sds100.keymapper.actions.sound.SoundsManagerImpl
import io.github.sds100.keymapper.backup.BackupManager
import io.github.sds100.keymapper.backup.BackupManagerImpl
import io.github.sds100.keymapper.data.db.AppDatabase
import io.github.sds100.keymapper.data.repositories.*
import io.github.sds100.keymapper.data.repositories.PreferenceRepository
import io.github.sds100.keymapper.data.repositories.RoomFingerprintMapRepository
import io.github.sds100.keymapper.data.repositories.RoomKeyMapRepository
import io.github.sds100.keymapper.data.repositories.RoomLogRepository
import io.github.sds100.keymapper.data.repositories.SettingsPreferenceRepository
import io.github.sds100.keymapper.logging.LogRepository
import io.github.sds100.keymapper.mappings.fingerprintmaps.FingerprintMapRepository
import io.github.sds100.keymapper.shizuku.ShizukuAdapter
Expand Down
6 changes: 5 additions & 1 deletion app/src/main/java/io/github/sds100/keymapper/UseCases.kt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import io.github.sds100.keymapper.mappings.DisplaySimpleMappingUseCaseImpl
import io.github.sds100.keymapper.mappings.PauseMappingsUseCaseImpl
import io.github.sds100.keymapper.mappings.fingerprintmaps.AreFingerprintGesturesSupportedUseCaseImpl
import io.github.sds100.keymapper.mappings.fingerprintmaps.DetectFingerprintMapsUseCaseImpl
import io.github.sds100.keymapper.mappings.keymaps.*
import io.github.sds100.keymapper.mappings.keymaps.ConfigKeyMapUseCase
import io.github.sds100.keymapper.mappings.keymaps.ConfigKeyMapUseCaseImpl
import io.github.sds100.keymapper.mappings.keymaps.CreateKeyMapShortcutUseCaseImpl
import io.github.sds100.keymapper.mappings.keymaps.DisplayKeyMapUseCase
import io.github.sds100.keymapper.mappings.keymaps.DisplayKeyMapUseCaseImpl
import io.github.sds100.keymapper.mappings.keymaps.detection.DetectKeyMapsUseCaseImpl
import io.github.sds100.keymapper.onboarding.OnboardingUseCaseImpl
import io.github.sds100.keymapper.reroutekeyevents.RerouteKeyEventsUseCaseImpl
Expand Down

0 comments on commit 6000845

Please sign in to comment.