Skip to content

Commit

Permalink
Merge branch 'main' into gradle-versions-check
Browse files Browse the repository at this point in the history
  • Loading branch information
pcolby committed Aug 9, 2024
2 parents 87caa8c + dbcdc0b commit 04e31d2
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
- name: Setup Build ID
run: |
[[ "$MATRIX_OS" == ubuntu* ]] && osName=linux || osName="${MATRIX_OS:0:3}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
distribution: 'temurin'
java-version: '17'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
uses: gradle/actions/setup-gradle@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog[^1]

## [1.4.2][] (2024-07-30)

Handle a rare exception when unregistering the broadcast listener.

## [1.4.1][] (2024-06-29)

Added metadata for F-Droid.
Expand Down Expand Up @@ -38,7 +42,8 @@ Added translations for 86 languages.

Initial release.

[Unreleased]: https://github.com/pcolby/nfc-quick-settings/compare/v1.4.1...HEAD
[Unreleased]: https://github.com/pcolby/nfc-quick-settings/compare/v1.4.2...HEAD
[1.4.2]: https://github.com/pcolby/nfc-quick-settings/releases/tag/v1.4.2
[1.4.1]: https://github.com/pcolby/nfc-quick-settings/releases/tag/v1.4.1
[1.4.0]: https://github.com/pcolby/nfc-quick-settings/releases/tag/v1.4.0
[1.3.1]: https://github.com/pcolby/nfc-quick-settings/releases/tag/v1.3.1
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ granted via the [Android Debug Bridge (adb)][] tool.
> installs it at `android_sdk/platform-tools/`. If you want the standalone Android SDK Platform Tools package,
> [download it here](https://developer.android.com/tools/releases/platform-tools).
2. Install NFC Quick Settings, via [Google Play] or [GitHub Releases].
2. Install NFC Quick Settings, via [Google Play], [F-Droid], or [GitHub Releases].

3. [Enable adb debugging on your device](https://developer.android.com/tools/adb#Enabling).

Expand All @@ -65,6 +65,7 @@ adb shell pm revoke au.id.colby.nfcquicksettings android.permission.WRITE_SECURE
[`NfcAdapter::enable()`]: https://cs.android.com/android/platform/superproject/+/main:frameworks/base/core/java/android/nfc/NfcAdapter.java;l=947?q=NfcAdapter "android.nfc.NfcAdapter::enable()"
[`WRITE_SECURE_SETTINGS`]: https://developer.android.com/reference/android/Manifest.permission#WRITE_SECURE_SETTINGS "android.permission.WRITE_SECURE_SETTINGS"
[Android Debug Bridge (adb)]: https://developer.android.com/tools/adb "Android Debug Bridge (adb)"
[F-Droid]: https://f-droid.org/packages/au.id.colby.nfcquicksettings "NFC Quick Settings on F-Droid"
[GitHub Releases]: https://github.com/pcolby/nfc-quick-settings/releases "NFC Quick Settings releases"
[Google Play]: https://play.google.com/store/apps/details?id=au.id.colby.nfcquicksettings "NFC Quick Settings on Google Play"
[SDK Manager]: https://developer.android.com/studio/intro/update#sdk-manager "Update your tools with the SDK Manager"
Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ android {
applicationId "au.id.colby.nfcquicksettings"
minSdk 24
targetSdk 34
versionCode 11
versionName "1.4.2-pre"
versionCode 13
versionName "1.4.3-pre"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down
13 changes: 11 additions & 2 deletions app/src/main/java/au/id/colby/nfcquicksettings/NfcTileService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import android.service.quicksettings.TileService
import android.util.Log
import androidx.core.content.ContextCompat
import au.id.colby.nfcquicksettings.R.string
import java.lang.IllegalArgumentException

private const val TAG = "NfcTileService"

Expand All @@ -42,7 +43,7 @@ class NfcTileService : TileService() {
override fun onStartListening() {
super.onStartListening()
Log.d(TAG, "onStartListening; Registering broadcast receiver")
ContextCompat.registerReceiver(
ContextCompat.registerReceiver( // No harm if already registered.
this,
nfcBroadcastReceiver,
IntentFilter(NfcAdapter.ACTION_ADAPTER_STATE_CHANGED),
Expand All @@ -58,7 +59,15 @@ class NfcTileService : TileService() {
*/
override fun onStopListening() {
Log.d(TAG, "onStopListening; Unregistering broadcast receiver")
unregisterReceiver(nfcBroadcastReceiver)
try {
unregisterReceiver(nfcBroadcastReceiver)
} catch (e: IllegalArgumentException) {
// It's very rare, but possible for onStopListening() to be called when the listener is
// no longer registered, such as when the tile is removed. This is non-fatal. We could
// use PackageManager.queryBroadcastReceivers() to perform a pre-check, but this is very
// rare, and Android does the same pre-check internally, so we optimise the happy case.
Log.w(TAG, "Failed to unregister broadcast receiver", e) // Non-fatal.
}
super.onStopListening()
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/play/release-notes/en-US/default.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
- Added metadata for F-Droid
- Handled a very rare, but possible, exception when removing the tile
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '8.5.0' apply false
id 'com.android.library' version '8.5.0' apply false
id 'com.android.application' version '8.5.2' apply false
id 'com.android.library' version '8.5.2' apply false
id 'com.github.ben-manes.versions' version '0.51.0'
id 'org.jetbrains.dokka' version '1.9.20' apply false
id 'org.jetbrains.kotlin.android' version '2.0.0' apply false
id 'org.jetbrains.kotlin.android' version '2.0.10' apply false
}

0 comments on commit 04e31d2

Please sign in to comment.