mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-android.git
synced 2026-04-21 22:38:01 +00:00
chore: remove Branch.io SDK and route deep links through own domain
Branch.io was inherited from Nova Wallet fork but never configured. Removed SDK integration, manifest intent filters, Gradle dependencies, Dagger DI modules, and string resources. Deep linking now routes exclusively through app.pezkuwichain.io with verified assetlinks.json.
This commit is contained in:
@@ -11,10 +11,6 @@ android {
|
||||
versionCode computeVersionCode()
|
||||
versionName computeVersionName()
|
||||
|
||||
// Branch.io key from local.properties or environment variable
|
||||
manifestPlaceholders = [
|
||||
BRANCH_KEY: readRawSecretOrNull('BRANCH_KEY') ?: "key_test_placeholder"
|
||||
]
|
||||
}
|
||||
signingConfigs {
|
||||
dev {
|
||||
|
||||
@@ -127,17 +127,6 @@
|
||||
<data android:host="app.pezkuwichain.io" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter android:autoVerify="true">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="https"/>
|
||||
<data android:host="@string/branch_io_link_host"/>
|
||||
<data android:host="@string/branch_io_link_host_alternate"/>
|
||||
</intent-filter>
|
||||
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
@@ -206,12 +195,6 @@
|
||||
android:name="io.novafoundation.nova.multisigs_notification_channel_id"
|
||||
android:value="@string/multisigs_notification_channel_id" />
|
||||
|
||||
<meta-data
|
||||
android:name="io.branch.sdk.BranchKey"
|
||||
android:value="${BRANCH_KEY}" />
|
||||
|
||||
<meta-data android:name="io.branch.sdk.TestMode" android:value="false" />
|
||||
|
||||
</application>
|
||||
|
||||
<queries>
|
||||
|
||||
@@ -15,7 +15,6 @@ import io.novafoundation.nova.common.di.FeatureContainer
|
||||
import io.novafoundation.nova.common.resources.ContextManager
|
||||
import io.novafoundation.nova.common.resources.LanguagesHolder
|
||||
import io.novafoundation.nova.common.utils.coroutines.RootScope
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.branchIo.BranchIOLinkHandler
|
||||
import io.novafoundation.nova.feature_wallet_connect_impl.BuildConfig
|
||||
import javax.inject.Inject
|
||||
|
||||
@@ -57,8 +56,6 @@ open class App : Application(), FeatureContainer {
|
||||
|
||||
appComponent.inject(this)
|
||||
|
||||
BranchIOLinkHandler.Initializer.init(this)
|
||||
|
||||
initializeWalletConnect()
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,6 @@ import io.novafoundation.nova.feature_dapp_api.data.repository.BrowserTabExterna
|
||||
import io.novafoundation.nova.feature_dapp_api.data.repository.DAppMetadataRepository
|
||||
import io.novafoundation.nova.feature_dapp_api.di.deeplinks.DAppDeepLinks
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.PendingDeepLinkProvider
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.branchIo.BranchIoLinkConverter
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.common.DeepLinkingPreferences
|
||||
import io.novafoundation.nova.feature_gift_api.di.GiftDeepLinks
|
||||
import io.novafoundation.nova.feature_governance_api.data.MutableGovernanceState
|
||||
@@ -122,8 +121,6 @@ interface RootDependencies {
|
||||
|
||||
val deepLinkingPreferences: DeepLinkingPreferences
|
||||
|
||||
val branchIoLinkConverter: BranchIoLinkConverter
|
||||
|
||||
val pendingDeepLinkProvider: PendingDeepLinkProvider
|
||||
|
||||
val multisigExtrinsicValidationRequestBus: MultisigExtrinsicValidationRequestBus
|
||||
|
||||
@@ -12,8 +12,6 @@ import io.novafoundation.nova.feature_dapp_api.di.deeplinks.DAppDeepLinks
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.DeepLinkHandler
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.PendingDeepLinkProvider
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.RootDeepLinkHandler
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.branchIo.BranchIOLinkHandler
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.branchIo.BranchIoLinkConverter
|
||||
import io.novafoundation.nova.feature_gift_api.di.GiftDeepLinks
|
||||
import io.novafoundation.nova.feature_governance_api.di.deeplinks.GovernanceDeepLinks
|
||||
import io.novafoundation.nova.feature_multisig_operations.di.deeplink.MultisigDeepLinks
|
||||
@@ -65,11 +63,4 @@ class DeepLinksModule {
|
||||
)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@FeatureScope
|
||||
fun provideBranchIOLinkHandler(
|
||||
branchIoLinkConverter: BranchIoLinkConverter
|
||||
): BranchIOLinkHandler {
|
||||
return BranchIOLinkHandler(branchIoLinkConverter)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import io.novafoundation.nova.common.utils.systemCall.SystemCallExecutor
|
||||
import io.novafoundation.nova.common.utils.updatePadding
|
||||
import io.novafoundation.nova.common.view.bottomSheet.action.observeActionBottomSheet
|
||||
import io.novafoundation.nova.common.view.dialog.dialog
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.branchIo.BranchIOLinkHandler
|
||||
import io.novafoundation.nova.feature_push_notifications.presentation.multisigsWarning.observeEnableMultisigPushesAlert
|
||||
import io.novafoundation.nova.splash.presentation.SplashBackgroundHolder
|
||||
|
||||
@@ -36,9 +35,6 @@ class RootActivity : BaseActivity<RootViewModel, ActivityRootBinding>(), SplashB
|
||||
@Inject
|
||||
lateinit var contextManager: ContextManager
|
||||
|
||||
@Inject
|
||||
lateinit var branchIOLinkHandler: BranchIOLinkHandler
|
||||
|
||||
override fun createBinding(): ActivityRootBinding {
|
||||
return ActivityRootBinding.inflate(LayoutInflater.from(this))
|
||||
}
|
||||
@@ -92,7 +88,6 @@ class RootActivity : BaseActivity<RootViewModel, ActivityRootBinding>(), SplashB
|
||||
super.onNewIntent(intent)
|
||||
setIntent(intent)
|
||||
|
||||
branchIOLinkHandler.onActivityNewIntent(this, intent)
|
||||
processIntent(intent)
|
||||
}
|
||||
|
||||
@@ -108,8 +103,6 @@ class RootActivity : BaseActivity<RootViewModel, ActivityRootBinding>(), SplashB
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
|
||||
branchIOLinkHandler.onActivityStart(this, viewModel::handleDeepLink)
|
||||
|
||||
viewModel.noticeInForeground()
|
||||
}
|
||||
|
||||
|
||||
@@ -220,8 +220,6 @@ buildscript {
|
||||
|
||||
swipeRefershLayout = "androidx.swiperefreshlayout:swiperefreshlayout:1.2.0-alpha01"
|
||||
|
||||
branchIo = "io.branch.sdk.android:library:5.18.0"
|
||||
|
||||
playServiceIdentifier = "com.google.android.gms:play-services-ads-identifier:18.2.0"
|
||||
|
||||
androidxWebKit = "androidx.webkit:webkit:1.14.0"
|
||||
|
||||
@@ -302,8 +302,6 @@
|
||||
<string name="account_migration_accepted_url" translatable="false">%s://polkadot/migration-accepted?key=%s</string>
|
||||
<string name="account_ledger_import_start_step_3_highlighted">access Bluetooth</string>
|
||||
|
||||
<string name="branch_io_link_host" translatable="false">pezkuwi-wallet.app.link</string>
|
||||
<string name="branch_io_link_host_alternate" translatable="false">pezkuwi-wallet-alternate.app.link</string>
|
||||
|
||||
<string name="ledger_verify_addresses_message_both_buttons">Press both buttons on yê te %s to approve addresses</string>
|
||||
<string name="ledger_verify_addresses_message_confirm_button">Press confirm button on yê te %s to approve addresses</string>
|
||||
|
||||
@@ -2759,8 +2759,6 @@
|
||||
<string name="wallet_send_phishing_warning_title">Scam alert</string>
|
||||
<string name="wallet_transfer_details_title">Transfer details</string>
|
||||
<string name="yesterday">Yesterday</string>
|
||||
<string name="branch_io_link_host" translatable="false">pezkuwi-wallet.app.link</string>
|
||||
<string name="branch_io_link_host_alternate" translatable="false">pezkuwi-wallet-alternate.app.link</string>
|
||||
|
||||
<string name="pezkuwi_dashboard_title">Pezkuwi</string>
|
||||
<string name="pezkuwi_dashboard_trust_score">Trust Score</string>
|
||||
|
||||
@@ -24,7 +24,6 @@ dependencies {
|
||||
implementation androidDep
|
||||
implementation materialDep
|
||||
|
||||
implementation branchIo
|
||||
implementation playServiceIdentifier
|
||||
|
||||
implementation coroutinesDep
|
||||
|
||||
-3
@@ -2,7 +2,6 @@ package io.novafoundation.nova.feature_deep_linking.di
|
||||
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.configuring.LinkBuilderFactory
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.PendingDeepLinkProvider
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.branchIo.BranchIoLinkConverter
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.common.DeepLinkingPreferences
|
||||
|
||||
interface DeepLinkingFeatureApi {
|
||||
@@ -10,7 +9,5 @@ interface DeepLinkingFeatureApi {
|
||||
|
||||
val pendingDeepLinkProvider: PendingDeepLinkProvider
|
||||
|
||||
val branchIoLinkConverter: BranchIoLinkConverter
|
||||
|
||||
val linkBuilderFactory: LinkBuilderFactory
|
||||
}
|
||||
|
||||
+1
-11
@@ -8,7 +8,6 @@ import io.novafoundation.nova.common.resources.ResourceManager
|
||||
import io.novafoundation.nova.feature_deep_linking.R
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.configuring.LinkBuilderFactory
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.PendingDeepLinkProvider
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.branchIo.BranchIoLinkConverter
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.common.DeepLinkingPreferences
|
||||
|
||||
@Module
|
||||
@@ -21,11 +20,7 @@ class DeepLinkingFeatureModule {
|
||||
) = DeepLinkingPreferences(
|
||||
deepLinkScheme = resourceManager.getString(R.string.deep_linking_scheme),
|
||||
deepLinkHost = resourceManager.getString(R.string.deep_linking_host),
|
||||
appLinkHost = resourceManager.getString(R.string.app_link_host),
|
||||
branchIoLinkHosts = listOf(
|
||||
resourceManager.getString(R.string.branch_io_link_host),
|
||||
resourceManager.getString(R.string.branch_io_link_host_alternate)
|
||||
)
|
||||
appLinkHost = resourceManager.getString(R.string.app_link_host)
|
||||
)
|
||||
|
||||
@Provides
|
||||
@@ -38,9 +33,4 @@ class DeepLinkingFeatureModule {
|
||||
return PendingDeepLinkProvider(preferences)
|
||||
}
|
||||
|
||||
@Provides
|
||||
@FeatureScope
|
||||
fun provideBranchIoLinkConverter(
|
||||
deepLinkingPreferences: DeepLinkingPreferences
|
||||
) = BranchIoLinkConverter(deepLinkingPreferences)
|
||||
}
|
||||
|
||||
+16
-6
@@ -2,7 +2,6 @@ package io.novafoundation.nova.feature_deep_linking.presentation.configuring
|
||||
|
||||
import android.net.Uri
|
||||
import io.novafoundation.nova.common.utils.appendPathOrSkip
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.branchIo.BranchIOConstants
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.common.DeepLinkingPreferences
|
||||
|
||||
interface LinkBuilder {
|
||||
@@ -76,22 +75,26 @@ class AppLinkBuilderType(
|
||||
private val deepLinkingPreferences: DeepLinkingPreferences
|
||||
) : LinkBuilder {
|
||||
|
||||
private var action: String? = null
|
||||
private var entity: String? = null
|
||||
private var screen: String? = null
|
||||
|
||||
private val urlBuilder = Uri.Builder()
|
||||
.scheme("https")
|
||||
.authority(deepLinkingPreferences.branchIoLinkHosts.first())
|
||||
.authority(deepLinkingPreferences.appLinkHost)
|
||||
|
||||
override fun setAction(action: String): LinkBuilder {
|
||||
urlBuilder.appendQueryParameter(BranchIOConstants.ACTION_QUERY, action)
|
||||
this.action = action
|
||||
return this
|
||||
}
|
||||
|
||||
override fun setEntity(entity: String): LinkBuilder {
|
||||
urlBuilder.appendQueryParameter(BranchIOConstants.ENTITY_QUERY, entity)
|
||||
this.entity = entity
|
||||
return this
|
||||
}
|
||||
|
||||
override fun setScreen(screen: String): LinkBuilder {
|
||||
urlBuilder.appendQueryParameter(BranchIOConstants.SCREEN_QUERY, screen)
|
||||
this.screen = screen
|
||||
return this
|
||||
}
|
||||
|
||||
@@ -101,7 +104,14 @@ class AppLinkBuilderType(
|
||||
}
|
||||
|
||||
override fun build(): Uri {
|
||||
return urlBuilder.build()
|
||||
val finalPath = Uri.Builder()
|
||||
.appendPathOrSkip(action)
|
||||
.appendPathOrSkip(entity)
|
||||
.appendPathOrSkip(screen)
|
||||
.build()
|
||||
.path
|
||||
|
||||
return urlBuilder.path(finalPath).build()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-7
@@ -1,7 +0,0 @@
|
||||
package io.novafoundation.nova.feature_deep_linking.presentation.handling.branchIo
|
||||
|
||||
object BranchIOConstants {
|
||||
const val ACTION_QUERY = "action"
|
||||
const val SCREEN_QUERY = "screen"
|
||||
const val ENTITY_QUERY = "entity"
|
||||
}
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
package io.novafoundation.nova.feature_deep_linking.presentation.handling.branchIo
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.util.Log
|
||||
import io.branch.referral.Branch
|
||||
import io.branch.referral.Defines
|
||||
import io.novafoundation.nova.common.utils.LOG_TAG
|
||||
import io.novafoundation.nova.feature_deep_linking.BuildConfig
|
||||
|
||||
class BranchIOLinkHandler(
|
||||
private val deepLinkFactory: BranchIoLinkConverter
|
||||
) {
|
||||
|
||||
object Initializer {
|
||||
fun init(context: Context) {
|
||||
if (BuildConfig.DEBUG) {
|
||||
Branch.enableLogging()
|
||||
}
|
||||
|
||||
val branchInstance = Branch.getAutoInstance(context)
|
||||
branchInstance.setConsumerProtectionAttributionLevel(Defines.BranchAttributionLevel.REDUCED)
|
||||
}
|
||||
}
|
||||
|
||||
fun onActivityStart(activity: Activity, deepLinkCallback: (Uri) -> Unit) {
|
||||
Branch.sessionBuilder(activity)
|
||||
.withCallback { branchUniversalObject, _, error ->
|
||||
if (error != null) {
|
||||
Log.e(LOG_TAG, error.toString())
|
||||
}
|
||||
|
||||
if (branchUniversalObject != null) {
|
||||
val deepLink = deepLinkFactory.formatToDeepLink(branchUniversalObject)
|
||||
deepLinkCallback(deepLink)
|
||||
}
|
||||
}
|
||||
.withData(activity.intent.data)
|
||||
.init()
|
||||
}
|
||||
|
||||
fun onActivityNewIntent(activity: Activity, intent: Intent?) {
|
||||
if (intent != null && intent.getBooleanExtra("branch_force_new_session", false)) {
|
||||
Branch.sessionBuilder(activity)
|
||||
.withCallback { _, error ->
|
||||
if (error != null) {
|
||||
Log.e(LOG_TAG, error.toString())
|
||||
}
|
||||
}
|
||||
.withData(intent.data)
|
||||
.reInit()
|
||||
}
|
||||
}
|
||||
}
|
||||
-44
@@ -1,44 +0,0 @@
|
||||
package io.novafoundation.nova.feature_deep_linking.presentation.handling.branchIo
|
||||
|
||||
import android.net.Uri
|
||||
import io.branch.indexing.BranchUniversalObject
|
||||
import io.novafoundation.nova.common.utils.appendPathOrSkip
|
||||
import io.novafoundation.nova.common.utils.appendQueries
|
||||
import io.novafoundation.nova.feature_deep_linking.presentation.handling.common.DeepLinkingPreferences
|
||||
|
||||
private val BRANCH_PARAMS_PREFIX = listOf("~", "$", "+")
|
||||
|
||||
class BranchIoLinkConverter(
|
||||
private val deepLinkingPreferences: DeepLinkingPreferences
|
||||
) {
|
||||
|
||||
fun formatToDeepLink(data: BranchUniversalObject): Uri {
|
||||
val queries = data.contentMetadata.customMetadata
|
||||
.excludeInternalIOQueries()
|
||||
.toMutableMap()
|
||||
|
||||
return Uri.Builder()
|
||||
.scheme(deepLinkingPreferences.deepLinkScheme)
|
||||
.authority(deepLinkingPreferences.deepLinkHost)
|
||||
.appendPathOrSkip(queries.extractAction())
|
||||
.appendPathOrSkip(queries.extractSubject())
|
||||
.appendQueries(queries)
|
||||
.build()
|
||||
}
|
||||
|
||||
private fun Map<String, String>.excludeInternalIOQueries(): Map<String, String> {
|
||||
return filterKeys { key ->
|
||||
val isBranchIOQuery = BRANCH_PARAMS_PREFIX.any { prefix -> key.startsWith(prefix) }
|
||||
!isBranchIOQuery
|
||||
}
|
||||
}
|
||||
|
||||
private fun MutableMap<String, String>.extractAction(): String? {
|
||||
return remove(BranchIOConstants.ACTION_QUERY)
|
||||
}
|
||||
|
||||
private fun MutableMap<String, String>.extractSubject(): String? {
|
||||
return remove(BranchIOConstants.SCREEN_QUERY)
|
||||
?: remove(BranchIOConstants.ENTITY_QUERY)
|
||||
}
|
||||
}
|
||||
+1
-2
@@ -5,8 +5,7 @@ import android.net.Uri
|
||||
class DeepLinkingPreferences(
|
||||
val deepLinkScheme: String,
|
||||
val deepLinkHost: String,
|
||||
val appLinkHost: String,
|
||||
val branchIoLinkHosts: List<String>
|
||||
val appLinkHost: String
|
||||
)
|
||||
|
||||
fun Uri.isDeepLink(preferences: DeepLinkingPreferences): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user