mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-23 13:10:54 +07:00
Add crash reporting controller and email sending on android (#1509)
This commit is contained in:
parent
74dab9da63
commit
25a3467cb3
@ -18,6 +18,8 @@ Move an air unit!\nSelect an air unit > select another city withing range > \nMo
|
||||
See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick on 'Stats' = Zobraz statistiku!\nVstup do Přehledové obrazovky (pravý horní roh) >\nKlikni na 'Statistika'
|
||||
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! = Hrom do čepice! Vypadá to, že se něco HÓÓÓDNĚ pokaziloTohle by se v ŽÁDNÉM PŘÍPADĚ nemělo stávat! Prosím pošlete mi (yairm210@hotmail.com) email s informacemi o hře (menu -> uložit hru -> kopírovat herní info -> vložit do emailu) a já se to pokusím opravit jak nejrychleji budu umět!
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -32,6 +32,8 @@ See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick
|
||||
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! =
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -32,6 +32,8 @@ See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick
|
||||
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! =
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -17,6 +17,8 @@ Move an air unit!\nSelect an air unit > select another city withing range > \nMo
|
||||
See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick on 'Stats' = Observez vos statistiques en détail !\n Allez dans la vue d'ensemble (dans le coin en haut à droite) >\nCliquez sur 'Statistiques'
|
||||
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! = Oh non ! On dirait que quelque chose ne s'est ABSOLUMENT pas passé comme prévu ! Ce n'est pas censé arriver ! S'il vous plaît, envoyez un mail à yairm210@hotmail.com avec les informations de la partie (Menu (en haut à gauche) -> Charger une partie -> Copy saved game to clipboard -> Copier dans le mail) et j'essayerai de régler cela aussi vite que possible !
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -18,6 +18,8 @@ See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick
|
||||
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! =
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -17,6 +17,8 @@ Move an air unit!\nSelect an air unit > select another city withing range > \nMo
|
||||
See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick on 'Stats' = Visualizza le tue statistiche!\nEntra nella tua schermata Panoramica (in alto a sinistra)\nClicca su 'Statistiche'
|
||||
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! = Santi numi! Pare che qualcosa sia andato disastrosamente storto! Quello che è successo non era assolutamente previsto! Mandami un'email all'indirizzo yairm210@hotmail.com con l'info della partita (menu -> salva partita -> copia info partita -> incolla su email) e proverò a riparare il guasto il più in fretta possibile!
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -31,6 +31,8 @@ Move an air unit!\nSelect an air unit > select another city withing range > \nMo
|
||||
See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick on 'Stats' =
|
||||
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! = 이런, 뭔가 심각한 일이 일어난 것 같군요! 원래라면 일어나지 않아야 하는 일인데 말이죠! (yairm210@hotmail.com) 이메일로 게임 정보를 함께 보내주세요. (메뉴 -> 게임 저장 -> 게임 정보 복사 -> 이메일에 붙여넣기) 하루빨리 찾아서 이런 일이 일어나지 않도록 하겠습니다!
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -31,7 +31,9 @@ Move an air unit!\nSelect an air unit > select another city withing range > \nMo
|
||||
See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick on 'Stats' =
|
||||
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! =
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! =\
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -18,6 +18,8 @@ Move an air unit!\nSelect an air unit > select another city withing range > \nMo
|
||||
See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick on 'Stats' = Zobacz rozkład statystyk!\nWejdź w 'Przegląd' (górny prawy róg) >\nKliknij na 'Statystyki'
|
||||
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! = O nie! Wygląda na to że coś przegapiłem! To absolutnie nie powinno się wydarzyć! Wyślij mi proszę (yairm210@hotmail.com) maila z informacją o grze (menu -> zapisz grę -> skopiuj informacje o grze -> wklej do maila) a ja postaram się to naprawić. Dziękuję za pomoc.
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -32,6 +32,8 @@ See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick
|
||||
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! =
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -32,6 +32,8 @@ See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick
|
||||
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! =
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -17,6 +17,7 @@ Move an air unit!\nSelect an air unit > select another city withing range > \nMo
|
||||
See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick on 'Stats' = Посмотрите вашу статистику!\nОткройте экран обзора (верхний правый угол) >\nНажмите на 'Статистика'
|
||||
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! = О нет! Кажется всё что-то пошло КАТАСТРОФИЧЕСКИ плохо! Это АБСОЛЮТНО не должно было произойти! Пожалуйста отправьте мне (yairm210@hotmail.com) емейл с информацией об игре (меню -> сохранить игру -> скопируйте информацию об игре -> вставьте в емейл) и я попытаюсь это исправить настолько быстро как я могу!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =О нет! Кажется всё что-то пошло КАТАСТРОФИЧЕСКИ плохо! Это АБСОЛЮТНО не должно было произойти! Пожалуйста отправьте нам отчет об ошибке и мы попытаемся это исправить как можно скорее!
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -17,6 +17,8 @@ Move an air unit!\nSelect an air unit > select another city withing range > \nMo
|
||||
See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick on 'Stats' = 查看当前文明详细信息!\n点击概览按钮(右上角) >\n点击"统计"
|
||||
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! = NO!看起来游戏好像出现了灾难性的Bug! 这绝对不应该发生! 请将游戏存档信息发送给我,方法如下:依次点击“菜单->保存游戏->复制当前游戏数据到剪贴板”,将剪贴板的内容通过email发送给我。我的email地址:yairm210@hotmail.com。我会尽快处理!
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -17,6 +17,8 @@ Move an air unit!\nSelect an air unit > select another city withing range > \nMo
|
||||
See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick on 'Stats' = ¡Mira tus estadísticas!\nEntra en la ventana de Visión general (arriba a la derecha) >\nHaz clic en 'Estadísticas'
|
||||
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! = Oh no! Parece que algo se ha roto! Esto no debería haber ocurrido! Mánda me un email (yairm210@hotmail.com , sólo en Inglés) con la información de la partida (menú -> guardar partida -> copiar información de la partida -> copiar en el email) intentaré solucionarlo lo antes posible!
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -17,6 +17,8 @@ Move an air unit!\nSelect an air unit > select another city withing range > \nMo
|
||||
See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick on 'Stats' = 查看當前文明詳細信息!\n點擊概覽按鈕(右上角) >\n點擊"統計"
|
||||
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! = NO!看起来游戏好像出现了灾难性的Bug!这绝对不应该发生!请将游戏存档信息发送给我,方法如下:依次点击“菜单->保存游戏->复制当前游戏数据到剪贴板”,将剪贴板的内容通过email发送给我。我的email地址:yairm210@hotmail.com。我会尽快处理!
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -18,6 +18,8 @@ Move an air unit!\nSelect an air unit > select another city withing range > \nMo
|
||||
See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick on 'Stats' = Подивіться статистику\nУвійдіть до екрану огляну (верхній правий вугол) >\nНатисніть на «Статистика»
|
||||
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! = Трясця! Схоже щось пішло КАТАСТРОФІЧНО неправильно! Цього АБСОЛЮТНО НЕ ПОВИННО БУЛО СТАТИСЯ! Будь ласка, надішліть мені (yairm210@hotmail.com) електронний лист з ігровою інформацією (меню -> зберегти гру -> копіювати інформацію про гру -> вставити до email) і я спробую виправити якнайшвидше!
|
||||
# Requires translation!
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -17,6 +17,7 @@ Move an air unit!\nSelect an air unit > select another city withing range > \nMo
|
||||
See your stats breakdown!\nEnter the Overview screen (top right corner) >\nClick on 'Stats' =
|
||||
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com) an email with the game information (menu -> save game -> copy game info -> paste into email) and I'll try to fix it as fast as I can! =
|
||||
Oh no! It looks like something went DISASTROUSLY wrong! This is ABSOLUTELY not supposed to happen! Please send us an report and we'll try to fix it as fast as we can! =
|
||||
|
||||
# Buildings
|
||||
|
||||
|
@ -8,9 +8,8 @@ import com.unciv.UncivGame
|
||||
class AndroidLauncher : AndroidApplication() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
val config = AndroidApplicationConfiguration()
|
||||
val version = BuildConfig.VERSION_NAME
|
||||
config.useImmersiveMode = true
|
||||
initialize(UncivGame(version), config)
|
||||
val config = AndroidApplicationConfiguration().apply { useImmersiveMode = true }
|
||||
val game = UncivGame(BuildConfig.VERSION_NAME, UncivCrashReportSender(this))
|
||||
initialize(game, config)
|
||||
}
|
||||
}
|
46
android/src/com/unciv/app/UncivCrashReportSender.kt
Normal file
46
android/src/com/unciv/app/UncivCrashReportSender.kt
Normal file
@ -0,0 +1,46 @@
|
||||
package com.unciv.app
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.ActivityNotFoundException
|
||||
import android.content.Intent
|
||||
import android.os.Build
|
||||
import android.widget.Toast
|
||||
import com.unciv.models.CrashReport
|
||||
import com.unciv.ui.utils.CrashReportSender
|
||||
|
||||
class UncivCrashReportSender(private val activity: Activity) : CrashReportSender {
|
||||
|
||||
companion object {
|
||||
private const val EMAIL_TO = "yairm210@hotmail.com"
|
||||
private const val CHOOSER_TITLE = "Send mail"
|
||||
private const val CANNOT_SEND_EMAIL = "There are no email clients installed."
|
||||
private const val EMAIL_TITLE = "Crash report"
|
||||
private const val EMAIL_BODY = "\n--------------------------------\n" +
|
||||
"Game version: %s\n" +
|
||||
"OS version: %s\n" +
|
||||
"Device model: %s\n" +
|
||||
"Game data: %s\n" +
|
||||
"Game settings: %s"
|
||||
}
|
||||
|
||||
override fun sendReport(report: CrashReport) {
|
||||
activity.runOnUiThread {
|
||||
try {
|
||||
activity.startActivity(Intent.createChooser(prepareIntent(report), CHOOSER_TITLE))
|
||||
} catch (ex: ActivityNotFoundException) {
|
||||
Toast.makeText(activity, CANNOT_SEND_EMAIL, Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun prepareIntent(report: CrashReport) = Intent(Intent.ACTION_SEND).apply {
|
||||
type = "message/rfc822"
|
||||
putExtra(Intent.EXTRA_EMAIL, arrayOf(EMAIL_TO))
|
||||
putExtra(Intent.EXTRA_SUBJECT, EMAIL_TITLE)
|
||||
putExtra(Intent.EXTRA_TEXT, buildEmailBody(report))
|
||||
addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
}
|
||||
|
||||
private fun buildEmailBody(report: CrashReport): String =
|
||||
EMAIL_BODY.format(report.version, Build.VERSION.SDK_INT, Build.MODEL, report.gameInfo, report.gameSettings)
|
||||
}
|
@ -18,16 +18,21 @@ import com.unciv.models.translations.TranslationFileReader
|
||||
import com.unciv.models.translations.Translations
|
||||
import com.unciv.ui.LanguagePickerScreen
|
||||
import com.unciv.ui.utils.CameraStageBaseScreen
|
||||
import com.unciv.ui.utils.CrashController
|
||||
import com.unciv.ui.utils.CrashReportSender
|
||||
import com.unciv.ui.utils.ImageGetter
|
||||
import com.unciv.ui.utils.center
|
||||
import com.unciv.ui.worldscreen.WorldScreen
|
||||
import java.util.*
|
||||
import java.util.UUID
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
class UncivGame(val version: String) : Game() {
|
||||
class UncivGame(
|
||||
val version: String,
|
||||
private val crashReportSender: CrashReportSender? = null
|
||||
) : Game() {
|
||||
lateinit var gameInfo: GameInfo
|
||||
lateinit var settings : GameSettings
|
||||
|
||||
lateinit var crashController: CrashController
|
||||
/**
|
||||
* This exists so that when debugging we can see the entire map.
|
||||
* Remember to turn this to false before commit and upload!
|
||||
@ -88,6 +93,7 @@ class UncivGame(val version: String) : Game() {
|
||||
isInitialized = true
|
||||
}
|
||||
}
|
||||
crashController = CrashController.Impl(crashReportSender)
|
||||
}
|
||||
|
||||
fun autoLoadGame(){
|
||||
|
7
core/src/com/unciv/models/CrashReport.kt
Normal file
7
core/src/com/unciv/models/CrashReport.kt
Normal file
@ -0,0 +1,7 @@
|
||||
package com.unciv.models
|
||||
|
||||
data class CrashReport(
|
||||
val gameInfo: String,
|
||||
val gameSettings: String,
|
||||
val version: String
|
||||
)
|
69
core/src/com/unciv/ui/utils/CrashController.kt
Normal file
69
core/src/com/unciv/ui/utils/CrashController.kt
Normal file
@ -0,0 +1,69 @@
|
||||
package com.unciv.ui.utils
|
||||
|
||||
import com.badlogic.gdx.utils.Json
|
||||
import com.unciv.UncivGame
|
||||
import com.unciv.models.CrashReport
|
||||
import com.unciv.ui.saves.Gzip
|
||||
import com.unciv.ui.worldscreen.optionstable.PopupTable
|
||||
|
||||
interface CrashController {
|
||||
|
||||
fun crashOccurred()
|
||||
fun showDialogIfNeeded()
|
||||
|
||||
class Impl(private val crashReportSender: CrashReportSender?) : CrashController {
|
||||
|
||||
companion object {
|
||||
private const val MESSAGE = "Oh no! It looks like something went DISASTROUSLY wrong!" +
|
||||
" This is ABSOLUTELY not supposed to happen! Please send us an report" +
|
||||
" and we'll try to fix it as fast as we can!"
|
||||
private const val MESSAGE_FALLBACK = "Oh no! It looks like something went DISASTROUSLY wrong!" +
|
||||
" This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com)" +
|
||||
" an email with the game information (menu -> save game -> copy game info -> paste into email)" +
|
||||
" and I'll try to fix it as fast as I can!"
|
||||
}
|
||||
|
||||
override fun crashOccurred() {
|
||||
UncivGame.Current.settings.run {
|
||||
hasCrashedRecently = true
|
||||
save()
|
||||
}
|
||||
}
|
||||
|
||||
override fun showDialogIfNeeded() {
|
||||
UncivGame.Current.settings.run {
|
||||
if (hasCrashedRecently) {
|
||||
prepareDialog().open()
|
||||
hasCrashedRecently = false
|
||||
save()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun prepareDialog(): PopupTable {
|
||||
return if (crashReportSender == null) {
|
||||
PopupTable(UncivGame.Current.worldScreen).apply {
|
||||
addGoodSizedLabel(MESSAGE_FALLBACK).row()
|
||||
addCloseButton()
|
||||
}
|
||||
} else {
|
||||
PopupTable(UncivGame.Current.worldScreen).apply {
|
||||
addGoodSizedLabel(MESSAGE).row()
|
||||
addButton("Send report") {
|
||||
crashReportSender.sendReport(buildReport())
|
||||
close()
|
||||
}
|
||||
addCloseButton()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun buildReport(): CrashReport {
|
||||
return UncivGame.Current.run {
|
||||
val zippedGameInfo = Json().toJson(gameInfo).let { Gzip.zip(it) }
|
||||
val zippedGameSettings = Json().toJson(settings).let { Gzip.zip(it) }
|
||||
CrashReport(zippedGameInfo, zippedGameSettings, version)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
8
core/src/com/unciv/ui/utils/CrashReportSender.kt
Normal file
8
core/src/com/unciv/ui/utils/CrashReportSender.kt
Normal file
@ -0,0 +1,8 @@
|
||||
package com.unciv.ui.utils
|
||||
|
||||
import com.unciv.models.CrashReport
|
||||
|
||||
interface CrashReportSender {
|
||||
|
||||
fun sendReport(report: CrashReport)
|
||||
}
|
@ -47,7 +47,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
val battleTable = BattleTable(this)
|
||||
val unitActionsTable = UnitActionsTable(this)
|
||||
|
||||
private val techPolicyandVictoryHolder = Table()
|
||||
private val techPolicyAndVictoryHolder = Table()
|
||||
private val techButtonHolder = Table()
|
||||
private val diplomacyButtonWrapper = Table()
|
||||
private val nextTurnButton = createNextTurnButton()
|
||||
@ -73,21 +73,21 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
techButtonHolder.onClick("paper") {
|
||||
game.setScreen(TechPickerScreen(viewingCiv))
|
||||
}
|
||||
techPolicyandVictoryHolder.add(techButtonHolder)
|
||||
techPolicyAndVictoryHolder.add(techButtonHolder)
|
||||
|
||||
// Don't show policies until they become relevant
|
||||
if(viewingCiv.policies.adoptedPolicies.isNotEmpty() || viewingCiv.policies.canAdoptPolicy()) {
|
||||
val policyScreenButton = Button(skin)
|
||||
policyScreenButton.add(ImageGetter.getImage("PolicyIcons/Constitution")).size(30f).pad(15f)
|
||||
policyScreenButton.onClick { game.setScreen(PolicyPickerScreen(this)) }
|
||||
techPolicyandVictoryHolder.add(policyScreenButton).pad(10f)
|
||||
techPolicyAndVictoryHolder.add(policyScreenButton).pad(10f)
|
||||
}
|
||||
|
||||
stage.addActor(tileMapHolder)
|
||||
stage.addActor(minimapWrapper)
|
||||
stage.addActor(topBar)
|
||||
stage.addActor(nextTurnButton)
|
||||
stage.addActor(techPolicyandVictoryHolder)
|
||||
stage.addActor(techPolicyAndVictoryHolder)
|
||||
stage.addActor(notificationsScroll)
|
||||
stage.addActor(tutorialTaskTable)
|
||||
|
||||
@ -193,8 +193,8 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
topBar.update(viewingCiv)
|
||||
|
||||
updateTechButton()
|
||||
techPolicyandVictoryHolder.pack()
|
||||
techPolicyandVictoryHolder.setPosition(10f, topBar.y - techPolicyandVictoryHolder.height - 5f)
|
||||
techPolicyAndVictoryHolder.pack()
|
||||
techPolicyAndVictoryHolder.setPosition(10f, topBar.y - techPolicyAndVictoryHolder.height - 5f)
|
||||
updateDiplomacyButton(viewingCiv)
|
||||
|
||||
|
||||
@ -261,17 +261,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
}
|
||||
|
||||
private fun displayTutorialsOnUpdate() {
|
||||
if (UncivGame.Current.settings.hasCrashedRecently) {
|
||||
val crashPopup = PopupTable(this)
|
||||
crashPopup.addGoodSizedLabel("Oh no! It looks like something went DISASTROUSLY wrong!" +
|
||||
" This is ABSOLUTELY not supposed to happen! Please send me (yairm210@hotmail.com)" +
|
||||
" an email with the game information (menu -> save game -> copy game info -> paste into email)" +
|
||||
" and I'll try to fix it as fast as I can!").row()
|
||||
crashPopup.addCloseButton()
|
||||
crashPopup.open()
|
||||
UncivGame.Current.settings.hasCrashedRecently = false
|
||||
UncivGame.Current.settings.save()
|
||||
}
|
||||
UncivGame.Current.crashController.showDialogIfNeeded()
|
||||
|
||||
displayTutorials("Introduction")
|
||||
if (!UncivGame.Current.settings.tutorialsShown.contains("_EnemyCityNeedsConqueringWithMeleeUnit")) {
|
||||
@ -305,7 +295,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
diplomacyButtonWrapper.add(btn)
|
||||
}
|
||||
diplomacyButtonWrapper.pack()
|
||||
diplomacyButtonWrapper.y = techPolicyandVictoryHolder.y -20 - diplomacyButtonWrapper.height
|
||||
diplomacyButtonWrapper.y = techPolicyAndVictoryHolder.y - 20 - diplomacyButtonWrapper.height
|
||||
}
|
||||
|
||||
private fun updateTechButton() {
|
||||
@ -402,8 +392,7 @@ class WorldScreen(val viewingCiv:CivilizationInfo) : CameraStageBaseScreen() {
|
||||
}
|
||||
}
|
||||
} catch (ex: Exception) {
|
||||
game.settings.hasCrashedRecently = true
|
||||
game.settings.save()
|
||||
UncivGame.Current.crashController.crashOccurred()
|
||||
throw ex
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ class IOSLauncher extends IOSApplication.Delegate {
|
||||
@Override
|
||||
protected IOSApplication createApplication() {
|
||||
IOSApplicationConfiguration config = new IOSApplicationConfiguration();
|
||||
return new IOSApplication(new com.unciv.UncivGame("IOS"), config);
|
||||
return new IOSApplication(new com.unciv.UncivGame("IOS", null), config);
|
||||
}
|
||||
|
||||
public static void main(String[] argv) {
|
||||
|
@ -36,8 +36,8 @@ public class BasicTests {
|
||||
@Test
|
||||
public void gameIsNotRunWithDebugModes() {
|
||||
assertTrue("This test will only pass if the game is not run with debug modes",
|
||||
!new UncivGame("").getSuperchargedForDebug()
|
||||
&& !new UncivGame("").getViewEntireMapForDebug());
|
||||
!new UncivGame("", null).getSuperchargedForDebug()
|
||||
&& !new UncivGame("", null).getViewEntireMapForDebug());
|
||||
}
|
||||
|
||||
// If there's a unit that obsoletes with no upgrade then when it obsoletes
|
||||
|
Loading…
Reference in New Issue
Block a user