Skip to content

add more extension functions for dynamic-links-ktx #1753

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

Merged
merged 10 commits into from
Aug 10, 2020

Conversation

thatfiredev
Copy link
Member

@thatfiredev thatfiredev commented Jul 2, 2020

KTX Suggestions

1. Extension functions for Intent and Uri

This allows developers to use intent.getFirebaseDynamicLink() and uri.getFirebaseDynamicLink() instead of Firebase.dynamicLinks.getDynamicLink(intent).

This was removed from the PR. See discussion below.

2. Destructuring declarations for ShortDynamicLink and PendingDynamicLinkData

ShortDynamicLink

val shortLinkTask = Firebase.dynamicLinks.shortLinkAsync {
    longLink = Uri.parse("https://example.page.link/?ibn=com.example.android")
}.addOnSuccessListener { result ->
    val shortLink = result.shortLink
    val flowchartLink = result.previewLink
    // use the received values
}

becomes:

val shortLinkTask = Firebase.dynamicLinks.shortLinkAsync {
    longLink = Uri.parse("https://example.page.link/?ibn=com.example.android")
}.addOnSuccessListener { (shortLink, previewLink, warnings) ->
    // access values directly
}

PendingDynamicLinkData

Firebase.dynamicLinks
        .getDynamicLink(intent)
        .addOnSuccessListener(this) { pendingDynamicLinkData ->
            val deepLink = pendingDynamicLinkData.link
            val minAppVersion = pendingDynamicLinkData.minimumAppVersion
            val clickTimestamp = pendingDynamicLinkData.clickTimestamp
            // use the received values
        }

becomes:

Firebase.dynamicLinks
        .getDynamicLink(intent)
        .addOnSuccessListener(this) { (deepLink, minAppVersion, clickTimestamp) ->
            // access the values directly
        }

@google-oss-bot
Copy link
Contributor

Hi @rosariopfernandes. Thanks for your PR.

I'm waiting for a firebase member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

…-sdk into rpf-fdl-ktx

� Conflicts:
�	firebase-dynamic-links/ktx/src/main/kotlin/com/google/firebase/dynamiclinks/ktx/FirebaseDynamicLinks.kt
@rlazo
Copy link
Collaborator

rlazo commented Jul 6, 2020

Hi @rosariopfernandes thanks for your proposal! I like the idea of the destructuring, but I'm not entirely sure about the extensions for Intent and Uri.

@vkryachko wdyt?

@rlazo rlazo requested review from rlazo and vkryachko July 6, 2020 11:04
@rlazo
Copy link
Collaborator

rlazo commented Jul 6, 2020

/ok-to-test

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jul 6, 2020

Coverage Report

Affected SDKs

  • firebase-dynamic-links-ktx

    SDK overall coverage changed from 77.78% (739dd16) to 80.39% (2ed4677d) by +2.61%.

    Filename Base (739dd16) Head (2ed4677d) Diff
    FirebaseDynamicLinks.kt 77.78% 80.39% +2.61%

Test Logs

Notes

HTML coverage reports can be produced locally with ./gradlew <product>:checkCoverage.
Report files are located at <product-build-dir>/reports/jacoco/.

Head commit (2ed4677d) is created by Prow via merging commits: 739dd16 9b84fd3.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jul 6, 2020

Binary Size Report

Affected SDKs

  • firebase-dynamic-links-ktx

    Type Base (739dd16) Head (2ed4677d) Diff
    aar 8.01 kB 8.54 kB +526 B (+6.6%)
    apk (release) 1.41 MB 1.41 MB +96 B (+0.0%)

Test Logs

Notes

Head commit (2ed4677d) is created by Prow via merging commits: 739dd16 9b84fd3.

@rlazo
Copy link
Collaborator

rlazo commented Jul 9, 2020

Check-changed failed because

> Task :firebase-dynamic-links:ktx:ktlintMainSourceSetCheck
�[90m/home/prow/go/src/github.com/firebase/firebase-android-sdk/firebase-dynamic-links/ktx/src/main/kotlin/com/google/firebase/dynamiclinks/ktx/�[0mFirebaseDynamicLinks.kt�[90m:�[0m17�[90m:1:�[0m Unused import
"plain" report written to /home/prow/go/src/github.com/firebase/firebase-android-sdk/firebase-dynamic-links/ktx/build/reports/ktlint/ktlintMainSourceSetCheck.txt
�[90m/home/prow/go/src/github.com/firebase/firebase-android-sdk/firebase-dynamic-links/ktx/src/main/kotlin/com/google/firebase/dynamiclinks/ktx/�[0mFirebaseDynamicLinks.kt�[90m:�[0m18�[90m:1:�[0m Unused import

you can use ./gradlew firebase-dynamic-links:ktx:klintFormat to format the code (this is new).

…-sdk into rpf-fdl-ktx

� Conflicts:
�	firebase-dynamic-links/ktx/src/test/kotlin/com/google/firebase/dynamiclinks/ktx/DynamicLinksTests.kt
@thatfiredev
Copy link
Member Author

@rlazo done, thanks!
I also went ahead and added tests for it.

@rlazo
Copy link
Collaborator

rlazo commented Jul 9, 2020

Thanks @rosariopfernandes ! I'll get your proposal through the API review and let you know the result.

Copy link
Collaborator

@rlazo rlazo left a comment

Choose a reason for hiding this comment

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

Hi @rosariopfernandes thanks for your patience, your proposal has been approved 👍 Just address the comments below and we can merge your change. Thanks for your help!

@thatfiredev
Copy link
Member Author

Thanks @rlazo ! All done.

@rlazo
Copy link
Collaborator

rlazo commented Aug 10, 2020

Thanks!

@rlazo rlazo merged commit 6ddd7d2 into firebase:master Aug 10, 2020
@thatfiredev thatfiredev deleted the rpf-fdl-ktx branch August 10, 2020 16:20
@google-oss-bot
Copy link
Contributor

@rosariopfernandes: The following test failed, say /retest to rerun them all:

Test name Commit Details Rerun command
smoke-tests 9b84fd3 link /test smoke-tests

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@firebase firebase locked and limited conversation to collaborators Sep 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants