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

[ABW-3465] Decode deep link and download metadata #180

Merged
merged 85 commits into from
Jul 9, 2024

Conversation

matiasbzurovski
Copy link
Contributor

Changelog

Adds the DeferredDeepLinkParser that will be responsible for decoding the information sent by a deferred deep link. From such data, it will create the corresponding list of HomeCards that the host app need to display.

Also, it will extend the API models to allow parsing the metadata when fetching an entity details. Such metadata will be use to retrieve the icon_url of a dapp_referrer.

Copy link

codecov bot commented Jul 2, 2024

Codecov Report

Attention: Patch coverage is 81.17647% with 32 lines in your changes missing coverage. Please review.

Project coverage is 98.4%. Comparing base (2631742) to head (c54e8b2).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #180     +/-   ##
=======================================
- Coverage   98.6%   98.4%   -0.3%     
=======================================
  Files        765     777     +12     
  Lines      11747   11915    +168     
  Branches      38      39      +1     
=======================================
+ Hits       11590   11726    +136     
- Misses       153     185     +32     
  Partials       4       4             
Flag Coverage Δ
kotlin 97.2% <0.0%> (-2.3%) ⬇️
rust 98.2% <91.3%> (-0.2%) ⬇️
swift 99.6% <ø> (ø)

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

Files Coverage Δ
...t/sargon/os/storage/EncryptedPreferencesStorage.kt 100.0% <ø> (ø)
src/core/error/common_error.rs 100.0% <ø> (ø)
src/gateway_api/methods/state_methods.rs 96.7% <100.0%> (+2.3%) ⬆️
...y_api/models/types/request/state/entity/opt_ins.rs 100.0% <100.0%> (ø)
...y_api/models/types/request/state/entity/request.rs 100.0% <100.0%> (ø)
...tion/unvalidated_transaction_manifest_uniffi_fn.rs 100.0% <ø> (ø)
...ds/deferred_deep_link/deferred_deep_link_method.rs 100.0% <100.0%> (ø)
...s/deferred_deep_link/onboarding_deep_link_value.rs 100.0% <100.0%> (ø)
src/wallet/home_cards/home_card.rs 100.0% <100.0%> (ø)
src/wallet/home_cards/home_cards.rs 100.0% <100.0%> (ø)
... and 7 more

src/core/error/common_error.rs Outdated Show resolved Hide resolved
src/gateway_api/methods/state_methods.rs Outdated Show resolved Hide resolved
src/gateway_api/methods/state_methods.rs Outdated Show resolved Hide resolved
src/gateway_api/methods/state_methods.rs Outdated Show resolved Hide resolved
src/wallet/home_cards/deferred_deep_link/parser.rs Outdated Show resolved Hide resolved
src/wallet/home_cards/manager.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@GhenadieVP GhenadieVP left a comment

Choose a reason for hiding this comment

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

Nice,
Well done!

@sergiupuhalschi-rdx sergiupuhalschi-rdx added the Kotlin 🤖 Changes in Kotlin Sargon label Jul 4, 2024
@@ -76,16 +83,33 @@ impl HomeCardsManager {
}

/// Handles a deferred deep link by parsing it and saving the generated `HomeCards` to `HomeCardsStorage`.
/// `HomeCard::ContinueRadQuest` if found in the link parsing result, replaces `HomeCard::StartRadQuest` if it's stored.
Copy link
Contributor

Choose a reason for hiding this comment

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

hmm, this does not seem to be possible - by definition this function should be called only after user did install the wallet, so there cannot be StartRadQuest stored.
Rather, it is the other way around - in wallet_created, we should not add the HomeCard::StartRadQuest if HomeCard::ContinueRadQuest is already present.

Copy link
Contributor

Choose a reason for hiding this comment

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

You're right. What about keeping this logic in both methods to make sure there is no chance both StartRadQuest and ContinueRadQuest are present at the same time? This way Sargon won't care about the order of the method calls. Also, for the deep link to be resolved the AF SDK performs a network request, then we perform a network request for the dApp icon URL, so there is a tiny possibility the deep link won't be handled fast enough. Keeping this logic also would prevent any scenarios like this.

@sergiupuhalschi-rdx sergiupuhalschi-rdx merged commit d189ab8 into main Jul 9, 2024
9 of 10 checks passed
@sergiupuhalschi-rdx sergiupuhalschi-rdx deleted the mb/deferred-parsing branch July 9, 2024 14:16
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Kotlin 🤖 Changes in Kotlin Sargon Rust 🦀 Changes in Rust Sargon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants