Skip to content

Commit

Permalink
chore(kotlin): make everything internal by default
Browse files Browse the repository at this point in the history
  • Loading branch information
outadoc committed Jun 28, 2024
1 parent 5a66b4d commit c2baf79
Show file tree
Hide file tree
Showing 326 changed files with 433 additions and 431 deletions.
2 changes: 2 additions & 0 deletions shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ plugins {
}

kotlin {
explicitApi()

androidTarget {
compilations.all {
kotlinOptions {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.preferencesDataStore

val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "fr.outadoc.justchatting")
internal val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = "fr.outadoc.justchatting")
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import fr.outadoc.justchatting.component.preferences.data.AppUser
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map

class SharedPrefsPreferenceRepository(
internal class SharedPrefsPreferenceRepository(
applicationContext: Context,
) : PreferenceRepository {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package fr.outadoc.justchatting.di

import fr.outadoc.justchatting.BuildConfig
import fr.outadoc.justchatting.component.chatapi.common.handler.ChatCommandHandlerFactoriesProvider
import fr.outadoc.justchatting.component.chatapi.common.pubsub.PubSubPluginsProvider
import fr.outadoc.justchatting.component.twitch.websocket.irc.IrcMessageMapper
Expand Down Expand Up @@ -37,14 +36,15 @@ import fr.outadoc.justchatting.feature.chat.presentation.FilterAutocompleteItems
import fr.outadoc.justchatting.feature.chat.presentation.StreamAndUserInfoViewModel
import fr.outadoc.justchatting.feature.chat.presentation.mobile.DefaultChatNotifier
import fr.outadoc.justchatting.feature.chat.presentation.mobile.MobileCreateShortcutForChannelUseCase
import fr.outadoc.justchatting.feature.pronouns.data.AlejoPronounsClient
import fr.outadoc.justchatting.feature.pronouns.data.AlejoPronounsApi
import fr.outadoc.justchatting.feature.pronouns.data.AlejoPronounsClient
import fr.outadoc.justchatting.feature.pronouns.domain.PronounsApi
import fr.outadoc.justchatting.feature.pronouns.domain.PronounsRepository
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.core.module.Module
import org.koin.dsl.module

val chatModule = module {
public val chatModule: Module = module {

viewModel { ChatViewModel(get(), get(), get(), get(), get(), get(), get(), get(), get()) }
viewModel { StreamAndUserInfoViewModel(get()) }
Expand All @@ -61,17 +61,11 @@ val chatModule = module {

single {
ChatCommandHandlerFactoriesProvider {
if (BuildConfig.ENABLE_MOCK_IRC_ENDPOINT) {
listOf(
get<MockChatWebSocket.Factory>(),
)
} else {
listOf(
get<LiveChatWebSocket.Factory>(),
get<LoggedInChatWebSocket.Factory>(),
get<PubSubWebSocket.Factory>(),
)
}
listOf(
get<LiveChatWebSocket.Factory>(),
get<LoggedInChatWebSocket.Factory>(),
get<PubSubWebSocket.Factory>(),
)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ import fr.outadoc.justchatting.component.chatapi.db.RecentChannelQueries
import fr.outadoc.justchatting.component.chatapi.db.RecentChannelsDao
import fr.outadoc.justchatting.component.chatapi.db.RecentEmoteQueries
import fr.outadoc.justchatting.component.chatapi.db.RecentEmotesDao
import org.koin.core.module.Module
import org.koin.dsl.module

val dbModule = module {
public val dbModule: Module = module {

single<SqlDriver> {
AndroidSqliteDriver(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import fr.outadoc.justchatting.feature.home.presentation.ChannelSearchViewModel
import fr.outadoc.justchatting.feature.home.presentation.FollowedChannelsViewModel
import fr.outadoc.justchatting.feature.home.presentation.FollowedStreamsViewModel
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.core.module.Module
import org.koin.dsl.module

val homeModule = module {
public val homeModule: Module = module {
viewModel { ChannelSearchViewModel(get()) }
viewModel { FollowedChannelsViewModel(get()) }
viewModel { FollowedStreamsViewModel(get()) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.koin.core.KoinApplication
import org.koin.core.context.startKoin

@Suppress("unused")
class KoinInitializer : Initializer<KoinApplication> {
public class KoinInitializer : Initializer<KoinApplication> {

override fun dependencies(): List<Class<out Initializer<*>>> = emptyList()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import fr.outadoc.justchatting.utils.http.AndroidHttpClientProvider
import fr.outadoc.justchatting.utils.http.BaseHttpClientProvider
import fr.outadoc.justchatting.utils.http.TwitchHttpClientProvider
import kotlinx.datetime.Clock
import org.koin.core.module.Module
import org.koin.core.qualifier.named
import org.koin.dsl.module

val mainModule = module {
public val mainModule: Module = module {
single<Clock> { Clock.System }
single<ConnectivityManager> { get<Context>().getSystemService()!! }
single<NetworkStateObserver> { AndroidNetworkStateObserver(get()) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package fr.outadoc.justchatting.di

import fr.outadoc.justchatting.feature.home.presentation.MainRouterViewModel
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.core.module.Module
import org.koin.dsl.module

val mainNavigationModule = module {
public val mainNavigationModule: Module = module {
viewModel { MainRouterViewModel(get(), get(), get(), get()) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import fr.outadoc.justchatting.feature.preferences.presentation.LogRepository
import fr.outadoc.justchatting.feature.preferences.presentation.ReadExternalDependenciesList
import fr.outadoc.justchatting.feature.preferences.presentation.SettingsViewModel
import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.core.module.Module
import org.koin.dsl.module

val settingsModule = module {
public val settingsModule: Module = module {
viewModel { SettingsViewModel(get(), get(), get()) }
single<LogRepository> { AndroidLogRepository(get()) }
single<ReadExternalDependenciesList> { DefaultReadExternalDependenciesList(get()) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ import fr.outadoc.justchatting.component.twitch.websocket.irc.recent.RecentMessa
import fr.outadoc.justchatting.component.twitch.websocket.irc.recent.RecentMessagesServer
import fr.outadoc.justchatting.utils.core.DefaultJson
import kotlinx.serialization.json.Json
import org.koin.core.module.Module
import org.koin.core.qualifier.named
import org.koin.dsl.module

val twitchModule = module {
public val twitchModule: Module = module {
single<Json> { DefaultJson }

single {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.content.Context
import androidx.core.graphics.drawable.IconCompat
import fr.outadoc.justchatting.component.chatapi.domain.model.User

fun User.getProfileImageIcon(context: Context): IconCompat =
internal fun User.getProfileImageIcon(context: Context): IconCompat =
IconCompat.createWithContentUri(
UserProfileImageContentProvider.createForUser(context, login).toString(),
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import org.koin.android.ext.android.inject
import java.io.FileNotFoundException
import java.io.FileOutputStream

class UserProfileImageContentProvider : ContentProvider() {
public class UserProfileImageContentProvider : ContentProvider() {

companion object {
internal companion object {

private const val PATH_LOGIN = "login"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import fr.outadoc.justchatting.feature.chat.domain.ChatRepository
import fr.outadoc.justchatting.utils.logging.logInfo
import org.koin.android.ext.android.inject

class ChatConnectionService : Service() {
internal class ChatConnectionService : Service() {

companion object {
private const val ACTION_REPLY = "reply"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package fr.outadoc.justchatting.feature.chat.presentation
import android.content.Context
import fr.outadoc.justchatting.component.chatapi.domain.model.User

interface ChatNotifier {
internal interface ChatNotifier {
val areNotificationsEnabled: Boolean
fun notify(context: Context, user: User)
fun dismissNotification(context: Context, channelId: String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import android.graphics.Bitmap
import coil.size.Size
import coil.transform.Transformation

class CoilReducedAnimationTransformation : Transformation {
internal class CoilReducedAnimationTransformation : Transformation {

override val cacheKey: String = "CoilReducedAnimationTransformation"
override suspend fun transform(input: Bitmap, size: Size): Bitmap = input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import fr.outadoc.justchatting.feature.chat.presentation.getBestUrl
import fr.outadoc.justchatting.utils.ui.isDark

@Composable
fun BadgeItem(
internal fun BadgeItem(
modifier: Modifier = Modifier,
badge: TwitchBadge,
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import org.koin.androidx.compose.getViewModel
import org.koin.compose.koinInject

@Composable
fun ChannelChatScreen(channelLogin: String) {
internal fun ChannelChatScreen(channelLogin: String) {
val viewModel: ChatViewModel = getViewModel()
val state by viewModel.state.collectAsState()
val inputState by viewModel.inputState.collectAsState()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.FocusRequester
import androidx.compose.ui.focus.focusRequester
Expand All @@ -53,7 +52,7 @@ import fr.outadoc.justchatting.utils.ui.shortToast

@ScreenPreviews
@Composable
fun ChannelChatScreenLoadingPreview() {
internal fun ChannelChatScreenLoadingPreview() {
AppTheme {
ChannelChatScreenContent(
state = ChatViewModel.State.Initial,
Expand All @@ -64,9 +63,9 @@ fun ChannelChatScreenLoadingPreview() {
}
}

@OptIn(ExperimentalComposeUiApi::class, ExperimentalMaterial3Api::class)
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ChannelChatScreenContent(
internal fun ChannelChatScreenContent(
modifier: Modifier = Modifier,
state: ChatViewModel.State,
inputState: ChatViewModel.InputState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import androidx.emoji2.text.DefaultEmojiCompatConfig
import androidx.emoji2.text.EmojiCompat
import fr.outadoc.justchatting.utils.ui.AppTheme

class ChatActivity : AppCompatActivity() {
public class ChatActivity : AppCompatActivity() {

companion object {
internal companion object {
private const val CHANNEL_LOGIN = "channel_login"

fun createIntent(context: Context, channelLogin: String): Intent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import fr.outadoc.justchatting.utils.ui.AppTheme
import fr.outadoc.justchatting.utils.ui.ThemePreviews

@Composable
fun AutoCompleteEmoteItem(
internal fun AutoCompleteEmoteItem(
modifier: Modifier = Modifier,
onClick: () -> Unit,
emote: Emote,
Expand All @@ -41,7 +41,7 @@ fun AutoCompleteEmoteItem(
}

@Composable
fun AutoCompleteUserItem(
internal fun AutoCompleteUserItem(
modifier: Modifier = Modifier,
onClick: () -> Unit,
chatter: Chatter,
Expand All @@ -57,7 +57,7 @@ fun AutoCompleteUserItem(

@ThemePreviews
@Composable
fun AutoCompleteItemPreviewSimple() {
internal fun AutoCompleteItemPreviewSimple() {
AppTheme {
SuggestionChip(
onClick = {},
Expand All @@ -70,7 +70,7 @@ fun AutoCompleteItemPreviewSimple() {

@ThemePreviews
@Composable
fun AutoCompleteItemPreviewIcon() {
internal fun AutoCompleteItemPreviewIcon() {
AppTheme {
SuggestionChip(
onClick = {},
Expand All @@ -82,7 +82,7 @@ fun AutoCompleteItemPreviewIcon() {
}

@Composable
fun SuggestionChip(
internal fun SuggestionChip(
modifier: Modifier = Modifier,
onClick: () -> Unit,
clickLabel: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import fr.outadoc.justchatting.utils.ui.AppTheme

@Preview
@Composable
fun ChatAutoCompleteRowPreview() {
internal fun ChatAutoCompleteRowPreview() {
AppTheme {
val items = listOf(
AutoCompleteItem.User(
Expand Down Expand Up @@ -45,7 +45,7 @@ fun ChatAutoCompleteRowPreview() {
}

@Composable
fun ChatAutoCompleteRow(
internal fun ChatAutoCompleteRow(
modifier: Modifier = Modifier,
onChatterClick: (Chatter) -> Unit,
onEmoteClick: (Emote) -> Unit,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import kotlinx.datetime.Instant
import kotlin.time.Duration.Companion.minutes

@Composable
fun ChatEvents(
internal fun ChatEvents(
modifier: Modifier = Modifier,
insets: PaddingValues,
roomState: RoomState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,19 @@ private val badgePlaceholder = Placeholder(
placeholderVerticalAlign = PlaceholderVerticalAlign.TextCenter,
)

fun emoteTextContent(emote: Emote): InlineTextContent =
internal fun emoteTextContent(emote: Emote): InlineTextContent =
InlineTextContent(emotePlaceholder) {
EmoteItem(
emote = emote,
)
}

fun badgeTextContent(badge: TwitchBadge): InlineTextContent =
internal fun badgeTextContent(badge: TwitchBadge): InlineTextContent =
InlineTextContent(badgePlaceholder) {
BadgeItem(badge = badge)
}

fun cheerEmoteTextContent(cheer: Emote): InlineTextContent {
internal fun cheerEmoteTextContent(cheer: Emote): InlineTextContent {
val textWidthEm: Float = cheer.bitsValue?.let { it.formatNumber().length / 1.8f } ?: 0f
return InlineTextContent(
Placeholder(
Expand All @@ -53,7 +53,7 @@ fun cheerEmoteTextContent(cheer: Emote): InlineTextContent {
}
}

fun previewTextContent(): InlineTextContent =
internal fun previewTextContent(): InlineTextContent =
InlineTextContent(badgePlaceholder) {
Icon(Icons.Default.Token, contentDescription = null)
}
Loading

0 comments on commit c2baf79

Please sign in to comment.