-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ec8f663
commit d8a9a62
Showing
32 changed files
with
1,520 additions
and
9 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
19 changes: 19 additions & 0 deletions
19
sdk/src/main/java/com/oursky/authgear/OAuthWebViewActivity.kt
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,19 @@ | ||
package com.oursky.authgear | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.net.Uri | ||
|
||
internal class OAuthWebViewActivity : OAuthWebViewBaseActivity() { | ||
|
||
companion object { | ||
fun createIntent(ctx: Context?, broadcastAction: String, uri: Uri?, redirectUri: Uri?): Intent { | ||
val intent = Intent(ctx, OAuthWebViewActivity::class.java) | ||
intent.data = uri | ||
intent.putExtra(OAuthWebViewBaseActivity.KEY_BROADCAST_ACTION, broadcastAction) | ||
intent.putExtra(OAuthWebViewBaseActivity.KEY_REDIRECT_URI, redirectUri) | ||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | ||
return intent | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
sdk/src/main/java/com/oursky/authgear/OAuthWebViewFullScreenActivity.kt
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,19 @@ | ||
package com.oursky.authgear | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.net.Uri | ||
|
||
internal class OAuthWebViewFullScreenActivity : OAuthWebViewBaseActivity() { | ||
|
||
companion object { | ||
fun createIntent(ctx: Context?, broadcastAction: String, uri: Uri?, redirectUri: Uri?): Intent { | ||
val intent = Intent(ctx, OAuthWebViewFullScreenActivity::class.java) | ||
intent.data = uri | ||
intent.putExtra(OAuthWebViewBaseActivity.KEY_BROADCAST_ACTION, broadcastAction) | ||
intent.putExtra(OAuthWebViewBaseActivity.KEY_REDIRECT_URI, redirectUri) | ||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | ||
return intent | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package com.oursky.authgear | ||
|
||
enum class UIVariant { | ||
CUSTOM_TABS | ||
CUSTOM_TABS, | ||
WEB_VIEW, | ||
WEB_VIEW_FULL_SCREEN | ||
} |
16 changes: 16 additions & 0 deletions
16
sdk/src/main/java/com/oursky/authgear/latte/AuthenticateOptions.kt
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,16 @@ | ||
package com.oursky.authgear.latte | ||
|
||
import com.oursky.authgear.ColorScheme | ||
import com.oursky.authgear.PromptOption | ||
|
||
data class AuthenticateOptions @JvmOverloads constructor( | ||
var xSecrets: Map<String, String> = mapOf(), | ||
var xState: Map<String, String> = mapOf(), | ||
var responseType: String? = "code", | ||
var prompt: List<PromptOption>? = null, | ||
var loginHint: String? = null, | ||
var uiLocales: List<String>? = null, | ||
var colorScheme: ColorScheme? = null, | ||
var wechatRedirectURI: String? = null, | ||
var page: String? = null | ||
) |
12 changes: 12 additions & 0 deletions
12
sdk/src/main/java/com/oursky/authgear/latte/BiometricOptions.kt
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,12 @@ | ||
package com.oursky.authgear.latte | ||
|
||
import androidx.fragment.app.FragmentActivity | ||
|
||
data class BiometricOptions constructor( | ||
var activity: FragmentActivity, | ||
var title: String, | ||
var subtitle: String? = null, | ||
var description: String? = null, | ||
var negativeButtonText: String? = null, | ||
var allowedAuthenticators: Int = androidx.biometric.BiometricManager.Authenticators.BIOMETRIC_WEAK | ||
) |
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,5 @@ | ||
package com.oursky.authgear.latte | ||
|
||
enum class Capability(val raw: String) { | ||
BIOMETRIC("biometric") | ||
} |
45 changes: 45 additions & 0 deletions
45
sdk/src/main/java/com/oursky/authgear/latte/EmailClient.kt
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,45 @@ | ||
package com.oursky.authgear.latte | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.content.pm.LabeledIntent | ||
import android.content.pm.PackageManager | ||
|
||
data class EmailClient(val packageName: String) { | ||
companion object { | ||
@JvmField | ||
val GMAIL = EmailClient("com.google.android.gm") | ||
@JvmField | ||
val OUTLOOK = EmailClient("com.microsoft.office.outlook") | ||
|
||
@JvmStatic | ||
fun makeEmailClientIntentChooser( | ||
ctx: Context, | ||
title: String, | ||
clients: List<EmailClient> | ||
): Intent? { | ||
val launchIntents: MutableList<Intent> = mutableListOf() | ||
val pm: PackageManager = ctx.packageManager | ||
for (client in clients) { | ||
val intent = pm.getLaunchIntentForPackage(client.packageName) ?: continue | ||
val info = pm.resolveActivity(intent, 0) ?: continue | ||
launchIntents.add( | ||
LabeledIntent( | ||
intent, | ||
client.packageName, | ||
info.loadLabel(pm), | ||
info.icon | ||
) | ||
) | ||
} | ||
if (launchIntents.size == 0) { | ||
return null | ||
} | ||
val firstIntent = launchIntents[0] | ||
val chooser = Intent.createChooser(firstIntent, title) | ||
chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, launchIntents.toTypedArray()) | ||
chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) | ||
return chooser | ||
} | ||
} | ||
} |
Oops, something went wrong.