diff --git a/vector/src/main/java/im/vector/riotx/VectorApplication.kt b/vector/src/main/java/im/vector/riotx/VectorApplication.kt index d7fe2a054d..db14dba93d 100644 --- a/vector/src/main/java/im/vector/riotx/VectorApplication.kt +++ b/vector/src/main/java/im/vector/riotx/VectorApplication.kt @@ -32,8 +32,6 @@ import com.airbnb.epoxy.EpoxyAsyncUtil import com.airbnb.epoxy.EpoxyController import com.facebook.stetho.Stetho import com.gabrielittner.threetenbp.LazyThreeTen -import com.github.piasy.biv.BigImageViewer -import com.github.piasy.biv.loader.glide.GlideImageLoader import im.vector.matrix.android.api.Matrix import im.vector.matrix.android.api.MatrixConfiguration import im.vector.matrix.android.api.auth.AuthenticationService @@ -108,7 +106,6 @@ class VectorApplication : logInfo() LazyThreeTen.init(this) - BigImageViewer.initialize(GlideImageLoader.with(applicationContext)) EpoxyController.defaultDiffingHandler = EpoxyAsyncUtil.getAsyncBackgroundHandler() EpoxyController.defaultModelBuildingHandler = EpoxyAsyncUtil.getAsyncBackgroundHandler() registerActivityLifecycleCallbacks(VectorActivityLifecycleCallbacks(popupAlertManager)) diff --git a/vector/src/main/java/im/vector/riotx/core/di/ActiveSessionHolder.kt b/vector/src/main/java/im/vector/riotx/core/di/ActiveSessionHolder.kt index 9fbd51984f..2dc7b24ebf 100644 --- a/vector/src/main/java/im/vector/riotx/core/di/ActiveSessionHolder.kt +++ b/vector/src/main/java/im/vector/riotx/core/di/ActiveSessionHolder.kt @@ -37,7 +37,8 @@ class ActiveSessionHolder @Inject constructor(private val authenticationService: private val incomingVerificationRequestHandler: IncomingVerificationRequestHandler, private val webRtcPeerConnectionManager: WebRtcPeerConnectionManager, private val pushRuleTriggerListener: PushRuleTriggerListener, - private val sessionListener: SessionListener + private val sessionListener: SessionListener, + private val imageManager: ImageManager ) { private var activeSession: AtomicReference = AtomicReference() @@ -52,6 +53,7 @@ class ActiveSessionHolder @Inject constructor(private val authenticationService: session.addListener(sessionListener) pushRuleTriggerListener.startWithSession(session) session.callSignalingService().addCallListener(webRtcPeerConnectionManager) + imageManager.onSessionStarted(session) } fun clearActiveSession() { diff --git a/vector/src/main/java/im/vector/riotx/core/di/ImageManager.kt b/vector/src/main/java/im/vector/riotx/core/di/ImageManager.kt new file mode 100644 index 0000000000..7972ebb163 --- /dev/null +++ b/vector/src/main/java/im/vector/riotx/core/di/ImageManager.kt @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2020 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. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.riotx.core.di + +import android.content.Context +import com.github.piasy.biv.BigImageViewer +import com.github.piasy.biv.loader.glide.GlideImageLoader +import im.vector.matrix.android.api.session.Session +import javax.inject.Inject + +/** + * This class is used to configure the library we use for images + */ +class ImageManager @Inject constructor( + private val context: Context +) { + + fun onSessionStarted(session: Session) { + BigImageViewer.initialize(GlideImageLoader.with(context)) + } +}