mirror of
https://github.com/wulkanowy/wulkanowy.git
synced 2025-01-31 17:52:45 +01:00
Add remove user id in db upgrade (#59)
This commit is contained in:
parent
bc4b150858
commit
e274949257
@ -2,18 +2,31 @@ package io.github.wulkanowy.data.db.dao;
|
|||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
|
import org.greenrobot.greendao.database.Database;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
import io.github.wulkanowy.data.db.dao.entities.DaoMaster;
|
import io.github.wulkanowy.data.db.dao.entities.DaoMaster;
|
||||||
|
import io.github.wulkanowy.data.db.shared.SharedPrefContract;
|
||||||
import io.github.wulkanowy.di.annotations.ApplicationContext;
|
import io.github.wulkanowy.di.annotations.ApplicationContext;
|
||||||
import io.github.wulkanowy.di.annotations.DatabaseInfo;
|
import io.github.wulkanowy.di.annotations.DatabaseInfo;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class DbHelper extends DaoMaster.DevOpenHelper {
|
public class DbHelper extends DaoMaster.DevOpenHelper {
|
||||||
|
|
||||||
|
private SharedPrefContract sharedPref;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
DbHelper(@ApplicationContext Context context, @DatabaseInfo String dbName) {
|
DbHelper(@ApplicationContext Context context, @DatabaseInfo String dbName,
|
||||||
|
SharedPrefContract sharedPref) {
|
||||||
super(context, dbName);
|
super(context, dbName);
|
||||||
|
this.sharedPref = sharedPref;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onUpgrade(Database db, int oldVersion, int newVersion) {
|
||||||
|
super.onUpgrade(db, oldVersion, newVersion);
|
||||||
|
sharedPref.setCurrentUserId(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user