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

Ignore project preview deep-links #538

Merged
merged 6 commits into from Jan 9, 2019

Conversation

justinswart
Copy link
Contributor

@justinswart justinswart commented Dec 21, 2018

πŸ“² What

Ignores project preview links as these should be handled by mobile safari and not by the app itself.

πŸ€” Why

We don't currently support project preview links in the app but because their URL structure matches a route in our Navigation enum the app attempts to open them. This fails and the user is stuck in the app when they should be redirected back out to mobile safari.

πŸ›  How

  • Added a projectPreview case to Navigation so that we can be sure that a given URL is in fact a preview URL.
  • If a match is found, we ignore it by returning .failure, thereby using the existing functionality to ignore unrecognized URLs.

πŸ‘€ See

https://trello.com/c/4GS7SNZ8

βœ… Acceptance criteria

  • Project preview links should open the app but then redirect back to mobile safari (will need to be tested in Release mode).

@@ -1365,6 +1365,39 @@ final class AppDelegateViewModelTests: TestCase {
self.goToMobileSafari.assertValues([unrecognizedUrl], "Go to mobile safari for the unrecognized url.")
}

func testEmailDeepLinking_UnrecognizedUrl_ProjectPreview() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test is essentially the same as the one above it but it explicitly uses a known project preview link (containing token query param) to test that it will be ignored.

@@ -38,6 +38,8 @@ public final class NavigationTests: XCTestCase {
KSRAssertMatch(.project(.slug("project"), .root, refTag: nil),
"/projects/creator/project")

KSRAssertMatch(nil, "/projects/creator/project?token=4")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just proves that we get a nil match on this type of URL.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wonder whether we should also add KSRAssertMatch(nil, "/projects/creator/project?ref=discovery&token=4") for exhausted url example.

<^> params <| "project_param"
<*> .success(.root)
<*> params <|? "ref"
<*> params <| "token"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Treats token as required for a project preview link.

@justinswart justinswart changed the title Ignore project preview deep-links [wip] Ignore project preview deep-links Dec 21, 2018
@@ -407,8 +404,11 @@ AppDelegateViewModelOutputs {
.filter { $0 == .tab(.me) }
.ignoreValues()

self.goToMobileSafari = self.foundRedirectUrlProperty.signal.skipNil()
.filter { Navigation.deepLinkMatch($0) == nil }
self.goToMobileSafari = Signal.merge(
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you might be able to just use deeplinkFromUrl.skipNil() here. Just wanted to make a note of that in case I forget later πŸ˜„

@justinswart
Copy link
Contributor Author

@justinswart justinswart removed the WIP label Jan 3, 2019
@justinswart justinswart changed the title [wip] Ignore project preview deep-links Ignore project preview deep-links Jan 3, 2019
@justinswart justinswart force-pushed the ignore-project-preview-deeplinks branch 2 times, most recently from 9765033 to 8a35671 Compare January 8, 2019 18:28
dusi
dusi previously approved these changes Jan 9, 2019
@dusi dusi dismissed their stale review January 9, 2019 01:03

Waiting for CI to finish

@justinswart justinswart force-pushed the ignore-project-preview-deeplinks branch from a314a93 to 75cfd98 Compare January 9, 2019 01:20
Copy link
Contributor

@dusi dusi left a comment

Choose a reason for hiding this comment

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

@justinswart
Copy link
Contributor Author

Thanks for digging in and testing!

@justinswart justinswart merged commit 2d7aa8e into master Jan 9, 2019
@justinswart justinswart deleted the ignore-project-preview-deeplinks branch January 9, 2019 01:51
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.

None yet

3 participants