Skip to content

feat: earn button on home#2337

Merged
zhouxl merged 4 commits into
devfrom
311/1190-ios-add-vault-entrance-to-home-screen
Feb 27, 2026
Merged

feat: earn button on home#2337
zhouxl merged 4 commits into
devfrom
311/1190-ios-add-vault-entrance-to-home-screen

Conversation

@zhouxl
Copy link
Copy Markdown
Collaborator

@zhouxl zhouxl commented Jan 28, 2026

Related Issue

Summary of Changes

Need Regression Testing

  • Yes
  • No

Risk Assessment

  • Low
  • Medium
  • High

Additional Notes

Screenshots (if applicable)

@zhouxl zhouxl linked an issue Jan 28, 2026 that may be closed by this pull request
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 28, 2026

PR Summary

Added new "Earn" feature entry points to the wallet interface. Introduced an EarnButton component on the wallet home screen and an EarnBanner component on the token detail view. Both components navigate to an earn URL (configured via AppUrl.earnUrl) when tapped. The visibility of these components is controlled by a feature flag that checks if the earn URL is configured. Added corresponding icon assets for the earn feature.

Changes

File Summary
FRW.xcodeproj/project.pbxproj Added file references and build phase entries for EarnButton.swift and EarnBanner.swift to the Xcode project configuration.
FRW/Foundation/Define/AppUrl.swift Added earnUrl static constant to AppUrl enum. Currently set to an empty string with a TODO comment for version 3.1.1.
FRW/Modules/Wallet/TokenDetail/TokenDetailView.swift Added conditional rendering of EarnBanner component below the summary view when vm.showEarnBanner is true.
FRW/Modules/Wallet/TokenDetail/TokenDetailViewModel.swift Added @Published property showEarnBanner that evaluates to true when AppUrl.earnUrl is not empty, controlling the visibility of the earn banner.
FRW/Modules/Wallet/View/EarnBanner.swift New file. A SwiftUI view displaying a promotional banner for Flow Vaults with 15% APY messaging. Features a gradient background, styled text, and navigates to the earn URL via browser when tapped.
FRW/Modules/Wallet/View/EarnButton.swift New file. A SwiftUI button component displaying "earn" text with an icon. Styled with rounded corners and navigates to the earn URL via browser when tapped.
FRW/Modules/Wallet/WalletHomeView.swift Added conditional rendering of EarnButton component in the wallet home view header when vm.showEarnButton is true.
FRW/Modules/Wallet/WalletViewModel.swift Added @Published property showEarnButton that evaluates to true when AppUrl.earnUrl is not empty, controlling the visibility of the earn button.
FRW/Resource/Assets.xcassets/wallet/earn_icon.imageset/Contents.json New file. JSON configuration for the earn_icon image asset referencing the SVG file.
FRW/Resource/Assets.xcassets/wallet/earn_icon.imageset/earn_icon.svg New file. SVG icon featuring a green circle with an upward trending arrow graphic for the earn button.
FRW/Resource/Assets.xcassets/wallet/earn_icon_36.imageset/Contents.json New file. JSON configuration for the earn_icon_36 image asset referencing the PDF file.
FRW/Resource/Assets.xcassets/wallet/earn_icon_36.imageset/earn_icon_36.pdf New file. PDF icon asset for the earn banner component.

autogenerated by presubmit.ai

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 28, 2026

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@zhouxl zhouxl linked an issue Jan 28, 2026 that may be closed by this pull request
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

🚨 Pull request needs attention.

Review Summary

Commits Considered (1)
  • 37c902d: feat: earn button on home
Files Processed (7)
  • FRW.xcodeproj/project.pbxproj (5 hunks)
  • FRW/Foundation/Define/AppUrl.swift (1 hunk)
  • FRW/Modules/Wallet/View/EarnButton.swift (1 hunk)
  • FRW/Modules/Wallet/WalletHomeView.swift (1 hunk)
  • FRW/Modules/Wallet/WalletViewModel.swift (1 hunk)
  • FRW/Resource/Assets.xcassets/wallet/earn_icon.imageset/Contents.json (1 hunk)
  • FRW/Resource/Assets.xcassets/wallet/earn_icon.imageset/earn_icon.svg (1 hunk)
Actionable Comments (2)
  • FRW/Foundation/Define/AppUrl.swift [13-13]

    possible bug: "Empty URL will cause the Earn button to always fail."

  • FRW/Modules/Wallet/WalletViewModel.swift [189-189]

    possible bug: "Button visibility should be tied to URL availability."

