This repository was archived by the owner on Jun 17, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 11 files changed +80
-3
lines changed
java/mozilla/components/concept/session/storage
main/java/mozilla/components/feature/session
test/java/mozilla/components/feature/session Expand file tree Collapse file tree 11 files changed +80
-3
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ _API contracts and abstraction layers for browser components._
40
40
41
41
* ** Engine** - Abstraction layer that allows hiding the actual browser engine implementation.
42
42
43
+ * ** Session-Storage** - Abstraction layer and contracts for hiding the actual session storage implementation.
44
+
43
45
* ** Toolbar** - Abstract definition of a browser toolbar component.
44
46
45
47
## Feature
Original file line number Diff line number Diff line change
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
+
5
+ apply plugin : ' com.android.library'
6
+ apply plugin : ' kotlin-android'
7
+
8
+ android {
9
+ compileSdkVersion rootProject. ext. build[' compileSdkVersion' ]
10
+
11
+ defaultConfig {
12
+ minSdkVersion rootProject. ext. build[' minSdkVersion' ]
13
+ targetSdkVersion rootProject. ext. build[' targetSdkVersion' ]
14
+ }
15
+
16
+ lintOptions {
17
+ warningsAsErrors true
18
+ abortOnError true
19
+ }
20
+
21
+ buildTypes {
22
+ release {
23
+ minifyEnabled false
24
+ proguardFiles getDefaultProguardFile(' proguard-android.txt' ), ' proguard-rules.pro'
25
+ }
26
+ }
27
+ }
28
+
29
+ dependencies {
30
+ implementation " org.jetbrains.kotlin:kotlin-stdlib:${ rootProject.ext.dependencies['kotlin']} "
31
+
32
+ implementation project(' :concept-engine' )
33
+ implementation project(' :browser-session' )
34
+ }
35
+
36
+ archivesBaseName = " session-storage"
37
+
38
+ apply from : ' ../../../publish.gradle'
39
+ ext. configurePublish(
40
+ ' org.mozilla.components' ,
41
+ ' session-storage' ,
42
+ ' An abstract layer and contracts for hiding the actual session storage implementation.' )
Original file line number Diff line number Diff line change
1
+ # Add project specific ProGuard rules here.
2
+ # You can control the set of applied configuration files using the
3
+ # proguardFiles setting in build.gradle.
4
+ #
5
+ # For more details, see
6
+ # http://developer.android.com/guide/developing/tools/proguard.html
7
+
8
+ # If your project uses WebView with JS, uncomment the following
9
+ # and specify the fully qualified class name to the JavaScript interface
10
+ # class:
11
+ #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12
+ # public *;
13
+ #}
14
+
15
+ # Uncomment this to preserve the line number information for
16
+ # debugging stack traces.
17
+ #-keepattributes SourceFile,LineNumberTable
18
+
19
+ # If you keep the line number information, uncomment this to
20
+ # hide the original source file name.
21
+ #-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
1
+ <!-- This Source Code Form is subject to the terms of the Mozilla Public
2
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
4
+ <manifest xmlns : android =" http://schemas.android.com/apk/res/android"
5
+ package =" mozilla.components.concept.session.storage" />
Original file line number Diff line number Diff line change 2
2
* License, v. 2.0. If a copy of the MPL was not distributed with this
3
3
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
4
5
- package mozilla.components.feature .session
5
+ package mozilla.components.concept .session.storage
6
6
7
7
import mozilla.components.browser.session.Session
8
8
import mozilla.components.concept.engine.Engine
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ android {
29
29
dependencies {
30
30
implementation project(' :browser-session' )
31
31
implementation project(' :concept-engine' )
32
+ implementation project(' :concept-session-storage' )
32
33
33
34
implementation " org.jetbrains.kotlin:kotlin-stdlib:${ rootProject.ext.dependencies['kotlin']} "
34
35
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import android.content.Context
8
8
import mozilla.components.browser.session.Session
9
9
import mozilla.components.concept.engine.Engine
10
10
import mozilla.components.concept.engine.EngineSession
11
+ import mozilla.components.concept.session.storage.SessionStorage
11
12
import org.json.JSONException
12
13
import org.json.JSONObject
13
14
import java.io.FileNotFoundException
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import mozilla.components.browser.session.Session
9
9
import mozilla.components.browser.session.SessionManager
10
10
import mozilla.components.concept.engine.Engine
11
11
import mozilla.components.concept.engine.EngineSession
12
+ import mozilla.components.concept.session.storage.SessionStorage
12
13
import java.util.concurrent.Executors
13
14
import java.util.concurrent.ScheduledExecutorService
14
15
import java.util.concurrent.TimeUnit
@@ -43,7 +44,7 @@ class SessionProvider(
43
44
44
45
if (savePeriodically) {
45
46
scheduler.scheduleAtFixedRate(
46
- { sessionStorage.persist(sessions, sessionManager. selectedSession? .id) },
47
+ { sessionStorage.persist(sessions, selectedSession.id) },
47
48
saveIntervalInSeconds,
48
49
saveIntervalInSeconds,
49
50
TimeUnit .SECONDS )
@@ -70,7 +71,6 @@ class SessionProvider(
70
71
* Stops this provider and periodic saves.
71
72
*/
72
73
fun stop () {
73
- sessions.clear()
74
74
scheduler.shutdown()
75
75
}
76
76
}
Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ package mozilla.components.feature.session
7
7
import mozilla.components.browser.session.Session
8
8
import mozilla.components.concept.engine.Engine
9
9
import mozilla.components.concept.engine.EngineSession
10
+ import mozilla.components.concept.session.storage.SessionStorage
10
11
import org.junit.Assert.assertEquals
11
12
import org.junit.Test
12
13
import org.junit.runner.RunWith
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ android {
30
30
31
31
dependencies {
32
32
implementation project(' :concept-engine' )
33
+ implementation project(' :concept-session-storage' )
33
34
implementation project(' :concept-toolbar' )
34
35
35
36
implementation project(' :browser-engine-system' )
You can’t perform that action at this time.
0 commit comments