Skip to content

Commit

Permalink
Merge pull request #47 from 2rabs/rt/core-module-explicitApi
Browse files Browse the repository at this point in the history
♻️ core モジュールに explicitApi を追加
  • Loading branch information
tatsutakein authored Nov 23, 2023
2 parents a64cecb + bb66ea5 commit ffddbed
Show file tree
Hide file tree
Showing 91 changed files with 156 additions and 337 deletions.
2 changes: 2 additions & 0 deletions core/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ plugins {
android.namespace = "club.nito.core.common"

kotlin {
explicitApi()

sourceSets {
commonMain {
dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import java.time.format.DateTimeFormatter
import java.time.format.FormatStyle
import java.util.Locale

class DefaultNitoDateTimeFormatter(
public class DefaultNitoDateTimeFormatter(
private val dateTimeFormatter: DateTimeFormatter,
) : NitoDateTimeFormatter {
override fun formatDateTimeString(instant: Instant): String {
Expand All @@ -18,7 +18,7 @@ class DefaultNitoDateTimeFormatter(
private fun DateTimeFormatter.format(instant: Instant): String = format(instant.toJavaInstant())
}

val previewNitoDateTimeFormatter = DefaultNitoDateTimeFormatter(
public val previewNitoDateTimeFormatter: NitoDateTimeFormatter = DefaultNitoDateTimeFormatter(
dateTimeFormatter = DateTimeFormatter
.ofLocalizedDateTime(FormatStyle.LONG, FormatStyle.SHORT)
.withLocale(Locale.getDefault())
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package club.nito.core.common

import java.util.UUID

actual fun randomUUIDHash(): Int = UUID.randomUUID().hashCode()
public actual fun randomUUIDHash(): Int = UUID.randomUUID().hashCode()

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package club.nito.core.common

import kotlinx.datetime.Instant

interface NitoDateTimeFormatter {
public interface NitoDateTimeFormatter {
/**
* 日時をフォーマットする
*/
fun formatDateTimeString(instant: Instant): String
public fun formatDateTimeString(instant: Instant): String
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package club.nito.core.common

expect fun randomUUIDHash(): Int
public expect fun randomUUIDHash(): Int

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ package club.nito.core.common

import platform.Foundation.NSUUID

actual fun randomUUIDHash(): Int = NSUUID().hash.toInt()
public actual fun randomUUIDHash(): Int = NSUUID().hash.toInt()
4 changes: 2 additions & 2 deletions core/data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ plugins {
android.namespace = "club.nito.core.data"

kotlin {
explicitApi()

sourceSets {
commonMain {
dependencies {
Expand All @@ -24,5 +26,3 @@ kotlin {
}
}
}
dependencies {
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ import kotlinx.coroutines.flow.Flow
/**
* 認証に関するリポジトリ
*/
sealed interface AuthRepository {
public sealed interface AuthRepository {
/**
* 認証情報の状態
*/
val authStatus: Flow<FetchSingleResult<AuthStatus>>
public val authStatus: Flow<FetchSingleResult<AuthStatus>>

/**
* サインインする
*/
suspend fun signIn(email: String, password: String)
public suspend fun signIn(email: String, password: String)

/**
* サインアウトする
*/
suspend fun signOut()
public suspend fun signOut()

/**
* 認証ユーザー情報を更新する
*/
suspend fun modifyAuthUser(email: String?, password: String?): UserInfo
public suspend fun modifyAuthUser(email: String?, password: String?): UserInfo
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ import club.nito.core.model.UserInfo
import club.nito.core.network.auth.AuthRemoteDataSource
import kotlinx.coroutines.flow.Flow

class DefaultAuthRepository(
public class DefaultAuthRepository(
private val remoteDataSource: AuthRemoteDataSource,
) : AuthRepository {
override val authStatus: Flow<FetchSingleResult<AuthStatus>> = remoteDataSource.authStatus

override suspend fun signIn(email: String, password: String) = remoteDataSource.signIn(
override suspend fun signIn(email: String, password: String): Unit = remoteDataSource.signIn(
email = email,
password = password,
)

override suspend fun signOut() = remoteDataSource.signOut()
override suspend fun signOut(): Unit = remoteDataSource.signOut()

override suspend fun modifyAuthUser(email: String?, password: String?): UserInfo = remoteDataSource.modifyAuthUser(
email = email,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import club.nito.core.model.participant.Participant
import club.nito.core.model.participant.ParticipantDeclaration
import club.nito.core.network.participation.ParticipantRemoteDataSource

class DefaultParticipantRepository(
public class DefaultParticipantRepository(
private val remoteDataSource: ParticipantRemoteDataSource,
) : ParticipantRepository {
override suspend fun getParticipants(scheduleId: String): List<Participant> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import club.nito.core.model.FetchSingleContentResult
import club.nito.core.model.UserProfile
import club.nito.core.network.user.UserRemoteDataSource

class DefaultUserRepository(
public class DefaultUserRepository(
private val remoteDataSource: UserRemoteDataSource,
) : UserRepository {
override suspend fun getProfile(userId: String): FetchSingleContentResult<UserProfile> {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import kotlinx.datetime.Instant

class OfflineFirstScheduleRepository(
public class OfflineFirstScheduleRepository(
private val remoteDataSource: ScheduleRemoteDataSource,
) : ScheduleRepository {
private val log = Logger.withTag("OfflineFirstScheduleRepository")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ import club.nito.core.model.participant.ParticipantDeclaration
/**
* 参加情報を扱うリポジトリ
*/
sealed interface ParticipantRepository {
public sealed interface ParticipantRepository {
/**
* 該当の予定の参加情報を取得する
*
* @param scheduleId 参加情報を取得するスケジュールID
*/
suspend fun getParticipants(scheduleId: String): List<Participant>
public suspend fun getParticipants(scheduleId: String): List<Participant>

/**
* 該当の予定の参加情報を取得する
*
* @param scheduleIds 参加情報を取得するスケジュールID配列
*/
suspend fun getParticipants(scheduleIds: List<String>): List<Participant>
public suspend fun getParticipants(scheduleIds: List<String>): List<Participant>

/**
* 該当のスケジュールに参加する
*
* @param declaration 参加表明データ
*/
suspend fun participate(declaration: ParticipantDeclaration): Long
public suspend fun participate(declaration: ParticipantDeclaration): Long
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ import kotlinx.datetime.Instant
/**
* スケジュールに関するリポジトリ
*/
sealed interface ScheduleRepository {
val scheduleListFlow: Flow<List<Schedule>>
suspend fun getScheduleList(
public sealed interface ScheduleRepository {
public val scheduleListFlow: Flow<List<Schedule>>
public suspend fun getScheduleList(
limit: Int,
order: Order = Order.DESCENDING,
after: Instant? = null,
): List<Schedule>

fun scheduleFlow(id: String): Flow<Schedule>
public fun scheduleFlow(id: String): Flow<Schedule>
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import club.nito.core.model.UserProfile
/**
* ユーザープロフィールに関するリポジトリ
*/
sealed interface UserRepository {
public sealed interface UserRepository {
/**
* ユーザープロフィールを取得する
*/
suspend fun getProfile(userId: String): FetchSingleContentResult<UserProfile>
public suspend fun getProfile(userId: String): FetchSingleContentResult<UserProfile>

/**
* 複数のユーザープロフィールを取得する
*/
suspend fun getProfiles(userIds: List<String>): List<UserProfile>
public suspend fun getProfiles(userIds: List<String>): List<UserProfile>
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import org.koin.core.module.dsl.singleOf
import org.koin.dsl.bind
import org.koin.dsl.module

val dataModule: Module = module {
public val dataModule: Module = module {
singleOf(::DefaultAuthRepository) bind AuthRepository::class
singleOf(::OfflineFirstScheduleRepository) bind ScheduleRepository::class
singleOf(::DefaultParticipantRepository) bind ParticipantRepository::class
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions core/database/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ plugins {
android.namespace = "club.nito.core.database"

kotlin {
explicitApi()

sourceSets {
commonMain {
dependencies {
Expand All @@ -16,5 +18,3 @@ kotlin {
}
}
}
dependencies {
}
Empty file.

This file was deleted.

Empty file.

This file was deleted.

This file was deleted.

Empty file.

This file was deleted.

2 changes: 2 additions & 0 deletions core/designsystem/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ plugins {
android.namespace = "club.nito.core.designsystem"

kotlin {
explicitApi()

js {
browser()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import androidx.core.view.WindowCompat
// Generated code from https://m3.material.io/theme-builder#/custom

@Composable
actual fun NitoTheme(
public actual fun NitoTheme(
useDarkTheme: Boolean,
// Dynamic color is available on Android 12+
dynamicColor: Boolean,
Expand Down
Loading

0 comments on commit ffddbed

Please sign in to comment.