Launch tutorial only in production release

This commit is contained in:
jacques 2022-03-17 18:26:25 +01:00
parent a8377f6395
commit 7f43b84b2e

View file

@ -34,6 +34,7 @@ import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
import androidx.room.Room; import androidx.room.Room;
import com.google.zxing.client.android.BuildConfig;
import com.google.zxing.client.android.Intents; import com.google.zxing.client.android.Intents;
import com.journeyapps.barcodescanner.ScanOptions; import com.journeyapps.barcodescanner.ScanOptions;
@ -79,7 +80,7 @@ public class DrugListActivity extends AppCompatActivity {
public void onStart() { public void onStart() {
super.onStart(); super.onStart();
if(BuildConfig.DEBUG) { if(net.foucry.pilldroid.BuildConfig.DEBUG) {
String manufacturer = Build.MANUFACTURER; String manufacturer = Build.MANUFACTURER;
String model = Build.MODEL; String model = Build.MODEL;
int version = Build.VERSION.SDK_INT; int version = Build.VERSION.SDK_INT;
@ -95,6 +96,7 @@ public class DrugListActivity extends AppCompatActivity {
medicines = Room medicines = Room
.databaseBuilder(getApplicationContext(), MedicineDatabase.class, "medicines") .databaseBuilder(getApplicationContext(), MedicineDatabase.class, "medicines")
.createFromAsset("drugs.db") .createFromAsset("drugs.db")
.allowMainThreadQueries()
.build(); .build();
// Manually migrate old database to room // Manually migrate old database to room
@ -133,9 +135,11 @@ public class DrugListActivity extends AppCompatActivity {
nm.cancelAll(); nm.cancelAll();
} }
// start tutorial // start tutorial (only in non debug mode
Log.i(TAG, "Launch tutorial"); if(!net.foucry.pilldroid.BuildConfig.DEBUG) {
startActivity(new Intent(this, WelcomeActivity.class)); Log.i(TAG, "Launch tutorial");
startActivity(new Intent(this, WelcomeActivity.class));
}
} }
@Override @Override