Build warnings cleanup (#6827)

This commit is contained in:
SomeTroglodyte
2022-05-19 02:12:18 +02:00
committed by GitHub
parent f464ac2544
commit 3d6a01d633
14 changed files with 195 additions and 130 deletions

View File

@ -10,6 +10,11 @@
<uses-feature android:name="android.software.leanback" android:required="false" />
<uses-feature android:name="android.hardware.touchscreen" android:required="false" />
<!--
Known Lint warnings:
UnusedAttribute: Since we're targeting a range of API levels, it's OK that e.g. appCategory will be ignored by OLD devices
IconDensities: See https://developer.android.com/training/tv/start/start#banner for the banner attribute, where they recommend supplying only one density.
-->
<application
android:allowBackup="true"
android:icon="@mipmap/uncivicon"
@ -24,7 +29,6 @@
android:name="com.unciv.app.AndroidLauncher"
android:launchMode="singleTask"
android:exported="true"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
tools:ignore="LockedOrientationActivity">
<intent-filter>
@ -45,7 +49,6 @@
<activity
android:name="com.unciv.app.AndroidTvLauncher"
android:label="@string/app_name"
android:exported="true"
android:theme="@style/GdxTheme">

View File

@ -31,7 +31,7 @@ android {
versionCode = BuildConfig.appCodeNumber
versionName = BuildConfig.appVersion
base.archivesBaseName = "Unciv"
base.archivesName.set("Unciv")
}
// necessary for Android Work lib
@ -53,14 +53,14 @@ android {
buildTypes {
getByName("release") {
// If you make this true you get a version of the game that just flat-out does't run
// If you make this true you get a version of the game that just flat-out doesn't run
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
}
lint {
disable.add("MissingTranslation")
disable += "MissingTranslation" // see res/values/strings.xml
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
@ -123,8 +123,9 @@ tasks.register<JavaExec>("run") {
}
dependencies {
// Updating to latest version would require upgrading sourceCompatability and targetCompatability to 1_8 -
// Updating to latest version would require upgrading sourceCompatibility and targetCompatibility to 1_8, and targetSdk to 31 -
// run `./gradlew build --scan` to see details
// Known Android Lint warning: "GradleDependency"
implementation("androidx.core:core-ktx:1.6.0")
implementation("androidx.work:work-runtime-ktx:2.6.0")
}

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!--
Known Lint warning: MissingTranslation. Yes, _fr_ is incomplete. Suppressed in android/build.gradle.kts
-->
<string name="app_name">UnCiv</string>
<string name="Notify_YourTurn_Short">Unciv - It\'s your turn!</string>
<string name="Notify_YourTurn_Long">Your friends are waiting for your turn in [gameName].</string>

View File

@ -3,6 +3,8 @@ package com.unciv.app
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.app.PendingIntent.FLAG_IMMUTABLE
import android.app.PendingIntent.FLAG_UPDATE_CURRENT
import android.content.Context
import android.content.ContextWrapper
import android.content.Intent
@ -121,9 +123,11 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
* It is not technically necessary for the Worker, since it is not a Service.
*/
fun showPersistentNotification(appContext: Context, lastTimeChecked: String, checkPeriod: String) {
val flags = (if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) FLAG_IMMUTABLE else 0) or
FLAG_UPDATE_CURRENT
val pendingIntent: PendingIntent =
Intent(appContext, AndroidLauncher::class.java).let { notificationIntent ->
PendingIntent.getActivity(appContext, 0, notificationIntent, 0)
PendingIntent.getActivity(appContext, 0, notificationIntent, flags)
}
val notification: NotificationCompat.Builder = NotificationCompat.Builder(appContext, NOTIFICATION_CHANNEL_ID_SERVICE)
@ -152,7 +156,9 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
action = Intent.ACTION_VIEW
data = Uri.parse("https://unciv.app/multiplayer?id=${game.second}")
}
val pendingIntent = PendingIntent.getActivity(applicationContext, 0, intent, 0)
val flags = (if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) FLAG_IMMUTABLE else 0) or
FLAG_UPDATE_CURRENT
val pendingIntent = PendingIntent.getActivity(applicationContext, 0, intent, flags)
val contentTitle = applicationContext.resources.getString(R.string.Notify_YourTurn_Short)
val notification: NotificationCompat.Builder = NotificationCompat.Builder(applicationContext, NOTIFICATION_CHANNEL_ID_INFO)
@ -367,14 +373,16 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
}
private fun showErrorNotification(stackTraceString: String) {
val flags = (if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) FLAG_IMMUTABLE else 0) or
FLAG_UPDATE_CURRENT
val pendingLaunchGameIntent: PendingIntent =
Intent(applicationContext, AndroidLauncher::class.java).let { notificationIntent ->
PendingIntent.getActivity(applicationContext, 0, notificationIntent, 0)
PendingIntent.getActivity(applicationContext, 0, notificationIntent, flags)
}
val pendingCopyClipboardIntent: PendingIntent =
Intent(applicationContext, CopyToClipboardReceiver::class.java).putExtra(CLIPBOARD_EXTRA, stackTraceString)
.let { notificationIntent -> PendingIntent.getBroadcast(applicationContext,0, notificationIntent, 0)
.let { notificationIntent -> PendingIntent.getBroadcast(applicationContext,0, notificationIntent, flags)
}
val notification: NotificationCompat.Builder = NotificationCompat.Builder(applicationContext, NOTIFICATION_CHANNEL_ID_INFO)