Commit Graph

1596 Commits

Author SHA1 Message Date
Christian Pauly 7c0dd5d8fd fix: Broken nested accountData content maps
If you call BasicEvent.fromJson the given content is copied first
which recursively makes sure
that the Map is from type
Map<String,dynamic>.
Using just the constructor doesnt have this which can lead that nested Maps in
the content is InternallinkedHashMap and
therefore lead to type errors.
2021-07-06 08:11:30 +02:00
Christian Pauly af3a99af1c chore: Pin moor to 4.3.2 to fix the CI errors 2021-07-05 10:59:42 +02:00
Christian Pauly ebc9be250d fix: Mark unsent events as failed
In Moor this was implemented but forgotten in Hive.
Events with status 0 (not sent yet) should be marked as failed on restart.
In fact they should be marked as failed if older than 1 minute. To not have a big startup job which iterates through all events in the database
we just do a time check when opening a room where we iterate through all events anyway.
The new implementation is now in the constructor of the Event and therefore
independent from the database implementation.
2021-07-05 08:37:46 +02:00
Krille Fear e0d3994a46 chore: bump version 2021-06-26 08:33:03 +00:00
Sorunome b664640a05
fix: Don't run syncs while the client is being initialized
Fixes that a sync could be done / processed while the client was still being initialized (loaded from database). This has lead to multiple bugs, such as the verified status of keys getting lost, notifications that come in during app startup displaying oddly, etc.

