-
Notifications
You must be signed in to change notification settings - Fork 992
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
deep linking first pass #171
Conversation
hey @eoji what discovery queries are included here? |
@ktman Deep linking to the Discovery screen was already present. In this PR, if the user clicks a link to https://www.kickstarter.com/projects, they're taken to Discovery |
ohhh interesting. mind testing what happens to queries like https://www.kickstarter.com/discover/advanced?woe_id=23424796&sort=magic&seed=2514803&page=2 want to make sure we're bouncing the queries we don't support back to web. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coooooool 😎 couple of small questions but looks good!
} | ||
|
||
private void inputPackageManager(final String url) { | ||
if (!TextUtils.isEmpty(url)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we add a .filter(url -> !TextUtils.isEmpty(url))
on the output here so that we won't get empty values emitted? https://github.com/kickstarter/android-oss/pull/171/files#diff-2f428d6bea56ac66d4ec1a8567629475R105
unless I'm missing something and we actually want those
|
||
uriFromIntent | ||
.filter(uri -> KSUri.isProjectUri(uri, uri.toString())) | ||
.map(Uri::toString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we just keep this output as an Observable<Uri>
since we're converting back to a Uri
in the view holder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some lil comments! awesome woooorrrkkkkk
@RequiresActivityViewModel(DeepLinkViewModel.ViewModel.class) | ||
public class DeepLinkActivity extends BaseActivity<DeepLinkViewModel.ViewModel> { | ||
@Override | ||
protected void onCreate(@Nullable final Bundle savedInstanceState) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we like to put our annotations right next to what it's annotating, e.g. final @Nullable Bundle savedInstanceState
import static com.kickstarter.libs.rx.transformers.Transformers.observeForUI; | ||
|
||
@RequiresActivityViewModel(DeepLinkViewModel.ViewModel.class) | ||
public class DeepLinkActivity extends BaseActivity<DeepLinkViewModel.ViewModel> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class can be final
finish(); | ||
} | ||
|
||
private void startProjectActivity(final String url) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NonNull
, L65 & 74 as well
} | ||
|
||
private void startProjectActivity(final String url) { | ||
final Uri uri = Uri.parse(url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alternatively, we could output the Uri rather than Url since we only need the Uri to start the activity
} | ||
|
||
private void startBrowser(final List<Intent> targetIntents) { | ||
final Intent chooserIntent = Intent.createChooser(targetIntents.remove(0), ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we can add a lil comment to explain why we need to remove the first targetIntent
?
intent.setData(pair.second); | ||
return intent; | ||
}) | ||
.toList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
niceee
.map(Uri::toString) | ||
.compose(bindToLifecycle()) | ||
.subscribe(this.requestPackageManager::onNext); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can nix this new line and add one btwn L109-110
} | ||
|
||
@Override | ||
public Observable<String> requestPackageManager() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these Observable functions can all be annotated with a @NonNull
return type
@@ -493,4 +493,11 @@ public void trackOpenedExternalLink(final @NonNull Project project, final @NonNu | |||
|
|||
this.client.track(KoalaEvent.OPENED_EXTERNAL_LINK, props); | |||
} | |||
|
|||
// DEEP LINK | |||
public void trackUserActivity() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we tend to name these Koala event functions exactly the event they're tracking; since UserActivity
is kind of vague, maybe we can be Xtra and name this trackContinueUserActivityAndOpenedDeepLink
or something of the sorts!
return new Intent() | ||
.setData(Uri.parse(url)); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
siqqqqq tests!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to meee just a couple non blocking questions
} | ||
|
||
private void startBrowser(final @NonNull List<Intent> targetIntents) { | ||
if (!targetIntents.isEmpty()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to confirm we want to call this method even if the targetIntents
are an empty list? If we don't need to call this then we could add a filter on the end of the output and have it not emit (but maybe we want finish()
to get called here?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we want to finish the DeepLinkActivity
!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
noice
when we add the EXTRA_INITIAL_INTENTS intents. */ | ||
final Intent chooserIntent = Intent.createChooser(targetIntents.remove(0), ""); | ||
chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS, | ||
targetIntents.toArray(new Parcelable[targetIntents.size()])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could any of this logic get pushed into the ViewModel? not sure if it relies on any context from the activity...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think only startActivity
, I really just need the chooserIntent
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lil nits im sry but logic and important things LGTM!
import static com.kickstarter.libs.rx.transformers.Transformers.observeForUI; | ||
|
||
@RequiresActivityViewModel(DeepLinkViewModel.ViewModel.class) | ||
final public class DeepLinkActivity extends BaseActivity<DeepLinkViewModel.ViewModel> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public final
protected void onCreate(final @Nullable Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
this.viewModel.outputs.startDiscoveryActivity() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can also alphabetize these outputs
…-linking # Conflicts: # app/src/main/java/com/kickstarter/libs/KoalaEvent.java
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazingggg 👌
what
First pass of deep linking on Android. This adds deep links to the discovery page and project pages.
views