Skip to content

Commit

Permalink
Release Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Michels authored and Joseph Michels committed Sep 8, 2018
1 parent ef40730 commit 1c1d767
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 32 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Expand Up @@ -19,7 +19,7 @@ android {
//1.1.0 Version Code: 4 Released 7-31-2016
//1.1.1 Version Code: 5 Released 8-05-2016
//1.1.2 Version Code: 6 Released 10-17-2016
versionCode 7
versionCode 8
versionName "2.0.0"

compileOptions {
Expand Down
1 change: 1 addition & 0 deletions app/release/output.json
@@ -0,0 +1 @@
[{"outputType":{"type":"APK"},"apkInfo":{"type":"MAIN","splits":[],"versionCode":8,"versionName":"2.0.0","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
Binary file modified app/src/main/assets/databases/mhgu.db.zip
Binary file not shown.
Expand Up @@ -6,6 +6,7 @@ import android.content.Context
import android.database.Cursor
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteQueryBuilder
import android.util.Log
import android.util.Xml
import com.ghstudios.android.data.classes.ASBSession
import com.ghstudios.android.data.classes.QuestHub
Expand Down Expand Up @@ -81,6 +82,9 @@ internal class MonsterHunterDatabaseHelper constructor(ctx: Context):

init {
setForcedUpgrade()

if(ctx.deleteDatabase("mhgen.db"))
Log.i(TAG,"Deleted old database")
}

companion object {
Expand Down Expand Up @@ -441,37 +445,7 @@ internal class MonsterHunterDatabaseHelper constructor(ctx: Context):

override fun onForcedUpgrade(db: SQLiteDatabase, oldVersion: Int, newVersion: Int) {
super.onForcedUpgrade(db, oldVersion, newVersion)

when (oldVersion) {
//Fall through, so all old versions will perform the updates
1, 2, 3, 4 -> {
//Database version 4 removed G rank from ASB
db.execSQL("UPDATE " + S.TABLE_ASB_SETS + " SET " + S.COLUMN_ASB_SET_RANK + "=1 WHERE " + S.COLUMN_ASB_SET_RANK + ">=2")

//Create a default wishlist if none exist
var c: Cursor? = db.rawQuery("SELECT COUNT(*) FROM " + S.TABLE_WISHLIST, null)
if (c!!.moveToFirst() && c.getInt(0) == 0) {
val cv = ContentValues()
cv.put(S.COLUMN_WISHLIST_NAME, myContext.getString(R.string.default_wishlist_name))
db.insert(S.TABLE_WISHLIST, null, cv)
}
c?.close()

//Create a default armor set
c = db.rawQuery("SELECT COUNT(*) FROM " + S.TABLE_ASB_SETS, null)
if (c!!.moveToFirst() && c.getInt(0) == 0) {
val cv = ContentValues()
cv.put(S.COLUMN_ASB_SET_NAME, myContext.getString(R.string.default_armor_set_name))
cv.put(S.COLUMN_ASB_SET_RANK, 0)
cv.put(S.COLUMN_ASB_SET_HUNTER_TYPE, 0)
cv.put(S.COLUMN_TALISMAN_EXISTS, 0)
db.insert(S.TABLE_ASB_SETS, null, cv)
}
c?.close()


}
}


}

Expand Down
3 changes: 3 additions & 0 deletions app/src/main/res/raw/keep.xml
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@drawable/monster_*,@drawable/icon_*,@drawable/loc_*"/>

0 comments on commit 1c1d767

Please sign in to comment.