Skip to content

Commit 7073555

Browse files
committed
Add request intent flags
1 parent 2d8c136 commit 7073555

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/com/codepath/oauth/OAuthBaseClient.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public abstract class OAuthBaseClient {
1919
protected SharedPreferences.Editor editor;
2020
protected OAuthAccessHandler accessHandler;
2121
protected String callbackUrl;
22+
protected int requestIntentFlags = -1;
2223

2324
protected static HashMap<Class<? extends OAuthBaseClient>, OAuthBaseClient> instances =
2425
new HashMap<Class<? extends OAuthBaseClient>, OAuthBaseClient>();
@@ -52,6 +53,7 @@ public void onReceivedRequestToken(Token requestToken, String authorizeUrl) {
5253
}
5354
// Launch the authorization URL in the browser
5455
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(authorizeUrl + "&perms=delete"));
56+
if (requestIntentFlags != -1) { intent.setFlags(requestIntentFlags); }
5557
OAuthBaseClient.this.context.startActivity(intent);
5658
}
5759

@@ -144,6 +146,11 @@ public void clearAccessToken() {
144146
public boolean isAuthenticated() {
145147
return client.getAccessToken() != null;
146148
}
149+
150+
// Sets the flags used when launching browser to authenticate through OAuth
151+
public void setRequestIntentFlags(int flags) {
152+
this.requestIntentFlags = flags;
153+
}
147154

148155
// Defines the handler events for the OAuth flow
149156
public static interface OAuthAccessHandler {

0 commit comments

Comments
 (0)