mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-22 15:50:51 +01:00
moving debug menu access to only the debug sourceset and providing an injectable interface to decouple from the direct access
This commit is contained in:
parent
e02cf61f2f
commit
19c8b2a630
@ -9,6 +9,7 @@
|
||||
<activity android:name=".features.debug.settings.DebugPrivateSettingsActivity" />
|
||||
<activity android:name=".features.debug.sas.DebugSasEmojiActivity" />
|
||||
<activity android:name=".features.debug.features.DebugFeaturesSettingsActivity" />
|
||||
<activity android:name=".features.debug.DebugMenuActivity" />
|
||||
|
||||
<activity
|
||||
android:name="com.facebook.flipper.android.diagnostics.FlipperDiagnosticActivity"
|
||||
|
@ -16,17 +16,32 @@
|
||||
|
||||
package im.vector.app.features.debug.di
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import dagger.Binds
|
||||
import dagger.Module
|
||||
import dagger.Provides
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import im.vector.app.core.platform.DebugReceiver
|
||||
import im.vector.app.features.debug.DebugMenuActivity
|
||||
import im.vector.app.features.navigation.DebugNavigator
|
||||
import im.vector.app.receivers.VectorDebugReceiver
|
||||
|
||||
@InstallIn(SingletonComponent::class)
|
||||
@Module
|
||||
abstract class DebugModule {
|
||||
|
||||
companion object {
|
||||
|
||||
@Provides
|
||||
fun providesDebugNavigator() = object : DebugNavigator {
|
||||
override fun openDebugMenu(context: Context) {
|
||||
context.startActivity(Intent(context, DebugMenuActivity::class.java))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Binds
|
||||
abstract fun bindsDebugReceiver(receiver: VectorDebugReceiver): DebugReceiver
|
||||
}
|
||||
|
@ -187,7 +187,6 @@
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".features.home.HomeActivity" />
|
||||
</activity>
|
||||
<activity android:name=".features.debug.DebugMenuActivity" />
|
||||
<activity android:name=".features.createdirect.CreateDirectRoomActivity" />
|
||||
<activity android:name=".features.invite.InviteUsersToRoomActivity" />
|
||||
<activity android:name=".features.webview.VectorWebViewActivity" />
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2019 New Vector Ltd
|
||||
* Copyright (c) 2022 New Vector Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -14,9 +14,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package im.vector.app.features.debug
|
||||
package im.vector.app.features.navigation
|
||||
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import android.content.Context
|
||||
|
||||
// This activity is not accessible
|
||||
class DebugMenuActivity : AppCompatActivity()
|
||||
interface DebugNavigator {
|
||||
fun openDebugMenu(context: Context)
|
||||
}
|
@ -51,7 +51,6 @@ import im.vector.app.features.crypto.recover.BootstrapBottomSheet
|
||||
import im.vector.app.features.crypto.recover.SetupMode
|
||||
import im.vector.app.features.crypto.verification.SupportedVerificationMethodsProvider
|
||||
import im.vector.app.features.crypto.verification.VerificationBottomSheet
|
||||
import im.vector.app.features.debug.DebugMenuActivity
|
||||
import im.vector.app.features.devtools.RoomDevToolActivity
|
||||
import im.vector.app.features.home.room.detail.RoomDetailActivity
|
||||
import im.vector.app.features.home.room.detail.arguments.TimelineArgs
|
||||
@ -123,7 +122,8 @@ class DefaultNavigator @Inject constructor(
|
||||
private val spaceStateHandler: SpaceStateHandler,
|
||||
private val supportedVerificationMethodsProvider: SupportedVerificationMethodsProvider,
|
||||
private val features: VectorFeatures,
|
||||
private val analyticsTracker: AnalyticsTracker
|
||||
private val analyticsTracker: AnalyticsTracker,
|
||||
private val debugNavigator: DebugNavigator,
|
||||
) : Navigator {
|
||||
|
||||
override fun openLogin(context: Context, loginConfig: LoginConfig?, flags: Int) {
|
||||
@ -367,7 +367,7 @@ class DefaultNavigator @Inject constructor(
|
||||
}
|
||||
|
||||
override fun openDebug(context: Context) {
|
||||
context.startActivity(Intent(context, DebugMenuActivity::class.java))
|
||||
debugNavigator.openDebugMenu(context)
|
||||
}
|
||||
|
||||
override fun openKeysBackupSetup(context: Context, showManualExport: Boolean) {
|
||||
@ -615,3 +615,4 @@ class DefaultNavigator @Inject constructor(
|
||||
context.startActivity(this)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,12 +21,21 @@ import dagger.Module
|
||||
import dagger.hilt.InstallIn
|
||||
import dagger.hilt.components.SingletonComponent
|
||||
import im.vector.app.core.platform.DebugReceiver
|
||||
import im.vector.app.features.navigation.DebugNavigator
|
||||
|
||||
@InstallIn(SingletonComponent::class)
|
||||
@Module
|
||||
object DebugModule {
|
||||
|
||||
@Provides
|
||||
fun providesDebugReceiver() = object: DebugReceiver {
|
||||
fun providesDebugNavigator() = object : DebugNavigator {
|
||||
override fun openDebugMenu(context: Context) {
|
||||
// no op
|
||||
}
|
||||
}
|
||||
|
||||
@Provides
|
||||
fun providesDebugReceiver() = object : DebugReceiver {
|
||||
override fun register(context: Context) {
|
||||
// no op
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user