Fixes #362 - Auto closes session
parent
85cc76de1f
commit
59c514996b
|
@ -76,7 +76,7 @@ class Core(private val context: Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
val sessionStorage by lazy {
|
val sessionStorage by lazy {
|
||||||
SessionBundleStorage(context, bundleLifetime = Pair(1, TimeUnit.HOURS))
|
SessionBundleStorage(context, bundleLifetime = Pair(BUNDLE_LIFETIME_IN_MINUTES, TimeUnit.MINUTES))
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -104,10 +104,13 @@ class Core(private val context: Context) {
|
||||||
|
|
||||||
// Now that we have restored our previous state (if there's one) let's setup auto saving the state while
|
// Now that we have restored our previous state (if there's one) let's setup auto saving the state while
|
||||||
// the app is used.
|
// the app is used.
|
||||||
sessionStorage.autoSave(sessionManager)
|
sessionStorage.apply {
|
||||||
|
autoSave(sessionManager)
|
||||||
.periodicallyInForeground(interval = 30, unit = TimeUnit.SECONDS)
|
.periodicallyInForeground(interval = 30, unit = TimeUnit.SECONDS)
|
||||||
.whenGoingToBackground()
|
.whenGoingToBackground()
|
||||||
.whenSessionsChange()
|
.whenSessionsChange()
|
||||||
|
autoClose(sessionManager)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,4 +145,8 @@ class Core(private val context: Context) {
|
||||||
else -> TrackingProtectionPolicy.none()
|
else -> TrackingProtectionPolicy.none()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val BUNDLE_LIFETIME_IN_MINUTES = 5L
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue