Skip to content

Commit

Permalink
Initialize mavericks via content provider.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosmuvi-stripe committed May 16, 2022
1 parent 041e91a commit cf0c027
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 32 deletions.
6 changes: 6 additions & 0 deletions financial-connections/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
android:name="com.stripe.android.financialconnections.FinancialConnectionsSheetActivity"
android:exported="false"
android:theme="@style/StripeDefaultTheme" />

<provider
android:name=".appinitializer.FinancialConnectionsInitializer"
android:authorities="${applicationId}.financialconnections-init"
android:exported="false"
android:multiprocess="true" />
</application>

<!--
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package com.stripe.android.financialconnections
import android.os.Parcelable
import androidx.activity.ComponentActivity
import androidx.fragment.app.Fragment
import com.airbnb.mvrx.Mavericks
import com.stripe.android.financialconnections.launcher.FinancialConnectionsSheetForDataLauncher
import com.stripe.android.financialconnections.launcher.FinancialConnectionsSheetForTokenLauncher
import com.stripe.android.financialconnections.launcher.FinancialConnectionsSheetLauncher
Expand All @@ -17,13 +16,8 @@ import kotlinx.parcelize.Parcelize
*/
class FinancialConnectionsSheet internal constructor(
private val financialConnectionsSheetLauncher: FinancialConnectionsSheetLauncher,
financialConnectionsInitializer: FinancialConnectionsInitializer = FinancialConnectionsInitializer()
) {

init {
financialConnectionsInitializer.initialize()
}

/**
* Configuration for a [FinancialConnectionsSheet]
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.stripe.android.financialconnections.appinitializer

import android.content.ContentProvider
import android.content.ContentValues
import android.database.Cursor
import android.net.Uri
import com.airbnb.mvrx.Mavericks

class FinancialConnectionsInitializer : ContentProvider() {
override fun onCreate(): Boolean {
Mavericks.initialize(context = requireNotNull(context))
return true
}

override fun query(
uri: Uri,
projection: Array<String>?,
selection: String?,
selectionArgs: Array<String>?,
sortOrder: String?
): Cursor? {
return null
}

override fun getType(uri: Uri): String? = null

override fun insert(uri: Uri, values: ContentValues?): Uri? = null

override fun delete(
uri: Uri,
selection: String?,
selectionArgs: Array<String>?
): Int = 0

override fun update(
uri: Uri,
values: ContentValues?,
selection: String?,
selectionArgs: Array<String>?
): Int = 0
}

0 comments on commit cf0c027

Please sign in to comment.