Skip to content

Commit 04808ca

Browse files
authored
Merge pull request #1304 from DimensionDev/feature/ios_settings
add more settings to ios
2 parents 6071972 + 278f435 commit 04808ca

File tree

102 files changed

+3444
-2264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+3444
-2264
lines changed

app/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ dependencies {
141141
coreLibraryDesugaring(libs.desugar.jdk.libs)
142142
implementation(libs.compose.webview)
143143
implementation(projects.shared)
144-
implementation(projects.shared.ui)
145144
implementation(projects.composeUi)
146145
implementation(libs.androidx.splash)
147146
implementation(libs.materialKolor)
@@ -180,10 +179,10 @@ ktlint {
180179
}
181180
}
182181

183-
if (project.file("google-services.json").exists()) {
182+
if (project.file("google-services.json").exists()) {
184183
afterEvaluate {
185184
val uploadCrashlyticsMappingFileRelease by tasks
186185
val processDebugGoogleServices by tasks
187186
uploadCrashlyticsMappingFileRelease.dependsOn(processDebugGoogleServices)
188187
}
189-
}
188+
}

app/src/main/java/dev/dimension/flare/ui/screen/home/TabSettingScreen.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ import dev.dimension.flare.ui.model.map
4848
import dev.dimension.flare.ui.model.onSuccess
4949
import dev.dimension.flare.ui.presenter.home.UserPresenter
5050
import dev.dimension.flare.ui.presenter.invoke
51+
import dev.dimension.flare.ui.screen.settings.AllTabsPresenter
5152
import dev.dimension.flare.ui.screen.settings.EditTabDialog
5253
import dev.dimension.flare.ui.screen.settings.TabAddBottomSheet
5354
import dev.dimension.flare.ui.screen.settings.TabCustomItem
54-
import dev.dimension.flare.ui.screen.settings.allTabsPresenter
5555
import dev.dimension.flare.ui.theme.screenHorizontalPadding
5656
import kotlinx.collections.immutable.toImmutableList
5757
import kotlinx.coroutines.CoroutineScope
@@ -227,7 +227,7 @@ private fun presenter(
227227
)
228228
}.invoke()
229229
var selectedEditTab by remember { mutableStateOf<TabItem?>(null) }
230-
val allTabsState = allTabsPresenter(filterIsTimeline = true)
230+
val allTabsState = remember { AllTabsPresenter(filterIsTimeline = true) }.invoke()
231231
val tabSettings by settingsRepository.tabSettings.collectAsUiState()
232232
val cacheTabs =
233233
remember {

app/src/main/java/dev/dimension/flare/ui/screen/misskey/MisskeyEntryBuilder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ internal fun EntryProviderBuilder<NavKey>.misskeyEntryBuilder(
5858
tabItem = remember(args) {
5959
Misskey.AntennasTimelineTabItem(
6060
account = args.accountType,
61-
id = args.antennaId,
61+
antennasId = args.antennaId,
6262
metaData = TabMetaData(
6363
title = TitleType.Text(args.title),
6464
icon = IconType.Material(IconType.Material.MaterialIcon.Rss),

app/src/main/java/dev/dimension/flare/ui/screen/settings/LocalFilterEditDialog.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ private fun presenter(keyword: String?) =
211211

212212
state.items.onSuccess {
213213
LaunchedEffect(Unit) {
214-
it.toImmutableList().find { it.keyword == keyword }?.let { item ->
214+
it.find { it.keyword == keyword }?.let { item ->
215215
forTimeline = item.forTimeline
216216
forNotification = item.forNotification
217217
forSearch = item.forSearch

app/src/main/java/dev/dimension/flare/ui/screen/settings/TabAddBottomSheet.kt

Lines changed: 86 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ import kotlinx.coroutines.launch
7878
@Composable
7979
internal fun TabAddBottomSheet(
8080
tabs: ImmutableList<TabItem>,
81-
allTabs: AllTabsState,
81+
allTabs: AllTabsPresenter.State,
8282
onDismissRequest: () -> Unit,
8383
onAddTab: (TabItem) -> Unit,
8484
onDeleteTab: (String) -> Unit,
@@ -149,7 +149,7 @@ internal fun TabAddBottomSheet(
149149
},
150150
modifier = Modifier.clip(CircleShape),
151151
)
152-
tabs.forEachIndexed { index, tabState ->
152+
tabs.forEachIndexed { index, tab ->
153153
LeadingIconTab(
154154
modifier = Modifier.clip(CircleShape),
155155
selected = pagerState.currentPage == index + 2,
@@ -159,35 +159,31 @@ internal fun TabAddBottomSheet(
159159
}
160160
},
161161
text = {
162-
tabState.onSuccess { tab ->
163-
Row(
164-
verticalAlignment = Alignment.CenterVertically,
165-
horizontalArrangement = Arrangement.spacedBy(8.dp),
166-
) {
167-
RichText(
168-
text = tab.profile.name,
169-
maxLines = 1,
170-
overflow = TextOverflow.Ellipsis,
171-
)
172-
Text(
173-
text = tab.profile.handle,
174-
style = MaterialTheme.typography.bodySmall,
175-
modifier =
176-
Modifier
177-
.alpha(MediumAlpha),
178-
maxLines = 1,
179-
overflow = TextOverflow.Ellipsis,
180-
)
181-
}
162+
Row(
163+
verticalAlignment = Alignment.CenterVertically,
164+
horizontalArrangement = Arrangement.spacedBy(8.dp),
165+
) {
166+
RichText(
167+
text = tab.profile.name,
168+
maxLines = 1,
169+
overflow = TextOverflow.Ellipsis,
170+
)
171+
Text(
172+
text = tab.profile.handle,
173+
style = MaterialTheme.typography.bodySmall,
174+
modifier =
175+
Modifier
176+
.alpha(MediumAlpha),
177+
maxLines = 1,
178+
overflow = TextOverflow.Ellipsis,
179+
)
182180
}
183181
},
184182
icon = {
185-
tabState.onSuccess { tab ->
186-
AvatarComponent(
187-
tab.profile.avatar,
188-
size = 24.dp,
189-
)
190-
}
183+
AvatarComponent(
184+
tab.profile.avatar,
185+
size = 24.dp,
186+
)
191187
},
192188
)
193189
}
@@ -278,82 +274,85 @@ internal fun TabAddBottomSheet(
278274
verticalArrangement = Arrangement.spacedBy(8.dp),
279275
modifier = Modifier.fillMaxWidth(),
280276
) {
281-
val tabState = tabs[it - 2]
282-
tabState.onSuccess { tab ->
283-
var selectedIndex by remember { mutableStateOf(0) }
284-
if (tab.extraTabs.any()) {
285-
val items =
286-
listOf(
287-
stringResource(id = R.string.tab_settings_default),
288-
) +
289-
tab.extraTabs
290-
.map {
291-
when (it) {
292-
is PinnableTimelineTabPresenter.State.Tab.Feed ->
293-
R.string.tab_settings_feed
277+
val tab = tabs[it - 2]
278+
var selectedIndex by remember { mutableStateOf(0) }
279+
if (tab.extraTabs.any()) {
280+
val items =
281+
listOf(
282+
stringResource(id = R.string.tab_settings_default),
283+
) +
284+
tab.extraTabs
285+
.map {
286+
when (it) {
287+
is PinnableTimelineTabPresenter.State.Tab.Feed ->
288+
R.string.tab_settings_feed
294289

295-
is PinnableTimelineTabPresenter.State.Tab.List ->
296-
R.string.tab_settings_list
290+
is PinnableTimelineTabPresenter.State.Tab.List ->
291+
R.string.tab_settings_list
297292

298-
is PinnableTimelineTabPresenter.State.Tab.Antenna ->
299-
R.string.home_tab_antennas_title
300-
}
301-
}.map { stringResource(id = it) }
302-
ButtonGroup(
303-
overflowIndicator = {},
304-
horizontalArrangement = Arrangement.spacedBy(4.dp, Alignment.CenterHorizontally),
305-
modifier = Modifier.fillMaxWidth(),
293+
is PinnableTimelineTabPresenter.State.Tab.Antenna ->
294+
R.string.home_tab_antennas_title
295+
}
296+
}.map { stringResource(id = it) }
297+
ButtonGroup(
298+
overflowIndicator = {},
299+
horizontalArrangement =
300+
Arrangement.spacedBy(
301+
4.dp,
302+
Alignment.CenterHorizontally,
303+
),
304+
modifier = Modifier.fillMaxWidth(),
305+
) {
306+
items.forEachIndexed { index, text ->
307+
toggleableItem(
308+
checked = selectedIndex == index,
309+
onCheckedChange = { selectedIndex = index },
310+
label = text,
311+
)
312+
}
313+
}
314+
}
315+
when (selectedIndex) {
316+
0 -> {
317+
LazyColumn(
318+
contentPadding = PaddingValues(horizontal = screenHorizontalPadding),
319+
verticalArrangement = Arrangement.spacedBy(2.dp),
306320
) {
307-
items.forEachIndexed { index, text ->
308-
toggleableItem(
309-
checked = selectedIndex == index,
310-
onCheckedChange = { selectedIndex = index },
311-
label = text,
321+
itemsIndexed(tab.tabs) { index, it ->
322+
TabItem(
323+
it,
324+
modifier =
325+
Modifier
326+
.listCard(
327+
index = index,
328+
totalCount = tab.tabs.size,
329+
),
312330
)
313331
}
314332
}
315333
}
316-
when (selectedIndex) {
317-
0 -> {
318-
LazyColumn(
319-
contentPadding = PaddingValues(horizontal = screenHorizontalPadding),
320-
verticalArrangement = Arrangement.spacedBy(2.dp),
321-
) {
322-
itemsIndexed(tab.tabs) { index, it ->
334+
335+
else -> {
336+
LazyColumn(
337+
contentPadding = PaddingValues(horizontal = screenHorizontalPadding),
338+
verticalArrangement = Arrangement.spacedBy(2.dp),
339+
) {
340+
val data =
341+
tab.extraTabs.elementAtOrNull(selectedIndex - 1)?.data
342+
if (data != null) {
343+
itemsIndexed(data) { index, totalCount, item ->
323344
TabItem(
324-
it,
345+
remember(item) { item.toTabItem(accountKey = tab.profile.key) },
325346
modifier =
326347
Modifier
327348
.listCard(
328349
index = index,
329-
totalCount = tab.tabs.size,
350+
totalCount = totalCount,
330351
),
331352
)
332353
}
333354
}
334355
}
335-
336-
else -> {
337-
LazyColumn(
338-
contentPadding = PaddingValues(horizontal = screenHorizontalPadding),
339-
verticalArrangement = Arrangement.spacedBy(2.dp),
340-
) {
341-
val data = tab.extraTabs.elementAtOrNull(selectedIndex - 1)?.data
342-
if (data != null) {
343-
itemsIndexed(data) { index, totalCount, item ->
344-
TabItem(
345-
remember(item) { item.toTabItem(accountKey = tab.profile.key) },
346-
modifier =
347-
Modifier
348-
.listCard(
349-
index = index,
350-
totalCount = totalCount,
351-
),
352-
)
353-
}
354-
}
355-
}
356-
}
357356
}
358357
}
359358
}

app/src/main/java/dev/dimension/flare/ui/screen/settings/TabCustomizeScreen.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ import dev.dimension.flare.ui.component.listCard
6969
import dev.dimension.flare.ui.model.UiProfile
7070
import dev.dimension.flare.ui.model.collectAsUiState
7171
import dev.dimension.flare.ui.model.onSuccess
72+
import dev.dimension.flare.ui.presenter.invoke
7273
import dev.dimension.flare.ui.presenter.list.PinnableTimelineTabPresenter
7374
import dev.dimension.flare.ui.theme.screenHorizontalPadding
7475
import kotlinx.collections.immutable.ImmutableList
@@ -393,7 +394,7 @@ private fun presenter(
393394
// val except = remember(cacheTabs) {
394395
// cacheTabs.map { it.key }.toImmutableList()
395396
// }
396-
val allTabs = allTabsPresenter()
397+
val allTabs = remember { AllTabsPresenter() }.invoke()
397398

398399
object {
399400
val tabs = cacheTabs

compose-ui/src/androidMain/kotlin/dev/dimension/flare/ui/component/platform/PlatformIcon.android.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import androidx.compose.material3.Icon
44
import androidx.compose.runtime.Composable
55
import androidx.compose.ui.Modifier
66
import androidx.compose.ui.graphics.Color
7+
import androidx.compose.ui.graphics.painter.Painter
78
import androidx.compose.ui.graphics.vector.ImageVector
89

910
@Composable
@@ -20,3 +21,18 @@ internal actual fun PlatformIcon(
2021
tint = tint,
2122
)
2223
}
24+
25+
@Composable
26+
internal actual fun PlatformIcon(
27+
painter: Painter,
28+
contentDescription: String?,
29+
modifier: Modifier,
30+
tint: Color,
31+
) {
32+
Icon(
33+
painter = painter,
34+
contentDescription = contentDescription,
35+
modifier = modifier,
36+
tint = tint,
37+
)
38+
}

shared/ui/src/commonMain/composeResources/drawable/ic_launcher_foreground.xml renamed to compose-ui/src/commonMain/composeResources/drawable/ic_launcher_foreground.xml

File renamed without changes.

shared/ui/src/commonMain/composeResources/drawable/ic_logo_text.xml renamed to compose-ui/src/commonMain/composeResources/drawable/ic_logo_text.xml

File renamed without changes.

compose-ui/src/commonMain/composeResources/values/strings.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<resources>
2+
<string name="app_name" translatable="false">Flare</string>
23
<string name="delete">Delete</string>
34

45
<string name="profile_header_following_count">%1$s Following</string>
@@ -463,4 +464,16 @@
463464
<string name="antenna_title">Antenna</string>
464465
<string name="mixed_timeline_title">Mixed</string>
465466

467+
468+
<string name="settings_about_description">The ultimate next generation open-sourced AI powered decentralized social network client.</string>
469+
<string name="settings_about_source_code">Source code</string>
470+
<string name="settings_about_telegram">Telegram</string>
471+
<string name="settings_about_telegram_description">Join our Telegram group</string>
472+
<string name="settings_about_discord" translatable="false">Discord</string>
473+
<string name="settings_about_discord_description">Join our Discord server</string>
474+
<string name="settings_about_line" translatable="false">Line</string>
475+
<string name="settings_about_line_description">Join our Line group</string>
476+
<string name="settings_about_localization">Crowdin</string>
477+
<string name="settings_about_localization_description">Help us translate Flare</string>
478+
<string name="settings_privacy_policy">Privacy Policy</string>
466479
</resources>

0 commit comments

Comments
 (0)