Skip to content

Commit

Permalink
Merge branch 'main' into feature/implement_translate_button2
Browse files Browse the repository at this point in the history
  • Loading branch information
Corvus400 authored Aug 30, 2023
2 parents 09e293f + 385a82b commit ce2aae3
Show file tree
Hide file tree
Showing 112 changed files with 334 additions and 80 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/Renovate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: suzuki-shunsuke/renovate-autoclose-action@befe0dc6bbdea6c28a0125be04496180609b52d2
- uses: suzuki-shunsuke/renovate-autoclose-action@v0.3.2

# Just for internal testing of renovate configuration.
# You have to set your PAT to secrets.
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local.properties
.project

# Windows thumbnail db
.DS_Store
Thumbs.db

# IDEA/Android Studio project files, because
# the project can be imported from settings.gradle.kts
Expand Down
4 changes: 2 additions & 2 deletions app-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ plugins {
id("droidkaigi.primitive.detekt")
id("droidkaigi.primitive.android.roborazzi")
id("droidkaigi.primitive.kover")
id("droidkaigi.primitive.osslicenses")
id("droidkaigi.primitive.android.osslicenses")
}

val keystorePropertiesFile = file("keystore.properties")
Expand Down Expand Up @@ -68,7 +68,7 @@ android {
buildConfigField(
type = "String",
name = "SERVER_URL",
value = "\"https://ssot-api.droidkaigi.jp\"",
value = "\"https://ssot-api.droidkaigi.jp/\"",
)
}
}
Expand Down
5 changes: 4 additions & 1 deletion app-android/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,7 @@
# hide the original source file name.
#-renamesourcefileattribute SourceFile

-dontwarn org.slf4j.impl.StaticLoggerBinder
-dontwarn org.slf4j.impl.StaticLoggerBinder

