mattermost-mobile/patches/@nozbe+watermelondb+0.23.0.patch
Elias Nahum 790b1beb22
[Gekidou] push notifications (#5779)
* Push notifications entry point

* Process android notification natively only if RN is not initialized

* Database changes to store local channel viewed_at

* EphemeralStore wait until screen removed

* Move schedule session notification to utility

* Fix channel remote & local actions + added actions for markChannelAsViewed & fetchMyChannel

* Add fetchMyTeam remote action

* Add dismissAllModalsAndPopToScreen to navigation

* Improve post list component & add app state to re-trigger queries

* Improve WS implementation

* Handle push notification events

* Fix postsInChannel since handler

* Handle in-app notifications

* Post list to listen to column changes

* Track selected bottom tab in ephemeral store

* add useIsTablet hook

* in-app notifications on tablets
2021-10-27 17:53:11 -03:00

54 lines
2.9 KiB
Diff

diff --git a/node_modules/@nozbe/watermelondb/adapters/sqlite/index.d.ts b/node_modules/@nozbe/watermelondb/adapters/sqlite/index.d.ts
index bb8f49a..1036aca 100644
--- a/node_modules/@nozbe/watermelondb/adapters/sqlite/index.d.ts
+++ b/node_modules/@nozbe/watermelondb/adapters/sqlite/index.d.ts
@@ -23,6 +23,7 @@ declare module '@nozbe/watermelondb/adapters/sqlite' {
export interface SQLiteAdapterOptions {
dbName?: string
migrations?: SchemaMigrations
+ migrationEvents?: MigrationEvents,
schema: AppSchema
jsi?: boolean
}
diff --git a/node_modules/@nozbe/watermelondb/native/android/src/main/java/com/nozbe/watermelondb/Database.kt b/node_modules/@nozbe/watermelondb/native/android/src/main/java/com/nozbe/watermelondb/Database.kt
index 802f137..785239e 100644
--- a/node_modules/@nozbe/watermelondb/native/android/src/main/java/com/nozbe/watermelondb/Database.kt
+++ b/node_modules/@nozbe/watermelondb/native/android/src/main/java/com/nozbe/watermelondb/Database.kt
@@ -11,17 +11,35 @@ import java.io.File
class Database(private val name: String, private val context: Context) {
private val db: SQLiteDatabase by lazy {
- SQLiteDatabase.openOrCreateDatabase(
+ SQLiteDatabase.openDatabase(
// TODO: This SUCKS. Seems like Android doesn't like sqlite `?mode=memory&cache=shared` mode. To avoid random breakages, save the file to /tmp, but this is slow.
// NOTE: This is because Android system SQLite is not compiled with SQLITE_USE_URI=1
// issue `PRAGMA cache=shared` query after connection when needed
if (name == ":memory:" || name.contains("mode=memory")) {
context.cacheDir.delete()
File(context.cacheDir, name).path
+ } else if (name.contains("/") || name.contains("file")) {
+ // Extracts the database name from the path
+ val dbName = name.substringAfterLast("/")
+
+ // Extracts the real path where the *.db file will be created
+ val truePath = name.substringAfterLast("file://").substringBeforeLast("/")
+
+ // Creates the directory
+ if (!truePath.contains("databases")) {
+ val fileObj = File(truePath, "databases")
+ fileObj.mkdir()
+
+ File("${truePath}/databases", dbName).path
+ } else {
+ File(truePath, dbName).path
+ }
} else
// On some systems there is some kind of lock on `/databases` folder ¯\_(ツ)_/¯
context.getDatabasePath("$name.db").path.replace("/databases", ""),
- null)
+ null,
+ SQLiteDatabase.CREATE_IF_NECESSARY or SQLiteDatabase.ENABLE_WRITE_AHEAD_LOGGING,
+ )
}
var userVersion: Int