Skip to content

Commit

Permalink
Update MainActivity.kt
Browse files Browse the repository at this point in the history
  • Loading branch information
Sisah2 authored Jun 9, 2024
1 parent c7b5cf0 commit f865e18
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions app/src/main/java/ui/activity/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,21 @@ class MainActivity : AppCompatActivity() {
File(Constants.USER_CONFIG).mkdirs()
File(Constants.USER_FILE_STORAGE + "/launcher/icons").mkdirs()

try {
// Only reinstall static files if they are of a mismatched version
try {
val stamp = File(Constants.VERSION_STAMP).readText().trim()
if (stamp.toInt() != BuildConfig.VERSION_CODE) {
removeResourceFiles()
Toast.makeText(this, getString(R.string.user_resources_was_reset), Toast.LENGTH_SHORT).show()
//reinstallStaticFiles()
}
} catch (e: Exception) {
removeResourceFiles()
Toast.makeText(this, getString(R.string.user_resources_was_reset), Toast.LENGTH_SHORT).show()
//reinstallStaticFiles()
}

// create icons files hint
if (!File(Constants.USER_FILE_STORAGE + "/launcher/icons/paste custom icons here.txt").exists())
File(Constants.USER_FILE_STORAGE + "/launcher/icons/paste custom icons here.txt").writeText(
Expand Down Expand Up @@ -658,17 +673,21 @@ class MainActivity : AppCompatActivity() {
hideAndroidControls(this)

val th = Thread {
try {
/* try {
// Only reinstall static files if they are of a mismatched version
try {
val stamp = File(Constants.VERSION_STAMP).readText().trim()
if (stamp.toInt() != BuildConfig.VERSION_CODE) {
reinstallStaticFiles()
removeResourceFiles()
Toast.makeText(this, getString(R.string.user_resources_was_reset), Toast.LENGTH_SHORT).show()
//reinstallStaticFiles()
}
} catch (e: Exception) {
reinstallStaticFiles()
removeResourceFiles()
Toast.makeText(this, getString(R.string.user_resources_was_reset), Toast.LENGTH_SHORT).show()
//reinstallStaticFiles()
}

*/
val inst = GameInstaller(prefs.getString("game_files", "")!!)

// Regenerate the fallback file in case user edits their Morrowind.ini
Expand Down

0 comments on commit f865e18

Please sign in to comment.