From 8a34173a97b5d8019eb7eef59154599e3ef5acfe Mon Sep 17 00:00:00 2001 From: Sven Braun Date: Tue, 2 Feb 2021 14:11:17 +0100 Subject: [PATCH] # implemented better activity context handling -> resolves issue causing by deeplinks --- .../main/java/com/schwarz/kokain/di/ActivityContextGuard.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kokain-di/src/main/java/com/schwarz/kokain/di/ActivityContextGuard.kt b/kokain-di/src/main/java/com/schwarz/kokain/di/ActivityContextGuard.kt index c0fe6f5..85e5b74 100644 --- a/kokain-di/src/main/java/com/schwarz/kokain/di/ActivityContextGuard.kt +++ b/kokain-di/src/main/java/com/schwarz/kokain/di/ActivityContextGuard.kt @@ -29,9 +29,11 @@ class ActivityContextGuard(applicationContext: Application) : LifecycleObserver private var currentRef: WeakReference = WeakReference(activity) init { - activity.lifecycle.addObserver(this) if(activity.lifecycle.currentState != Lifecycle.State.DESTROYED){ + activity.lifecycle.addObserver(this) map[reference] = this + }else{ + currentRef.clear() } }