Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiplayer Notification Fix for random Termination #2024

Merged
merged 5 commits into from
Feb 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added more internationalization
Added missing androidX declaration (neccessary for newer Gradle versions)
Updated Gradle for new Android Studio Version
  • Loading branch information
wrov committed Feb 27, 2020
commit b214a89cab2c87846a67fc108aaf0a7a2841dc74
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ Thumbs.db
!/ios-moe/xcode/*.xcodeproj/xcshareddata
!/ios-moe/xcode/*.xcodeproj/project.pbxproj
/ios-moe/xcode/native/
gradle.properties
SaveFiles/
android/android-release.apk
android/assets/GameSettings.json
Expand Down
9 changes: 0 additions & 9 deletions android/assets/jsons/translationsByLanguage/German.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1747,15 +1747,6 @@ Haka War Dance = Haka-Kriegstanz
Rejuvenation = Verjüngung
All healing effects doubled = Alle Heilungseffekte verdoppelt
# Multiplayer Turn Checker Service
An error has occured = Ein Fehler ist aufgetreten
Multiplayer turn notifier service terminated = Multiplayer Zug Benachrichtigungsdienst wurde beendet
Your friends are waiting on your turn. = Deine Freunde warten auf deinen Zug.
Unciv - It's your turn! = Unciv - Du bist am Zug!
Unciv will inform you when it's your turn in multiplayer. = Unciv wird dich benachrichtigen, wenn du im Multiplayer am Zug bist.
Last online turn check: [lastTimeChecked] = Letzter online Zug Check: [lastTimeChecked]
Checks ca. every [checkPeriod] minute(s) when Internet available. = Prüft etwa alle [checkPeriod] Minute(n) wenn Internet vorhanden.
Configurable in Unciv options menu. = Konfigurierbar im Unciv Optionsmenü.
Unciv multiplayer turn notifier running = Unciv Multiplayer Zug Benachrichtiger läuft.
Multiplayer options = Multiplayer Einstellungen
Enable out-of-game turn notifications = Aktiviere Zug Benachrichtigungen außerhalb des Spiels
Time between turn checks out-of-game (in minutes) = Intervall zwischen Zug Prüfungen (in Minuten)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1742,15 +1742,6 @@ Haka War Dance =
Rejuvenation =
All healing effects doubled =
# Multiplayer Turn Checker Service
An error has occured =
Multiplayer turn notifier service terminated =
Your friends are waiting on your turn. =
Unciv - It's your turn! =
Unciv will inform you when it's your turn in multiplayer. =
Last online turn check: [lastTimeChecked] =
Checks ca. every [checkPeriod] minute(s) when Internet available. =
Configurable in Unciv options menu. =
Unciv multiplayer turn notifier running =
Multiplayer options =
Enable out-of-game turn notifications =
Time between turn checks out-of-game (in minutes) =
Expand Down
2 changes: 2 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
android.useAndroidX=true
android.enableJetifier=true
4 changes: 4 additions & 0 deletions android/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@
<string name="Notify_Persist_Long_P2">Prüft etwa alle</string>
<string name="Notify_Persist_Long_P3">Minute(n) wenn Internet vorhanden.</string>
<string name="Notify_Persist_Long_P4">Konfigurierbar im Unciv Optionsmenü.</string>
<string name="Notify_ChannelInfo_Short">Unciv Multiplayer Zugprüfer Ereignis</string>
<string name="Notify_ChannelInfo_Long">Informiert dich, wenn du im Multiplayer am Zug bist.</string>
<string name="Notify_ChannelService_Short">Unciv Multiplayer Zugprüfer Persistenter Status</string>
<string name="Notify_ChannelService_Long">Permanent angezeigte Benachrichtigung, welche dich über die Hintergrundaktivität des Dienstes informiert.</string>
</resources>
9 changes: 9 additions & 0 deletions android/res/values-fr-rFR/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">UnCiv</string>
<string name="Notify_YourTurn_Short">Unciv - C\'est à vous !</string>
<string name="Notify_YourTurn_Long">Vos amis attendent votre action.</string>
<string name="Notify_Error_Long">Service de notification du tour multijoueur terminé</string>
<string name="Notify_Error_Short">Une erreur est survenue</string>
<string name="Notify_Persist_Long_P4">Configurable dans le menu des options de Unciv</string>
</resources>
4 changes: 4 additions & 0 deletions android/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@
<string name="Notify_Persist_Long_P2">Checks ca. every</string>
<string name="Notify_Persist_Long_P3">minute(s) when Internet available.</string>
<string name="Notify_Persist_Long_P4">Configurable in Unciv options menu.</string>
<string name="Notify_ChannelInfo_Short">Unciv Multiplayer Turn Checker Alert</string>
<string name="Notify_ChannelInfo_Long">Informs you when it\'s your turn in multiplayer.</string>
<string name="Notify_ChannelService_Short">Unciv Multiplayer Turn Checker Persistent Status</string>
<string name="Notify_ChannelService_Long">Shown constantly to inform you about background checking.</string>
</resources>
10 changes: 4 additions & 6 deletions android/src/com/unciv/app/MultiplayerTurnCheckWorker.kt
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
*/
fun createNotificationChannelInfo(appContext: Context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val name = "Unciv Multiplayer Turn Checker Alert"
val descriptionText = "Informs you when it's your turn in multiplayer."
val name = appContext.resources.getString(R.string.Notify_ChannelInfo_Short)
val descriptionText = appContext.resources.getString(R.string.Notify_ChannelInfo_Long)
val importance = NotificationManager.IMPORTANCE_HIGH
val mChannel = NotificationChannel(NOTIFICATION_CHANNEL_ID_INFO, name, importance)
mChannel.description = descriptionText
Expand All @@ -90,8 +90,8 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame
*/
fun createNotificationChannelService(appContext: Context) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
val name = "Unciv Multiplayer Turn Checker Persistent Status"
val descriptionText = "Shown constantly to inform you about background checking."
val name = appContext.resources.getString(R.string.Notify_ChannelService_Short)
val descriptionText = appContext.resources.getString(R.string.Notify_ChannelService_Long)
val importance = NotificationManager.IMPORTANCE_MIN
val mChannel = NotificationChannel(NOTIFICATION_CHANNEL_ID_SERVICE, name, importance)
mChannel.setShowBadge(false)
Expand Down Expand Up @@ -258,8 +258,6 @@ class MultiplayerTurnCheckWorker(appContext: Context, workerParams: WorkerParame

val notification: NotificationCompat.Builder = NotificationCompat.Builder(applicationContext, NOTIFICATION_CHANNEL_ID_INFO)
.setPriority(NotificationManagerCompat.IMPORTANCE_DEFAULT) // No direct user action expected
// These two strings must not be translated,
// because the translation engine can be the cause of the exception.
.setContentTitle(applicationContext.resources.getString(R.string.Notify_Error_Short))
.setContentText(applicationContext.resources.getString(R.string.Notify_Error_Long))
.setSmallIcon(R.drawable.uncivicon2)
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
buildscript {

ext.kotlinVersion = '1.3.50'
ext.kotlinVersion = '1.3.61'

repositories {
// Chinese mirrors for quicker loading for chinese devs - uncomment if you're chinese
Expand All @@ -18,7 +18,7 @@ buildscript {
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.android.tools.build:gradle:3.6.0'
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.1'

// This is for wrapping the .jar file into a standalone executable
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sat Aug 24 11:02:13 CST 2019
#Thu Feb 27 10:30:48 CET 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip