Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Stanisław Chmiela <sjchmiela@users.noreply.github.com>
  • Loading branch information
gurs1kh and sjchmiela committed Jun 3, 2020
1 parent 503e599 commit c964941
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ Package-specific changes not released in any SDK will be added here just before

### 🎉 New features

- `expo-sqlite` now supports encrypted SQLite files ([#8242](https://github.com/expo/expo/pull/8242/) by [@gurs1kh](https://github.com/gurs1kh))
- Initial release of **`expo-screen-capture`** 🥳
- Initial release of **`expo-notifications`** 🥳
- Added `@react-native-community/segmented-control` in version `1.6.1`. ([#8038](https://github.com/expo/expo/pull/8038) by [@marchenk0va](https://github.com/marchenk0va) and [#8441](https://github.com/expo/expo/pull/8441) by [@tsapeta](https://github.com/tsapeta))
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/versions/unversioned/sdk/sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Open a database, creating it if it doesn't exist, and return a `Database` object

- **fileInfo (_object_ or _string_)** -- Either name of the database file or an object with the following:
- **name (_string_)** -- Name of the database file to open.
- **key (_string_)** -- Key used to encrypt database file
- **key (_string_)** -- Key used to optionally encrypt the database file. Note that this will only be used on iOS and Android to encrypt database files stored on the device's filesystem. On Web the key will not be used as WebSQL API available in browsers doesn't expose such functionality—data will be stored unencrypted. For a proper solution for storing secure data we recommend looking into [`SecureStore`](../securestore/) module.

The `version`, `description` and `size` arguments are ignored, but are accepted by the function for compatibility with the WebSQL specification.

Expand Down
3 changes: 2 additions & 1 deletion packages/expo-sqlite/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### 🛠 Breaking changes

### 🎉 New features
- now supports encrypted SQLite files ([#8242](https://github.com/expo/expo/pull/8242/) by [@gurs1kh](https://github.com/gurs1kh))

- Add support for natively encrypted SQLite databases for Android and iOS ([#8242](https://github.com/expo/expo/pull/8242/) by [@gurs1kh](https://github.com/gurs1kh))

### 🐛 Bug fixes
2 changes: 1 addition & 1 deletion packages/expo-sqlite/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ if (new File(rootProject.projectDir.parentFile, 'package.json').exists()) {

dependencies {
unimodule "unimodules-core"
api 'net.zetetic:android-database-sqlcipher:4.3.0@aar'
api "net.zetetic:android-database-sqlcipher:4.3.0@aar"
api "androidx.sqlite:sqlite:2.0.1"
}
8 changes: 4 additions & 4 deletions packages/expo-sqlite/ios/EXSQLite/EXSQLite.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ - (NSString *)pathForDatabaseName:(NSString *)name
return [directory stringByAppendingPathComponent:name];
}

- (NSValue *)openDatabase:(NSString *)dbName databaseKey:(NSString *)dbKey
- (NSValue *)openDatabase:(NSString *)dbName withKey:(NSString *)dbKey
{
NSValue *cachedDB = nil;
NSString *path = [self pathForDatabaseName:dbName];
Expand All @@ -59,9 +59,9 @@ - (NSValue *)openDatabase:(NSString *)dbName databaseKey:(NSString *)dbKey
return nil;
};

if (dbKey != NULL) {
if (!dbKey) {
const char *key = [dbKey UTF8String];
if (key != NULL) {
if (!key) {
sqlite3_key(db, key, (int)strlen(key));
}
}
Expand All @@ -81,7 +81,7 @@ - (NSValue *)openDatabase:(NSString *)dbName databaseKey:(NSString *)dbKey
rejecter:(UMPromiseRejectBlock)reject)
{
@synchronized(self) {
NSValue *databasePointer = [self openDatabase:dbName :dbKey];
NSValue *databasePointer = [self openDatabase:dbName withKey:dbKey];
if (!databasePointer) {
reject(@"E_SQLITE_OPEN_DATABASE", @"Could not open database.", nil);
return;
Expand Down

0 comments on commit c964941

Please sign in to comment.