forked from DroidKaigi/conference-app-2024
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DroidKaigi#880 from Corvus400/feature/display_snac…
…k_bar_compose_multiplatform_timetable_detail_screen ✨ [Compose Multiplatform] When you don't have permission to access the calendar on the session details screen, the snack bar is displayed.
- Loading branch information
Showing
7 changed files
with
121 additions
and
16 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
app-ios-shared/src/commonMain/composeResources/values-ja/strings.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="permission_required">セッションを予定として追加するには、カレンダーへのアクセス権限が必要です。</string> | ||
</resources> |
4 changes: 4 additions & 0 deletions
4
app-ios-shared/src/commonMain/composeResources/values/strings.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="permission_required">To add a session as a scheduled event, you need access permission to the calendar.</string> | ||
</resources> |
8 changes: 8 additions & 0 deletions
8
...ios-shared/src/commonMain/kotlin/io/github/droidkaigi/confsched/shared/AppIosSharedRes.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.github.droidkaigi.confsched.shared | ||
|
||
import conference_app_2024.app_ios_shared.generated.resources.Res | ||
|
||
object AppIosSharedRes { | ||
val drawable = Res.drawable | ||
val string = Res.string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...rc/commonMain/kotlin/io/github/droidkaigi/confsched/shared/IosComposeKaigiAppPresenter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.github.droidkaigi.confsched.shared | ||
|
||
import androidx.compose.runtime.Composable | ||
import io.github.droidkaigi.confsched.compose.EventEffect | ||
import io.github.droidkaigi.confsched.compose.EventFlow | ||
import io.github.droidkaigi.confsched.droidkaigiui.providePresenterDefaults | ||
import io.github.droidkaigi.confsched.shared.IosComposeKaigiAppEvent.ShowRequiresAuthorization | ||
|
||
sealed interface IosComposeKaigiAppEvent { | ||
val snackbarMessage: String | ||
|
||
data class ShowRequiresAuthorization( | ||
override val snackbarMessage: String, | ||
) : IosComposeKaigiAppEvent | ||
} | ||
|
||
@Composable | ||
fun iosComposeKaigiAppPresenter( | ||
events: EventFlow<IosComposeKaigiAppEvent> | ||
) : IosComposeKaigiAppUiState = providePresenterDefaults { userMessageStateHolder -> | ||
EventEffect(events) { event -> | ||
when (event) { | ||
is ShowRequiresAuthorization -> { | ||
userMessageStateHolder.showMessage( | ||
message = event.snackbarMessage, | ||
// TODO Add code to transition to the settings screen when the action button is pressed. | ||
// TODO Perhaps UIApplication.openSettingsURLString can be used to achieve this. | ||
actionLabel = null, | ||
) | ||
} | ||
} | ||
} | ||
IosComposeKaigiAppUiState(userMessageStateHolder) | ||
} |
9 changes: 9 additions & 0 deletions
9
...in/io/github/droidkaigi/confsched/droidkaigiui/compositionlocal/LocalSnackbarHostState.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package io.github.droidkaigi.confsched.droidkaigiui.compositionlocal | ||
|
||
import androidx.compose.material3.SnackbarHostState | ||
import androidx.compose.runtime.compositionLocalOf | ||
|
||
@Suppress("CompositionLocalAllowlist") | ||
val LocalSnackbarHostState = compositionLocalOf<SnackbarHostState?> { | ||
null | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters