From 2d81135487ef3e266f877ef059e4605cf6f4b065 Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 28 Jun 2019 15:28:55 -0700 Subject: [PATCH] set dbname in build.gradle --- xwords4/android/app/build.gradle | 3 +++ .../app/src/main/java/org/eehouse/android/xw4/DBHelper.java | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/xwords4/android/app/build.gradle b/xwords4/android/app/build.gradle index 49e61f8cc..aecf4beb4 100644 --- a/xwords4/android/app/build.gradle +++ b/xwords4/android/app/build.gradle @@ -67,6 +67,7 @@ android { flavorDimensions "variant"//, "abi" productFlavors { all { + buildConfigField "String", "DB_NAME", "\"xwdb\""; buildConfigField "String", "BUILD_INFO_NAME", "\"${BUILD_INFO_NAME}\"" buildConfigField "boolean", "IS_TAGGED_BUILD", "${CURTAG}" == '' ? "false" : "true" resValue "string", "invite_prefix", "/and/" @@ -102,6 +103,7 @@ android { } xw4d { dimension "variant" + buildConfigField "String", "DB_NAME", "\"xwddb\""; applicationId "org.eehouse.android.xw4dbg" manifestPlaceholders = [ FABRIC_API_KEY: "$FABRIC_API_KEY", APP_ID: applicationId, ] resValue "string", "app_name", "CrossDbg" @@ -116,6 +118,7 @@ android { xw4dNoSMS { dimension "variant" + buildConfigField "String", "DB_NAME", "\"xwddb\""; applicationId "org.eehouse.android.xw4dbg" manifestPlaceholders = [ FABRIC_API_KEY: "$FABRIC_API_KEY", APP_ID: applicationId, ] resValue "string", "app_name", "CrossDbg" diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBHelper.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBHelper.java index 77b0a5e54..f9e1128d8 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBHelper.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/DBHelper.java @@ -46,7 +46,7 @@ public class DBHelper extends SQLiteOpenHelper { public static final String TABLE_NAME_INVITES = "invites"; public static final String TABLE_NAME_CHAT = "chat"; public static final String TABLE_NAME_LOGS = "logs"; - private static final String DB_NAME = "xwdb"; + private static final String DB_NAME = BuildConfig.DB_NAME; private static final int DB_VERSION = 29; public static final String GAME_NAME = "GAME_NAME"; @@ -233,7 +233,7 @@ public class DBHelper extends SQLiteOpenHelper { public DBHelper( Context context ) { - super( context, DB_NAME, null, DB_VERSION ); + super( context, getDBName(), null, DB_VERSION ); m_context = context; } @@ -263,7 +263,7 @@ public class DBHelper extends SQLiteOpenHelper { @SuppressWarnings("fallthrough") public void onUpgrade( SQLiteDatabase db, int oldVersion, int newVersion ) { - Log.i( TAG, "onUpgrade: old: %d; new: %d", oldVersion, newVersion ); + Log.i( TAG, "onUpgrade(%s): old: %d; new: %d", db, oldVersion, newVersion ); boolean madeSumTable = false; boolean madeChatTable = false;