Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement updated legend settings with leaderboard toggle and shoutout edits #293

Merged
merged 10 commits into from
Jan 31, 2025
2 changes: 1 addition & 1 deletion app/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<ID>LongMethod:FeedNoteCard.kt$@Composable private fun FeedNote( data: FeedPostUi, fullWidthContent: Boolean, avatarSizeDp: Dp, avatarPaddingValues: PaddingValues, notePaddingValues: PaddingValues, enableTweetsMode: Boolean, headerSingleLine: Boolean, showReplyTo: Boolean, forceContentIndent: Boolean, expanded: Boolean, textSelectable: Boolean, showNoteStatCounts: Boolean, noteCallbacks: NoteCallbacks, onPostAction: ((FeedPostAction) -&gt; Unit)? = null, onPostLongClickAction: ((FeedPostAction) -&gt; Unit)? = null, contentFooter: @Composable () -&gt; Unit = {}, )</ID>
<ID>LongMethod:FeedNoteCard.kt$@ExperimentalMaterial3Api @Composable private fun FeedNoteCard( data: FeedPostUi, state: NoteContract.UiState, eventPublisher: (UiEvent) -&gt; Unit, modifier: Modifier = Modifier, shape: Shape = CardDefaults.shape, colors: CardColors = noteCardColors(), cardPadding: PaddingValues = PaddingValues(all = 0.dp), enableTweetsMode: Boolean = false, headerSingleLine: Boolean = true, fullWidthContent: Boolean = false, forceContentIndent: Boolean = false, drawLineAboveAvatar: Boolean = false, drawLineBelowAvatar: Boolean = false, expanded: Boolean = false, textSelectable: Boolean = false, showReplyTo: Boolean = true, noteOptionsMenuEnabled: Boolean = true, showNoteStatCounts: Boolean = true, noteCallbacks: NoteCallbacks = NoteCallbacks(), onGoToWallet: (() -&gt; Unit)? = null, contentFooter: @Composable () -&gt; Unit = {}, )</ID>
<ID>LongMethod:HomeFeedScreen.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable fun HomeFeedScreen( state: HomeFeedContract.UiState, onTopLevelDestinationChanged: (PrimalTopLevelDestination) -&gt; Unit, onDrawerScreenClick: (DrawerScreenDestination) -&gt; Unit, onDrawerQrCodeClick: () -&gt; Unit, onSearchClick: () -&gt; Unit, noteCallbacks: NoteCallbacks, onGoToWallet: () -&gt; Unit, onNewPostClick: (content: TextFieldValue?) -&gt; Unit, eventPublisher: (UiEvent) -&gt; Unit, )</ID>
<ID>LongMethod:LegendaryProfileCustomizationScreen.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable fun LegendaryProfileCustomizationScreen( state: LegendaryProfileCustomizationContract.UiState, eventPublisher: (LegendaryProfileCustomizationContract.UiEvent) -&gt; Unit, onClose: () -&gt; Unit, )</ID>
<ID>LongMethod:LegendaryProfileCustomizationScreen.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable private fun LegendaryProfileCustomizationScreen( state: LegendaryProfileCustomizationContract.UiState, eventPublisher: (UiEvent) -&gt; Unit, onClose: () -&gt; Unit, )</ID>
<ID>LongMethod:MessageConversationListScreen.kt$@Composable private fun ConversationListItem( conversation: MessageConversationUi, onConversationClick: (String) -&gt; Unit, onProfileClick: (profileId: String) -&gt; Unit, )</ID>
<ID>LongMethod:MessageConversationListScreen.kt$@Composable private fun MessagesTabs( relation: ConversationRelation, onFollowsTabClick: () -&gt; Unit, onOtherTabClick: () -&gt; Unit, onMarkAllRead: () -&gt; Unit, )</ID>
<ID>LongMethod:MultipleUserPicker.kt$@OptIn(ExperimentalMaterial3Api::class) @Composable fun MultipleUserPicker( modifier: Modifier = Modifier, sheetTitle: String, placeholderText: String, onDismissRequest: () -&gt; Unit, onUsersSelected: (Set&lt;UserProfileItemUi&gt;) -&gt; Unit, sheetState: SheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), startingSelectedUsers: Set&lt;UserProfileItemUi&gt;, )</ID>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ val NostrJson = Json {
coerceInputValues = true
}

val NostrJsonImplicitNulls = Json {
ignoreUnknownKeys = true
coerceInputValues = true
explicitNulls = false
}

val NostrJsonEncodeDefaults = Json {
ignoreUnknownKeys = true
encodeDefaults = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ import net.primal.android.premium.legend.become.PremiumBecomeLegendScreen
import net.primal.android.premium.legend.become.PremiumBecomeLegendViewModel
import net.primal.android.premium.legend.card.LegendCardScreen
import net.primal.android.premium.legend.card.LegendCardViewModel
import net.primal.android.premium.legend.custimization.LegendaryProfileCustomizationScreen
import net.primal.android.premium.legend.custimization.LegendaryProfileCustomizationViewModel
import net.primal.android.premium.legend.customization.LegendaryProfileCustomizationScreen
import net.primal.android.premium.legend.customization.LegendaryProfileCustomizationViewModel
import net.primal.android.premium.legend.leaderboard.LegendLeaderboardScreen
import net.primal.android.premium.legend.leaderboard.LegendLeaderboardViewModel
import net.primal.android.premium.manage.PremiumManageContract
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package net.primal.android.premium.api
import javax.inject.Inject
import net.primal.android.core.serialization.json.NostrJson
import net.primal.android.core.serialization.json.NostrJsonEncodeDefaults
import net.primal.android.core.serialization.json.NostrJsonImplicitNulls
import net.primal.android.core.serialization.json.decodeFromStringOrNull
import net.primal.android.networking.di.PrimalCacheApiClient
import net.primal.android.networking.di.PrimalWalletApiClient
Expand Down Expand Up @@ -216,7 +217,7 @@ class PremiumApiImpl @Inject constructor(
AppSpecificDataRequest(
eventFromUser = nostrNotary.signAppSpecificDataNostrEvent(
userId = userId,
content = NostrJson.encodeToString(updateProfileRequest),
content = NostrJsonImplicitNulls.encodeToString(updateProfileRequest),
),
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ data class MembershipStatusResponse(
@SerialName("recurring") val recurring: Boolean = false,
@SerialName("renews_on") val renewsOn: Long? = null,
@SerialName("origin") val origin: String? = null,
@SerialName("edited_shoutout") val editedShoutout: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import kotlinx.serialization.Serializable

@Serializable
data class UpdatePrimalLegendProfileRequest(
@SerialName("style") val styleId: String,
@SerialName("custom_badge") val customBadge: Boolean,
@SerialName("avatar_glow") val avatarGlow: Boolean,
@SerialName("style") val styleId: String?,
@SerialName("custom_badge") val customBadge: Boolean?,
@SerialName("avatar_glow") val avatarGlow: Boolean?,
@SerialName("in_leaderboard") val inLeaderboard: Boolean?,
@SerialName("edited_shoutout") val editedShoutout: String?,
)
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ data class PremiumMembership(
val recurring: Boolean = false,
val renewsOn: Long? = null,
val origin: String? = null,
val editedShoutout: String? = null,
) {
fun isExpired() = expiresOn != null && Clock.System.now().epochSeconds > expiresOn
}
Loading