# Jetpack DataStore
-keep class androidx.datastore.*.** {*;}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ import io.github.droidkaigi.confsched2023.model.AboutItem.Sponsors
import io.github.droidkaigi.confsched2023.model.AboutItem.Staff
import io.github.droidkaigi.confsched2023.model.AboutItem.X
import io.github.droidkaigi.confsched2023.model.AboutItem.YouTube
import io.github.droidkaigi.confsched2023.model.Lang.JAPANESE
import io.github.droidkaigi.confsched2023.model.TimetableItem
import io.github.droidkaigi.confsched2023.model.defaultLang
import io.github.droidkaigi.confsched2023.sessions.navigateSearchScreen
import io.github.droidkaigi.confsched2023.sessions.navigateTimetableScreen
import io.github.droidkaigi.confsched2023.sessions.navigateToBookmarkScreen
Expand Down Expand Up @@ -117,9 +119,7 @@ private fun KaigiNavHost(
)
sponsorsScreen(
onNavigationIconClick = navController::popBackStack,
onSponsorClick = { sponsor ->
TODO()
},
onSponsorClick = externalNavController::navigate,
)
staffScreen(
onBackClick = navController::popBackStack,
Expand Down Expand Up @@ -150,7 +150,14 @@ private fun NavGraphBuilder.mainScreen(
onAboutItemClick = { aboutItem ->
when (aboutItem) {
Sponsors -> navController.navigateSponsorsScreen()
CodeOfConduct -> externalNavController.navigate(url = "https://portal.droidkaigi.jp/about/code-of-conduct")
CodeOfConduct -> {
val url = if (defaultLang() == JAPANESE) {
"https://portal.droidkaigi.jp/about/code-of-conduct"
} else {
"https://portal.droidkaigi.jp/en/about/code-of-conduct"
}
externalNavController.navigate(url = url)
}
Contributors -> mainNestedNavController.navigate(contributorsScreenRoute)
License -> externalNavController.navigateToLicenseScreen()
Medium -> externalNavController.navigate(url = "https://medium.com/droidkaigi")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ class EntryPointTest {
override suspend fun getBoolean(key: String): Boolean {
return true
}

override suspend fun getString(key: String): String {
return "default"
}
},
authenticator = object : Authenticator {
override suspend fun currentUser(): User? {
Expand All @@ -50,4 +54,4 @@ class EntryPointTest {
assertNotNull(kmpEntryPoint.get<SponsorsRepository>())
assertNotNull(kmpEntryPoint.get<StaffRepository>())
}
}
}
3 changes: 3 additions & 0 deletions app-ios/Modules/Sources/RemoteConfig/RemoteConfig.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ public class RemoteConfigApiImpl: RemoteConfigApi {
bool: RemoteConfig.remoteConfig().configValue(forKey: key).boolValue
)
}
public func getString(key: String) async throws -> String {
return RemoteConfig.remoteConfig().configValue(forKey: key).stringValue ?? ""
}
}
2 changes: 1 addition & 1 deletion app-ios/Modules/Sources/Session/SessionView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public struct SessionView: View {
InformationRow(
icon: Assets.Icons.language.swiftUIImage,
title: "対応言語",
content: viewModel.timetableItem.language.langOfSpeaker
content: viewModel.timetableItem.getSupportedLangString(isJapaneseLocale: (Locale.current.language.languageCode?.identifier == "ja"))
)
InformationRow(
icon: Assets.Icons.category.swiftUIImage,
Expand Down
2 changes: 1 addition & 1 deletion build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ gradlePlugin {
implementationClass = "io.github.droidkaigi.confsched2023.primitive.DetektPlugin"
}
register("oss-licenses") {
id = "droidkaigi.primitive.osslicenses"
id = "droidkaigi.primitive.android.osslicenses"
implementationClass = "io.github.droidkaigi.confsched2023.primitive.OssLicensesPlugin"
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package io.github.droidkaigi.confsched2023.primitive

import com.google.devtools.ksp.gradle.KspTaskMetadata
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.withType

@Suppress("unused")
class KmpAndroidPlugin : Plugin<Project> {
Expand Down Expand Up @@ -34,6 +36,10 @@ class KmpAndroidPlugin : Plugin<Project> {
}
}
}
// https://slack-chats.kotlinlang.org/t/13166064/been-discovering-that-the-task-kspcommonmainkotlinmetadata-i#9a50fa1b-1ec5-47c2-9172-2a5780a1900e
tasks.withType<KspTaskMetadata>().configureEach {
notCompatibleWithConfigurationCache("Configuration cache not supported due to serialization")
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package io.github.droidkaigi.confsched2023.primitive
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

@Suppress("unused")
Expand All @@ -15,6 +16,9 @@ class KmpPlugin : Plugin<Project> {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class.java) {
kotlinOptions.jvmTarget = "11"
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinNativeLink>().configureEach {
notCompatibleWithConfigurationCache("Configuration chache not supported for a system property read at configuration time")
}
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions config/detekt/baseline.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<SmellBaseline>
<Blacklist>
</Blacklist>
<Whitelist>
</Whitelist>
<SuppressedFalsePositive>
</SuppressedFalsePositive>
<TemporarySuppressedIssues>
</TemporarySuppressedIssues>
</SmellBaseline>
5 changes: 4 additions & 1 deletion core/data/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
#-renamesourcefileattribute SourceFile

## Firebase
-keep class androidx.datastore.*.** {*;}
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ class AuthenticatorModule {
@InstallIn(SingletonComponent::class)
@Module
class RemoteConfigModule {

@Provides
@Singleton
fun provideFirebaseRemoteConfig(): RemoteConfigApi {
fun provideRemoteConfigApi(): RemoteConfigApi {
return DefaultRemoteConfigApi()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.github.droidkaigi.confsched2023.data.remoteconfig

import co.touchlab.kermit.Logger
import dev.gitlive.firebase.Firebase
import dev.gitlive.firebase.remoteconfig.get
import dev.gitlive.firebase.remoteconfig.remoteConfig
Expand All @@ -14,13 +15,26 @@ class DefaultRemoteConfigApi : RemoteConfigApi {
// init {
// CoroutineScope(Dispatchers.IO).launch {
// firebaseRemoteConfig.settings {
// minimumFetchIntervalInSeconds = 12 * 3600L
// minimumFetchIntervalInSeconds = 1 * 60
// }
// }
// }

override suspend fun getBoolean(key: String): Boolean {
firebaseRemoteConfig.fetchAndActivate()
fetchConfig()
return firebaseRemoteConfig[key]
}

override suspend fun getString(key: String): String {
fetchConfig()
return firebaseRemoteConfig[key]
}

private suspend fun fetchConfig() {
try {
firebaseRemoteConfig.fetchAndActivate()
} catch (e: Exception) {
Logger.e(e.message ?: "FirebaseRemoteConfig fetchAndActivate failed")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,27 @@ class DefaultStampRepository(
private val remoteConfigApi: RemoteConfigApi,
) : StampRepository {
private val isStampsEnabledStateFlow: MutableStateFlow<Boolean> = MutableStateFlow(false)
private val stampDetailDescriptionStateFlow: MutableStateFlow<String> = MutableStateFlow("")

private suspend fun fetchStampsEnabled() {
isStampsEnabledStateFlow.value = remoteConfigApi.getBoolean(IS_STAMPS_ENABLED_KEY)
}

private suspend fun fetchStampDetailDescription() {
stampDetailDescriptionStateFlow.value =
remoteConfigApi.getString(STAMP_DETAIL_DESCRIPTION_KEY)
}

override fun getStampEnabledStream(): Flow<Boolean> {
return isStampsEnabledStateFlow.onStart { fetchStampsEnabled() }
}

override fun getStampDetailDescriptionStream(): Flow<String> {
return stampDetailDescriptionStateFlow.onStart { fetchStampDetailDescription() }
}

companion object {
const val IS_STAMPS_ENABLED_KEY = "is_stamps_enable"
const val STAMP_DETAIL_DESCRIPTION_KEY = "achievements_detail_description"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ import androidx.datastore.core.IOException
class FakeRemoteConfigApi : RemoteConfigApi {

sealed interface Status : RemoteConfigApi {
object Default : Status {
data object Default : Status {
override suspend fun getBoolean(key: String): Boolean {
return true
}

override suspend fun getString(key: String): String {
return "default"
}
}

object ThrowException : Status {
data object ThrowException : Status {
override suspend fun getBoolean(key: String): Boolean {
throw IOException("FakeRemoteConfigApi throws exception")
}

override suspend fun getString(key: String): String {
throw IOException("FakeRemoteConfigApi throws exception")
}
}
}

Expand All @@ -27,4 +35,8 @@ class FakeRemoteConfigApi : RemoteConfigApi {
override suspend fun getBoolean(key: String): Boolean {
return status.getBoolean(key)
}

override suspend fun getString(key: String): String {
return status.getString(key)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ package io.github.droidkaigi.confsched2023.data.remoteconfig

interface RemoteConfigApi {
suspend fun getBoolean(key: String): Boolean
suspend fun getString(key: String): String
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DefaultSessionsApiClient internal constructor(
}
}

internal fun SessionsAllResponse.toTimetable(): Timetable {
fun SessionsAllResponse.toTimetable(): Timetable {
val timetableContents = this
val speakerIdToSpeaker: Map<String, TimetableSpeaker> = timetableContents.speakers
.groupBy { it.id }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.map

class DefaultSessionsRepository(
public class DefaultSessionsRepository(
private val sessionsApi: SessionsApiClient,
private val userDataStore: UserDataStore,
private val sessionCacheDataStore: SessionCacheDataStore,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ import kotlinx.coroutines.flow.Flow
interface StampRepository {

fun getStampEnabledStream(): Flow<Boolean>
fun getStampDetailDescriptionStream(): Flow<String>
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
package io.github.droidkaigi.confsched2023.model

public sealed class AppError : RuntimeException {
private constructor()
private constructor(message: String?) : super(message)
private constructor(message: String?, cause: Throwable?) : super(message, cause)
private constructor(cause: Throwable?) : super(cause)
private constructor(message: String? = null, cause: Throwable? = null) : super(message, cause)

public sealed class ApiException(cause: Throwable?) : AppError(cause) {
public class NetworkException(cause: Throwable?) : ApiException(cause)
public class ServerException(cause: Throwable?) : ApiException(cause)
public class TimeoutException(cause: Throwable?) : ApiException(cause)
public class SessionNotFoundException(cause: Throwable?) : AppError(cause)
public class UnknownException(cause: Throwable?) : AppError(cause)
public sealed class ApiException(cause: Throwable?) : AppError(cause = cause) {
public class NetworkException(cause: Throwable?) : ApiException(cause = cause)
public class ServerException(cause: Throwable?) : ApiException(cause = cause)
public class TimeoutException(cause: Throwable?) : ApiException(cause = cause)
public class SessionNotFoundException(cause: Throwable?) : AppError(cause = cause)
public class UnknownException(cause: Throwable?) : AppError(cause = cause)
}

public sealed class ExternalIntegrationError(cause: Throwable?) : AppError(cause) {
public sealed class ExternalIntegrationError(cause: Throwable?) : AppError(cause = cause) {
public class NoCalendarIntegrationFoundException(cause: Throwable?) :
ExternalIntegrationError(cause)
}

public class UnknownException(cause: Throwable?) : AppError(cause)
public class UnknownException(cause: Throwable?) : AppError(cause = cause)
}
Loading

0 comments on commit ce2aae3

Please sign in to comment.