Skip to content

Commit

Permalink
Rename CANCELED to INCOMPLETE
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahkoop committed Jan 3, 2024
1 parent f427f47 commit 8813e70
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ public Intent createIntent(@NonNull Context context, BrowserSwitchOptions browse
public BrowserSwitchResult parseResult(int resultCode, @Nullable Intent intent) {
// A successful result will be returned via deep link back to the app, so the only result
// that will be delivered via activity result is a cancel (ex: the user closed the browser)
return new BrowserSwitchResult(BrowserSwitchStatus.CANCELED, request);
return new BrowserSwitchResult(BrowserSwitchStatus.INCOMPLETE, request);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public BrowserSwitchResult deliverResult(@NonNull FragmentActivity activity) {
// ensure that success result is delivered exactly once
persistentStore.clearActiveRequest(appContext);
break;
case BrowserSwitchStatus.CANCELED:
case BrowserSwitchStatus.INCOMPLETE:
// ensure that cancellation result is delivered exactly once, but allow for
// a cancellation result to remain in shared storage in case it
// later becomes successful
Expand Down Expand Up @@ -166,7 +166,7 @@ public BrowserSwitchResult getResult(@NonNull FragmentActivity activity) {
if (deepLinkUrl != null && request.matchesDeepLinkUrlScheme(deepLinkUrl)) {
result = new BrowserSwitchResult(BrowserSwitchStatus.SUCCESS, request, deepLinkUrl);
} else if (request.getShouldNotifyCancellation()) {
result = new BrowserSwitchResult(BrowserSwitchStatus.CANCELED, request);
result = new BrowserSwitchResult(BrowserSwitchStatus.INCOMPLETE, request);
}

return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* The status of a {@link BrowserSwitchResult}.
*/
@Retention(RetentionPolicy.SOURCE)
@IntDef({BrowserSwitchStatus.SUCCESS, BrowserSwitchStatus.CANCELED})
@IntDef({BrowserSwitchStatus.SUCCESS, BrowserSwitchStatus.INCOMPLETE})
public @interface BrowserSwitchStatus {

/**
Expand All @@ -18,7 +18,7 @@
int SUCCESS = 1;

/**
* Browser switch is considered canceled when a user re-enters the app without deep link.
* Browser switch is considered incomplete when a user re-enters the app without deep link.
*/
int CANCELED = 2;
int INCOMPLETE = 2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public void deliverResult_whenDeepLinkUrlExists_AndReturnUrlSchemeDoesNotMatch_A
assertNotNull(result);
assertEquals(123, result.getRequestCode());
assertSame(browserSwitchDestinationUrl, result.getRequestUrl());
assertEquals(result.getStatus(), BrowserSwitchStatus.CANCELED);
assertEquals(result.getStatus(), BrowserSwitchStatus.INCOMPLETE);
assertSame(result.getRequestMetadata(), requestMetadata);
assertNull(result.getDeepLinkUrl());

Expand Down Expand Up @@ -327,7 +327,7 @@ public void deliverResult_whenDeepLinkUrlDoesNotExistAndShouldNotifyCancellation
assertNotNull(result);
assertEquals(123, result.getRequestCode());
assertSame(browserSwitchDestinationUrl, result.getRequestUrl());
assertEquals(result.getStatus(), BrowserSwitchStatus.CANCELED);
assertEquals(result.getStatus(), BrowserSwitchStatus.INCOMPLETE);
assertSame(result.getRequestMetadata(), requestMetadata);
assertNull(result.getDeepLinkUrl());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down Expand Up @@ -117,7 +116,7 @@ public void onBrowserSwitchResult(BrowserSwitchResult result) {
selectedColorText = String.format("Selected color: %s", color);
}
break;
case BrowserSwitchStatus.CANCELED:
case BrowserSwitchStatus.INCOMPLETE:
resultText = "Browser Switch Cancelled by User";
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class LauncherActivity : AppCompatActivity() {
}
}

BrowserSwitchStatus.CANCELED -> resultText = "Browser Switch Cancelled by User"
BrowserSwitchStatus.INCOMPLETE -> resultText = "Browser Switch Cancelled by User"
}
var metadataOutput: String? = null
val requestMetadata = result.requestMetadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class LauncherActivityNoButton : AppCompatActivity() {
}
}

BrowserSwitchStatus.CANCELED -> resultText = "Browser Switch Cancelled by User"
BrowserSwitchStatus.INCOMPLETE -> resultText = "Browser Switch Cancelled by User"
}
var metadataOutput: String? = null
val requestMetadata = result.requestMetadata
Expand Down

0 comments on commit 8813e70

Please sign in to comment.