Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehardy authored Jan 25, 2021
1 parent e484c95 commit 8ecff6e
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ public class ReactNativeFirebaseDynamicLinksModule extends ReactNativeFirebaseMo
*/
private boolean gotInitialLink = false;
/**
* Used by getInitialLink to check if the activity has been resumed.
* "host" here refers to the host activity.
* Used by getInitialLink to check if the activity has been resumed.
* "host" refers to the host activity, in terms of {@link LifeCycleEventListener#onHostResume()}
*/
private boolean hostResumed = false;
/**
Expand Down Expand Up @@ -134,7 +134,7 @@ public void getInitialLink(Promise promise) {

// Check for the case where getInitialLink
// runs before the LifeCycleState is RESUMED (e.g. BEFORE_CREATE or BEFORE_RESUME).
if(!hostResumed) {
if (!hostResumed) {
// Use initialPromise to store the Promise that was passed and
// run it when LifeCycleState changes to RESUMED in onHostResume.
initialPromise = promise;
Expand All @@ -150,7 +150,7 @@ public void getInitialLink(Promise promise) {

Intent currentIntent = currentActivity.getIntent();
// Verify if the app was resumed from the Overview (history) screen.
launchedFromHistory = currentIntent != null && (currentIntent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0;
launchedFromHistory = (currentIntent != null) && ((currentIntent.getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) != 0);

FirebaseDynamicLinks.getInstance().getDynamicLink(currentIntent)
.addOnCompleteListener(task -> {
Expand Down Expand Up @@ -438,7 +438,7 @@ public void onHostResume() {
hostResumed = true;
// Check if getInitialLink was called before LifeCycleState was RESUMED
// and there's a pending Promise.
if(initialPromise != null) {
if (initialPromise != null) {
// Call getInitialLink getInitialLink with the Promise that was passed in the original call.
getInitialLink(initialPromise);
// Clear the Promise
Expand Down

0 comments on commit 8ecff6e

Please sign in to comment.