1
0
mirror of https://github.com/AllanWang/Frost-for-Facebook.git synced 2024-11-10 04:52:38 +01:00

Update dependency and address deprecations (#473)

This commit is contained in:
Allan Wang 2017-11-06 00:13:53 -05:00 committed by GitHub
parent d82a9b9e29
commit fc4a018d48
6 changed files with 23 additions and 9 deletions

View File

@ -14,6 +14,9 @@ import com.crashlytics.android.Crashlytics
import com.crashlytics.android.answers.Answers
import com.mikepenz.materialdrawer.util.AbstractDrawerImageLoader
import com.mikepenz.materialdrawer.util.DrawerImageLoader
import com.pitchedapps.frost.dbflow.CookiesDb
import com.pitchedapps.frost.dbflow.FbTabsDb
import com.pitchedapps.frost.dbflow.NotificationDb
import com.pitchedapps.frost.facebook.FbCookie
import com.pitchedapps.frost.services.scheduleNotifications
import com.pitchedapps.frost.services.setupNotificationChannels
@ -21,10 +24,12 @@ import com.pitchedapps.frost.utils.FrostPglAdBlock
import com.pitchedapps.frost.utils.L
import com.pitchedapps.frost.utils.Prefs
import com.pitchedapps.frost.utils.Showcase
import com.raizlabs.android.dbflow.config.DatabaseConfig
import com.raizlabs.android.dbflow.config.FlowConfig
import com.raizlabs.android.dbflow.config.FlowManager
import io.fabric.sdk.android.Fabric
import java.util.*
import kotlin.reflect.KClass
/**
@ -38,8 +43,17 @@ class FrostApp : Application() {
// lateinit var refWatcher: RefWatcher
private fun FlowConfig.Builder.withDatabase(name: String, klass: KClass<*>) =
addDatabaseConfig(DatabaseConfig.builder(klass.java)
.databaseName(name)
.build())
override fun onCreate() {
FlowManager.init(FlowConfig.Builder(this).build())
FlowManager.init(FlowConfig.Builder(this)
.withDatabase(CookiesDb.NAME, CookiesDb::class)
.withDatabase(FbTabsDb.NAME, FbTabsDb::class)
.withDatabase(NotificationDb.NAME, NotificationDb::class)
.build())
Showcase.initialize(this, "${BuildConfig.APPLICATION_ID}.showcase")
Prefs.initialize(this, "${BuildConfig.APPLICATION_ID}.prefs")
// if (LeakCanary.isInAnalyzerProcess(this)) return

View File

@ -21,7 +21,7 @@ import java.net.UnknownHostException
* Created by Allan Wang on 2017-05-30.
*/
@Database(name = CookiesDb.NAME, version = CookiesDb.VERSION)
@Database(version = CookiesDb.VERSION)
object CookiesDb {
const val NAME = "Cookies"
const val VERSION = 2

View File

@ -17,8 +17,8 @@ object DbUtils {
}
inline fun <reified T : Any> List<T>.replace(context: Context, dbName: String) {
inline fun <reified T : Any> List<T>.replace(dbName: String) {
L.d("Replacing $dbName.db")
DbUtils.db(dbName).reset(context)
DbUtils.db(dbName).reset()
FastStoreModelTransaction.saveBuilder(FlowManager.getModelAdapter(T::class.java)).addAll(this).build()
}

View File

@ -15,7 +15,7 @@ import com.raizlabs.android.dbflow.structure.BaseModel
* Created by Allan Wang on 2017-05-30.
*/
@Database(name = FbTabsDb.NAME, version = FbTabsDb.VERSION)
@Database( version = FbTabsDb.VERSION)
object FbTabsDb {
const val NAME = "FrostTabs"
const val VERSION = 1
@ -31,6 +31,6 @@ fun loadFbTabs(): List<FbItem> {
return defaultTabs()
}
fun List<FbItem>.saveAsync(c: Context) {
mapIndexed { index, fbTab -> FbTabModel(index, fbTab) }.replace(c, FbTabsDb.NAME)
fun List<FbItem>.saveAsync() {
mapIndexed { index, fbTab -> FbTabModel(index, fbTab) }.replace(FbTabsDb.NAME)
}

View File

@ -11,7 +11,7 @@ import com.raizlabs.android.dbflow.structure.BaseModel
* Created by Allan Wang on 2017-05-30.
*/
@Database(name = NotificationDb.NAME, version = NotificationDb.VERSION)
@Database(version = NotificationDb.VERSION)
object NotificationDb {
const val NAME = "Notifications"
const val VERSION = 2

View File

@ -22,7 +22,7 @@ KOTLIN=1.1.51
COMMONS_TEXT=1.1
CRASHLYTICS=2.7.1
DBFLOW=4.0.5
DBFLOW=4.1.2
EXOMEDIA=4.0.3
IAB=1.0.44
IICON_COMMUNITY=1.9.32.2