-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[connect] Init Account Onboarding settings; XML layout POC (#9769)
* init onboarding settings; refactor settings nav graph * init full terms of service saving * add more fields * pass props to webview * prove XML layout usage * lint * resource lint * tweak AppearanceView UI * add previews * cleanup * rm unused * refactor API to prevent updating props after init * string resources * cleanup and comments * fix tests * lint
- Loading branch information
1 parent
3d66b3c
commit e1b1316
Showing
24 changed files
with
766 additions
and
98 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
35 changes: 34 additions & 1 deletion
35
...android/connect/example/ui/features/accountonboarding/AccountOnboardingExampleActivity.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 |
---|---|---|
@@ -1,19 +1,52 @@ | ||
package com.stripe.android.connect.example.ui.features.accountonboarding | ||
|
||
import android.content.Context | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import androidx.activity.viewModels | ||
import com.stripe.android.connect.AccountOnboardingProps | ||
import com.stripe.android.connect.EmbeddedComponentManager | ||
import com.stripe.android.connect.PrivateBetaConnectSDK | ||
import com.stripe.android.connect.example.R | ||
import com.stripe.android.connect.example.databinding.ViewAccountOnboardingExampleBinding | ||
import com.stripe.android.connect.example.ui.common.BasicExampleComponentActivity | ||
import com.stripe.android.connect.example.ui.settings.SettingsViewModel | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@OptIn(PrivateBetaConnectSDK::class) | ||
@AndroidEntryPoint | ||
class AccountOnboardingExampleActivity : BasicExampleComponentActivity() { | ||
override val titleRes: Int = R.string.account_onboarding | ||
|
||
private val settingsViewModel by viewModels<SettingsViewModel>() | ||
|
||
override fun createComponentView(context: Context, embeddedComponentManager: EmbeddedComponentManager): View { | ||
return embeddedComponentManager.createAccountOnboardingView(context) | ||
val settings = settingsViewModel.state.value | ||
val onboardingSettings = settings.onboardingSettings | ||
val settingsProps = AccountOnboardingProps( | ||
fullTermsOfServiceUrl = onboardingSettings.fullTermsOfServiceString, | ||
recipientTermsOfServiceUrl = onboardingSettings.recipientTermsOfServiceString, | ||
privacyPolicyUrl = onboardingSettings.privacyPolicyString, | ||
) | ||
return if (settings.presentationSettings.useXmlViews) { | ||
ViewAccountOnboardingExampleBinding.inflate(LayoutInflater.from(context)).root | ||
.apply { | ||
val props = AccountOnboardingProps( | ||
fullTermsOfServiceUrl = settingsProps.fullTermsOfServiceUrl, | ||
recipientTermsOfServiceUrl = settingsProps.recipientTermsOfServiceUrl, | ||
privacyPolicyUrl = settingsProps.privacyPolicyUrl, | ||
) | ||
initialize( | ||
embeddedComponentManager = embeddedComponentManager, | ||
listener = null, | ||
props = props | ||
) | ||
} | ||
} else { | ||
embeddedComponentManager.createAccountOnboardingView( | ||
context = context, | ||
props = settingsProps | ||
) | ||
} | ||
} | ||
} |
28 changes: 24 additions & 4 deletions
28
...ain/java/com/stripe/android/connect/example/ui/features/payouts/PayoutsExampleActivity.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
Oops, something went wrong.