sockeqwe / sqlbrite-dao

DAO for SQLBrite
http://hannesdorfmann.com/android/sqlbrite-dao
Apache License 2.0
182 stars 22 forks source link

Dao Manager constructor should accept a listener #25

Closed harinair closed 8 years ago

harinair commented 8 years ago

Currently it is nice that the Dao's createTable and onUpgrade are invoked. However I may need to start something else: example a FullSync if DB is upgraded. I don't want to handle this in the Dao. I really would like to get a callback on DB Upgrade or create complete. I suggest that DaoManager allows argument CreationListener:

interface CreationListener {
     void onUpgradeComplete(int oldVersion, int newVersion);
     void onCreateComplete();
}
sockeqwe commented 8 years ago

Yep, will add that

harinair notifications@github.com schrieb am Di., 24. Nov. 2015, 04:43:

Currently it is nice that the Dao's createTable and onUpgrade are invoked. However I may need to start something else: example a FullSync if DB is upgraded. I don't want to handle this in the Dao. I really would like to get a callback on DB Upgrade or create complete. I suggest that DaoManager allows argument CreationListener:

interface CreationListener { void onUpgradeComplete(int oldVersion, int newVersion); void onCreateComplete(); }

— Reply to this email directly or view it on GitHub https://github.com/sockeqwe/sqlbrite-dao/issues/25.

harinair commented 8 years ago

Thank you. Right now, I am creating a fake DAO and adding it as the last DAO to the DAO Manager.

Do you want me to work on this?

sockeqwe commented 8 years ago

I'm thinking about crrating the DaoManager with the Builder Pattern rather then constructor because the number of construction parameters are increasing and we may add even more options in the future. What do you think?

harinair notifications@github.com schrieb am Mi., 25. Nov. 2015, 06:21:

Thank you. Right now, I am creating a fake DAO and adding it as the last DAO to the DAO Manager.

Do you want me to work on this?

— Reply to this email directly or view it on GitHub https://github.com/sockeqwe/sqlbrite-dao/issues/25#issuecomment-159494717 .

harinair commented 8 years ago

Good idea.

sockeqwe commented 8 years ago

Introduced DaoManager.Builder which takes TablesCreatedListener and TablesUpgradedListener in version 0.5.0