Skip to content

Commit 13e8a65

Browse files
authored
Merge pull request #1112 from EsraaAkram/update_target_sdk_to_34
---update_to_target_sdk_34:
2 parents b22e93e + 69bc117 commit 13e8a65

File tree

19 files changed

+97
-58
lines changed

19 files changed

+97
-58
lines changed

.github/workflows/pull_request.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ jobs:
1111
name: test and assemble
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
15-
- name: set up JDK 11
16-
uses: actions/setup-java@v1
14+
- uses: actions/checkout@v3
15+
- name: set up JDK 17
16+
uses: actions/setup-java@v3
1717
with:
18-
java-version: 11
18+
java-version: 17
19+
distribution: 'temurin'
1920
- name: Generate dummy property file
2021
run: |
2122
echo "#Treetracker API Keys

app/build.gradle

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,11 @@ def loadExtraProperties(String fileName) {
1818
loadExtraProperties("treetracker.keys.properties")
1919

2020
android {
21-
compileSdkVersion 31
22-
buildToolsVersion '30.0.3'
23-
21+
compileSdkVersion 34
2422
defaultConfig {
2523
applicationId "org.greenstand.android.TreeTracker"
2624
minSdkVersion 21
27-
targetSdkVersion 31
25+
targetSdkVersion 34
2826
versionCode 196
2927
versionName "2.1.1"
3028
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
@@ -56,29 +54,25 @@ android {
5654
buildFeatures {
5755
compose true
5856
viewBinding true
57+
58+
buildConfig = true
5959
}
6060

6161
kotlinOptions {
62-
jvmTarget = "1.8"
62+
jvmTarget = "11" //"1.8"
6363
}
6464

6565
composeOptions {
66-
kotlinCompilerExtensionVersion compose_version
66+
kotlinCompilerExtensionVersion "1.5.14"
6767
}
6868

6969
compileOptions {
70-
sourceCompatibility JavaVersion.VERSION_1_8
71-
targetCompatibility JavaVersion.VERSION_1_8
70+
sourceCompatibility JavaVersion.VERSION_11//VERSION_1_8
71+
targetCompatibility JavaVersion.VERSION_11
7272

7373
coreLibraryDesugaringEnabled = true
7474
}
7575

76-
lintOptions {
77-
checkReleaseBuilds false
78-
// Or, if you prefer, you can continue to check for errors in release builds,
79-
// but continue the build even when errors are found:
80-
abortOnError false
81-
}
8276

8377
buildTypes {
8478
release {
@@ -170,11 +164,16 @@ android {
170164
exclude 'META-INF/INDEX.LIST'
171165

172166
}
167+
lint {
168+
abortOnError false
169+
checkReleaseBuilds false
170+
}
171+
namespace 'org.greenstand.android.TreeTracker'
173172
}
174173

175174
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
176175
kotlinOptions {
177-
jvmTarget = "1.8"
176+
jvmTarget = "11" //"1.8"
178177
}
179178
}
180179

@@ -215,7 +214,7 @@ dependencies {
215214
implementation "androidx.compose.material:material:$compose_version"
216215
implementation "androidx.compose.animation:animation:$compose_version"
217216
implementation "androidx.activity:activity-compose:1.3.0"
218-
implementation "androidx.navigation:navigation-compose:2.4.1"
217+
implementation "androidx.navigation:navigation-compose:2.5.0"
219218

220219
//Permissions management library for Jetpack Compose
221220
implementation "com.google.accompanist:accompanist-permissions:0.21.1-beta"
@@ -228,11 +227,11 @@ dependencies {
228227
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.5")
229228

230229
//Database
231-
implementation 'androidx.room:room-runtime:2.4.0-beta01'
232-
implementation 'androidx.room:room-ktx:2.4.0-beta01'
233-
kapt "androidx.room:room-compiler:2.4.0-beta01"
230+
implementation 'androidx.room:room-runtime:2.6.1'
231+
implementation 'androidx.room:room-ktx:2.6.1'
232+
kapt "androidx.room:room-compiler:2.6.1"
234233

235-
devImplementation 'com.amitshekhar.android:debug-db:1.0.6'
234+
devImplementation 'com.github.amitshekhariitbhu.Android-Debug-Database:debug-db:v1.0.6'
236235

237236
api "com.squareup.retrofit2:converter-gson:${retrofit2Version}"
238237
implementation "com.squareup.retrofit2:retrofit:${retrofit2Version}"
@@ -263,7 +262,7 @@ dependencies {
263262
implementation 'com.google.firebase:firebase-iid:21.0.1'
264263

265264
testImplementation 'androidx.test:core-ktx:1.5.0'
266-
testImplementation "io.mockk:mockk:1.10.0"
265+
testImplementation "io.mockk:mockk:1.13.12"
267266
testImplementation "junit:junit:4.13.1"
268267
testImplementation "androidx.room:room-testing:2.2.6"
269268
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.9"

app/src/main/AndroidManifest.xml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="org.greenstand.android.TreeTracker"
3+
xmlns:tools="http://schemas.android.com/tools"
44
android:installLocation="auto">
5-
5+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
66
<uses-feature
77
android:glEsVersion="0x00020000"
88
android:required="true"/>
9+
<uses-feature
10+
android:name="android.hardware.camera"
11+
android:required="false" />
912

1013
<uses-permission android:name="android.permission.WAKE_LOCK" />
1114
<uses-permission android:name="android.permission.CAMERA" />
1215
<uses-permission android:name="android.permission.INTERNET"/>
13-
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
16+
<!-- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>-->
1417
<uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/>
1518
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
1619
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
1720
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
1821
<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION"/>
1922

23+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
24+
25+
26+
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove" />
27+
2028
<application
2129
android:name=".application.TreeTrackerApplication"
2230
android:allowBackup="true"
@@ -29,7 +37,10 @@
2937
android:hardwareAccelerated="true">
3038

3139
<uses-library android:name="org.apache.http.legacy" android:required="false"/>
32-
40+
<service
41+
android:name="androidx.work.impl.foreground.SystemForegroundService"
42+
android:foregroundServiceType="dataSync"
43+
tools:node="merge" />
3344
<activity android:name=".activities.ImageCaptureActivity"
3445
android:configChanges="orientation"
3546
android:label="@string/app_name"

app/src/main/java/org/greenstand/android/TreeTracker/application/TreeTrackerApplication.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package org.greenstand.android.TreeTracker.application
1818
import android.app.Application
1919
import android.content.Context
2020
import androidx.multidex.MultiDex
21+
import com.google.firebase.FirebaseApp
2122
import org.greenstand.android.TreeTracker.BuildConfig
2223
import org.greenstand.android.TreeTracker.analytics.ExceptionLogger
2324
import org.greenstand.android.TreeTracker.api.ObjectStorageClient
@@ -27,6 +28,7 @@ import org.greenstand.android.TreeTracker.di.roomModule
2728
import org.koin.android.ext.koin.androidContext
2829
import org.koin.android.ext.koin.androidLogger
2930
import org.koin.core.context.startKoin
31+
import org.koin.core.logger.Level
3032
import timber.log.Timber
3133

3234
class TreeTrackerApplication : Application() {
@@ -35,11 +37,13 @@ class TreeTrackerApplication : Application() {
3537
appContext = applicationContext
3638

3739
super.onCreate()
40+
// FirebaseApp.initializeApp(appContext)
3841

3942
ObjectStorageClient.init(applicationContext)
4043

4144
startKoin {
42-
androidLogger()
45+
// androidLogger()
46+
androidLogger(Level.NONE)
4347
androidContext(applicationContext)
4448
modules(
4549
appModule,

app/src/main/java/org/greenstand/android/TreeTracker/background/SyncNotificationManager.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package org.greenstand.android.TreeTracker.background
1818
import android.app.NotificationChannel
1919
import android.app.NotificationManager
2020
import android.content.Context
21+
import android.content.pm.ServiceInfo
2122
import android.os.Build
2223
import androidx.annotation.RequiresApi
2324
import androidx.core.app.NotificationCompat
@@ -49,7 +50,11 @@ class SyncNotificationManager(
4950
.addAction(android.R.drawable.ic_delete, applicationContext.getString(R.string.cancel), intent)
5051
.setProgress(0, 0, true)
5152

52-
return ForegroundInfo(NOTIFICATION_ID, builder.build())
53+
return ForegroundInfo(NOTIFICATION_ID, builder.build(),if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
54+
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
55+
} else {
56+
0
57+
})
5358
}
5459

5560
@RequiresApi(Build.VERSION_CODES.O)

app/src/main/java/org/greenstand/android/TreeTracker/background/TreeSyncWorker.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ class TreeSyncWorker(
6868
notificationManager.createNotificationChannel(channel)
6969
}
7070

71-
val PENDING_INTENT_FLAG_MUTABLE = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_MUTABLE else 0
71+
val pendingFlag = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) PendingIntent.FLAG_MUTABLE else 0
7272
val notification = NotificationCompat.Builder(applicationContext, NOTIFICATION_CHANNEL_ID)
73-
.setContentIntent(PendingIntent.getActivity(applicationContext, 0, Intent(applicationContext, TreeTrackerActivity::class.java), PENDING_INTENT_FLAG_MUTABLE))
73+
.setContentIntent(PendingIntent.getActivity(applicationContext, 0, Intent(applicationContext, TreeTrackerActivity::class.java), pendingFlag))
7474
.setSmallIcon(R.drawable.upload_icon)
7575
.setOngoing(true)
7676
.setAutoCancel(true)

app/src/main/java/org/greenstand/android/TreeTracker/capture/TreeCaptureViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ class TreeCaptureViewModel(
103103
class TreeCaptureViewModelFactory(private val profilePicUrl: String) :
104104
ViewModelProvider.Factory, KoinComponent {
105105
@Suppress("UNCHECKED_CAST")
106-
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
106+
override fun <T : ViewModel> create(modelClass: Class<T>): T {
107107
CaptureFlowScopeManager.open()
108108
return TreeCaptureViewModel(profilePicUrl, get(), get(), get(), get(), get(), get()) as T
109109
}

app/src/main/java/org/greenstand/android/TreeTracker/dashboard/DashboardViewModel.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ class DashboardViewModel(
121121
triggerSnackBar(R.string.sync_preparing)
122122
_isSyncing = true
123123
}
124+
125+
null -> {}
124126
}
125127
}
126128

app/src/main/java/org/greenstand/android/TreeTracker/messages/announcementmessage/AnnouncementViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class AnnouncementViewModelFactory(
6262
) :
6363
ViewModelProvider.Factory, KoinComponent {
6464
@Suppress("UNCHECKED_CAST")
65-
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
65+
override fun <T : ViewModel> create(modelClass: Class<T>): T {
6666
return AnnouncementViewModel(messageId, get()) as T
6767
}
6868
}

app/src/main/java/org/greenstand/android/TreeTracker/messages/directmessages/ChatViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class ChatViewModel(
9999
class ChatViewModelFactory(private val userId: Long, private val otherChatIdentifier: String) :
100100
ViewModelProvider.Factory, KoinComponent {
101101
@Suppress("UNCHECKED_CAST")
102-
override fun <T : ViewModel?> create(modelClass: Class<T>): T {
102+
override fun <T : ViewModel> create(modelClass: Class<T>): T {
103103
return ChatViewModel(userId, otherChatIdentifier, get(), get()) as T
104104
}
105105
}

0 commit comments

Comments
 (0)