Additionally, the init lock was released too early; it is now released when the init is actually done.
2021-06-25 13:26:23 +02:00
Christian Pauly 616d25034f chore: Bump version 2021-06-22 15:45:22 +02:00
Christian Pauly 768b0623da feat: Implement sync status stream
This new sync status stream gives the current status of the sync to make it possible
to display in the UI where the sync currently hangs and
what the progress is while updating 1000 rooms. So the app can display a
progress bar.
2021-06-20 15:59:59 +02:00
Christian Pauly c734dc5b9f chore: Bump version 2021-06-20 10:31:50 +02:00
Christian Pauly 96d28a1b76 feat: Implement migration for hive schema versions 2021-06-20 10:31:17 +02:00
Christian Pauly 16f1cb7456 chore: Bump version 2021-06-19 11:06:34 +02:00
Christian Pauly a7ffe4835d feat: Also migrate inbound group sessions
For users who do not use the chat backup this could be useful.
2021-06-19 11:03:52 +02:00
Christian Pauly 4dc62f6150 fix: Make sure hive keys only contain valid characters
There are some matrix IDs like room IDs which contain for example emojis.
This is valid from the spec and some people hack their Synapse to have this.
2021-06-19 10:51:17 +02:00
Christian Pauly c37c5a962e chore: Bump version and update changelog 2021-06-18 10:17:15 +02:00
Christian Pauly 69b52ba85b refactor: Move pedantic to dev_dependencies
The unawaited method from the pedantic package was a historic solution
for the case that you dont want to await a future in an async function.
But now we can do this with just a comment which
is the recommended way to do this now.
This makes it possible to have pedantic as a dev_dependency which means just one dependency less.
2021-06-18 10:15:59 +02:00
Christian Pauly 45a2472fcd chore: Update readme 2021-06-18 10:10:24 +02:00
Christian Pauly c0c7f68bf3 chore: Rename to matrix 2021-06-18 09:58:25 +02:00
Christian Pauly 38d81d6093 fix: Migrate missing device keys
Currently we only migrate the client and SSSSCache but this leads to the
problem that we are no longer self signed after the migration.
We need to migrate all device keys too.
This also abstracts the migration code in a method. init() is too large already...
2021-06-18 09:16:12 +02:00
Christian Pauly 14ee16fe16 feat: Implement new Hive Database
The hive database now implements the whole API except for storing files which
should be better done by the flutter_cache_manager package inside of the
flutter app. All tests already run with Hive now but the Moor database is still
tested too. We needed to change some wait jobs in the tests because the Hive
database is not 100% in memory for the tests like Moor.
For now both database implementations are equal and the developer can pick
which one to use but we plan to get rid of Moor in the future.
2021-06-16 08:43:33 +02:00
Christian Pauly 28dc8b4ff0 refactor: Improve clearing
This makes sure that the database is null after clearing so it will
be built again using the databaseBuilder.
Also this makes sure that the sync has
aborted BEFORE the clearing starts to
get rid of some warnings in the logs.
2021-06-14 11:00:41 +02:00
Christian Pauly fe06b96e93 fix: Do not logout before migration
Before the migration of the databases starts there is always a
logout signal sent. This was wrong.
This also cleans up the logs a little bit
and removes the useless parameters for the second init() call
because those are going to come from the new database anyway.
2021-06-14 08:29:03 +02:00
Christian Pauly 967712adfe feat: Implement database migration
This allows the user to give a legacyDatabaseBuilder to the client object
and in the init proccess the client checks by itself if there is old data in the legacy
database. If yes then it migrates them and
then deletes the old database. This uses the database_api and is agnostic to
the database implementation.
2021-06-11 10:10:18 +02:00
Christian Pauly cfa4441682 chore: Update matrix api lite
To fix the log filtering.
2021-06-10 09:23:08 +02:00
Lukas Lihotzki ae2aafbd52 test: use setUp and tearDown 2021-06-09 17:12:14 +02:00
Krille Fear a5cbbf5cf4 chore: Update matrix_api_lite 2021-06-09 08:12:47 +00:00
Christian Pauly d308fac43c fix: CI
This switches to the official Dart docker Image for code analyzing and dartdocs
Also this fixes loading Dart from the
official repository in the test job.
2021-06-08 11:40:04 +02:00
Christian Pauly 0e1e72d3ab fix: Minor test glitches 2021-06-01 15:27:57 +02:00
Christian Pauly c387b33e9f refactor: Make support for file storing optional in database API 2021-06-01 15:27:18 +02:00
Christian Pauly ab0ff46900 refactor: Remove types for timeline callbacks
These types weren't that helpful anyway and their names were not compatible
with the new linter rule of Flutter 2.2.
2021-06-01 12:57:52 +02:00
Christian Pauly 73db010db4 fix: Make QueuedToDeviceEvent store content as String OR Map
Temporary fix to stay compatible to Moor AND a key value store
2021-06-01 12:56:43 +02:00
Christian Pauly d0f67f914a refactor: Add sortOrderKey and check for this while Event creation
This makes it easier to write a store which just stores the Event json and
does not have a dedicated scheme for
each object like Moor has.
2021-06-01 12:55:45 +02:00
Christian Pauly 26261ecd5e feat: Add fromJson method for Room
This also included to move the room summary to a dedicated object inside
of the Room object because so it is easier to convert this to and from json.
2021-06-01 12:54:16 +02:00
Christian Pauly 9631cea83a feat: Add toJson method for StoredInboundGroupSession 2021-06-01 12:51:17 +02:00
Christian Pauly c3d47b16c6 CI: Use correct image 2021-05-25 10:46:34 +02:00
Christian Pauly c66e35c16c refactor: Create a clean database API 2021-05-20 07:36:03 +00:00
Christian Pauly 6fae2e1426 docs: Clean up repository docs
This adds a first version 0.1.0 to the project and a start for a changelog.
This also updates the readme and the contributing docs.
2021-05-18 11:41:53 +00:00
Christian Pauly d1b76b01c4 fix: Try clear and try close database 2021-05-17 14:36:10 +02:00
Christian Pauly bb9a8ff7e9 fix: SdkError Exception can be anything so should be dynamic 2021-05-17 14:17:46 +02:00
Christian Pauly aa4b0a25fa refactor: Update matrix_api_lite and remove no longer necessary dep override
The logger package has been removed too because the matrix_api_lite no longer
depends on it. It was a unnecessary import anyway because it was transitive in the past.
2021-05-17 07:50:54 +00:00
Nicolas Werner 6f52c0e2c3 fix: Allow SDK users to delete the db after logout 2021-05-17 07:38:53 +00:00
Christian Pauly 3e076425e6 CI: Remove update dependency job
Updating dependencies in a library does not make much sense.
Due to we dont have a pubspec.lock the app which uses this library always uses the
newest minor release by default.
For new major releases which have a new API this breaks anyway and needs manual help.
So if we depend on a specific major version we should not force the app to use the latest minor
versions without a reason to stay as compatible as possible.
2021-05-12 14:45:51 +02:00
Lukas Lihotzki c196610998 chore: operation names from OpenAPI spec 2021-05-12 13:56:16 +02:00
Christian Pauly 70ee808911 feat: Enhanced alias handling 2021-05-01 09:26:46 +02:00
Lukas Lihotzki fdf650abd5 refactor: avoid if-condition based on bit value 2021-04-26 18:48:54 +02:00
Lukas Lihotzki b4f755388a refactor: high-level loops 2021-04-19 18:58:59 +02:00
Lukas Lihotzki 71fdd28a8a refactor: await unconditionally 2021-04-16 14:19:42 +02:00
Christian Pauly ffef732103 refactor: enable more linter rules
enable prefer_final_locals and prefer_final_in_for_each linter rules
2021-04-14 10:29:29 +02:00
Lukas Lihotzki 545ce26e39 style: fix format and lint 2021-04-12 14:49:03 +02:00
Lukas Lihotzki ac9df588d1 chore: recreate database.g.dart 2021-04-12 14:49:03 +02:00
Lukas Lihotzki 089ecfdb0c chore: update dependencies 2021-04-12 14:49:03 +02:00
Lukas Lihotzki d413f54f10 refactor: use OpenSSL for file e2ee 2021-04-12 14:49:03 +02:00