Skip to content

Commit 060d22b

Browse files
committed
Updated target SDK to 35. closes #562
1 parent 5efd523 commit 060d22b

File tree

7 files changed

+55
-33
lines changed

7 files changed

+55
-33
lines changed

android/app/build.gradle

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ def getGitHash = { ->
1515
}
1616

1717
android {
18-
compileSdk 34
18+
compileSdk 35
1919

2020
defaultConfig {
2121
applicationId "com.httpsms"
2222
minSdk 28
23-
targetSdk 33
23+
targetSdk 35
2424
versionCode 1
2525
versionName "${getGitHash()}"
2626
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -51,23 +51,23 @@ android {
5151
}
5252

5353
dependencies {
54-
implementation platform('com.google.firebase:firebase-bom:32.7.4')
54+
implementation platform('com.google.firebase:firebase-bom:33.5.1')
5555
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
5656
implementation 'com.google.firebase:firebase-analytics-ktx'
5757
implementation 'com.google.firebase:firebase-messaging-ktx'
58-
implementation 'com.squareup.okhttp3:okhttp:4.10.0'
58+
implementation 'com.squareup.okhttp3:okhttp:4.12.0'
5959
implementation 'com.jakewharton.timber:timber:5.0.1'
6060
implementation 'androidx.preference:preference-ktx:1.2.1'
61-
implementation 'androidx.work:work-runtime-ktx:2.9.0'
62-
implementation 'androidx.core:core-ktx:1.12.0'
61+
implementation 'androidx.work:work-runtime-ktx:2.10.0'
62+
implementation 'androidx.core:core-ktx:1.15.0'
6363
implementation "androidx.cardview:cardview:1.0.0"
64-
implementation 'com.beust:klaxon:5.5'
65-
implementation 'androidx.appcompat:appcompat:1.6.1'
66-
implementation 'org.apache.commons:commons-text:1.9'
67-
implementation 'com.google.android.material:material:1.11.0'
68-
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
69-
implementation 'androidx.core:core-ktx:1.12.0'
64+
implementation 'com.beust:klaxon:5.6'
65+
implementation 'androidx.appcompat:appcompat:1.7.0'
66+
implementation 'org.apache.commons:commons-text:1.12.0'
67+
implementation 'com.google.android.material:material:1.12.0'
68+
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
69+
implementation 'androidx.core:core-ktx:1.15.0'
7070
testImplementation 'junit:junit:4.13.2'
71-
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
72-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
71+
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
72+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
7373
}

android/app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<uses-permission android:name="android.permission.WAKE_LOCK" />
2020
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
2121
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
22+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_REMOTE_MESSAGING"/>
2223

2324
<application
2425
android:allowBackup="true"
@@ -47,7 +48,7 @@
4748
tools:ignore="LockedOrientationActivity" />
4849
<activity
4950
android:name="com.journeyapps.barcodescanner.CaptureActivity"
50-
android:screenOrientation="portrait"
51+
android:screenOrientation="fullSensor"
5152
tools:replace="screenOrientation"
5253
tools:ignore="DiscouragedApi" />
5354

@@ -60,6 +61,7 @@
6061

6162
<service
6263
android:name=".MyFirebaseMessagingService"
64+
android:foregroundServiceType="remoteMessaging"
6365
android:exported="false">
6466
<intent-filter>
6567
<action android:name="com.google.firebase.MESSAGING_EVENT" />

android/app/src/main/java/com/httpsms/LoginActivity.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ class LoginActivity : AppCompatActivity() {
120120
}
121121

122122
@SuppressLint("HardwareIds")
123+
@Suppress("DEPRECATION")
123124
private fun getPhoneNumber(context: Context): String? {
124125
val telephonyManager = this.getSystemService(Context.TELEPHONY_SERVICE) as TelephonyManager
125126
if (ActivityCompat.checkSelfPermission(
@@ -291,8 +292,8 @@ class LoginActivity : AppCompatActivity() {
291292
}
292293

293294
Thread {
294-
val error = HttpSmsApiService(apiKey.text.toString(), URI(serverUrl.text.toString().trim())).validateApiKey()
295-
liveData.postValue(error)
295+
val response = HttpSmsApiService(apiKey.text.toString(), URI(serverUrl.text.toString().trim())).validateApiKey()
296+
liveData.postValue(response)
296297
Timber.d("finished validating api URL")
297298
}.start()
298299
}

android/app/src/main/java/com/httpsms/Receiver.kt

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.httpsms
22

33
import android.content.Context
4+
import android.content.Context.RECEIVER_EXPORTED
45
import android.content.IntentFilter
6+
import android.os.Build
7+
import androidx.annotation.RequiresApi
58
import timber.log.Timber
69

710
object Receiver {
@@ -12,19 +15,35 @@ object Receiver {
1215
if(sentReceiver == null) {
1316
Timber.d("registering [sent] receiver for intent [${SmsManagerService.sentAction()}]")
1417
sentReceiver = SentReceiver()
15-
context.registerReceiver(
16-
sentReceiver,
17-
IntentFilter(SmsManagerService.sentAction())
18-
)
18+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
19+
context.registerReceiver(
20+
sentReceiver,
21+
IntentFilter(SmsManagerService.sentAction()),
22+
RECEIVER_EXPORTED
23+
)
24+
} else {
25+
context.registerReceiver(
26+
sentReceiver,
27+
IntentFilter(SmsManagerService.sentAction())
28+
)
29+
}
1930
}
2031

2132
if(deliveredReceiver == null) {
2233
Timber.d("registering [delivered] receiver for intent [${SmsManagerService.deliveredAction()}]")
2334
deliveredReceiver = DeliveredReceiver()
24-
context.registerReceiver(
25-
deliveredReceiver,
26-
IntentFilter(SmsManagerService.deliveredAction())
27-
)
35+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
36+
context.registerReceiver(
37+
deliveredReceiver,
38+
IntentFilter(SmsManagerService.deliveredAction()),
39+
RECEIVER_EXPORTED
40+
)
41+
} else {
42+
context.registerReceiver(
43+
deliveredReceiver,
44+
IntentFilter(SmsManagerService.deliveredAction())
45+
)
46+
}
2847
}
2948
}
3049

android/app/src/main/java/com/httpsms/SmsManagerService.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class SmsManagerService {
3636
} else {
3737
context.getSystemService(SubscriptionManager::class.java)
3838
}
39-
return localSubscriptionManager.activeSubscriptionInfoList.size > 1
39+
return localSubscriptionManager.activeSubscriptionInfoList!!.size > 1
4040
}
4141
}
4242

@@ -61,11 +61,11 @@ class SmsManagerService {
6161
context.getSystemService(SubscriptionManager::class.java)
6262
}
6363

64-
Timber.d("active subscription info size: [${localSubscriptionManager.activeSubscriptionInfoList.size}]")
65-
val subscriptionId = if (sim == Constants.SIM1 && localSubscriptionManager.activeSubscriptionInfoList.size > 0) {
66-
localSubscriptionManager.activeSubscriptionInfoList[0].subscriptionId
67-
} else if (sim == Constants.SIM2 && localSubscriptionManager.activeSubscriptionInfoList.size > 1) {
68-
localSubscriptionManager.activeSubscriptionInfoList[1].subscriptionId
64+
Timber.d("active subscription info size: [${localSubscriptionManager.activeSubscriptionInfoList!!.size}]")
65+
val subscriptionId = if (sim == Constants.SIM1 && localSubscriptionManager.activeSubscriptionInfoList!!.size > 0) {
66+
localSubscriptionManager.activeSubscriptionInfoList!![0].subscriptionId
67+
} else if (sim == Constants.SIM2 && localSubscriptionManager.activeSubscriptionInfoList!!.size > 1) {
68+
localSubscriptionManager.activeSubscriptionInfoList!![1].subscriptionId
6969
} else{
7070
SubscriptionManager.getDefaultSmsSubscriptionId()
7171
}

android/app/src/main/java/com/httpsms/receivers/PhoneStateReceiver.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ class PhoneStateReceiver : BroadcastReceiver() {
9898
}
9999

100100
var sim = Constants.SIM1
101-
localSubscriptionManager.activeSubscriptionInfoList.forEach {
101+
localSubscriptionManager.activeSubscriptionInfoList!!.forEach {
102102
if (it.subscriptionId == subscriptionId) {
103103
if (it.simSlotIndex > 0){
104104
sim = Constants.SIM2

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ buildscript {
1111
}
1212
dependencies {
1313
// Add this line
14-
classpath 'com.google.gms:google-services:4.4.0'
14+
classpath 'com.google.gms:google-services:4.4.2'
1515
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1616
}
1717
}

0 commit comments

Comments
 (0)