Skip to content

Local SQLite store can't open on Linux desktop #82

Open

Description

@TheZupZup

The app uses sqflite for the local store, but sqflite only ships Android and Apple implementations. sqflite_common_ffi is a dev dependency only, and nothing in lib/ sets databaseFactory for Linux/Windows. So on the Linux desktop build, AppDatabase.open() should fail on the first call.

Found while reading the code for #81. Not reproduced on a real Linux build yet.

Impact if confirmed:

  • local mode ("Use offline") can't save anything on Linux
  • in connected mode, fix: data-loss, sync and concurrency bugs from a QA pass #81 makes the local store the durable copy of every edit. Without it, Linux falls back to sending saves straight to the backend (the old behavior). So a desktop close with the backend down can still lose the last edit there.

Likely fix: init FFI in main() on Linux/Windows (sqfliteFfiInit(); databaseFactory = databaseFactoryFfi;) and move sqflite_common_ffi to dependencies. Needs a packaging decision first: sqlite3 3.x downloads a prebuilt SQLite through a build hook by default, which matters for F-Droid and offline builds. The other options are its system source, which links the distro's libsqlite3, or bundling.

Expected: notes save locally on Linux, in local mode and as the durable copy in connected mode, the same as on Android.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions