From d43f29e3bad6c1b7516310fb91558d590d112563 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Mon, 22 Jan 2024 16:11:15 -0800 Subject: [PATCH 1/7] bump to version 17 --- library/build.gradle | 10 +++++----- settings.gradle | 11 +++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/library/build.gradle b/library/build.gradle index bfbe72be0..9982868ce 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -20,11 +20,11 @@ ktlint { android { namespace 'org.xmtp.android.library' - compileSdk 33 + compileSdk 34 defaultConfig { minSdk 22 - targetSdk 33 + targetSdk 34 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" @@ -37,14 +37,14 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } testOptions { animationsDisabled = true } kotlinOptions { - jvmTarget = '11' + jvmTarget = '17' } publishing { singleVariant("release") { diff --git a/settings.gradle b/settings.gradle index f0c79301b..4a71b176e 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,6 +4,17 @@ pluginManagement { google() mavenCentral() } + buildscript { + repositories { + mavenCentral() + maven { + url = uri("https://storage.googleapis.com/r8-releases/raw") + } + } + dependencies { + classpath("com.android.tools:r8:8.2.42") + } + } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) From a60d40faf0e20f6b2529f7eba73fad2230204b98 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Mon, 22 Jan 2024 20:51:02 -0800 Subject: [PATCH 2/7] newer gradle plugin --- build.gradle | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 11 ----------- 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/build.gradle b/build.gradle index c5ec9fcf9..0a9735caf 100644 --- a/build.gradle +++ b/build.gradle @@ -9,8 +9,8 @@ //} plugins { - id 'com.android.application' version '7.3.1' apply false - id 'com.android.library' version '7.3.1' apply false + id 'com.android.application' version '7.4.2' apply false + id 'com.android.library' version '7.4.2' apply false id 'org.jetbrains.kotlin.android' version '1.8.0' apply false id 'io.github.gradle-nexus.publish-plugin' version "1.2.0" id "org.jetbrains.dokka" version "1.8.10" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index da450a2a9..b3886bbca 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue Dec 20 09:09:47 PST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle index 4a71b176e..f0c79301b 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,17 +4,6 @@ pluginManagement { google() mavenCentral() } - buildscript { - repositories { - mavenCentral() - maven { - url = uri("https://storage.googleapis.com/r8-releases/raw") - } - } - dependencies { - classpath("com.android.tools:r8:8.2.42") - } - } } dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) From 1f1424bde924b8bf7bd0c738408c93f7561a7427 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Tue, 23 Jan 2024 07:19:28 -0800 Subject: [PATCH 3/7] jump to agp 8 --- build.gradle | 4 ++-- gradle.properties | 4 +++- gradle/wrapper/gradle-wrapper.properties | 2 +- library/build.gradle | 8 ++++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 0a9735caf..861d2b9f7 100644 --- a/build.gradle +++ b/build.gradle @@ -9,8 +9,8 @@ //} plugins { - id 'com.android.application' version '7.4.2' apply false - id 'com.android.library' version '7.4.2' apply false + id 'com.android.application' version '8.0.0' apply false + id 'com.android.library' version '8.0.0' apply false id 'org.jetbrains.kotlin.android' version '1.8.0' apply false id 'io.github.gradle-nexus.publish-plugin' version "1.2.0" id "org.jetbrains.dokka" version "1.8.10" diff --git a/gradle.properties b/gradle.properties index 3c5031eb7..a2e90d87b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -20,4 +20,6 @@ kotlin.code.style=official # Enables namespacing of each library's R class so that its R class includes only the # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library -android.nonTransitiveRClass=true \ No newline at end of file +android.nonTransitiveRClass=true +android.defaults.buildfeatures.buildconfig=true +android.nonFinalResIds=false \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b3886bbca..474c74efe 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue Dec 20 09:09:47 PST 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/library/build.gradle b/library/build.gradle index 9982868ce..02f0fbaa9 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -78,19 +78,19 @@ protobuf { } dependencies { - implementation 'com.google.crypto.tink:tink-android:1.7.0' + implementation 'com.google.crypto.tink:tink-android:1.8.0' implementation 'io.grpc:grpc-kotlin-stub:1.3.0' implementation 'io.grpc:grpc-okhttp:1.51.1' implementation 'io.grpc:grpc-protobuf-lite:1.51.0' - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4' + implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.3' implementation 'org.web3j:crypto:5.0.0' implementation "net.java.dev.jna:jna:5.13.0@aar" api 'com.google.protobuf:protobuf-kotlin-lite:3.22.3' - api 'org.xmtp:proto-kotlin:3.31.0' + api 'org.xmtp:proto-kotlin:3.38.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'app.cash.turbine:turbine:0.12.1' - androidTestImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.6.4' + androidTestImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test:1.7.3' androidTestImplementation 'androidx.test.ext:junit:1.1.5' androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1' } From 9158e1ab27550aadbea4f75d6c3f659c45427e0c Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Tue, 23 Jan 2024 07:31:54 -0800 Subject: [PATCH 4/7] more gradle bumping --- example/build.gradle | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/example/build.gradle b/example/build.gradle index 5bfe01bbc..1b6255d73 100644 --- a/example/build.gradle +++ b/example/build.gradle @@ -1,6 +1,6 @@ buildscript { ext { - lifecycle_version = '2.6.0' + lifecycle_version = '2.7.0' } } @@ -36,34 +36,31 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_11 - targetCompatibility JavaVersion.VERSION_11 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '11' + jvmTarget = '17' } buildFeatures { viewBinding true } - configurations { - all*.exclude module: "bcprov-jdk15to18" // Needed for dev.pinkroom.walletconnectkit - } } dependencies { implementation project(':library') - implementation 'androidx.core:core-ktx:1.9.0' + implementation 'androidx.core:core-ktx:1.12.0' implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version" implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version" implementation 'androidx.appcompat:appcompat:1.6.1' - implementation 'com.google.android.material:material:1.8.0' - implementation 'com.google.firebase:firebase-messaging:23.1.2' + implementation 'com.google.android.material:material:1.11.0' + implementation 'com.google.firebase:firebase-messaging:23.4.0' implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - implementation 'androidx.fragment:fragment-ktx:1.5.5' - implementation 'androidx.activity:activity-ktx:1.6.1' + implementation 'androidx.fragment:fragment-ktx:1.6.2' + implementation 'androidx.activity:activity-ktx:1.8.2' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' - implementation 'androidx.recyclerview:recyclerview:1.3.0' + implementation 'androidx.recyclerview:recyclerview:1.3.2' implementation 'org.web3j:crypto:5.0.0' // WalletConnect V2: core library + WalletConnectModal @@ -72,7 +69,7 @@ dependencies { implementation("com.walletconnect:walletconnect-modal") //Navigation Component - def nav_version = "2.7.5" + def nav_version = "2.7.6" implementation "androidx.navigation:navigation-fragment-ktx:$nav_version" implementation "androidx.navigation:navigation-ui-ktx:$nav_version" From f270982207520c27ceb457fab98c29caf7d905c7 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Tue, 23 Jan 2024 07:36:32 -0800 Subject: [PATCH 5/7] make ci use java 17 --- .github/workflows/lint.yml | 5 ++++- .github/workflows/test.yml | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index fc8ec6b5e..9084fbd90 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,7 +15,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - + - uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: '17' - name: Gradle Run ktlint run: ./gradlew ktlintCheck --continue - uses: actions/upload-artifact@v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 352f9428a..09c213249 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,7 +19,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'adopt' - java-version: '11' + java-version: '17' - name: Setup Gradle uses: gradle/gradle-build-action@v2 - name: Validate Gradle Wrapper @@ -39,7 +39,7 @@ jobs: - uses: actions/setup-java@v3 with: distribution: 'adopt' - java-version: '11' + java-version: '17' - name: Setup Gradle uses: gradle/gradle-build-action@v2 - name: Validate Gradle Wrapper From 71a93ba5b3aeeff91842d62182aba573ebd99e1d Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Tue, 23 Jan 2024 07:57:44 -0800 Subject: [PATCH 6/7] fix push notification compat --- .../PushNotificationsService.kt | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/example/src/main/java/org/xmtp/android/example/pushnotifications/PushNotificationsService.kt b/example/src/main/java/org/xmtp/android/example/pushnotifications/PushNotificationsService.kt index f1e39e381..6f1553707 100644 --- a/example/src/main/java/org/xmtp/android/example/pushnotifications/PushNotificationsService.kt +++ b/example/src/main/java/org/xmtp/android/example/pushnotifications/PushNotificationsService.kt @@ -1,8 +1,11 @@ package org.xmtp.android.example.pushnotifications +import android.Manifest import android.app.PendingIntent +import android.content.pm.PackageManager import android.util.Base64 import android.util.Log +import androidx.core.app.ActivityCompat import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import androidx.core.content.ContextCompat @@ -87,8 +90,22 @@ class PushNotificationsService : FirebaseMessagingService() { .setContentIntent(pendingIntent) // Use the URL as the ID for now until one is passed back from the server. - NotificationManagerCompat.from(this).apply { - notify(topic.hashCode(), builder.build()) + NotificationManagerCompat.from(this).also { + if (ActivityCompat.checkSelfPermission( + this, + Manifest.permission.POST_NOTIFICATIONS + ) != PackageManager.PERMISSION_GRANTED + ) { + // TODO: Consider calling + // ActivityCompat#requestPermissions + // here to request the missing permissions, and then overriding + // public void onRequestPermissionsResult(int requestCode, String[] permissions, + // int[] grantResults) + // to handle the case where the user grants the permission. See the documentation + // for ActivityCompat#requestPermissions for more details. + return + } + it.notify(topic.hashCode(), builder.build()) } } } From 76a23cd61c4c27fae8948897e45f139224da6f21 Mon Sep 17 00:00:00 2001 From: Naomi Plasterer Date: Mon, 5 Feb 2024 15:24:57 -0800 Subject: [PATCH 7/7] feat: move to java17