formatting

This commit is contained in:
Felix 2019-11-09 20:38:00 +01:00
parent 116559d24b
commit e7c1c56c91
2 changed files with 31 additions and 31 deletions

View file

@ -26,15 +26,15 @@ import de.nicidienase.chaosflix.common.userdata.entities.watchlist.WatchlistItem
import de.nicidienase.chaosflix.common.userdata.entities.watchlist.WatchlistItemDao
@Database(entities = arrayOf(
Conference::class,
Event::class,
Recording::class,
RelatedEvent::class,
ConferenceGroup::class,
Conference::class,
Event::class,
Recording::class,
RelatedEvent::class,
ConferenceGroup::class,
PlaybackProgress::class,
WatchlistItem::class,
OfflineEvent::class
PlaybackProgress::class,
WatchlistItem::class,
OfflineEvent::class
), version = 6, exportSchema = true)
@TypeConverters(Converters::class)
abstract class ChaosflixDatabase : RoomDatabase() {
@ -50,13 +50,13 @@ abstract class ChaosflixDatabase : RoomDatabase() {
abstract fun offlineEventDao(): OfflineEventDao
companion object : SingletonHolder<ChaosflixDatabase, Context>({
Room.databaseBuilder(
it.applicationContext,
ChaosflixDatabase::class.java, "mediaccc.de")
.addMigrations(
ChaosflixDatabase.migration_5_6)
.fallbackToDestructiveMigrationFrom(1, 2, 3, 4)
.build()
Room.databaseBuilder(
it.applicationContext,
ChaosflixDatabase::class.java, "mediaccc.de")
.addMigrations(
ChaosflixDatabase.migration_5_6)
.fallbackToDestructiveMigrationFrom(1, 2, 3, 4)
.build()
}) {
val migration_2_3 = object : Migration(2, 3) {

View file

@ -19,29 +19,29 @@ class ApiFactory private constructor(val res: Resources) {
val client: OkHttpClient by lazy {
OkHttpClient.Builder()
.connectTimeout(60, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.addInterceptor(useragentInterceptor)
.build()
.connectTimeout(60, TimeUnit.SECONDS)
.readTimeout(60, TimeUnit.SECONDS)
.addInterceptor(useragentInterceptor)
.build()
}
val recordingApi: RecordingService by lazy {
Retrofit.Builder()
.baseUrl(res.getString(R.string.recording_url))
.client(client)
.addConverterFactory(gsonConverterFactory)
.build()
.create(RecordingService::class.java)
}
val streamingApi: StreamingService by lazy { Retrofit.Builder()
.baseUrl(BuildConfig.STREAMING_API_BASE_URL)
.baseUrl(res.getString(R.string.recording_url))
.client(client)
.addConverterFactory(gsonConverterFactory)
.build()
.create(StreamingService::class.java) }
.create(RecordingService::class.java)
}
private val useragentInterceptor: Interceptor = Interceptor {chain ->
val streamingApi: StreamingService by lazy { Retrofit.Builder()
.baseUrl(BuildConfig.STREAMING_API_BASE_URL)
.client(client)
.addConverterFactory(gsonConverterFactory)
.build()
.create(StreamingService::class.java) }
private val useragentInterceptor: Interceptor = Interceptor { chain ->
val requestWithUseragent = chain.request().newBuilder()
.header("UserAgent", chaosflixUserAgent)
.build()
@ -56,5 +56,5 @@ class ApiFactory private constructor(val res: Resources) {
return "chaosflix/$versionName $osVersion ($device)"
}
companion object: SingletonHolder<ApiFactory, Resources>(::ApiFactory)
companion object : SingletonHolder<ApiFactory, Resources>(::ApiFactory)
}