mirror of
https://github.com/vector-im/element-android.git
synced 2024-12-01 16:01:36 +08:00
Hilt: replace the VectorComponent
This commit is contained in:
parent
7ec0872b78
commit
ff53cf4db9
@ -17,6 +17,7 @@ buildscript {
|
|||||||
// https://developer.android.com/studio/releases/gradle-plugin
|
// https://developer.android.com/studio/releases/gradle-plugin
|
||||||
classpath libs.gradle.gradlePlugin
|
classpath libs.gradle.gradlePlugin
|
||||||
classpath libs.gradle.kotlinPlugin
|
classpath libs.gradle.kotlinPlugin
|
||||||
|
classpath libs.gradle.hiltPlugin
|
||||||
classpath 'com.google.gms:google-services:4.3.10'
|
classpath 'com.google.gms:google-services:4.3.10'
|
||||||
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'
|
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'
|
||||||
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.4'
|
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.4'
|
||||||
|
@ -34,7 +34,9 @@ def androidxTest = "1.4.0"
|
|||||||
ext.libs = [
|
ext.libs = [
|
||||||
gradle : [
|
gradle : [
|
||||||
'gradlePlugin' : "com.android.tools.build:gradle:$gradle",
|
'gradlePlugin' : "com.android.tools.build:gradle:$gradle",
|
||||||
'kotlinPlugin' : "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin"
|
'kotlinPlugin' : "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin",
|
||||||
|
'hiltPlugin' : "com.google.dagger:hilt-android-gradle-plugin:$dagger"
|
||||||
|
|
||||||
],
|
],
|
||||||
jetbrains : [
|
jetbrains : [
|
||||||
'kotlinStdlibJdk7' : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin",
|
'kotlinStdlibJdk7' : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin",
|
||||||
@ -74,7 +76,9 @@ ext.libs = [
|
|||||||
],
|
],
|
||||||
dagger : [
|
dagger : [
|
||||||
'dagger' : "com.google.dagger:dagger:$dagger",
|
'dagger' : "com.google.dagger:dagger:$dagger",
|
||||||
'daggerCompiler' : "com.google.dagger:dagger-compiler:$dagger"
|
'daggerCompiler' : "com.google.dagger:dagger-compiler:$dagger",
|
||||||
|
'hilt' : "com.google.dagger:hilt-android:$dagger",
|
||||||
|
'hiltCompiler' : "com.google.dagger:hilt-compiler:$dagger"
|
||||||
],
|
],
|
||||||
squareup : [
|
squareup : [
|
||||||
'moshi' : "com.squareup.moshi:moshi-adapters:$moshi",
|
'moshi' : "com.squareup.moshi:moshi-adapters:$moshi",
|
||||||
|
@ -6,6 +6,7 @@ apply plugin: 'kotlin-android'
|
|||||||
apply plugin: 'kotlin-parcelize'
|
apply plugin: 'kotlin-parcelize'
|
||||||
apply plugin: 'kotlin-kapt'
|
apply plugin: 'kotlin-kapt'
|
||||||
apply plugin: 'placeholder-resolver'
|
apply plugin: 'placeholder-resolver'
|
||||||
|
apply plugin: 'dagger.hilt.android.plugin'
|
||||||
|
|
||||||
kapt {
|
kapt {
|
||||||
correctErrorTypes = true
|
correctErrorTypes = true
|
||||||
@ -457,8 +458,8 @@ dependencies {
|
|||||||
implementation 'nl.dionsegijn:konfetti:1.3.2'
|
implementation 'nl.dionsegijn:konfetti:1.3.2'
|
||||||
implementation 'com.github.jetradarmobile:android-snowfall:1.2.1'
|
implementation 'com.github.jetradarmobile:android-snowfall:1.2.1'
|
||||||
// DI
|
// DI
|
||||||
implementation libs.dagger.dagger
|
implementation libs.dagger.hilt
|
||||||
kapt libs.dagger.daggerCompiler
|
kapt libs.dagger.hiltCompiler
|
||||||
|
|
||||||
// gplay flavor only
|
// gplay flavor only
|
||||||
gplayImplementation('com.google.firebase:firebase-messaging:22.0.0') {
|
gplayImplementation('com.google.firebase:firebase-messaging:22.0.0') {
|
||||||
|
@ -39,10 +39,11 @@ import com.facebook.stetho.Stetho
|
|||||||
import com.gabrielittner.threetenbp.LazyThreeTen
|
import com.gabrielittner.threetenbp.LazyThreeTen
|
||||||
import com.vanniktech.emoji.EmojiManager
|
import com.vanniktech.emoji.EmojiManager
|
||||||
import com.vanniktech.emoji.google.GoogleEmojiProvider
|
import com.vanniktech.emoji.google.GoogleEmojiProvider
|
||||||
|
import dagger.hilt.EntryPoints
|
||||||
|
import dagger.hilt.android.HiltAndroidApp
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
import im.vector.app.core.di.ActiveSessionHolder
|
||||||
import im.vector.app.core.di.DaggerVectorComponent
|
import im.vector.app.core.di.AggregatorEntryPoint
|
||||||
import im.vector.app.core.di.HasVectorInjector
|
import im.vector.app.core.di.HasVectorInjector
|
||||||
import im.vector.app.core.di.VectorComponent
|
|
||||||
import im.vector.app.core.extensions.configureAndStart
|
import im.vector.app.core.extensions.configureAndStart
|
||||||
import im.vector.app.core.extensions.startSyncing
|
import im.vector.app.core.extensions.startSyncing
|
||||||
import im.vector.app.core.rx.RxConfig
|
import im.vector.app.core.rx.RxConfig
|
||||||
@ -75,6 +76,7 @@ import java.util.concurrent.Executors
|
|||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import androidx.work.Configuration as WorkConfiguration
|
import androidx.work.Configuration as WorkConfiguration
|
||||||
|
|
||||||
|
@HiltAndroidApp
|
||||||
class VectorApplication :
|
class VectorApplication :
|
||||||
Application(),
|
Application(),
|
||||||
HasVectorInjector,
|
HasVectorInjector,
|
||||||
@ -100,8 +102,6 @@ class VectorApplication :
|
|||||||
@Inject lateinit var callManager: WebRtcCallManager
|
@Inject lateinit var callManager: WebRtcCallManager
|
||||||
@Inject lateinit var invitesAcceptor: InvitesAcceptor
|
@Inject lateinit var invitesAcceptor: InvitesAcceptor
|
||||||
|
|
||||||
lateinit var vectorComponent: VectorComponent
|
|
||||||
|
|
||||||
// font thread handler
|
// font thread handler
|
||||||
private var fontThreadHandler: Handler? = null
|
private var fontThreadHandler: Handler? = null
|
||||||
|
|
||||||
@ -114,12 +114,15 @@ class VectorApplication :
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun component(): AggregatorEntryPoint {
|
||||||
|
// Use EntryPoints to get an instance of the AggregatorEntryPoint.
|
||||||
|
return EntryPoints.get(this, AggregatorEntryPoint::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
enableStrictModeIfNeeded()
|
enableStrictModeIfNeeded()
|
||||||
super.onCreate()
|
super.onCreate()
|
||||||
appContext = this
|
appContext = this
|
||||||
vectorComponent = DaggerVectorComponent.factory().create(this)
|
|
||||||
vectorComponent.inject(this)
|
|
||||||
invitesAcceptor.initialize()
|
invitesAcceptor.initialize()
|
||||||
vectorUncaughtExceptionHandler.activate(this)
|
vectorUncaughtExceptionHandler.activate(this)
|
||||||
rxConfig.setupRxPlugin()
|
rxConfig.setupRxPlugin()
|
||||||
@ -132,7 +135,7 @@ class VectorApplication :
|
|||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
Timber.plant(Timber.DebugTree())
|
Timber.plant(Timber.DebugTree())
|
||||||
}
|
}
|
||||||
Timber.plant(vectorComponent.vectorFileLogger())
|
Timber.plant(component().vectorFileLogger())
|
||||||
|
|
||||||
if (BuildConfig.DEBUG) {
|
if (BuildConfig.DEBUG) {
|
||||||
Stetho.initializeWithDefaults(this)
|
Stetho.initializeWithDefaults(this)
|
||||||
@ -236,8 +239,8 @@ class VectorApplication :
|
|||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun injector(): VectorComponent {
|
override fun injector(): AggregatorEntryPoint {
|
||||||
return vectorComponent
|
return component()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun logInfo() {
|
private fun logInfo() {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2019 New Vector Ltd
|
* Copyright (c) 2021 New Vector Ltd
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -18,13 +18,13 @@ package im.vector.app.core.di
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
import dagger.BindsInstance
|
import dagger.hilt.EntryPoint
|
||||||
import dagger.Component
|
import dagger.hilt.InstallIn
|
||||||
|
import dagger.hilt.components.SingletonComponent
|
||||||
import im.vector.app.ActiveSessionDataSource
|
import im.vector.app.ActiveSessionDataSource
|
||||||
import im.vector.app.AppStateHandler
|
import im.vector.app.AppStateHandler
|
||||||
import im.vector.app.EmojiCompatFontProvider
|
import im.vector.app.EmojiCompatFontProvider
|
||||||
import im.vector.app.EmojiCompatWrapper
|
import im.vector.app.EmojiCompatWrapper
|
||||||
import im.vector.app.VectorApplication
|
|
||||||
import im.vector.app.core.dialogs.UnrecognizedCertificateDialog
|
import im.vector.app.core.dialogs.UnrecognizedCertificateDialog
|
||||||
import im.vector.app.core.dispatchers.CoroutineDispatchers
|
import im.vector.app.core.dispatchers.CoroutineDispatchers
|
||||||
import im.vector.app.core.error.ErrorFormatter
|
import im.vector.app.core.error.ErrorFormatter
|
||||||
@ -47,7 +47,6 @@ import im.vector.app.features.invite.AutoAcceptInvites
|
|||||||
import im.vector.app.features.login.ReAuthHelper
|
import im.vector.app.features.login.ReAuthHelper
|
||||||
import im.vector.app.features.navigation.Navigator
|
import im.vector.app.features.navigation.Navigator
|
||||||
import im.vector.app.features.notifications.NotifiableEventResolver
|
import im.vector.app.features.notifications.NotifiableEventResolver
|
||||||
import im.vector.app.features.notifications.NotificationBroadcastReceiver
|
|
||||||
import im.vector.app.features.notifications.NotificationDrawerManager
|
import im.vector.app.features.notifications.NotificationDrawerManager
|
||||||
import im.vector.app.features.notifications.NotificationUtils
|
import im.vector.app.features.notifications.NotificationUtils
|
||||||
import im.vector.app.features.notifications.PushRuleTriggerListener
|
import im.vector.app.features.notifications.PushRuleTriggerListener
|
||||||
@ -68,15 +67,10 @@ import org.matrix.android.sdk.api.auth.AuthenticationService
|
|||||||
import org.matrix.android.sdk.api.auth.HomeServerHistoryService
|
import org.matrix.android.sdk.api.auth.HomeServerHistoryService
|
||||||
import org.matrix.android.sdk.api.raw.RawService
|
import org.matrix.android.sdk.api.raw.RawService
|
||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
import javax.inject.Singleton
|
|
||||||
|
|
||||||
@Component(modules = [VectorModule::class])
|
@InstallIn(SingletonComponent::class)
|
||||||
@Singleton
|
@EntryPoint
|
||||||
interface VectorComponent {
|
interface AggregatorEntryPoint {
|
||||||
|
|
||||||
fun inject(notificationBroadcastReceiver: NotificationBroadcastReceiver)
|
|
||||||
|
|
||||||
fun inject(vectorApplication: VectorApplication)
|
|
||||||
|
|
||||||
fun matrix(): Matrix
|
fun matrix(): Matrix
|
||||||
|
|
||||||
@ -175,9 +169,4 @@ interface VectorComponent {
|
|||||||
fun coroutineDispatchers(): CoroutineDispatchers
|
fun coroutineDispatchers(): CoroutineDispatchers
|
||||||
|
|
||||||
fun jitsiActiveConferenceHolder(): JitsiActiveConferenceHolder
|
fun jitsiActiveConferenceHolder(): JitsiActiveConferenceHolder
|
||||||
|
|
||||||
@Component.Factory
|
|
||||||
interface Factory {
|
|
||||||
fun create(@BindsInstance context: Context): VectorComponent
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -21,6 +21,7 @@ import androidx.fragment.app.Fragment
|
|||||||
import androidx.fragment.app.FragmentFactory
|
import androidx.fragment.app.FragmentFactory
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
|
import dagger.hilt.migration.DisableInstallInCheck
|
||||||
import dagger.multibindings.IntoMap
|
import dagger.multibindings.IntoMap
|
||||||
import im.vector.app.features.attachments.preview.AttachmentsPreviewFragment
|
import im.vector.app.features.attachments.preview.AttachmentsPreviewFragment
|
||||||
import im.vector.app.features.contactsbook.ContactsBookFragment
|
import im.vector.app.features.contactsbook.ContactsBookFragment
|
||||||
@ -157,6 +158,7 @@ import im.vector.app.features.usercode.ShowUserCodeFragment
|
|||||||
import im.vector.app.features.userdirectory.UserListFragment
|
import im.vector.app.features.userdirectory.UserListFragment
|
||||||
import im.vector.app.features.widgets.WidgetFragment
|
import im.vector.app.features.widgets.WidgetFragment
|
||||||
|
|
||||||
|
@DisableInstallInCheck
|
||||||
@Module
|
@Module
|
||||||
interface FragmentModule {
|
interface FragmentModule {
|
||||||
/**
|
/**
|
||||||
|
@ -18,5 +18,5 @@ package im.vector.app.core.di
|
|||||||
|
|
||||||
interface HasVectorInjector {
|
interface HasVectorInjector {
|
||||||
|
|
||||||
fun injector(): VectorComponent
|
fun injector(): AggregatorEntryPoint
|
||||||
}
|
}
|
||||||
|
@ -16,58 +16,93 @@
|
|||||||
|
|
||||||
package im.vector.app.core.di
|
package im.vector.app.core.di
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.content.res.Resources
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.fragment.app.FragmentFactory
|
import androidx.fragment.app.FragmentFactory
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import dagger.BindsInstance
|
import dagger.BindsInstance
|
||||||
import dagger.Component
|
import dagger.Component
|
||||||
|
import dagger.hilt.EntryPoint
|
||||||
|
import dagger.hilt.InstallIn
|
||||||
|
import dagger.hilt.components.SingletonComponent
|
||||||
|
import im.vector.app.ActiveSessionDataSource
|
||||||
|
import im.vector.app.AppStateHandler
|
||||||
|
import im.vector.app.EmojiCompatFontProvider
|
||||||
|
import im.vector.app.EmojiCompatWrapper
|
||||||
import im.vector.app.core.dialogs.UnrecognizedCertificateDialog
|
import im.vector.app.core.dialogs.UnrecognizedCertificateDialog
|
||||||
|
import im.vector.app.core.dispatchers.CoroutineDispatchers
|
||||||
import im.vector.app.core.error.ErrorFormatter
|
import im.vector.app.core.error.ErrorFormatter
|
||||||
|
import im.vector.app.core.network.WifiDetector
|
||||||
import im.vector.app.core.preference.UserAvatarPreference
|
import im.vector.app.core.preference.UserAvatarPreference
|
||||||
|
import im.vector.app.core.pushers.PushersManager
|
||||||
|
import im.vector.app.core.utils.AssetReader
|
||||||
|
import im.vector.app.core.utils.DimensionConverter
|
||||||
import im.vector.app.features.MainActivity
|
import im.vector.app.features.MainActivity
|
||||||
import im.vector.app.features.auth.ReAuthActivity
|
import im.vector.app.features.auth.ReAuthActivity
|
||||||
import im.vector.app.features.call.CallControlsBottomSheet
|
import im.vector.app.features.call.CallControlsBottomSheet
|
||||||
import im.vector.app.features.call.VectorCallActivity
|
import im.vector.app.features.call.VectorCallActivity
|
||||||
|
import im.vector.app.features.call.conference.JitsiActiveConferenceHolder
|
||||||
import im.vector.app.features.call.conference.VectorJitsiActivity
|
import im.vector.app.features.call.conference.VectorJitsiActivity
|
||||||
import im.vector.app.features.call.transfer.CallTransferActivity
|
import im.vector.app.features.call.transfer.CallTransferActivity
|
||||||
|
import im.vector.app.features.call.webrtc.WebRtcCallManager
|
||||||
|
import im.vector.app.features.configuration.VectorConfiguration
|
||||||
import im.vector.app.features.createdirect.CreateDirectRoomActivity
|
import im.vector.app.features.createdirect.CreateDirectRoomActivity
|
||||||
import im.vector.app.features.crypto.keysbackup.settings.KeysBackupManageActivity
|
import im.vector.app.features.crypto.keysbackup.settings.KeysBackupManageActivity
|
||||||
import im.vector.app.features.crypto.keysbackup.setup.KeysBackupSetupActivity
|
import im.vector.app.features.crypto.keysbackup.setup.KeysBackupSetupActivity
|
||||||
|
import im.vector.app.features.crypto.keysrequest.KeyRequestHandler
|
||||||
import im.vector.app.features.crypto.quads.SharedSecureStorageActivity
|
import im.vector.app.features.crypto.quads.SharedSecureStorageActivity
|
||||||
import im.vector.app.features.crypto.recover.BootstrapBottomSheet
|
import im.vector.app.features.crypto.recover.BootstrapBottomSheet
|
||||||
|
import im.vector.app.features.crypto.verification.IncomingVerificationRequestHandler
|
||||||
import im.vector.app.features.crypto.verification.VerificationBottomSheet
|
import im.vector.app.features.crypto.verification.VerificationBottomSheet
|
||||||
import im.vector.app.features.debug.DebugMenuActivity
|
import im.vector.app.features.debug.DebugMenuActivity
|
||||||
import im.vector.app.features.devtools.RoomDevToolActivity
|
import im.vector.app.features.devtools.RoomDevToolActivity
|
||||||
|
import im.vector.app.features.home.AvatarRenderer
|
||||||
|
import im.vector.app.features.home.CurrentSpaceSuggestedRoomListDataSource
|
||||||
import im.vector.app.features.home.HomeActivity
|
import im.vector.app.features.home.HomeActivity
|
||||||
import im.vector.app.features.home.HomeModule
|
import im.vector.app.features.home.HomeModule
|
||||||
import im.vector.app.features.home.room.detail.JoinReplacementRoomBottomSheet
|
import im.vector.app.features.home.room.detail.JoinReplacementRoomBottomSheet
|
||||||
import im.vector.app.features.home.room.detail.RoomDetailActivity
|
import im.vector.app.features.home.room.detail.RoomDetailActivity
|
||||||
|
import im.vector.app.features.home.room.detail.RoomDetailPendingActionStore
|
||||||
import im.vector.app.features.home.room.detail.readreceipts.DisplayReadReceiptsBottomSheet
|
import im.vector.app.features.home.room.detail.readreceipts.DisplayReadReceiptsBottomSheet
|
||||||
import im.vector.app.features.home.room.detail.search.SearchActivity
|
import im.vector.app.features.home.room.detail.search.SearchActivity
|
||||||
import im.vector.app.features.home.room.detail.timeline.action.MessageActionsBottomSheet
|
import im.vector.app.features.home.room.detail.timeline.action.MessageActionsBottomSheet
|
||||||
import im.vector.app.features.home.room.detail.timeline.edithistory.ViewEditHistoryBottomSheet
|
import im.vector.app.features.home.room.detail.timeline.edithistory.ViewEditHistoryBottomSheet
|
||||||
|
import im.vector.app.features.home.room.detail.timeline.helper.MatrixItemColorProvider
|
||||||
import im.vector.app.features.home.room.detail.timeline.reactions.ViewReactionsBottomSheet
|
import im.vector.app.features.home.room.detail.timeline.reactions.ViewReactionsBottomSheet
|
||||||
import im.vector.app.features.home.room.detail.upgrade.MigrateRoomBottomSheet
|
import im.vector.app.features.home.room.detail.upgrade.MigrateRoomBottomSheet
|
||||||
import im.vector.app.features.home.room.detail.widget.RoomWidgetsBottomSheet
|
import im.vector.app.features.home.room.detail.widget.RoomWidgetsBottomSheet
|
||||||
import im.vector.app.features.home.room.filtered.FilteredRoomsActivity
|
import im.vector.app.features.home.room.filtered.FilteredRoomsActivity
|
||||||
import im.vector.app.features.home.room.list.RoomListModule
|
import im.vector.app.features.home.room.list.RoomListModule
|
||||||
import im.vector.app.features.home.room.list.actions.RoomListQuickActionsBottomSheet
|
import im.vector.app.features.home.room.list.actions.RoomListQuickActionsBottomSheet
|
||||||
|
import im.vector.app.features.html.EventHtmlRenderer
|
||||||
|
import im.vector.app.features.html.VectorHtmlCompressor
|
||||||
import im.vector.app.features.invite.AutoAcceptInvites
|
import im.vector.app.features.invite.AutoAcceptInvites
|
||||||
import im.vector.app.features.invite.InviteUsersToRoomActivity
|
import im.vector.app.features.invite.InviteUsersToRoomActivity
|
||||||
import im.vector.app.features.invite.VectorInviteView
|
import im.vector.app.features.invite.VectorInviteView
|
||||||
import im.vector.app.features.link.LinkHandlerActivity
|
import im.vector.app.features.link.LinkHandlerActivity
|
||||||
import im.vector.app.features.login.LoginActivity
|
import im.vector.app.features.login.LoginActivity
|
||||||
|
import im.vector.app.features.login.ReAuthHelper
|
||||||
import im.vector.app.features.login2.LoginActivity2
|
import im.vector.app.features.login2.LoginActivity2
|
||||||
import im.vector.app.features.matrixto.MatrixToBottomSheet
|
import im.vector.app.features.matrixto.MatrixToBottomSheet
|
||||||
import im.vector.app.features.media.BigImageViewerActivity
|
import im.vector.app.features.media.BigImageViewerActivity
|
||||||
import im.vector.app.features.media.VectorAttachmentViewerActivity
|
import im.vector.app.features.media.VectorAttachmentViewerActivity
|
||||||
import im.vector.app.features.navigation.Navigator
|
import im.vector.app.features.navigation.Navigator
|
||||||
|
import im.vector.app.features.notifications.NotifiableEventResolver
|
||||||
|
import im.vector.app.features.notifications.NotificationDrawerManager
|
||||||
|
import im.vector.app.features.notifications.NotificationUtils
|
||||||
|
import im.vector.app.features.notifications.PushRuleTriggerListener
|
||||||
|
import im.vector.app.features.pin.PinCodeStore
|
||||||
import im.vector.app.features.pin.PinLocker
|
import im.vector.app.features.pin.PinLocker
|
||||||
|
import im.vector.app.features.popup.PopupAlertManager
|
||||||
import im.vector.app.features.qrcode.QrCodeScannerActivity
|
import im.vector.app.features.qrcode.QrCodeScannerActivity
|
||||||
import im.vector.app.features.rageshake.BugReportActivity
|
import im.vector.app.features.rageshake.BugReportActivity
|
||||||
import im.vector.app.features.rageshake.BugReporter
|
import im.vector.app.features.rageshake.BugReporter
|
||||||
import im.vector.app.features.rageshake.RageShake
|
import im.vector.app.features.rageshake.RageShake
|
||||||
|
import im.vector.app.features.rageshake.VectorFileLogger
|
||||||
|
import im.vector.app.features.rageshake.VectorUncaughtExceptionHandler
|
||||||
import im.vector.app.features.reactions.EmojiReactionPickerActivity
|
import im.vector.app.features.reactions.EmojiReactionPickerActivity
|
||||||
|
import im.vector.app.features.reactions.data.EmojiDataSource
|
||||||
import im.vector.app.features.reactions.widget.ReactionButton
|
import im.vector.app.features.reactions.widget.ReactionButton
|
||||||
import im.vector.app.features.roomdirectory.RoomDirectoryActivity
|
import im.vector.app.features.roomdirectory.RoomDirectoryActivity
|
||||||
import im.vector.app.features.roomdirectory.createroom.CreateRoomActivity
|
import im.vector.app.features.roomdirectory.createroom.CreateRoomActivity
|
||||||
@ -78,6 +113,9 @@ import im.vector.app.features.roomprofile.alias.detail.RoomAliasBottomSheet
|
|||||||
import im.vector.app.features.roomprofile.settings.historyvisibility.RoomHistoryVisibilityBottomSheet
|
import im.vector.app.features.roomprofile.settings.historyvisibility.RoomHistoryVisibilityBottomSheet
|
||||||
import im.vector.app.features.roomprofile.settings.joinrule.RoomJoinRuleActivity
|
import im.vector.app.features.roomprofile.settings.joinrule.RoomJoinRuleActivity
|
||||||
import im.vector.app.features.roomprofile.settings.joinrule.RoomJoinRuleBottomSheet
|
import im.vector.app.features.roomprofile.settings.joinrule.RoomJoinRuleBottomSheet
|
||||||
|
import im.vector.app.features.session.SessionListener
|
||||||
|
import im.vector.app.features.settings.VectorDataStore
|
||||||
|
import im.vector.app.features.settings.VectorPreferences
|
||||||
import im.vector.app.features.settings.VectorSettingsActivity
|
import im.vector.app.features.settings.VectorSettingsActivity
|
||||||
import im.vector.app.features.settings.devices.DeviceVerificationInfoBottomSheet
|
import im.vector.app.features.settings.devices.DeviceVerificationInfoBottomSheet
|
||||||
import im.vector.app.features.share.IncomingShareActivity
|
import im.vector.app.features.share.IncomingShareActivity
|
||||||
@ -98,10 +136,118 @@ import im.vector.app.features.widgets.WidgetActivity
|
|||||||
import im.vector.app.features.widgets.permissions.RoomWidgetPermissionBottomSheet
|
import im.vector.app.features.widgets.permissions.RoomWidgetPermissionBottomSheet
|
||||||
import im.vector.app.features.workers.signout.SignOutBottomSheetDialogFragment
|
import im.vector.app.features.workers.signout.SignOutBottomSheetDialogFragment
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
|
import org.matrix.android.sdk.api.Matrix
|
||||||
|
import org.matrix.android.sdk.api.auth.AuthenticationService
|
||||||
|
import org.matrix.android.sdk.api.auth.HomeServerHistoryService
|
||||||
|
import org.matrix.android.sdk.api.raw.RawService
|
||||||
|
import org.matrix.android.sdk.api.session.Session
|
||||||
|
|
||||||
|
@InstallIn(SingletonComponent::class)
|
||||||
|
@EntryPoint
|
||||||
|
interface ScreenComponentDependencies {
|
||||||
|
fun matrix(): Matrix
|
||||||
|
|
||||||
|
fun matrixItemColorProvider(): MatrixItemColorProvider
|
||||||
|
|
||||||
|
fun sessionListener(): SessionListener
|
||||||
|
|
||||||
|
fun currentSession(): Session
|
||||||
|
|
||||||
|
fun notificationUtils(): NotificationUtils
|
||||||
|
|
||||||
|
fun notificationDrawerManager(): NotificationDrawerManager
|
||||||
|
|
||||||
|
fun appContext(): Context
|
||||||
|
|
||||||
|
fun resources(): Resources
|
||||||
|
|
||||||
|
fun assetReader(): AssetReader
|
||||||
|
|
||||||
|
fun dimensionConverter(): DimensionConverter
|
||||||
|
|
||||||
|
fun vectorConfiguration(): VectorConfiguration
|
||||||
|
|
||||||
|
fun avatarRenderer(): AvatarRenderer
|
||||||
|
|
||||||
|
fun activeSessionHolder(): ActiveSessionHolder
|
||||||
|
|
||||||
|
fun unrecognizedCertificateDialog(): UnrecognizedCertificateDialog
|
||||||
|
|
||||||
|
fun emojiCompatFontProvider(): EmojiCompatFontProvider
|
||||||
|
|
||||||
|
fun emojiCompatWrapper(): EmojiCompatWrapper
|
||||||
|
|
||||||
|
fun eventHtmlRenderer(): EventHtmlRenderer
|
||||||
|
|
||||||
|
fun vectorHtmlCompressor(): VectorHtmlCompressor
|
||||||
|
|
||||||
|
fun navigator(): Navigator
|
||||||
|
|
||||||
|
fun errorFormatter(): ErrorFormatter
|
||||||
|
|
||||||
|
fun appStateHandler(): AppStateHandler
|
||||||
|
|
||||||
|
fun currentSpaceSuggestedRoomListDataSource(): CurrentSpaceSuggestedRoomListDataSource
|
||||||
|
|
||||||
|
fun roomDetailPendingActionStore(): RoomDetailPendingActionStore
|
||||||
|
|
||||||
|
fun activeSessionObservableStore(): ActiveSessionDataSource
|
||||||
|
|
||||||
|
fun incomingVerificationRequestHandler(): IncomingVerificationRequestHandler
|
||||||
|
|
||||||
|
fun incomingKeyRequestHandler(): KeyRequestHandler
|
||||||
|
|
||||||
|
fun authenticationService(): AuthenticationService
|
||||||
|
|
||||||
|
fun rawService(): RawService
|
||||||
|
|
||||||
|
fun homeServerHistoryService(): HomeServerHistoryService
|
||||||
|
|
||||||
|
fun bugReporter(): BugReporter
|
||||||
|
|
||||||
|
fun vectorUncaughtExceptionHandler(): VectorUncaughtExceptionHandler
|
||||||
|
|
||||||
|
fun pushRuleTriggerListener(): PushRuleTriggerListener
|
||||||
|
|
||||||
|
fun pusherManager(): PushersManager
|
||||||
|
|
||||||
|
fun notifiableEventResolver(): NotifiableEventResolver
|
||||||
|
|
||||||
|
fun vectorPreferences(): VectorPreferences
|
||||||
|
|
||||||
|
fun vectorDataStore(): VectorDataStore
|
||||||
|
|
||||||
|
fun wifiDetector(): WifiDetector
|
||||||
|
|
||||||
|
fun vectorFileLogger(): VectorFileLogger
|
||||||
|
|
||||||
|
fun uiStateRepository(): UiStateRepository
|
||||||
|
|
||||||
|
fun pinCodeStore(): PinCodeStore
|
||||||
|
|
||||||
|
fun emojiDataSource(): EmojiDataSource
|
||||||
|
|
||||||
|
fun alertManager(): PopupAlertManager
|
||||||
|
|
||||||
|
fun reAuthHelper(): ReAuthHelper
|
||||||
|
|
||||||
|
fun pinLocker(): PinLocker
|
||||||
|
|
||||||
|
fun autoAcceptInvites(): AutoAcceptInvites
|
||||||
|
|
||||||
|
fun webRtcCallManager(): WebRtcCallManager
|
||||||
|
|
||||||
|
fun appCoroutineScope(): CoroutineScope
|
||||||
|
|
||||||
|
fun coroutineDispatchers(): CoroutineDispatchers
|
||||||
|
|
||||||
|
fun jitsiActiveConferenceHolder(): JitsiActiveConferenceHolder
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Component(
|
@Component(
|
||||||
dependencies = [
|
dependencies = [
|
||||||
VectorComponent::class
|
ScreenComponentDependencies::class
|
||||||
],
|
],
|
||||||
modules = [
|
modules = [
|
||||||
ViewModelModule::class,
|
ViewModelModule::class,
|
||||||
@ -218,7 +364,7 @@ interface ScreenComponent {
|
|||||||
|
|
||||||
@Component.Factory
|
@Component.Factory
|
||||||
interface Factory {
|
interface Factory {
|
||||||
fun create(vectorComponent: VectorComponent,
|
fun create(deps: ScreenComponentDependencies,
|
||||||
@BindsInstance context: AppCompatActivity
|
@BindsInstance context: AppCompatActivity
|
||||||
): ScreenComponent
|
): ScreenComponent
|
||||||
}
|
}
|
||||||
|
@ -20,9 +20,11 @@ import androidx.appcompat.app.AppCompatActivity
|
|||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
|
import dagger.hilt.migration.DisableInstallInCheck
|
||||||
import im.vector.app.core.glide.GlideApp
|
import im.vector.app.core.glide.GlideApp
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
|
@DisableInstallInCheck
|
||||||
object ScreenModule {
|
object ScreenModule {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package im.vector.app.core.di
|
package im.vector.app.core.di
|
||||||
|
|
||||||
|
import android.app.Application
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Context.MODE_PRIVATE
|
import android.content.Context.MODE_PRIVATE
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
@ -23,6 +24,8 @@ import android.content.res.Resources
|
|||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
|
import dagger.hilt.InstallIn
|
||||||
|
import dagger.hilt.components.SingletonComponent
|
||||||
import im.vector.app.core.dispatchers.CoroutineDispatchers
|
import im.vector.app.core.dispatchers.CoroutineDispatchers
|
||||||
import im.vector.app.core.error.DefaultErrorFormatter
|
import im.vector.app.core.error.DefaultErrorFormatter
|
||||||
import im.vector.app.core.error.ErrorFormatter
|
import im.vector.app.core.error.ErrorFormatter
|
||||||
@ -45,11 +48,35 @@ import org.matrix.android.sdk.api.raw.RawService
|
|||||||
import org.matrix.android.sdk.api.session.Session
|
import org.matrix.android.sdk.api.session.Session
|
||||||
import javax.inject.Singleton
|
import javax.inject.Singleton
|
||||||
|
|
||||||
|
@InstallIn(SingletonComponent::class)
|
||||||
@Module
|
@Module
|
||||||
abstract class VectorModule {
|
abstract class VectorBindModule {
|
||||||
|
|
||||||
@Module
|
@Binds
|
||||||
companion object {
|
abstract fun bindNavigator(navigator: DefaultNavigator): Navigator
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
abstract fun bindErrorFormatter(formatter: DefaultErrorFormatter): ErrorFormatter
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
abstract fun bindUiStateRepository(repository: SharedPreferencesUiStateRepository): UiStateRepository
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
abstract fun bindPinCodeStore(store: SharedPrefPinCodeStore): PinCodeStore
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
abstract fun bindAutoAcceptInvites(autoAcceptInvites: CompileTimeAutoAcceptInvites): AutoAcceptInvites
|
||||||
|
}
|
||||||
|
|
||||||
|
@InstallIn(SingletonComponent::class)
|
||||||
|
@Module
|
||||||
|
object VectorStaticModule {
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
@JvmStatic
|
||||||
|
fun providesContext(application: Application): Context {
|
||||||
|
return application.applicationContext
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@JvmStatic
|
@JvmStatic
|
||||||
@ -112,20 +139,4 @@ abstract class VectorModule {
|
|||||||
fun providesCoroutineDispatchers(): CoroutineDispatchers {
|
fun providesCoroutineDispatchers(): CoroutineDispatchers {
|
||||||
return CoroutineDispatchers(io = Dispatchers.IO)
|
return CoroutineDispatchers(io = Dispatchers.IO)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Binds
|
|
||||||
abstract fun bindNavigator(navigator: DefaultNavigator): Navigator
|
|
||||||
|
|
||||||
@Binds
|
|
||||||
abstract fun bindErrorFormatter(formatter: DefaultErrorFormatter): ErrorFormatter
|
|
||||||
|
|
||||||
@Binds
|
|
||||||
abstract fun bindUiStateRepository(repository: SharedPreferencesUiStateRepository): UiStateRepository
|
|
||||||
|
|
||||||
@Binds
|
|
||||||
abstract fun bindPinCodeStore(store: SharedPrefPinCodeStore): PinCodeStore
|
|
||||||
|
|
||||||
@Binds
|
|
||||||
abstract fun bindAutoAcceptInvites(autoAcceptInvites: CompileTimeAutoAcceptInvites): AutoAcceptInvites
|
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@ import androidx.lifecycle.ViewModel
|
|||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
|
import dagger.hilt.migration.DisableInstallInCheck
|
||||||
import dagger.multibindings.IntoMap
|
import dagger.multibindings.IntoMap
|
||||||
import im.vector.app.core.platform.ConfigurationViewModel
|
import im.vector.app.core.platform.ConfigurationViewModel
|
||||||
import im.vector.app.features.call.SharedKnownCallsViewModel
|
import im.vector.app.features.call.SharedKnownCallsViewModel
|
||||||
@ -42,6 +43,7 @@ import im.vector.app.features.spaces.SpacePreviewSharedActionViewModel
|
|||||||
import im.vector.app.features.spaces.people.SpacePeopleSharedActionViewModel
|
import im.vector.app.features.spaces.people.SpacePeopleSharedActionViewModel
|
||||||
import im.vector.app.features.userdirectory.UserListSharedActionViewModel
|
import im.vector.app.features.userdirectory.UserListSharedActionViewModel
|
||||||
|
|
||||||
|
@DisableInstallInCheck
|
||||||
@Module
|
@Module
|
||||||
interface ViewModelModule {
|
interface ViewModelModule {
|
||||||
|
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
package im.vector.app.core.extensions
|
package im.vector.app.core.extensions
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import im.vector.app.core.di.AggregatorEntryPoint
|
||||||
import im.vector.app.core.di.HasVectorInjector
|
import im.vector.app.core.di.HasVectorInjector
|
||||||
import im.vector.app.core.di.VectorComponent
|
|
||||||
|
|
||||||
fun Context.vectorComponent(): VectorComponent {
|
fun Context.vectorComponent(): AggregatorEntryPoint {
|
||||||
val appContext = applicationContext
|
val appContext = applicationContext
|
||||||
if (appContext is HasVectorInjector) {
|
if (appContext is HasVectorInjector) {
|
||||||
return appContext.injector()
|
return appContext.injector()
|
||||||
|
@ -45,14 +45,16 @@ import com.bumptech.glide.util.Util
|
|||||||
import com.google.android.material.appbar.MaterialToolbar
|
import com.google.android.material.appbar.MaterialToolbar
|
||||||
import com.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.jakewharton.rxbinding3.view.clicks
|
import com.jakewharton.rxbinding3.view.clicks
|
||||||
|
import dagger.hilt.EntryPoints
|
||||||
import im.vector.app.BuildConfig
|
import im.vector.app.BuildConfig
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
import im.vector.app.core.di.ActiveSessionHolder
|
||||||
|
import im.vector.app.core.di.AggregatorEntryPoint
|
||||||
import im.vector.app.core.di.DaggerScreenComponent
|
import im.vector.app.core.di.DaggerScreenComponent
|
||||||
import im.vector.app.core.di.HasScreenInjector
|
import im.vector.app.core.di.HasScreenInjector
|
||||||
import im.vector.app.core.di.HasVectorInjector
|
import im.vector.app.core.di.HasVectorInjector
|
||||||
import im.vector.app.core.di.ScreenComponent
|
import im.vector.app.core.di.ScreenComponent
|
||||||
import im.vector.app.core.di.VectorComponent
|
import im.vector.app.core.di.ScreenComponentDependencies
|
||||||
import im.vector.app.core.dialogs.DialogLocker
|
import im.vector.app.core.dialogs.DialogLocker
|
||||||
import im.vector.app.core.dialogs.UnrecognizedCertificateDialog
|
import im.vector.app.core.dialogs.UnrecognizedCertificateDialog
|
||||||
import im.vector.app.core.extensions.exhaustive
|
import im.vector.app.core.extensions.exhaustive
|
||||||
@ -188,7 +190,10 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), HasSc
|
|||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
Timber.i("onCreate Activity ${javaClass.simpleName}")
|
Timber.i("onCreate Activity ${javaClass.simpleName}")
|
||||||
val vectorComponent = getVectorComponent()
|
val vectorComponent = getVectorComponent()
|
||||||
screenComponent = DaggerScreenComponent.factory().create(vectorComponent, this)
|
val screenComponentDeps = EntryPoints.get(
|
||||||
|
applicationContext,
|
||||||
|
ScreenComponentDependencies::class.java)
|
||||||
|
screenComponent = DaggerScreenComponent.factory().create(screenComponentDeps, this)
|
||||||
val timeForInjection = measureTimeMillis {
|
val timeForInjection = measureTimeMillis {
|
||||||
injectWith(screenComponent)
|
injectWith(screenComponent)
|
||||||
}
|
}
|
||||||
@ -419,7 +424,7 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), HasSc
|
|||||||
* PRIVATE METHODS
|
* PRIVATE METHODS
|
||||||
* ========================================================================================== */
|
* ========================================================================================== */
|
||||||
|
|
||||||
internal fun getVectorComponent(): VectorComponent {
|
internal fun getVectorComponent(): AggregatorEntryPoint {
|
||||||
return (application as HasVectorInjector).injector()
|
return (application as HasVectorInjector).injector()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,8 +33,10 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
|
|||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||||
import com.jakewharton.rxbinding3.view.clicks
|
import com.jakewharton.rxbinding3.view.clicks
|
||||||
|
import dagger.hilt.EntryPoints
|
||||||
import im.vector.app.core.di.DaggerScreenComponent
|
import im.vector.app.core.di.DaggerScreenComponent
|
||||||
import im.vector.app.core.di.ScreenComponent
|
import im.vector.app.core.di.ScreenComponent
|
||||||
|
import im.vector.app.core.di.ScreenComponentDependencies
|
||||||
import im.vector.app.core.utils.DimensionConverter
|
import im.vector.app.core.utils.DimensionConverter
|
||||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
import io.reactivex.disposables.CompositeDisposable
|
import io.reactivex.disposables.CompositeDisposable
|
||||||
@ -122,7 +124,10 @@ abstract class VectorBaseBottomSheetDialogFragment<VB : ViewBinding> : BottomShe
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
override fun onAttach(context: Context) {
|
||||||
screenComponent = DaggerScreenComponent.factory().create(vectorBaseActivity.getVectorComponent(), vectorBaseActivity)
|
val screenComponentDeps = EntryPoints.get(
|
||||||
|
vectorBaseActivity.applicationContext,
|
||||||
|
ScreenComponentDependencies::class.java)
|
||||||
|
screenComponent = DaggerScreenComponent.factory().create(screenComponentDeps, vectorBaseActivity)
|
||||||
viewModelFactory = screenComponent.viewModelFactory()
|
viewModelFactory = screenComponent.viewModelFactory()
|
||||||
super.onAttach(context)
|
super.onAttach(context)
|
||||||
injectWith(screenComponent)
|
injectWith(screenComponent)
|
||||||
|
@ -35,10 +35,12 @@ import com.bumptech.glide.util.Util.assertMainThread
|
|||||||
import com.google.android.material.appbar.MaterialToolbar
|
import com.google.android.material.appbar.MaterialToolbar
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import com.jakewharton.rxbinding3.view.clicks
|
import com.jakewharton.rxbinding3.view.clicks
|
||||||
|
import dagger.hilt.EntryPoints
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.di.DaggerScreenComponent
|
import im.vector.app.core.di.DaggerScreenComponent
|
||||||
import im.vector.app.core.di.HasScreenInjector
|
import im.vector.app.core.di.HasScreenInjector
|
||||||
import im.vector.app.core.di.ScreenComponent
|
import im.vector.app.core.di.ScreenComponent
|
||||||
|
import im.vector.app.core.di.ScreenComponentDependencies
|
||||||
import im.vector.app.core.dialogs.UnrecognizedCertificateDialog
|
import im.vector.app.core.dialogs.UnrecognizedCertificateDialog
|
||||||
import im.vector.app.core.error.ErrorFormatter
|
import im.vector.app.core.error.ErrorFormatter
|
||||||
import im.vector.app.core.extensions.toMvRxBundle
|
import im.vector.app.core.extensions.toMvRxBundle
|
||||||
@ -95,7 +97,10 @@ abstract class VectorBaseFragment<VB : ViewBinding> : Fragment(), MavericksView,
|
|||||||
* ========================================================================================== */
|
* ========================================================================================== */
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
override fun onAttach(context: Context) {
|
||||||
screenComponent = DaggerScreenComponent.factory().create(vectorBaseActivity.getVectorComponent(), vectorBaseActivity)
|
val screenComponentDeps = EntryPoints.get(
|
||||||
|
vectorBaseActivity.applicationContext,
|
||||||
|
ScreenComponentDependencies::class.java)
|
||||||
|
screenComponent = DaggerScreenComponent.factory().create(screenComponentDeps, vectorBaseActivity)
|
||||||
navigator = screenComponent.navigator()
|
navigator = screenComponent.navigator()
|
||||||
errorFormatter = screenComponent.errorFormatter()
|
errorFormatter = screenComponent.errorFormatter()
|
||||||
unrecognizedCertificateDialog = screenComponent.unrecognizedCertificateDialog()
|
unrecognizedCertificateDialog = screenComponent.unrecognizedCertificateDialog()
|
||||||
|
@ -19,9 +19,11 @@ package im.vector.app.features.home
|
|||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
|
import dagger.hilt.migration.DisableInstallInCheck
|
||||||
import im.vector.app.features.home.room.detail.timeline.TimelineEventControllerHandler
|
import im.vector.app.features.home.room.detail.timeline.TimelineEventControllerHandler
|
||||||
import im.vector.app.features.home.room.detail.timeline.helper.TimelineAsyncHelper
|
import im.vector.app.features.home.room.detail.timeline.helper.TimelineAsyncHelper
|
||||||
|
|
||||||
|
@DisableInstallInCheck
|
||||||
@Module
|
@Module
|
||||||
object HomeModule {
|
object HomeModule {
|
||||||
|
|
||||||
|
@ -18,7 +18,9 @@ package im.vector.app.features.home.room.list
|
|||||||
|
|
||||||
import dagger.Binds
|
import dagger.Binds
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
|
import dagger.hilt.migration.DisableInstallInCheck
|
||||||
|
|
||||||
|
@DisableInstallInCheck
|
||||||
@Module
|
@Module
|
||||||
abstract class RoomListModule {
|
abstract class RoomListModule {
|
||||||
|
|
||||||
|
@ -30,12 +30,9 @@ import androidx.core.view.isInvisible
|
|||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.lifecycle.lifecycleScope
|
import androidx.lifecycle.lifecycleScope
|
||||||
import androidx.transition.Transition
|
import androidx.transition.Transition
|
||||||
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
import im.vector.app.core.di.ActiveSessionHolder
|
||||||
import im.vector.app.core.di.DaggerScreenComponent
|
|
||||||
import im.vector.app.core.di.HasVectorInjector
|
|
||||||
import im.vector.app.core.di.ScreenComponent
|
|
||||||
import im.vector.app.core.di.VectorComponent
|
|
||||||
import im.vector.app.core.intent.getMimeTypeFromUri
|
import im.vector.app.core.intent.getMimeTypeFromUri
|
||||||
import im.vector.app.core.utils.shareMedia
|
import im.vector.app.core.utils.shareMedia
|
||||||
import im.vector.app.features.themes.ActivityOtherThemes
|
import im.vector.app.features.themes.ActivityOtherThemes
|
||||||
@ -48,8 +45,8 @@ import kotlinx.coroutines.withContext
|
|||||||
import kotlinx.parcelize.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
import timber.log.Timber
|
import timber.log.Timber
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
import kotlin.system.measureTimeMillis
|
|
||||||
|
|
||||||
|
@AndroidEntryPoint
|
||||||
class VectorAttachmentViewerActivity : AttachmentViewerActivity(), BaseAttachmentProvider.InteractionListener {
|
class VectorAttachmentViewerActivity : AttachmentViewerActivity(), BaseAttachmentProvider.InteractionListener {
|
||||||
|
|
||||||
@Parcelize
|
@Parcelize
|
||||||
@ -61,14 +58,11 @@ class VectorAttachmentViewerActivity : AttachmentViewerActivity(), BaseAttachmen
|
|||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var sessionHolder: ActiveSessionHolder
|
lateinit var sessionHolder: ActiveSessionHolder
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var dataSourceFactory: AttachmentProviderFactory
|
lateinit var dataSourceFactory: AttachmentProviderFactory
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
lateinit var imageContentRenderer: ImageContentRenderer
|
lateinit var imageContentRenderer: ImageContentRenderer
|
||||||
|
|
||||||
private lateinit var screenComponent: ScreenComponent
|
|
||||||
|
|
||||||
private var initialIndex = 0
|
private var initialIndex = 0
|
||||||
private var isAnimatingOut = false
|
private var isAnimatingOut = false
|
||||||
@ -78,12 +72,6 @@ class VectorAttachmentViewerActivity : AttachmentViewerActivity(), BaseAttachmen
|
|||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
Timber.i("onCreate Activity ${javaClass.simpleName}")
|
Timber.i("onCreate Activity ${javaClass.simpleName}")
|
||||||
val vectorComponent = getVectorComponent()
|
|
||||||
screenComponent = DaggerScreenComponent.factory().create(vectorComponent, this)
|
|
||||||
val timeForInjection = measureTimeMillis {
|
|
||||||
screenComponent.inject(this)
|
|
||||||
}
|
|
||||||
Timber.v("Injecting dependencies into ${javaClass.simpleName} took $timeForInjection ms")
|
|
||||||
ThemeUtils.setActivityTheme(this, getOtherThemes())
|
ThemeUtils.setActivityTheme(this, getOtherThemes())
|
||||||
|
|
||||||
val args = args() ?: throw IllegalArgumentException("Missing arguments")
|
val args = args() ?: throw IllegalArgumentException("Missing arguments")
|
||||||
@ -220,10 +208,6 @@ class VectorAttachmentViewerActivity : AttachmentViewerActivity(), BaseAttachmen
|
|||||||
|
|
||||||
private fun args() = intent.getParcelableExtra<Args>(EXTRA_ARGS)
|
private fun args() = intent.getParcelableExtra<Args>(EXTRA_ARGS)
|
||||||
|
|
||||||
private fun getVectorComponent(): VectorComponent {
|
|
||||||
return (application as HasVectorInjector).injector()
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun scheduleStartPostponedTransition(sharedElement: View) {
|
private fun scheduleStartPostponedTransition(sharedElement: View) {
|
||||||
sharedElement.viewTreeObserver.addOnPreDrawListener(
|
sharedElement.viewTreeObserver.addOnPreDrawListener(
|
||||||
object : ViewTreeObserver.OnPreDrawListener {
|
object : ViewTreeObserver.OnPreDrawListener {
|
||||||
|
@ -20,6 +20,7 @@ import android.content.BroadcastReceiver
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import androidx.core.app.RemoteInput
|
import androidx.core.app.RemoteInput
|
||||||
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.di.ActiveSessionHolder
|
import im.vector.app.core.di.ActiveSessionHolder
|
||||||
import im.vector.app.core.extensions.vectorComponent
|
import im.vector.app.core.extensions.vectorComponent
|
||||||
@ -36,6 +37,7 @@ import javax.inject.Inject
|
|||||||
/**
|
/**
|
||||||
* Receives actions broadcast by notification (on click, on dismiss, inline replies, etc.)
|
* Receives actions broadcast by notification (on click, on dismiss, inline replies, etc.)
|
||||||
*/
|
*/
|
||||||
|
@AndroidEntryPoint
|
||||||
class NotificationBroadcastReceiver : BroadcastReceiver() {
|
class NotificationBroadcastReceiver : BroadcastReceiver() {
|
||||||
|
|
||||||
@Inject lateinit var notificationDrawerManager: NotificationDrawerManager
|
@Inject lateinit var notificationDrawerManager: NotificationDrawerManager
|
||||||
@ -44,7 +46,6 @@ class NotificationBroadcastReceiver : BroadcastReceiver() {
|
|||||||
override fun onReceive(context: Context?, intent: Intent?) {
|
override fun onReceive(context: Context?, intent: Intent?) {
|
||||||
if (intent == null || context == null) return
|
if (intent == null || context == null) return
|
||||||
Timber.v("NotificationBroadcastReceiver received : $intent")
|
Timber.v("NotificationBroadcastReceiver received : $intent")
|
||||||
context.vectorComponent().inject(this)
|
|
||||||
when (intent.action) {
|
when (intent.action) {
|
||||||
NotificationUtils.SMART_REPLY_ACTION ->
|
NotificationUtils.SMART_REPLY_ACTION ->
|
||||||
handleSmartReply(intent, context)
|
handleSmartReply(intent, context)
|
||||||
|
@ -22,10 +22,12 @@ import android.view.View
|
|||||||
import androidx.annotation.CallSuper
|
import androidx.annotation.CallSuper
|
||||||
import androidx.preference.PreferenceFragmentCompat
|
import androidx.preference.PreferenceFragmentCompat
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
|
import dagger.hilt.EntryPoints
|
||||||
import im.vector.app.R
|
import im.vector.app.R
|
||||||
import im.vector.app.core.di.DaggerScreenComponent
|
import im.vector.app.core.di.DaggerScreenComponent
|
||||||
import im.vector.app.core.di.HasScreenInjector
|
import im.vector.app.core.di.HasScreenInjector
|
||||||
import im.vector.app.core.di.ScreenComponent
|
import im.vector.app.core.di.ScreenComponent
|
||||||
|
import im.vector.app.core.di.ScreenComponentDependencies
|
||||||
import im.vector.app.core.error.ErrorFormatter
|
import im.vector.app.core.error.ErrorFormatter
|
||||||
import im.vector.app.core.platform.VectorBaseActivity
|
import im.vector.app.core.platform.VectorBaseActivity
|
||||||
import im.vector.app.core.utils.toast
|
import im.vector.app.core.utils.toast
|
||||||
@ -56,7 +58,10 @@ abstract class VectorSettingsBaseFragment : PreferenceFragmentCompat(), HasScree
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
override fun onAttach(context: Context) {
|
||||||
screenComponent = DaggerScreenComponent.factory().create(vectorActivity.getVectorComponent(), vectorActivity)
|
val screenComponentDeps = EntryPoints.get(
|
||||||
|
vectorActivity.applicationContext,
|
||||||
|
ScreenComponentDependencies::class.java)
|
||||||
|
screenComponent = DaggerScreenComponent.factory().create(screenComponentDeps, vectorActivity)
|
||||||
super.onAttach(context)
|
super.onAttach(context)
|
||||||
session = screenComponent.activeSessionHolder().getActiveSession()
|
session = screenComponent.activeSessionHolder().getActiveSession()
|
||||||
errorFormatter = screenComponent.errorFormatter()
|
errorFormatter = screenComponent.errorFormatter()
|
||||||
|
Loading…
Reference in New Issue
Block a user