This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:background="@drawable/splash_background" | |
android:orientation="vertical" | |
android:scrollbarAlwaysDrawVerticalTrack="true"> | |
<TextView |
This file contains hidden or 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
class AuthenticatorActivity : Activity(), AuthenticationHandler { | |
companion object { | |
private val TAG: String = this::class.java.simpleName | |
} | |
/** | |
* The identityManager for this application | |
*/ | |
private val identityManager: IdentityManager by inject() |
This file contains hidden or 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
/** | |
* Handles the login event | |
*/ | |
private fun handleLogin() { | |
val username = loginform_username.getContent() | |
val password = loginform_password.getContent() | |
Log.d(TAG, "handleLogin - username = $username, password = $password") | |
/** |
This file contains hidden or 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
/** | |
* Part of the AuthenticationHandler interface | |
* | |
* Called when the Amazon Cognito service returns a valid set of tokens, when the tokens | |
* are available (cached) or after successful completion of the authentication process. | |
* | |
* @param userSession Contains the valid user tokens | |
* @param newDevice If this is a new device, then contains the device information | |
*/ | |
override fun onSuccess(userSession: CognitoUserSession?, newDevice: CognitoDevice?) { |
This file contains hidden or 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
@Suppress("InflateParams") | |
override fun getMFACode(continuation: MultiFactorAuthenticationContinuation?) { | |
runOnUiThread { | |
val mfaPromptDialog = layoutInflater.inflate(R.layout.dialog_mfa_prompt, null) | |
val mfaInput = mfaPromptDialog.find(R.id.mfapromptdialog_code) as MFAEditText | |
continuation?.let { | |
val mfaInstructions = mfaPromptDialog.find(R.id.mfapromptdialog_instructions) as TextView | |
mfaInstructions.text = "Enter the code we just sent to ${it.parameters.deliveryMedium}:${it.parameters.destination}" | |
} | |
alert { |
This file contains hidden or 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
package com.shellmonger.apps.familyphotos.services.interfaces | |
import android.arch.lifecycle.LiveData | |
import com.shellmonger.apps.familyphotos.models.User | |
enum class IdentityRequest { | |
NEED_CREDENTIALS, | |
NEED_NEWPASSWORD, | |
NEED_MULTIFACTORCODE, | |
SUCCESS, |
This file contains hidden or 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
package com.shellmonger.apps.familyphotos.services.mock | |
import android.arch.lifecycle.LiveData | |
import android.arch.lifecycle.MutableLiveData | |
import android.util.Log | |
import com.amazonaws.mobile.auth.core.internal.util.ThreadUtils.runOnUiThread | |
import com.shellmonger.apps.familyphotos.models.User | |
import com.shellmonger.apps.familyphotos.services.interfaces.IdentityHandler | |
import com.shellmonger.apps.familyphotos.services.interfaces.IdentityManager | |
import com.shellmonger.apps.familyphotos.services.interfaces.IdentityRequest |
This file contains hidden or 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
@SuppressLint("InflateParams") | |
private fun handleLogin() { | |
identityManager.initiateSignin { | |
request, params, callback -> when(request) { | |
IdentityRequest.NEED_CREDENTIALS -> { | |
Log.d(TAG, "NEED_CREDENTIALS") | |
callback(mapOf("username" to loginform_username.getContent(), "password" to loginform_password.getContent())) | |
} | |
IdentityRequest.NEED_NEWPASSWORD -> { |
This file contains hidden or 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
#!/usr/bin/env bash | |
echo "Processing $1" | |
base=${1//.html/} | |
# split .html into an empty file, a .yaml and an .htm | |
csplit "$base.html" '/---/' | |
mv xx00 tmp/$base.yaml | |
mv xx01 tmp/$base.html |
This file contains hidden or 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
<?xml version="1.0" encoding="utf-8"?> | |
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context=".ui.NoteDetailActivity"> | |
<EditText | |
android:id="@+id/detail_title_editor" |