Skip to content

Commit

Permalink
GitBook: [develop] 30 pages modified
Browse files Browse the repository at this point in the history
  • Loading branch information
agrosner authored and gitbook-bot committed Feb 17, 2021
1 parent 209e682 commit 1e45a39
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Binary file modified usage2/5.0-migration-guide.md
Binary file not shown.
22 changes: 18 additions & 4 deletions usage2/advanced-usage/sqlciphersupport.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,28 @@ You also need to add the Proguard rule:
-dontwarn net.sqlcipher.**
```

Then in your application class when initializing DBFlow:
Next, you need to subclass the provided `SQLCipherOpenHelper` \(taken from test files\):

```kotlin
FlowManager.init(context) {
database<CipherDatabase>(
openHelperCreator = SQLCipherOpenHelper.createHelperCreator(DemoApp.context, secret = "dbflow-rules"))
class SQLCipherOpenHelperImpl(context: Context,
databaseDefinition: DBFlowDatabase,
callback: DatabaseCallback?)
: SQLCipherOpenHelper(context, databaseDefinition, callback) {
override val cipherSecret get() = "dbflow-rules"
}
```

_Note:_ that the constructor with `DatabaseDefinition` and `DatabaseHelperListener` is required.

Then in your application class when initializing DBFlow:

```kotlin
FlowManager.init(FlowConfig.Builder(context)
.database(
DatabaseConfig.Builder(CipherDatabase::class) { db, callback -> SQLCipherHelperImpl(context, databaseDefinition, callback))
.build())
.build())
```

And that's it. You're all set to start using SQLCipher!

0 comments on commit 1e45a39

Please sign in to comment.