mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-29 06:28:45 +03:00
Inject member in VectorBaseActivity instead of using SingletonEntryPoint
This commit is contained in:
parent
ae802dea31
commit
f95d21ef17
1 changed files with 8 additions and 20 deletions
|
@ -105,7 +105,7 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
|
|||
|
||||
protected var analyticsScreenName: MobileScreen.ScreenName? = null
|
||||
|
||||
protected lateinit var analyticsTracker: AnalyticsTracker
|
||||
@Inject lateinit var analyticsTracker: AnalyticsTracker
|
||||
|
||||
/* ==========================================================================================
|
||||
* View
|
||||
|
@ -149,26 +149,22 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
|
|||
* ========================================================================================== */
|
||||
|
||||
private lateinit var configurationViewModel: ConfigurationViewModel
|
||||
private lateinit var sessionListener: SessionListener
|
||||
protected lateinit var bugReporter: BugReporter
|
||||
private lateinit var pinLocker: PinLocker
|
||||
|
||||
@Inject lateinit var sessionListener: SessionListener
|
||||
@Inject lateinit var bugReporter: BugReporter
|
||||
@Inject lateinit var pinLocker: PinLocker
|
||||
@Inject lateinit var rageShake: RageShake
|
||||
@Inject lateinit var buildMeta: BuildMeta
|
||||
@Inject lateinit var fontScalePreferences: FontScalePreferences
|
||||
@Inject lateinit var vectorLocale: VectorLocaleProvider
|
||||
@Inject lateinit var vectorFeatures: VectorFeatures
|
||||
@Inject lateinit var navigator: Navigator
|
||||
@Inject lateinit var activeSessionHolder: ActiveSessionHolder
|
||||
@Inject lateinit var vectorPreferences: VectorPreferences
|
||||
|
||||
// For debug only
|
||||
@Inject lateinit var debugReceiver: DebugReceiver
|
||||
|
||||
@Inject
|
||||
lateinit var vectorFeatures: VectorFeatures
|
||||
|
||||
lateinit var navigator: Navigator
|
||||
private set
|
||||
|
||||
private lateinit var activeSessionHolder: ActiveSessionHolder
|
||||
private lateinit var vectorPreferences: VectorPreferences
|
||||
|
||||
// Filter for multiple invalid token error
|
||||
private var mainActivityStarted = false
|
||||
|
@ -205,7 +201,6 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
|
|||
@CallSuper
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
Timber.i("onCreate Activity ${javaClass.simpleName}")
|
||||
val singletonEntryPoint = singletonEntryPoint()
|
||||
val activityEntryPoint = EntryPointAccessors.fromActivity(this, ActivityEntryPoint::class.java)
|
||||
ThemeUtils.setActivityTheme(this, getOtherThemes())
|
||||
viewModelFactory = activityEntryPoint.viewModelFactory()
|
||||
|
@ -213,12 +208,6 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
|
|||
addOnMultiWindowModeChangedListener(onMultiWindowModeChangedListener)
|
||||
setupMenu()
|
||||
configurationViewModel = viewModelProvider.get(ConfigurationViewModel::class.java)
|
||||
bugReporter = singletonEntryPoint.bugReporter()
|
||||
pinLocker = singletonEntryPoint.pinLocker()
|
||||
analyticsTracker = singletonEntryPoint.analyticsTracker()
|
||||
navigator = singletonEntryPoint.navigator()
|
||||
activeSessionHolder = singletonEntryPoint.activeSessionHolder()
|
||||
vectorPreferences = singletonEntryPoint.vectorPreferences()
|
||||
configurationViewModel.activityRestarter.observe(this) {
|
||||
if (!it.hasBeenHandled) {
|
||||
// Recreate the Activity because configuration has changed
|
||||
|
@ -230,7 +219,6 @@ abstract class VectorBaseActivity<VB : ViewBinding> : AppCompatActivity(), Maver
|
|||
navigator.openPinCode(this, pinStartForActivityResult, PinMode.AUTH)
|
||||
}
|
||||
}
|
||||
sessionListener = singletonEntryPoint.sessionListener()
|
||||
sessionListener.globalErrorLiveData.observeEvent(this) {
|
||||
handleGlobalError(it)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue