-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Adding a UI for repost notifications - Adding a no-op implementation of `NotificationInteractions` for use with compose previews - I want to start doing this instead of having default `Unit` values for interface functions - Adding a post preview state for `PostContentUiState` --------- Co-authored-by: John Oberhauser <j.git-global@obez.io>
- Loading branch information
1 parent
a725044
commit 627b4eb
Showing
11 changed files
with
104 additions
and
21 deletions.
There are no files selected for viewing
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
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
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
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
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
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
54 changes: 45 additions & 9 deletions
54
core/ui/notifications/src/main/java/org/mozilla/social/core/ui/notifications/cards/Repost.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 |
---|---|---|
@@ -1,18 +1,54 @@ | ||
package org.mozilla.social.core.ui.notifications.cards | ||
|
||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import androidx.compose.ui.tooling.preview.Preview | ||
import org.mozilla.social.common.utils.StringFactory | ||
import org.mozilla.social.core.ui.common.utils.PreviewTheme | ||
import org.mozilla.social.core.ui.htmlcontent.HtmlContentInteractions | ||
import org.mozilla.social.core.ui.notifications.NotificationCard | ||
import org.mozilla.social.core.ui.notifications.NotificationInteractionsNoOp | ||
import org.mozilla.social.core.ui.notifications.NotificationUiState | ||
import org.mozilla.social.core.ui.poll.PollInteractions | ||
import org.mozilla.social.core.ui.postcard.PostContent | ||
import org.mozilla.social.core.ui.postcard.PostContentUiState | ||
|
||
@Composable | ||
fun RepostNotification( | ||
uiState: NotificationUiState.Repost | ||
internal fun RepostNotificationContent( | ||
uiState: NotificationUiState.Repost, | ||
htmlContentInteractions: HtmlContentInteractions, | ||
pollInteractions: PollInteractions, | ||
) { | ||
Text( | ||
modifier = Modifier.padding(8.dp), | ||
text = "Repost ${uiState.id}" | ||
PostContent( | ||
uiState = uiState.postContentUiState, | ||
htmlContentInteractions = htmlContentInteractions, | ||
pollInteractions = pollInteractions, | ||
) | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun RepostNotificationPreview() { | ||
PreviewTheme { | ||
NotificationCard( | ||
uiState = NotificationUiState.Repost( | ||
id = 1, | ||
timeStamp = StringFactory.literal("1 day ago"), | ||
title = StringFactory.literal("John mentioned you:"), | ||
avatarUrl = "", | ||
postContentUiState = PostContentUiState( | ||
pollUiState = null, | ||
statusTextHtml = "this is a status", | ||
mediaAttachments = emptyList(), | ||
mentions = emptyList(), | ||
previewCard = null, | ||
contentWarning = "", | ||
), | ||
accountId = "", | ||
statusId = "", | ||
), | ||
htmlContentInteractions = object : HtmlContentInteractions {}, | ||
pollInteractions = object : PollInteractions {}, | ||
notificationInteractions = NotificationInteractionsNoOp, | ||
) | ||
} | ||
} |
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
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
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
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