Skip to content
Snippets Groups Projects
Verified Commit b50e9540 authored by Torsten Grote's avatar Torsten Grote
Browse files

Upgrade libraries

Also target latest Android version and apply necessary fixes
parent b4acc246
No related branches found
No related tags found
1 merge request!59Implement Onboarding UI
......@@ -36,9 +36,6 @@
<option name="ALLOW_TRAILING_COMMA" value="true" />
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
</JetCodeStyleSettings>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="Groovy">
<indentOptions>
<option name="SMART_TABS" value="true" />
......
buildscript {
ext.kotlin_version = '1.5.31'
ext.hilt_version = '2.38.1'
ext.kotlin_version = '1.6.10'
ext.hilt_version = '2.40'
ext.tor_version = '0.3.5.15'
ext.obfs4_version = '0.0.12-dev-40245c4a'
ext.junit_version = '5.7.2'
ext.mockk_version = '1.10.4'
ext.ktlint_plugin_version = '10.1.0'
ext.ktlint_plugin_version = '10.2.1'
ext.androidx_fragment_version = '1.3.6'
ext.androidx_constraintlayout_version = '2.1.1'
ext.google_material_version = '1.4.0'
ext.androidx_fragment_version = '1.4.1'
ext.androidx_constraintlayout_version = '2.1.3'
ext.google_material_version = '1.5.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.android.tools.build:gradle:7.0.4'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
}
......
ktlint {
version = "0.42.1"
version = "0.43.2"
android = true
enableExperimentalRules = false
verbose = true
......
......@@ -6,7 +6,7 @@ plugins {
id 'kotlin-kapt'
id 'dagger.hilt.android.plugin'
id "org.jlleitschuh.gradle.ktlint" version "$ktlint_plugin_version"
id 'checkstyle'
id 'checkstyle' // only needed for Java code
}
android {
......@@ -16,7 +16,7 @@ android {
defaultConfig {
applicationId "org.briarproject.mailbox"
minSdkVersion 16
targetSdkVersion 30
targetSdkVersion 31
versionCode 1
versionName "1.0"
multiDexEnabled true // only needed when minSdkVersion < 21
......@@ -55,11 +55,11 @@ dependencies {
implementation project(path: ':dont-kill-me-lib')
implementation 'com.github.tony19:logback-android:2.0.0'
implementation 'androidx.appcompat:appcompat:1.3.1'
implementation "androidx.activity:activity-ktx:1.3.1"
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation "androidx.activity:activity-ktx:1.4.0"
implementation "androidx.fragment:fragment-ktx:$androidx_fragment_version"
def lifecycle_version = "2.4.0-rc01"
def lifecycle_version = "2.4.0"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version"
......
......@@ -24,9 +24,10 @@ import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.NotificationManager.IMPORTANCE_LOW
import android.app.PendingIntent
import android.app.PendingIntent.FLAG_IMMUTABLE
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Build.VERSION.SDK_INT
import androidx.annotation.RequiresApi
import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationCompat.PRIORITY_MIN
......@@ -50,7 +51,7 @@ class MailboxNotificationManager @Inject constructor(
private val nm = getSystemService(ctx, NotificationManager::class.java)!!
init {
if (Build.VERSION.SDK_INT >= 26) createNotificationChannels()
if (SDK_INT >= 26) createNotificationChannels()
}
@RequiresApi(26)
......@@ -68,8 +69,9 @@ class MailboxNotificationManager @Inject constructor(
val serviceNotification: Notification
get() {
val notificationIntent = Intent(ctx, MainActivity::class.java)
val flags = if (SDK_INT >= 23) FLAG_IMMUTABLE else 0
val pendingIntent = PendingIntent.getActivity(
ctx, 0, notificationIntent, 0
ctx, 0, notificationIntent, flags
)
return NotificationCompat.Builder(ctx, CHANNEL_ID)
.setContentTitle(ctx.getString(R.string.notification_mailbox_title))
......
......@@ -46,6 +46,7 @@ import javax.annotation.concurrent.ThreadSafe;
import static android.app.AlarmManager.ELAPSED_REALTIME_WAKEUP;
import static android.app.AlarmManager.INTERVAL_FIFTEEN_MINUTES;
import static android.app.PendingIntent.FLAG_CANCEL_CURRENT;
import static android.app.PendingIntent.FLAG_IMMUTABLE;
import static android.content.Context.ALARM_SERVICE;
import static android.os.Build.VERSION.SDK_INT;
import static java.util.Objects.requireNonNull;
......@@ -194,8 +195,9 @@ public class AndroidTaskScheduler implements TaskScheduler, Service {
private PendingIntent getAlarmPendingIntent() {
Intent i = new Intent(app, AlarmReceiver.class);
i.putExtra(EXTRA_PID, Process.myPid());
return PendingIntent
.getBroadcast(app, REQUEST_ALARM, i, FLAG_CANCEL_CURRENT);
int flags = SDK_INT >= 23 ? FLAG_CANCEL_CURRENT | FLAG_IMMUTABLE :
FLAG_CANCEL_CURRENT;
return PendingIntent.getBroadcast(app, REQUEST_ALARM, i, flags);
}
private class ScheduledTask
......
......@@ -14,6 +14,7 @@ dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
api 'com.google.code.findbugs:jsr305:3.0.2'
api 'javax.inject:javax.inject:1' // required for @Qualifier in @Wakeful
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version" // used by jackson
implementation "com.google.dagger:hilt-core:$hilt_version"
kapt "com.google.dagger:dagger-compiler:$hilt_version"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment