You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/advanced/Next.md
+24-10Lines changed: 24 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -16,12 +16,12 @@ Current implementation of persistence layer is created using [SQLiteOpenHelper](
16
16
a helper class that manages database creation and migrations. Even if this approach is powerful, the lack of compile time query verification and a big boilerplate of mapping SQLite queries to actual values make this implementation prone to many errors.
17
17
18
18
This Async Storage feature improves the persistence layer, using modern approaches to access SQLite (using [Room](https://developer.android.com/training/data-storage/room)), to reduce possible anomalies to the minimum.
19
-
On top of that, it allows to access Async Storage from the native side, useful in [Brownfield integration.](BrownfieldIntegration.md#android)
19
+
On top of that, it allows accessing AsyncStorage from the native side, useful in [Brownfield integration.](BrownfieldIntegration.md#android)
20
20
21
21
### Migration
22
22
23
23
This feature requires no migration from the developer perspective - the current database will be recreated (based on the current one), meaning user won't lose any data if you decide to opt in.
24
-
There's a small drawback to know - the database "recreation" happens **only once**. Unless you want to disable the feature in the future, there's nothing to worry about.
24
+
There's a small drawback to know - the database "recreation" happens **only once**.
25
25
26
26
#### How it works
27
27
@@ -36,15 +36,17 @@ If you decide to disable the feature, your users will be back using old database
36
36
When you enable the feature again, the new database is **not** recreated, because it already exists, and no data is copied over.
37
37
38
38
39
-
### Enabling
39
+
### Enable
40
+
41
+
See [Configuration](#configuration) section below to learn more about setting different versions of Kotlin or Room.
40
42
41
43
1. In your project's `android` directory, locate root `build.gradle` file. Add Kotlin dependency to the `buildscript`:
42
44
43
45
```diff
44
46
buildscript {
45
47
ext {
46
48
// other extensions
47
-
+ kotlinVersion = '1.4.21'
49
+
+ kotlinVersion = '1.5.31'
48
50
}
49
51
50
52
dependencies {
@@ -55,26 +57,38 @@ buildscript {
55
57
56
58
```
57
59
58
-
2. In the same directory (normally `android`) locate `gradle.properties` file (if does not exists, create one) and add the line:
60
+
2. In the same directory (normally `android`) locate `gradle.properties` file (if it does not exist, create one) and add the line:
59
61
60
62
```groovy
61
63
AsyncStorage_useNextStorage=true
62
64
```
63
65
64
-
**How to specifying Kotlin version**
66
+
### Configuration
67
+
68
+
**Kotlin version**
65
69
66
-
Supported Kotlin versions are `1.4.x`. You can specify which one to use in two ways:
70
+
Next storage is tested against Kotlin version `1.5.31`.
71
+
You can specify different version, in one of two ways:
67
72
68
-
-having an `kotlinVersion` extension on the `rootProject` (recommended):
73
+
-add `kotlinVersion` extension to the `rootProject`:
69
74
70
75
```groovy
71
-
rootProject.ext.kotlinVersion = '1.4.21'
76
+
rootProject.ext.kotlinVersion = '1.5.31'
72
77
```
73
78
74
79
- specify `AsyncStorage_kotlinVersion` in `gradle.properties`:
75
80
76
81
```groovy
77
-
AsyncStorage_kotlinVersion=1.4.21
82
+
AsyncStorage_kotlinVersion=1.5.31
83
+
```
84
+
85
+
**Room**
86
+
87
+
Next AsyncStorage uses [Room persistence library](https://developer.android.com/jetpack/androidx/releases/room) to store data.
88
+
Currently, tested version is `2.3.0`. You can specify different version, by adding a flag to `gradle.properties`:
0 commit comments