Skip to content

SDKS-4937: App parity with iOS#203

Draft
vibhorgoswami wants to merge 1 commit into
developfrom
SDKS-4937
Draft

SDKS-4937: App parity with iOS#203
vibhorgoswami wants to merge 1 commit into
developfrom
SDKS-4937

Conversation

@vibhorgoswami
Copy link
Copy Markdown
Contributor

@vibhorgoswami vibhorgoswami commented May 22, 2026

JIRA Ticket

SDKS-4937

Description

Match Android and iOS Sample Apps

Summary by CodeRabbit

  • New Features
    • Redesigned Token screen UI with tab-based navigation and card-based layouts.
    • Added clipboard copy functionality for token fields.
    • Implemented real-time token expiry countdown display.
    • Enhanced top app bar with icon actions for token operations (access, refresh, revoke, clear).
    • Added dedicated error and empty state cards.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

📝 Walkthrough

Walkthrough

Token screen UI refactored from dropdown/expanded-state layout to tab-driven card-based rendering. ViewModel's JSON token formatting removed. New composables render token fields with inline clipboard copy, expiry countdown via binary search, error states, and empty states.

Changes

Token Screen Redesign

Layer / File(s) Summary
ViewModel state and formatting cleanup
samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/token/TokenViewModel.kt
Token formatting flow (formattedToken derived from JSON serialization) and related imports removed. ViewModel retains state flow and token operation methods; new provider imports (daVinci, journey, web) added.
Screen imports and TokenScreen initialization
samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/token/Token.kt
Import set updated to include ClipboardManager and ClipData for clipboard interaction, and icon-related imports. TokenScreen entry point now collects only tokenState and triggers loadAllTokens() on composition via LaunchedEffect.
Scaffold, top bar actions, and tab-driven content
samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/token/Token.kt
Scaffold updated with icon action buttons (access, refresh, revoke, clear) in top bar. Content switches from prior card/dropdown/text layout to a tab row with tab selection triggering selectTab(). Selected tab determines which token/error fields are rendered from tokenState.
Token, expiry, field, error, and empty card composables
samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/token/Token.kt
TokenCard renders token metadata and expiry countdown. ExpiryCountdownCard computes remaining seconds via binary search on token.isExpired(threshold), formats countdown (expired vs. days/hours/minutes/seconds), and applies conditional coloring. TokenFieldCard displays labeled token values with optional truncation and inline clipboard-copy button. ErrorCard and EmptyCard render error messages and "no token" states respectively.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • spetrov
  • witrisna
  • vahancouver

Poem

🐰 Tokens now tab through the air so bright,
Binary searches find expiry in sight,
Cards flutter and copy with clipboard delight,
No dropdown fuss—just selection so tight!
✨ A screen redesign done right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'SDKS-4937: App parity with iOS' is partially related to the changeset—it references app parity with iOS, which matches the PR objective, but does not capture the specific, substantial UI rewrite of the Token screen that is the primary technical change.
Description check ✅ Passed The pull request description includes both required template sections: the JIRA ticket link and a brief description. However, the description is minimal and lacks detail about the specific changes made to the Token screen and ViewModel.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch SDKS-4937

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/token/Token.kt (1)

298-311: 💤 Low value

Minor capitalization inconsistency with "DaVinci" tab.

The tab displays "DaVinci" (Line 137), but EmptyCard will show "Davinci" due to replaceFirstChar { it.uppercase() } on "davinci". Consider using a display name property or mapping for consistency.

💡 Suggested approach
 `@Composable`
 private fun EmptyCard(tab: TokenType) {
+    val tabDisplayName = when (tab) {
+        TokenType.JOURNEY -> "Journey"
+        TokenType.DAVINCI -> "DaVinci"
+        TokenType.OIDC -> "OIDC"
+    }
     Card(
         modifier = Modifier.fillMaxWidth(),
         elevation = CardDefaults.cardElevation(defaultElevation = 2.dp),
     ) {
         Text(
-            text = "No ${tab.name.lowercase().replaceFirstChar { it.uppercase() }} token available",
+            text = "No $tabDisplayName token available",
             style = MaterialTheme.typography.bodyMedium,
             color = MaterialTheme.colorScheme.onSurfaceVariant,
             modifier = Modifier.padding(16.dp),
         )
     }
 }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/token/Token.kt`
around lines 298 - 311, EmptyCard currently builds a display string from
tab.name using lowercase + replaceFirstChar which yields "Davinci" for the
DaVinci tab; instead add/use a canonical display name on the TokenType (e.g., a
displayName property or a when-mapping) and use that in EmptyCard (replace uses
of tab.name.lowercase().replaceFirstChar { it.uppercase() } with tab.displayName
or a small mapping in EmptyCard that returns "DaVinci" for the DaVinci enum
value and the usual capitalized form for others) so the casing matches the tab
label exactly.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/token/Token.kt`:
- Around line 298-311: EmptyCard currently builds a display string from tab.name
using lowercase + replaceFirstChar which yields "Davinci" for the DaVinci tab;
instead add/use a canonical display name on the TokenType (e.g., a displayName
property or a when-mapping) and use that in EmptyCard (replace uses of
tab.name.lowercase().replaceFirstChar { it.uppercase() } with tab.displayName or
a small mapping in EmptyCard that returns "DaVinci" for the DaVinci enum value
and the usual capitalized form for others) so the casing matches the tab label
exactly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c2dba3de-9f99-4d86-87da-400ae6eca3d8

📥 Commits

Reviewing files that changed from the base of the PR and between 02ca67e and 1af0521.

📒 Files selected for processing (2)
  • samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/token/Token.kt
  • samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/token/TokenViewModel.kt
💤 Files with no reviewable changes (1)
  • samples/pingsampleapp/src/main/java/com/pingidentity/samples/pingsampleapp/token/TokenViewModel.kt

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 42.64%. Comparing base (02ca67e) to head (1af0521).

Additional details and impacted files
@@            Coverage Diff             @@
##             develop     #203   +/-   ##
==========================================
  Coverage      42.64%   42.64%           
  Complexity      1287     1287           
==========================================
  Files            312      312           
  Lines           9447     9447           
  Branches        1403     1403           
==========================================
  Hits            4029     4029           
  Misses          4862     4862           
  Partials         556      556           
Flag Coverage Δ
integration-tests 25.08% <ø> (ø)
unit-tests 25.90% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant