mirror of
https://github.com/element-hq/element-android
synced 2024-11-28 05:31:21 +03:00
Give analytics to Activities and Fragments
This commit is contained in:
parent
42d987f8ef
commit
eeeab1dd0e
5 changed files with 18 additions and 0 deletions
|
@ -21,6 +21,7 @@ import dagger.hilt.InstallIn
|
|||
import dagger.hilt.components.SingletonComponent
|
||||
import im.vector.app.core.dialogs.UnrecognizedCertificateDialog
|
||||
import im.vector.app.core.error.ErrorFormatter
|
||||
import im.vector.app.features.analytics.VectorAnalytics
|
||||
import im.vector.app.features.call.webrtc.WebRtcCallManager
|
||||
import im.vector.app.features.home.AvatarRenderer
|
||||
import im.vector.app.features.navigation.Navigator
|
||||
|
@ -55,6 +56,8 @@ interface SingletonEntryPoint {
|
|||
|
||||
fun pinLocker(): PinLocker
|
||||
|
||||
fun analytics(): VectorAnalytics
|
||||
|
||||
fun webRtcCallManager(): WebRtcCallManager
|
||||
|
||||
fun appCoroutineScope(): CoroutineScope
|
||||
|
|
|
@ -66,6 +66,7 @@ import im.vector.app.core.flow.throttleFirst
|
|||
import im.vector.app.core.utils.toast
|
||||
import im.vector.app.features.MainActivity
|
||||
import im.vector.app.features.MainActivityArgs
|
||||
import im.vector.app.features.analytics.VectorAnalytics
|
||||
import im.vector.app.features.configuration.VectorConfiguration
|
||||
import im.vector.app.features.consent.ConsentNotGivenHelper
|
||||
import im.vector.app.features.navigation.Navigator
|
||||
|
@ -134,6 +135,7 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
|
|||
private lateinit var sessionListener: SessionListener
|
||||
protected lateinit var bugReporter: BugReporter
|
||||
private lateinit var pinLocker: PinLocker
|
||||
protected lateinit var analytics: VectorAnalytics
|
||||
|
||||
@Inject
|
||||
lateinit var rageShake: RageShake
|
||||
|
@ -189,6 +191,7 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
|
|||
configurationViewModel = viewModelProvider.get(ConfigurationViewModel::class.java)
|
||||
bugReporter = singletonEntryPoint.bugReporter()
|
||||
pinLocker = singletonEntryPoint.pinLocker()
|
||||
analytics = singletonEntryPoint.analytics()
|
||||
navigator = singletonEntryPoint.navigator()
|
||||
activeSessionHolder = singletonEntryPoint.activeSessionHolder()
|
||||
vectorPreferences = singletonEntryPoint.vectorPreferences()
|
||||
|
|
|
@ -34,9 +34,11 @@ import com.google.android.material.bottomsheet.BottomSheetDialog
|
|||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||
import dagger.hilt.android.EntryPointAccessors
|
||||
import im.vector.app.core.di.ActivityEntryPoint
|
||||
import im.vector.app.core.extensions.singletonEntryPoint
|
||||
import im.vector.app.core.extensions.toMvRxBundle
|
||||
import im.vector.app.core.flow.throttleFirst
|
||||
import im.vector.app.core.utils.DimensionConverter
|
||||
import im.vector.app.features.analytics.VectorAnalytics
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
import reactivecircus.flowbinding.android.view.clicks
|
||||
|
@ -83,6 +85,8 @@ abstract class VectorBaseBottomSheetDialogFragment<VB : ViewBinding> : BottomShe
|
|||
|
||||
open val showExpanded = false
|
||||
|
||||
protected lateinit var analytics: VectorAnalytics
|
||||
|
||||
interface ResultListener {
|
||||
fun onBottomSheetResult(resultCode: Int, data: Any?)
|
||||
|
||||
|
@ -120,6 +124,8 @@ abstract class VectorBaseBottomSheetDialogFragment<VB : ViewBinding> : BottomShe
|
|||
override fun onAttach(context: Context) {
|
||||
val activityEntryPoint = EntryPointAccessors.fromActivity(vectorBaseActivity, ActivityEntryPoint::class.java)
|
||||
viewModelFactory = activityEntryPoint.viewModelFactory()
|
||||
val singletonEntryPoint = context.singletonEntryPoint()
|
||||
analytics = singletonEntryPoint.analytics()
|
||||
super.onAttach(context)
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ import im.vector.app.core.error.ErrorFormatter
|
|||
import im.vector.app.core.extensions.singletonEntryPoint
|
||||
import im.vector.app.core.extensions.toMvRxBundle
|
||||
import im.vector.app.core.flow.throttleFirst
|
||||
import im.vector.app.features.analytics.VectorAnalytics
|
||||
import im.vector.app.features.navigation.Navigator
|
||||
import im.vector.lib.ui.styles.dialogs.MaterialProgressDialog
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
|
@ -61,6 +62,7 @@ abstract class VectorBaseFragment<VB : ViewBinding> : Fragment(), MavericksView
|
|||
* ========================================================================================== */
|
||||
|
||||
protected lateinit var navigator: Navigator
|
||||
protected lateinit var analytics: VectorAnalytics
|
||||
protected lateinit var errorFormatter: ErrorFormatter
|
||||
protected lateinit var unrecognizedCertificateDialog: UnrecognizedCertificateDialog
|
||||
|
||||
|
@ -97,6 +99,7 @@ abstract class VectorBaseFragment<VB : ViewBinding> : Fragment(), MavericksView
|
|||
val activityEntryPoint = EntryPointAccessors.fromActivity(vectorBaseActivity, ActivityEntryPoint::class.java)
|
||||
navigator = singletonEntryPoint.navigator()
|
||||
errorFormatter = singletonEntryPoint.errorFormatter()
|
||||
analytics = singletonEntryPoint.analytics()
|
||||
unrecognizedCertificateDialog = singletonEntryPoint.unrecognizedCertificateDialog()
|
||||
viewModelFactory = activityEntryPoint.viewModelFactory()
|
||||
childFragmentManager.fragmentFactory = activityEntryPoint.fragmentFactory()
|
||||
|
|
|
@ -28,6 +28,7 @@ import im.vector.app.core.error.ErrorFormatter
|
|||
import im.vector.app.core.extensions.singletonEntryPoint
|
||||
import im.vector.app.core.platform.VectorBaseActivity
|
||||
import im.vector.app.core.utils.toast
|
||||
import im.vector.app.features.analytics.VectorAnalytics
|
||||
import org.matrix.android.sdk.api.session.Session
|
||||
import timber.log.Timber
|
||||
|
||||
|
@ -42,6 +43,7 @@ abstract class VectorSettingsBaseFragment : PreferenceFragmentCompat(), Maverick
|
|||
// members
|
||||
protected lateinit var session: Session
|
||||
protected lateinit var errorFormatter: ErrorFormatter
|
||||
protected lateinit var analytics: VectorAnalytics
|
||||
|
||||
abstract val preferenceXmlRes: Int
|
||||
|
||||
|
@ -56,6 +58,7 @@ abstract class VectorSettingsBaseFragment : PreferenceFragmentCompat(), Maverick
|
|||
super.onAttach(context)
|
||||
session = singletonEntryPoint.activeSessionHolder().getActiveSession()
|
||||
errorFormatter = singletonEntryPoint.errorFormatter()
|
||||
analytics = singletonEntryPoint.analytics()
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
|
|
Loading…
Reference in a new issue