diff --git a/openfeedback-m3/api/openfeedback-m3.api b/openfeedback-m3/api/openfeedback-m3.api index 400a76a..45b520e 100644 --- a/openfeedback-m3/api/openfeedback-m3.api +++ b/openfeedback-m3/api/openfeedback-m3.api @@ -69,12 +69,16 @@ public final class io/openfeedback/m3/ComposableSingletons$VoteItemsPreviewKt { public final fun getLambda-2$openfeedback_m3_release ()Lkotlin/jvm/functions/Function2; } +public final class io/openfeedback/m3/FeedbackNotReadyKt { + public static final fun FeedbackNotReady-3IgeMak (Landroidx/compose/ui/Modifier;JLandroidx/compose/foundation/layout/PaddingValues;Landroidx/compose/runtime/Composer;II)V +} + public final class io/openfeedback/m3/LoadingKt { public static final fun Loading (Landroidx/compose/ui/Modifier;Landroidx/compose/runtime/Composer;II)V } public final class io/openfeedback/m3/OpenFeedbackLayoutKt { - public static final fun OpenFeedbackLayout (Lio/openfeedback/ui/models/UISessionFeedback;Landroidx/compose/ui/Modifier;ILandroidx/compose/foundation/layout/Arrangement$Horizontal;Landroidx/compose/foundation/layout/Arrangement$Vertical;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;II)V + public static final fun OpenFeedbackLayout (Lio/openfeedback/ui/models/UISessionFeedback;Landroidx/compose/ui/Modifier;IZLandroidx/compose/foundation/layout/Arrangement$Horizontal;Landroidx/compose/foundation/layout/Arrangement$Vertical;Lkotlin/jvm/functions/Function4;Lkotlin/jvm/functions/Function3;Lkotlin/jvm/functions/Function4;Landroidx/compose/runtime/Composer;II)V } public final class io/openfeedback/m3/VoteCardKt { diff --git a/openfeedback-m3/api/openfeedback-m3.klib.api b/openfeedback-m3/api/openfeedback-m3.klib.api index def84e9..47c5e19 100644 --- a/openfeedback-m3/api/openfeedback-m3.klib.api +++ b/openfeedback-m3/api/openfeedback-m3.klib.api @@ -8,6 +8,7 @@ // Library unique name: final fun io.openfeedback.m3/Comment(io.openfeedback.ui.models/UIComment, androidx.compose.ui/Modifier?, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.graphics/Shape?, kotlin/Function1, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.openfeedback.m3/Comment|Comment(io.openfeedback.ui.models.UIComment;androidx.compose.ui.Modifier?;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.graphics.Shape?;kotlin.Function1;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] final fun io.openfeedback.m3/CommentInput(kotlin/String, kotlin/Function1, kotlin/Function0, androidx.compose.ui/Modifier?, kotlin/Boolean, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.openfeedback.m3/CommentInput|CommentInput(kotlin.String;kotlin.Function1;kotlin.Function0;androidx.compose.ui.Modifier?;kotlin.Boolean;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] +final fun io.openfeedback.m3/FeedbackNotReady(androidx.compose.ui/Modifier?, androidx.compose.ui.graphics/Color, androidx.compose.foundation.layout/PaddingValues?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.openfeedback.m3/FeedbackNotReady|FeedbackNotReady(androidx.compose.ui.Modifier?;androidx.compose.ui.graphics.Color;androidx.compose.foundation.layout.PaddingValues?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] final fun io.openfeedback.m3/Loading(androidx.compose.ui/Modifier?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.openfeedback.m3/Loading|Loading(androidx.compose.ui.Modifier?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] -final fun io.openfeedback.m3/OpenFeedbackLayout(io.openfeedback.ui.models/UISessionFeedback, androidx.compose.ui/Modifier?, kotlin/Int, androidx.compose.foundation.layout/Arrangement.Horizontal?, androidx.compose.foundation.layout/Arrangement.Vertical?, kotlin/Function4, kotlin/Function3, kotlin/Function4, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.openfeedback.m3/OpenFeedbackLayout|OpenFeedbackLayout(io.openfeedback.ui.models.UISessionFeedback;androidx.compose.ui.Modifier?;kotlin.Int;androidx.compose.foundation.layout.Arrangement.Horizontal?;androidx.compose.foundation.layout.Arrangement.Vertical?;kotlin.Function4;kotlin.Function3;kotlin.Function4;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] +final fun io.openfeedback.m3/OpenFeedbackLayout(io.openfeedback.ui.models/UISessionFeedback, androidx.compose.ui/Modifier?, kotlin/Int, kotlin/Boolean, androidx.compose.foundation.layout/Arrangement.Horizontal?, androidx.compose.foundation.layout/Arrangement.Vertical?, kotlin/Function4, kotlin/Function3, kotlin/Function4, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.openfeedback.m3/OpenFeedbackLayout|OpenFeedbackLayout(io.openfeedback.ui.models.UISessionFeedback;androidx.compose.ui.Modifier?;kotlin.Int;kotlin.Boolean;androidx.compose.foundation.layout.Arrangement.Horizontal?;androidx.compose.foundation.layout.Arrangement.Vertical?;kotlin.Function4;kotlin.Function3;kotlin.Function4;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] final fun io.openfeedback.m3/VoteCard(io.openfeedback.ui.models/UIVoteItem, androidx.compose.ui/Modifier?, androidx.compose.ui.text/TextStyle?, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Color, androidx.compose.ui.graphics/Shape?, kotlin/Function1, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.openfeedback.m3/VoteCard|VoteCard(io.openfeedback.ui.models.UIVoteItem;androidx.compose.ui.Modifier?;androidx.compose.ui.text.TextStyle?;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Color;androidx.compose.ui.graphics.Shape?;kotlin.Function1;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] diff --git a/openfeedback-m3/build.gradle.kts b/openfeedback-m3/build.gradle.kts index 5f4e1fa..f39af6c 100644 --- a/openfeedback-m3/build.gradle.kts +++ b/openfeedback-m3/build.gradle.kts @@ -15,6 +15,7 @@ library( api(projects.openfeedbackUiModels) implementation(kotlinMultiplatformExtension.compose.material3) + implementation(kotlinMultiplatformExtension.compose.materialIconsExtended) } } val androidMain by getting { diff --git a/openfeedback-m3/src/commonMain/kotlin/io/openfeedback/m3/FeedbackNotReady.kt b/openfeedback-m3/src/commonMain/kotlin/io/openfeedback/m3/FeedbackNotReady.kt new file mode 100644 index 0000000..6784714 --- /dev/null +++ b/openfeedback-m3/src/commonMain/kotlin/io/openfeedback/m3/FeedbackNotReady.kt @@ -0,0 +1,82 @@ +package io.openfeedback.m3 + +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Box +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.PaddingValues +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.height +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.size +import androidx.compose.material.icons.Icons +import androidx.compose.material.icons.filled.SentimentDissatisfied +import androidx.compose.material.icons.filled.SentimentNeutral +import androidx.compose.material.icons.filled.SentimentSatisfied +import androidx.compose.material.icons.filled.SentimentVeryDissatisfied +import androidx.compose.material.icons.filled.SentimentVerySatisfied +import androidx.compose.material3.Icon +import androidx.compose.material3.MaterialTheme +import androidx.compose.material3.Surface +import androidx.compose.material3.Text +import androidx.compose.runtime.Composable +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.graphics.Color +import androidx.compose.ui.unit.dp +import io.openfeedback.resources.LocalStrings + +@Composable +fun FeedbackNotReady( + modifier: Modifier = Modifier, + containerColor: Color = MaterialTheme.colorScheme.surfaceContainerHigh, + contentPadding: PaddingValues = PaddingValues(32.dp) +) { + Surface(modifier = modifier, color = containerColor) { + Column( + modifier = Modifier + .fillMaxWidth() + .padding(contentPadding), + ) { + Box( + modifier = Modifier.fillMaxWidth(), + contentAlignment = Alignment.Center + ) { + Row(horizontalArrangement = Arrangement.spacedBy(8.dp)) { + Icon( + imageVector = Icons.Default.SentimentVerySatisfied, + contentDescription = null, + modifier = Modifier.size(32.dp) + ) + Icon( + imageVector = Icons.Default.SentimentSatisfied, + contentDescription = null, + modifier = Modifier.size(32.dp) + ) + Icon( + imageVector = Icons.Default.SentimentNeutral, + contentDescription = null, + modifier = Modifier.size(32.dp) + ) + Icon( + imageVector = Icons.Default.SentimentDissatisfied, + contentDescription = null, + modifier = Modifier.size(32.dp) + ) + Icon( + imageVector = Icons.Default.SentimentVeryDissatisfied, + contentDescription = null, + modifier = Modifier.size(32.dp) + ) + } + } + Spacer(modifier = Modifier.height(16.dp)) + Text( + text = LocalStrings.current.strings.notReady.title, + style = MaterialTheme.typography.titleMedium + ) + Text(text = LocalStrings.current.strings.notReady.description) + } + } +} diff --git a/openfeedback-resources/api/openfeedback-resources.api b/openfeedback-resources/api/openfeedback-resources.api index d614dbb..f7ff823 100644 --- a/openfeedback-resources/api/openfeedback-resources.api +++ b/openfeedback-resources/api/openfeedback-resources.api @@ -25,6 +25,20 @@ public final class io/openfeedback/resources/LocalStringsKt { public static final fun getLocalStrings ()Landroidx/compose/runtime/ProvidableCompositionLocal; } +public final class io/openfeedback/resources/NotReadyStrings { + public static final field $stable I + public fun (Ljava/lang/String;Ljava/lang/String;)V + public final fun component1 ()Ljava/lang/String; + public final fun component2 ()Ljava/lang/String; + public final fun copy (Ljava/lang/String;Ljava/lang/String;)Lio/openfeedback/resources/NotReadyStrings; + public static synthetic fun copy$default (Lio/openfeedback/resources/NotReadyStrings;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/openfeedback/resources/NotReadyStrings; + public fun equals (Ljava/lang/Object;)Z + public final fun getDescription ()Ljava/lang/String; + public final fun getTitle ()Ljava/lang/String; + public fun hashCode ()I + public fun toString ()Ljava/lang/String; +} + public final class io/openfeedback/resources/Res { public static final field $stable I public static final field INSTANCE Lio/openfeedback/resources/Res; @@ -59,15 +73,17 @@ public final class io/openfeedback/resources/Res$string { public final class io/openfeedback/resources/Strings { public static final field $stable I - public fun (Lio/openfeedback/resources/CommentStrings;Ljava/lang/String;Ljava/lang/String;)V - public final fun component1 ()Lio/openfeedback/resources/CommentStrings; - public final fun component2 ()Ljava/lang/String; + public fun (Lio/openfeedback/resources/NotReadyStrings;Lio/openfeedback/resources/CommentStrings;Ljava/lang/String;Ljava/lang/String;)V + public final fun component1 ()Lio/openfeedback/resources/NotReadyStrings; + public final fun component2 ()Lio/openfeedback/resources/CommentStrings; public final fun component3 ()Ljava/lang/String; - public final fun copy (Lio/openfeedback/resources/CommentStrings;Ljava/lang/String;Ljava/lang/String;)Lio/openfeedback/resources/Strings; - public static synthetic fun copy$default (Lio/openfeedback/resources/Strings;Lio/openfeedback/resources/CommentStrings;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/openfeedback/resources/Strings; + public final fun component4 ()Ljava/lang/String; + public final fun copy (Lio/openfeedback/resources/NotReadyStrings;Lio/openfeedback/resources/CommentStrings;Ljava/lang/String;Ljava/lang/String;)Lio/openfeedback/resources/Strings; + public static synthetic fun copy$default (Lio/openfeedback/resources/Strings;Lio/openfeedback/resources/NotReadyStrings;Lio/openfeedback/resources/CommentStrings;Ljava/lang/String;Ljava/lang/String;ILjava/lang/Object;)Lio/openfeedback/resources/Strings; public fun equals (Ljava/lang/Object;)Z public final fun getComments ()Lio/openfeedback/resources/CommentStrings; public final fun getFromYou ()Ljava/lang/String; + public final fun getNotReady ()Lio/openfeedback/resources/NotReadyStrings; public final fun getPoweredBy ()Ljava/lang/String; public fun hashCode ()I public fun toString ()Ljava/lang/String; diff --git a/openfeedback-resources/api/openfeedback-resources.klib.api b/openfeedback-resources/api/openfeedback-resources.klib.api index d3cc91d..8a004a5 100644 --- a/openfeedback-resources/api/openfeedback-resources.klib.api +++ b/openfeedback-resources/api/openfeedback-resources.klib.api @@ -28,20 +28,39 @@ final class io.openfeedback.resources/CommentStrings { // io.openfeedback.resour final fun toString(): kotlin/String // io.openfeedback.resources/CommentStrings.toString|toString(){}[0] } +final class io.openfeedback.resources/NotReadyStrings { // io.openfeedback.resources/NotReadyStrings|null[0] + constructor (kotlin/String, kotlin/String) // io.openfeedback.resources/NotReadyStrings.|(kotlin.String;kotlin.String){}[0] + + final val description // io.openfeedback.resources/NotReadyStrings.description|{}description[0] + final fun (): kotlin/String // io.openfeedback.resources/NotReadyStrings.description.|(){}[0] + final val title // io.openfeedback.resources/NotReadyStrings.title|{}title[0] + final fun (): kotlin/String // io.openfeedback.resources/NotReadyStrings.title.|(){}[0] + + final fun component1(): kotlin/String // io.openfeedback.resources/NotReadyStrings.component1|component1(){}[0] + final fun component2(): kotlin/String // io.openfeedback.resources/NotReadyStrings.component2|component2(){}[0] + final fun copy(kotlin/String = ..., kotlin/String = ...): io.openfeedback.resources/NotReadyStrings // io.openfeedback.resources/NotReadyStrings.copy|copy(kotlin.String;kotlin.String){}[0] + final fun equals(kotlin/Any?): kotlin/Boolean // io.openfeedback.resources/NotReadyStrings.equals|equals(kotlin.Any?){}[0] + final fun hashCode(): kotlin/Int // io.openfeedback.resources/NotReadyStrings.hashCode|hashCode(){}[0] + final fun toString(): kotlin/String // io.openfeedback.resources/NotReadyStrings.toString|toString(){}[0] +} + final class io.openfeedback.resources/Strings { // io.openfeedback.resources/Strings|null[0] - constructor (io.openfeedback.resources/CommentStrings, kotlin/String, kotlin/String) // io.openfeedback.resources/Strings.|(io.openfeedback.resources.CommentStrings;kotlin.String;kotlin.String){}[0] + constructor (io.openfeedback.resources/NotReadyStrings, io.openfeedback.resources/CommentStrings, kotlin/String, kotlin/String) // io.openfeedback.resources/Strings.|(io.openfeedback.resources.NotReadyStrings;io.openfeedback.resources.CommentStrings;kotlin.String;kotlin.String){}[0] final val comments // io.openfeedback.resources/Strings.comments|{}comments[0] final fun (): io.openfeedback.resources/CommentStrings // io.openfeedback.resources/Strings.comments.|(){}[0] final val fromYou // io.openfeedback.resources/Strings.fromYou|{}fromYou[0] final fun (): kotlin/String // io.openfeedback.resources/Strings.fromYou.|(){}[0] + final val notReady // io.openfeedback.resources/Strings.notReady|{}notReady[0] + final fun (): io.openfeedback.resources/NotReadyStrings // io.openfeedback.resources/Strings.notReady.|(){}[0] final val poweredBy // io.openfeedback.resources/Strings.poweredBy|{}poweredBy[0] final fun (): kotlin/String // io.openfeedback.resources/Strings.poweredBy.|(){}[0] - final fun component1(): io.openfeedback.resources/CommentStrings // io.openfeedback.resources/Strings.component1|component1(){}[0] - final fun component2(): kotlin/String // io.openfeedback.resources/Strings.component2|component2(){}[0] + final fun component1(): io.openfeedback.resources/NotReadyStrings // io.openfeedback.resources/Strings.component1|component1(){}[0] + final fun component2(): io.openfeedback.resources/CommentStrings // io.openfeedback.resources/Strings.component2|component2(){}[0] final fun component3(): kotlin/String // io.openfeedback.resources/Strings.component3|component3(){}[0] - final fun copy(io.openfeedback.resources/CommentStrings = ..., kotlin/String = ..., kotlin/String = ...): io.openfeedback.resources/Strings // io.openfeedback.resources/Strings.copy|copy(io.openfeedback.resources.CommentStrings;kotlin.String;kotlin.String){}[0] + final fun component4(): kotlin/String // io.openfeedback.resources/Strings.component4|component4(){}[0] + final fun copy(io.openfeedback.resources/NotReadyStrings = ..., io.openfeedback.resources/CommentStrings = ..., kotlin/String = ..., kotlin/String = ...): io.openfeedback.resources/Strings // io.openfeedback.resources/Strings.copy|copy(io.openfeedback.resources.NotReadyStrings;io.openfeedback.resources.CommentStrings;kotlin.String;kotlin.String){}[0] final fun equals(kotlin/Any?): kotlin/Boolean // io.openfeedback.resources/Strings.equals|equals(kotlin.Any?){}[0] final fun hashCode(): kotlin/Int // io.openfeedback.resources/Strings.hashCode|hashCode(){}[0] final fun toString(): kotlin/String // io.openfeedback.resources/Strings.toString|toString(){}[0] @@ -65,6 +84,7 @@ final object io.openfeedback.resources/Res { // io.openfeedback.resources/Res|nu final val io.openfeedback.resources/LocalStrings // io.openfeedback.resources/LocalStrings|{}LocalStrings[0] final fun (): androidx.compose.runtime/ProvidableCompositionLocal> // io.openfeedback.resources/LocalStrings.|(){}[0] final val io.openfeedback.resources/io_openfeedback_resources_CommentStrings$stableprop // io.openfeedback.resources/io_openfeedback_resources_CommentStrings$stableprop|#static{}io_openfeedback_resources_CommentStrings$stableprop[0] +final val io.openfeedback.resources/io_openfeedback_resources_NotReadyStrings$stableprop // io.openfeedback.resources/io_openfeedback_resources_NotReadyStrings$stableprop|#static{}io_openfeedback_resources_NotReadyStrings$stableprop[0] final val io.openfeedback.resources/io_openfeedback_resources_Res$stableprop // io.openfeedback.resources/io_openfeedback_resources_Res$stableprop|#static{}io_openfeedback_resources_Res$stableprop[0] final val io.openfeedback.resources/io_openfeedback_resources_Res_array$stableprop // io.openfeedback.resources/io_openfeedback_resources_Res_array$stableprop|#static{}io_openfeedback_resources_Res_array$stableprop[0] final val io.openfeedback.resources/io_openfeedback_resources_Res_drawable$stableprop // io.openfeedback.resources/io_openfeedback_resources_Res_drawable$stableprop|#static{}io_openfeedback_resources_Res_drawable$stableprop[0] diff --git a/openfeedback-resources/src/commonMain/kotlin/io/openfeedback/resources/EnStrings.kt b/openfeedback-resources/src/commonMain/kotlin/io/openfeedback/resources/EnStrings.kt index c525e66..42588ff 100644 --- a/openfeedback-resources/src/commonMain/kotlin/io/openfeedback/resources/EnStrings.kt +++ b/openfeedback-resources/src/commonMain/kotlin/io/openfeedback/resources/EnStrings.kt @@ -4,6 +4,10 @@ import cafe.adriel.lyricist.LyricistStrings @LyricistStrings(languageTag = "en", default = true) internal val EnStrings = Strings( + notReady = NotReadyStrings( + title = "React online!", + description = "A little more patience, and you'll be able to share your feedback when the session starts." + ), comments = CommentStrings( titleSection = "Comments", titleInput = "Your comment", diff --git a/openfeedback-resources/src/commonMain/kotlin/io/openfeedback/resources/FrStrings.kt b/openfeedback-resources/src/commonMain/kotlin/io/openfeedback/resources/FrStrings.kt index 5a9c25f..542545e 100644 --- a/openfeedback-resources/src/commonMain/kotlin/io/openfeedback/resources/FrStrings.kt +++ b/openfeedback-resources/src/commonMain/kotlin/io/openfeedback/resources/FrStrings.kt @@ -4,6 +4,10 @@ import cafe.adriel.lyricist.LyricistStrings @LyricistStrings(languageTag = "fr") internal val FrStrings = Strings( + notReady = NotReadyStrings( + title = "Réagissez en live !", + description = "Encore un peu de patience, vous pourrez partagez vos feedbacks lorsque la session démarrera." + ), comments = CommentStrings( titleSection = "Commentaires", titleInput = "Votre commentaire", diff --git a/openfeedback-resources/src/commonMain/kotlin/io/openfeedback/resources/Strings.kt b/openfeedback-resources/src/commonMain/kotlin/io/openfeedback/resources/Strings.kt index 6a97347..270799b 100644 --- a/openfeedback-resources/src/commonMain/kotlin/io/openfeedback/resources/Strings.kt +++ b/openfeedback-resources/src/commonMain/kotlin/io/openfeedback/resources/Strings.kt @@ -1,11 +1,17 @@ package io.openfeedback.resources data class Strings( + val notReady: NotReadyStrings, val comments: CommentStrings, val poweredBy: String, val fromYou: String ) +data class NotReadyStrings( + val title: String, + val description: String +) + data class CommentStrings( val titleSection: String, val titleInput: String, diff --git a/openfeedback-viewmodel/api/openfeedback-viewmodel.api b/openfeedback-viewmodel/api/openfeedback-viewmodel.api index a7a0218..d9276b1 100644 --- a/openfeedback-viewmodel/api/openfeedback-viewmodel.api +++ b/openfeedback-viewmodel/api/openfeedback-viewmodel.api @@ -1,5 +1,5 @@ public final class io/openfeedback/OpenFeedbackKt { - public static final fun OpenFeedback (Ljava/lang/String;Ljava/lang/String;Landroidx/compose/ui/Modifier;ILjava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function2;Lio/openfeedback/viewmodels/OpenFeedbackViewModel;Landroidx/compose/runtime/Composer;II)V + public static final fun OpenFeedback (Ljava/lang/String;Ljava/lang/String;Landroidx/compose/ui/Modifier;IZZLjava/lang/String;Ljava/lang/String;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Landroidx/compose/runtime/Composer;II)V } public final class io/openfeedback/viewmodels/OpenFeedbackFirebaseConfig { diff --git a/openfeedback-viewmodel/api/openfeedback-viewmodel.klib.api b/openfeedback-viewmodel/api/openfeedback-viewmodel.klib.api index 2bf9f26..76a60e6 100644 --- a/openfeedback-viewmodel/api/openfeedback-viewmodel.klib.api +++ b/openfeedback-viewmodel/api/openfeedback-viewmodel.klib.api @@ -76,4 +76,4 @@ final val io.openfeedback.viewmodels/io_openfeedback_viewmodels_OpenFeedbackView final fun io.openfeedback.viewmodels/getFirebaseApp(kotlin/String?): dev.gitlive.firebase/FirebaseApp // io.openfeedback.viewmodels/getFirebaseApp|getFirebaseApp(kotlin.String?){}[0] final fun io.openfeedback.viewmodels/initializeOpenFeedback(io.openfeedback.viewmodels/OpenFeedbackFirebaseConfig) // io.openfeedback.viewmodels/initializeOpenFeedback|initializeOpenFeedback(io.openfeedback.viewmodels.OpenFeedbackFirebaseConfig){}[0] -final fun io.openfeedback/OpenFeedback(kotlin/String, kotlin/String, androidx.compose.ui/Modifier?, kotlin/Int, kotlin/String?, kotlin/String?, kotlin/Function2?, io.openfeedback.viewmodels/OpenFeedbackViewModel?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.openfeedback/OpenFeedback|OpenFeedback(kotlin.String;kotlin.String;androidx.compose.ui.Modifier?;kotlin.Int;kotlin.String?;kotlin.String?;kotlin.Function2?;io.openfeedback.viewmodels.OpenFeedbackViewModel?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] +final fun io.openfeedback/OpenFeedback(kotlin/String, kotlin/String, androidx.compose.ui/Modifier?, kotlin/Int, kotlin/Boolean, kotlin/Boolean, kotlin/String?, kotlin/String?, kotlin/Function2?, kotlin/Function2?, androidx.compose.runtime/Composer?, kotlin/Int, kotlin/Int) // io.openfeedback/OpenFeedback|OpenFeedback(kotlin.String;kotlin.String;androidx.compose.ui.Modifier?;kotlin.Int;kotlin.Boolean;kotlin.Boolean;kotlin.String?;kotlin.String?;kotlin.Function2?;kotlin.Function2?;androidx.compose.runtime.Composer?;kotlin.Int;kotlin.Int){}[0] diff --git a/openfeedback-viewmodel/src/commonMain/kotlin/io/openfeedback/OpenFeedback.kt b/openfeedback-viewmodel/src/commonMain/kotlin/io/openfeedback/OpenFeedback.kt index 5d310f0..b8c84d4 100644 --- a/openfeedback-viewmodel/src/commonMain/kotlin/io/openfeedback/OpenFeedback.kt +++ b/openfeedback-viewmodel/src/commonMain/kotlin/io/openfeedback/OpenFeedback.kt @@ -16,6 +16,7 @@ import com.vanniktech.locale.Locale import com.vanniktech.locale.Locales import io.openfeedback.m3.Comment import io.openfeedback.m3.CommentInput +import io.openfeedback.m3.FeedbackNotReady import io.openfeedback.m3.Loading import io.openfeedback.m3.OpenFeedbackLayout import io.openfeedback.m3.VoteCard @@ -31,11 +32,11 @@ import io.openfeedback.viewmodels.getFirebaseApp * @param sessionId Firestore session id * @param modifier The modifier to be applied to the component. * @param columnCount Number of column to display for vote items. + * @param isReady Flag to display the component or not. * @param displayComments Flag to display comments or not. * @param languageCode Language code of the user. * @param appName Locale openfeedback name, used to restore openfeedback configuration. * @param loading Component to display when the view model fetch vote items. - * @param viewModel ViewModel instance to fetch UI models and interact with feedback form. */ @OptIn(ExperimentalMaterial3Api::class) @Composable @@ -44,11 +45,20 @@ fun OpenFeedback( sessionId: String, modifier: Modifier = Modifier, columnCount: Int = 2, + isReady: Boolean = true, displayComments: Boolean = true, languageCode: String = Locale.from(Locales.currentLocaleString()).language.code, appName: String? = null, loading: @Composable () -> Unit = { Loading(modifier = modifier) }, - viewModel: OpenFeedbackViewModel = viewModel( + notReady: @Composable () -> Unit = { FeedbackNotReady(modifier = modifier) }, +) { + if (isReady.not()) { + notReady() + return + } + // Putting the ViewModel initialization here allows us to display this component + // in a Composable Preview with isNotReady flag set to true. + val viewModel = viewModel( key = sessionId, factory = OpenFeedbackViewModel.provideFactory( firebaseApp = getFirebaseApp(appName), @@ -57,7 +67,6 @@ fun OpenFeedback( languageCode = languageCode ) ) -) { val uiState = viewModel.uiState.collectAsState() when (uiState.value) { is OpenFeedbackUiState.Loading -> loading() diff --git a/sample-app-shared/src/commonMain/kotlin/io/openfeedback/shared/main.kt b/sample-app-shared/src/commonMain/kotlin/io/openfeedback/shared/main.kt index c6a1845..53b5184 100644 --- a/sample-app-shared/src/commonMain/kotlin/io/openfeedback/shared/main.kt +++ b/sample-app-shared/src/commonMain/kotlin/io/openfeedback/shared/main.kt @@ -42,8 +42,7 @@ fun SampleApp( OpenFeedback( projectId = "eaJnyMXD3oNfhrrnBYDT", sessionId = "100", - modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp), - displayComments = true + modifier = Modifier.padding(horizontal = 8.dp, vertical = 4.dp) ) } }