Skip to content

Commit

Permalink
fix handling of unavailable API
Browse files Browse the repository at this point in the history
  • Loading branch information
wuan committed Jul 11, 2024
1 parent 7ef1425 commit 668a004
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ android {
applicationId "org.blitzortung.android.app"
minSdkVersion 21
targetSdkVersion 34
versionCode 319
versionCode 320
versionName '2.2.4'
multiDexEnabled false
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/java/org/blitzortung/android/app/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,11 @@ class Main : FragmentActivity(), OnSharedPreferenceChangeListener {
statusComponent.indicateError(event.failed)
if (!event.failed && event.sequenceNumber != null) {
val updatedSequenceNumber =
if (isAtLeast(24)) {
currentSequenceNumber.updateAndGet { previousSequenceNumber ->
if (previousSequenceNumber < event.sequenceNumber) event.sequenceNumber else previousSequenceNumber
}} else {
if (currentSequenceNumber.get() < event.sequenceNumber) event.sequenceNumber else currentSequenceNumber.get()
}
if (updatedSequenceNumber == event.sequenceNumber) {
currentResult = event
Expand Down

0 comments on commit 668a004

Please sign in to comment.