-
Notifications
You must be signed in to change notification settings - Fork 656
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scope EmbeddedComponentManager instances to Activities
- Loading branch information
1 parent
c72b3ed
commit 47f60e0
Showing
7 changed files
with
88 additions
and
95 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
25 changes: 25 additions & 0 deletions
25
connect-example/src/main/java/com/stripe/android/connect/example/BaseActivity.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,25 @@ | ||
package com.stripe.android.connect.example | ||
|
||
import android.os.Bundle | ||
import androidx.activity.ComponentActivity | ||
import androidx.activity.viewModels | ||
import androidx.annotation.CallSuper | ||
import com.stripe.android.connect.EmbeddedComponentManager | ||
import com.stripe.android.connect.PrivateBetaConnectSDK | ||
import com.stripe.android.connect.example.ui.embeddedcomponentmanagerloader.EmbeddedComponentLoaderViewModel | ||
import dagger.hilt.android.AndroidEntryPoint | ||
|
||
@OptIn(PrivateBetaConnectSDK::class) | ||
@AndroidEntryPoint | ||
abstract class BaseActivity : ComponentActivity() { | ||
|
||
protected val loaderViewModel: EmbeddedComponentLoaderViewModel by viewModels() | ||
|
||
@CallSuper | ||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
|
||
EmbeddedComponentManager.onActivityCreate(this) | ||
lifecycle.addObserver(loaderViewModel) | ||
} | ||
} |
13 changes: 2 additions & 11 deletions
13
connect-example/src/main/java/com/stripe/android/connect/example/MainActivity.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
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.