-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #49 from Onegini/develop
Develop
- Loading branch information
Showing
13 changed files
with
145 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
app/src/main/java/com/onegini/mobile/exampleapp/view/handler/RegistrationRequestHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* Copyright (c) 2016 Onegini B.V. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.onegini.mobile.exampleapp.view.handler; | ||
|
||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.net.Uri; | ||
import com.onegini.mobile.sdk.android.handlers.request.OneginiRegistrationRequestHandler; | ||
import com.onegini.mobile.sdk.android.handlers.request.callback.OneginiRegistrationCallback; | ||
|
||
public class RegistrationRequestHandler implements OneginiRegistrationRequestHandler { | ||
|
||
private static OneginiRegistrationCallback CALLBACK; | ||
|
||
/** | ||
* Finish registration action with result from web browser | ||
*/ | ||
public static void handleRegistrationCallback(final Uri uri) { | ||
if (CALLBACK != null) { | ||
CALLBACK.handleRegistrationCallback(uri); | ||
CALLBACK = null; | ||
} | ||
} | ||
|
||
/** | ||
* Cancel registration action in case of web browser error | ||
*/ | ||
public static void onRegistrationCanceled() { | ||
if (CALLBACK != null) { | ||
CALLBACK.denyRegistration(); | ||
CALLBACK = null; | ||
} | ||
} | ||
|
||
private final Context context; | ||
|
||
public RegistrationRequestHandler(final Context context) { | ||
this.context = context; | ||
} | ||
|
||
@Override | ||
public void startRegistration(final Uri uri, final OneginiRegistrationCallback oneginiRegistrationCallback) { | ||
CALLBACK = oneginiRegistrationCallback; | ||
|
||
// We're going to launch external browser to allow user to log in. You could also use embedded WebView instead. | ||
final Intent intent = new Intent(Intent.ACTION_VIEW, uri); | ||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); | ||
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY); | ||
|
||
context.startActivity(intent); | ||
} | ||
} |
41 changes: 0 additions & 41 deletions
41
app/src/main/java/com/onegini/mobile/exampleapp/view/handler/RegistrationURLHandler.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.