-
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 ui for favorite notifications (#381)
- Adding UI for favorite notifications Co-authored-by: John Oberhauser <j.git-global@obez.io>
- Loading branch information
1 parent
5ce07c8
commit d2223b7
Showing
6 changed files
with
76 additions
and
12 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
57 changes: 47 additions & 10 deletions
57
...ui/notifications/src/main/java/org/mozilla/social/core/ui/notifications/cards/Favorite.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,55 @@ | ||
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 FavoriteNotification( | ||
uiState: NotificationUiState.Favorite | ||
internal fun FavoriteNotificationContent( | ||
uiState: NotificationUiState.Favorite, | ||
htmlContentInteractions: HtmlContentInteractions, | ||
pollInteractions: PollInteractions, | ||
) { | ||
Text( | ||
modifier = Modifier.padding(8.dp), | ||
text = "Favorite ${uiState.id}" | ||
PostContent( | ||
uiState = uiState.postContentUiState, | ||
htmlContentInteractions = htmlContentInteractions, | ||
pollInteractions = pollInteractions, | ||
) | ||
} | ||
} | ||
|
||
@Preview | ||
@Composable | ||
private fun FavoriteNotificationPreview() { | ||
PreviewTheme { | ||
NotificationCard( | ||
uiState = NotificationUiState.Favorite( | ||
id = 1, | ||
timeStamp = StringFactory.literal("1 day ago"), | ||
title = StringFactory.literal("John favorited your post:"), | ||
avatarUrl = "", | ||
postContentUiState = PostContentUiState( | ||
pollUiState = null, | ||
statusTextHtml = "this is a status", | ||
mediaAttachments = emptyList(), | ||
mentions = emptyList(), | ||
previewCard = null, | ||
contentWarning = "", | ||
), | ||
accountId = "", | ||
statusId = "", | ||
accountName = "", | ||
), | ||
htmlContentInteractions = object : HtmlContentInteractions {}, | ||
pollInteractions = object : PollInteractions {}, | ||
notificationInteractions = NotificationInteractionsNoOp, | ||
) | ||
} | ||
} |