Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/src/main/java/dev/dimension/flare/ui/route/Route.kt
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ internal sealed interface Route : NavKey {
@Serializable
data object LocalFilter : Settings

@Serializable
data object GuestSetting : Settings

@Serializable
data object LocalHistory : Settings

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import compose.icons.fontawesomeicons.solid.ClockRotateLeft
import compose.icons.fontawesomeicons.solid.Database
import compose.icons.fontawesomeicons.solid.Filter
import compose.icons.fontawesomeicons.solid.Gear
import compose.icons.fontawesomeicons.solid.Globe
import compose.icons.fontawesomeicons.solid.Language
import compose.icons.fontawesomeicons.solid.Palette
import compose.icons.fontawesomeicons.solid.PenToSquare
Expand Down Expand Up @@ -97,7 +96,6 @@ internal fun SettingsScreen(
toColorSpace: () -> Unit,
toTabCustomization: () -> Unit,
toLocalFilter: () -> Unit,
toGuestSettings: () -> Unit,
toLocalHistory: () -> Unit,
toDraftBox: () -> Unit,
toAiConfig: () -> Unit,
Expand Down Expand Up @@ -168,29 +166,6 @@ internal fun SettingsScreen(
},
)
}

state.user
.onError {
SegmentedListItem(
onClick = {
toGuestSettings.invoke()
},
shapes = ListItemDefaults.single(),
content = {
Text(text = stringResource(id = R.string.settings_guest_setting_title))
},
leadingContent = {
ThemedIcon(
imageVector = FontAwesomeIcons.Solid.Globe,
contentDescription = stringResource(id = R.string.settings_guest_setting_title),
color = ThemeIconData.Color.SapphireBlue,
)
},
supportingContent = {
Text(text = stringResource(id = R.string.settings_guest_setting_description))
},
)
}
Column(
verticalArrangement = Arrangement.spacedBy(ListItemDefaults.SegmentedGap),
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ internal fun EntryProviderScope<NavKey>.settingsSelectEntryBuilder(
toLocalFilter = {
navigate(Route.Settings.LocalFilter)
},
toGuestSettings = {
navigate(Route.Settings.GuestSetting)
},
toLocalHistory = {
navigate(Route.Settings.LocalHistory)
},
Expand Down Expand Up @@ -142,14 +139,6 @@ internal fun EntryProviderScope<NavKey>.settingsSelectEntryBuilder(
)
}

entry<Route.Settings.GuestSetting>(
metadata = DialogSceneStrategy.dialog()
) {
GuestSettingScreen(
onBack = onBack
)
}

entry<Route.Settings.LocalHistory>(
metadata = ListDetailSceneStrategy.detailPane(
sceneKey = "Settings"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,13 @@ import dev.dimension.flare.data.datastore.model.ComposeConfigData
import dev.dimension.flare.data.datastore.model.ComposeConfigDataSerializer
import dev.dimension.flare.data.datastore.model.FlareConfig
import dev.dimension.flare.data.datastore.model.FlareConfigSerializer
import dev.dimension.flare.data.datastore.model.GuestData
import dev.dimension.flare.data.datastore.model.GuestDataSerializer
import dev.dimension.flare.data.io.PlatformPathProducer
import okio.FileSystem
import okio.SYSTEM

internal class AppDataStore(
private val platformPathProducer: PlatformPathProducer,
) {
val guestDataStore: DataStore<GuestData> by lazy {
DataStoreFactory.create(
storage =
OkioStorage(
fileSystem = FileSystem.SYSTEM,
serializer = GuestDataSerializer,
producePath = {
platformPathProducer.dataStoreFile("guest_data.pb")
},
),
)
}

val flareDataStore: DataStore<FlareConfig> by lazy {
DataStoreFactory.create(
storage =
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,12 @@ internal fun accountServiceFlow(
): Flow<MicroblogDataSource> =
when (accountType) {
AccountType.Guest -> {
val guestData = repository.appDataStore.guestDataStore.data
guestData.map {
it.platformType.spec.guestDataSource(
host = it.host,
flowOf(
PlatformType.Mastodon.spec.guestDataSource(
host = "mastodon.social",
locale = Locale.language,
)
}
),
)
}

is AccountType.Specific -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import kotlin.io.encoding.Base64
@Immutable
@Serializable
public enum class PlatformType {
Nostr,
Mastodon,
Misskey,
Bluesky,
Expand All @@ -17,6 +16,7 @@ public enum class PlatformType {
xQt,

VVo,
Nostr,
}

@Immutable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.flow.flow
Expand Down Expand Up @@ -85,7 +86,9 @@ public class ProfilePresenter(
service.accountKey
} else {
null
} ?: throw NoActiveAccountException
} ?: run {
throw NoActiveAccountException
}
(service as RelationDataSource).relationHandler.relation(actualUserKey).toUi()
}
}
Expand Down Expand Up @@ -136,7 +139,9 @@ public class ProfilePresenter(
service.accountKey
} else {
null
} ?: throw NoActiveAccountException
} ?: run {
throw NoActiveAccountException
}

service
.profileTabs(actualUserKey)
Expand Down Expand Up @@ -195,7 +200,7 @@ public class ProfilePresenter(
combine(
isListDataSourceFlow,
userStateFlow.map { it.takeSuccess() },
myAccountKeyFlow,
myAccountKeyFlow.map { it as MicroBlogKey? }.catch { emit(null) },
) { isListDataSource, user, myAccountKey ->
Pair(
isListDataSource,
Expand All @@ -216,10 +221,6 @@ public class ProfilePresenter(
}
}

private val isGuestMode by lazy {
accountType == AccountType.Guest
}

@Composable
override fun body(): ProfileState {
val service by serviceFlow.collectAsUiState()
Expand Down
Loading
Loading