-
Notifications
You must be signed in to change notification settings - Fork 649
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master' into poc-mavericks
- Loading branch information
Showing
30 changed files
with
401 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
6 changes: 4 additions & 2 deletions
6
...ripecardscan/framework/util/FrameSaver.kt → ...droid/camera/framework/util/FrameSaver.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
2 changes: 1 addition & 1 deletion
2
...cardscan/framework/util/FrameSaverTest.kt → ...d/camera/framework/util/FrameSaverTest.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
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
63 changes: 63 additions & 0 deletions
63
...droid/financialconnections/example/FinancialConnectionsBankAccountTokenExampleActivity.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,63 @@ | ||
package com.stripe.android.financialconnections.example | ||
|
||
import android.os.Bundle | ||
import androidx.activity.viewModels | ||
import androidx.appcompat.app.AppCompatActivity | ||
import androidx.lifecycle.lifecycleScope | ||
import com.stripe.android.financialconnections.example.databinding.ActivityFinancialconnectionsExampleBinding | ||
import com.stripe.android.financialconnections.FinancialConnectionsSheet | ||
import com.stripe.android.financialconnections.example.FinancialConnectionsExampleViewEffect.OpenFinancialConnectionsSheetExample | ||
|
||
class FinancialConnectionsBankAccountTokenExampleActivity : AppCompatActivity() { | ||
|
||
private val viewModel by viewModels<FinancialConnectionsExampleViewModel>() | ||
|
||
private lateinit var financialConnectionsSheet: FinancialConnectionsSheet | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
with(ActivityFinancialconnectionsExampleBinding.inflate(layoutInflater)) { | ||
setContentView(root) | ||
setupViews() | ||
observeViews() | ||
observeState() | ||
} | ||
} | ||
|
||
private fun ActivityFinancialconnectionsExampleBinding.setupViews() { | ||
toolbar.setTitle(R.string.collect_bank_account_for_bank_account_token_title) | ||
setSupportActionBar(toolbar) | ||
financialConnectionsSheet = FinancialConnectionsSheet.createForBankAccountToken( | ||
activity = this@FinancialConnectionsBankAccountTokenExampleActivity, | ||
callback = viewModel::onFinancialConnectionsSheetForBankAccountTokenResult | ||
) | ||
} | ||
|
||
private fun ActivityFinancialconnectionsExampleBinding.observeViews() { | ||
launchConnectionsSheet.setOnClickListener { viewModel.startFinancialConnectionsSessionForToken() } | ||
} | ||
|
||
private fun ActivityFinancialconnectionsExampleBinding.observeState() { | ||
lifecycleScope.launchWhenStarted { | ||
viewModel.state.collect { | ||
bindState(it, this@observeState) | ||
} | ||
} | ||
lifecycleScope.launchWhenStarted { | ||
viewModel.viewEffect.collect { | ||
when (it) { | ||
is OpenFinancialConnectionsSheetExample -> financialConnectionsSheet.present(it.configuration) | ||
} | ||
} | ||
} | ||
} | ||
|
||
private fun bindState( | ||
financialConnectionsExampleState: FinancialConnectionsExampleState, | ||
viewBinding: ActivityFinancialconnectionsExampleBinding | ||
) { | ||
viewBinding.status.text = financialConnectionsExampleState.status | ||
viewBinding.launchConnectionsSheet.isEnabled = | ||
financialConnectionsExampleState.loading.not() | ||
} | ||
} |
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
Oops, something went wrong.