WIP
This commit is contained in:
@@ -44,23 +44,12 @@ import okhttp3.*
|
||||
import org.kodein.di.*
|
||||
import org.kodein.di.android.x.androidXModule
|
||||
import xyz.quaver.io.FileX
|
||||
import xyz.quaver.pupil.sources.initSources
|
||||
import xyz.quaver.pupil.sources.sourceModule
|
||||
import xyz.quaver.pupil.types.Tag
|
||||
import xyz.quaver.pupil.util.*
|
||||
import xyz.quaver.setClient
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
lateinit var histories: SavedSet<String>
|
||||
private set
|
||||
lateinit var favorites: SavedSet<String>
|
||||
private set
|
||||
lateinit var favoriteTags: SavedSet<Tag>
|
||||
private set
|
||||
lateinit var searchHistory: SavedSet<String>
|
||||
private set
|
||||
|
||||
lateinit var clientBuilder: OkHttpClient.Builder
|
||||
|
||||
var clientHolder: OkHttpClient? = null
|
||||
@@ -79,6 +68,11 @@ class Pupil : Application(), DIAware {
|
||||
bind<OkHttpClient>() with provider { client }
|
||||
bind<ImageCache>() with singleton { ImageCache(this@Pupil) }
|
||||
bind<DownloadManager>() with singleton { DownloadManager(this@Pupil) }
|
||||
|
||||
bind<SavedSourceSet>(tag = "histories") with singleton { SavedSourceSet(File(ContextCompat.getDataDir(this@Pupil), "histories.json")) }
|
||||
bind<SavedSourceSet>(tag = "favorites") with singleton { SavedSourceSet(File(ContextCompat.getDataDir(this@Pupil), "favorites.json")) }
|
||||
bind<SavedSourceSet>(tag = "favoriteTags") with singleton { SavedSourceSet(File(ContextCompat.getDataDir(this@Pupil), "favoriteTags.json")) }
|
||||
bind<SavedSourceSet>(tag = "searchHistory") with singleton { SavedSourceSet(File(ContextCompat.getDataDir(this@Pupil), "searchHistory.json")) }
|
||||
}
|
||||
|
||||
private lateinit var firebaseAnalytics: FirebaseAnalytics
|
||||
@@ -93,8 +87,6 @@ class Pupil : Application(), DIAware {
|
||||
else userID
|
||||
}
|
||||
|
||||
initSources(this)
|
||||
|
||||
firebaseAnalytics = Firebase.analytics
|
||||
FirebaseCrashlytics.getInstance().setUserId(userID)
|
||||
|
||||
@@ -125,11 +117,6 @@ class Pupil : Application(), DIAware {
|
||||
Preferences["reset_secure"] = true
|
||||
}
|
||||
|
||||
histories = SavedSet(File(ContextCompat.getDataDir(this), "histories.json"), "")
|
||||
favorites = SavedSet(File(ContextCompat.getDataDir(this), "favorites.json"), "")
|
||||
favoriteTags = SavedSet(File(ContextCompat.getDataDir(this), "favorites_tags.json"), Tag.parse(""))
|
||||
searchHistory = SavedSet(File(ContextCompat.getDataDir(this), "search_histories.json"), "")
|
||||
|
||||
if (BuildConfig.DEBUG)
|
||||
FirebaseAnalytics.getInstance(this).setAnalyticsCollectionEnabled(false)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user