Skipped Comments (1)
  • FRW/Modules/Wallet/View/EarnButton.swift [16-16]

    enhancement: "Non-localized and informal error message."

enum AppUrl {
static let cadenceSwapUrl = "https://app.increment.fi"
static let evmSwapUrl = "https://swap.flow.com"
static let earnUrl = "" //TODO: #six 3.1.1
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The earnUrl is set to an empty string with a TODO comment. This will cause the button to always show an error message ("don't have earn url") when clicked since URL(string: "") returns nil. Consider either:

  1. Setting showEarnButton to false until the URL is available
  2. Adding a proper placeholder URL
  3. Hiding the button when the URL is empty



@Published
var showEarnButton: Bool = true
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The showEarnButton is hardcoded to true. Consider deriving this value from whether AppUrl.earnUrl is empty or not, e.g., var showEarnButton: Bool { !AppUrl.earnUrl.isEmpty }. This would prevent showing a non-functional button.

@zhouxl zhouxl requested a review from lmcmz January 28, 2026 13:28
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

🚨 Pull request needs attention.

Review Summary

Commits Considered (1)
  • 999a1f1: feat: add earn banner to token detail
Files Processed (6)
  • FRW.xcodeproj/project.pbxproj (7 hunks)
  • FRW/Modules/Wallet/TokenDetail/TokenDetailView.swift (1 hunk)
  • FRW/Modules/Wallet/TokenDetail/TokenDetailViewModel.swift (1 hunk)
  • FRW/Modules/Wallet/View/EarnBanner.swift (1 hunk)
  • FRW/Resource/Assets.xcassets/wallet/earn_icon_36.imageset/Contents.json (1 hunk)
  • FRW/Resource/Assets.xcassets/wallet/earn_icon_36.imageset/earn_icon_36.pdf (0 hunks)
Actionable Comments (1)
  • FRW/Modules/Wallet/View/EarnBanner.swift [40-40]

    possible bug: "Incorrect frame modifier usage."

Skipped Comments (3)
  • FRW/Modules/Wallet/View/EarnBanner.swift [21-28]

    possible issue: "Hardcoded financial values in the UI may become stale."

  • FRW/Modules/Wallet/View/EarnBanner.swift [17-17]

    enhancement: "User-facing error message is not professional."

  • FRW/Modules/Wallet/TokenDetail/TokenDetailViewModel.swift [188-189]

    possible issue: "Banner visibility is always enabled without conditional logic."

.clipShape(Circle())
}
.padding(18)
.frame(width: .infinity, alignment: .leading)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Using .frame(width: .infinity, ...) is incorrect syntax. To make the view expand to fill available width, use .frame(maxWidth: .infinity, alignment: .leading) instead.

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

LGTM!

Review Summary

Commits Considered (1)
Files Processed (2)
  • FRW/Modules/Wallet/TokenDetail/TokenDetailViewModel.swift (1 hunk)
  • FRW/Modules/Wallet/WalletViewModel.swift (1 hunk)
Actionable Comments (0)
Skipped Comments (2)
  • FRW/Modules/Wallet/TokenDetail/TokenDetailViewModel.swift [188-189]

    possible issue: "Published property initialized with static value may not reflect runtime changes."

  • FRW/Modules/Wallet/WalletViewModel.swift [188-189]

    possible issue: "Published property initialized with static value may not reflect runtime changes."

@zhouxl zhouxl marked this pull request as ready for review January 30, 2026 06:53
@zhouxl zhouxl requested a review from a team as a code owner January 30, 2026 06:53
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

LGTM!

Review Summary

Commits Considered (1)
  • 0efde12: Merge branch 'dev' into 311/1190-ios-add-vault-entrance-to-home-screen
Files Processed (3)
  • FRW.xcodeproj/project.pbxproj (7 hunks)
  • FRW/Modules/Wallet/WalletHomeView.swift (1 hunk)
  • FRW/Modules/Wallet/WalletViewModel.swift (1 hunk)
Actionable Comments (0)
Skipped Comments (1)
  • FRW/Modules/Wallet/WalletViewModel.swift [189-189]

    possible issue: "Property value is computed only once at initialization."

@zhouxl zhouxl merged commit ef1f834 into dev Feb 27, 2026
4 checks passed
@zhouxl zhouxl deleted the 311/1190-ios-add-vault-entrance-to-home-screen branch February 27, 2026 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Add vault entrance to home screen [iOS] Add Earn banner to token detail page

2 participants