Commit Graph

518 Commits

Author SHA1 Message Date
td 22694a81d8
fix: also delete db on logout
we already cleared it out, but to change the db enc pw on the app we need to delete it completely first
2024-07-26 22:19:02 +05:30
Krille b962e8288b
feat: Add support for isFederate option for rooms 2024-07-26 13:45:13 +02:00
Krille e7802bd20b
fix: Synapse CI job failing because invite state not completely synced 2024-07-23 10:30:40 +02:00
Krille cabf357cf7
refactor: Cache profiles in database and refactor API 2024-07-23 08:51:10 +02:00
Krille 0f5526e1b8
feat: Automatically cancel typing indicators after 30 seconds 2024-07-03 14:36:40 +02:00
Krille 9d9865a1a1
fix: Do not update lastEvent with state events 2024-07-03 14:27:39 +02:00
td 869a7f41a9
fix: lastEvent after edit and redact 2024-07-01 21:31:13 +05:30
td a540bc6ef7
fix: dont override passed powerlevels with groupcall powerlevels 2024-06-11 19:00:39 +05:30
krille-chan 885aeb3c17
refactor: Deprecate Streams in favor of client.onSync
This deprecates all streams which can
be created by using client.onSync
anyway for a more predictable state
handling in consuming apps.
2024-05-28 13:48:31 +02:00
td 79960d1be3
fix: Do not set messages as state events anymore
We had this as a workaround and forgot to remove it after the database migration to the new way how to store the last message.
2024-05-22 22:22:56 +05:30
Krille 4d60c8f023
refactor: Make network request timeout
configurable
2024-05-21 08:30:34 +02:00
krille-chan c5e6a89f05
refactor: Combine sendMessageTimeoutSeconds and sendTimelineEventTimeout
Those timeouts were basically the same
and both had the same default value
1 minute. I guess it was just a
mistake to duplicate this.
2024-05-20 16:57:55 +02:00
Krille 93bf30f376
refactor: Make client members read only 2024-05-16 07:23:30 +02:00
Krille 5a79aa9536
refactor: make sure ensureNotSoftLoggedOut does not run multiple times 2024-05-14 10:40:32 +02:00
Krille 3f8a4c8189
feat: Implement unpublished MSC custom refresh token lifetime 2024-05-14 10:40:32 +02:00
Krille 039c214e7a
fix: ensureNotSoftLoggedOut must be called before network reqeust in syncFilter check 2024-05-14 10:13:45 +02:00
Krille 501c457ea1
refactor: delete not sent events without eventupdate stream workaround
This fixes several problems. First
sending a fake event through the
onEventUpdate stream was not a
good design and lead to problems
if you expect a timeline event but
then are unable to build the
event from json. This now uses
a new stream in the Client which
is listened to in the timeline to
delete an event which should be
much more reliable.
It also now throws an exception
if deleting the event fails
instead of returning true or false.
A deprecation note is added.
2024-05-08 12:02:55 +02:00
Krille 5b46ae6e31
refactor: Use strippedstatevent as base for room state and user class
Before we have used the Event class for all
state events while for invite rooms those
actually were StrippedStateEvent objects. This
created some problems like we needed to set a
fake originServerTs (usually to DateTime.now()).
Actually we don't need the additional keys for
state events most of the time so just using
StrippedStateEvent for all states and typecasting
them to event where needed is not much of a
hassle while we benefit from a more clear
structure.
This also now uses StrippedStateEvent as a base
class for the User class which makes the User
class more minimal as keys like event_id and
origin_server_ts are no longer necessary. As we
create a lot of fake User objects where we had to
put fake values in it, it brings more benefits
than problems to just get rid of those fields.
2024-05-03 14:06:49 +02:00
td 20a31c1908
feat: famedly calls 2024-04-23 15:52:35 +05:30
Krille 0e867402bc
chore: Sort archive by last activity 2024-03-26 13:30:06 +01:00
Krille 2456a64f37
refactor: Use dart records for checkHomeserver method
This makes use of dart
records to return three
different values for one
method. This makes the
special class no longer
necessary just for
returning data.
2024-03-18 15:20:31 +01:00
Krille b90b902218
refactor: BREAKING Migrate database to new lastEvent storage method
This changes the way how the last event is stored
for each room. It is now stored next to the
room event itself in the rooms box and no longer
stored like a room state. This way we need to
bump the database version which will cause an
inital sync for the client. Be aware of this when
updating the SDK!
2024-03-18 14:11:15 +01:00
krille-chan 20073ddd49
refactor: Store lastEvent in room object instead of room state 2024-03-18 13:18:36 +01:00
Krille 3d09219269
feat: Offers client.ensureNotSoftLoggedOut() to fix using client with stopped sync loop
This also makes sure that
the access token is
refreshed when calling
client.getEventByPushNotification()
which is porbably the most
common case for a client
with a stopped sync loop
doing network requests.
2024-03-14 14:49:47 +01:00
Krille d049e667ee
refactor: BREAKING Allow calling init when in soft logout state and fix some bugs
This fixes several problems with current soft logout
handling, as it now stores the refresh token correct and
only refreshs it 1 minute in advance instead of 5
minutes.
2024-03-07 15:49:23 +01:00
Nicolas Werner f6fa9df2c5
fix: archived room state store logic
This was implicitly relying to the timestamp of state events getting
compared in the setState function. Fix this by using the helper
functions already used for invite and join rooms.
2024-03-04 19:31:35 +01:00
Nicolas Werner 6f82e92f2c
fix: properly overwrite loaded state for partial loaded rooms
Otherwise invites, which get converted to normal rooms, might still have
old member events set in memory, that don't match the current state.
2024-03-04 17:52:06 +01:00
Krille 65c56f3630
feat: Store accesstokenExpiresIn and call softlogout 5 minutes before 2024-02-23 13:06:38 +01:00
Krille 38b1eb75e5
feat: Implement handling soft logout 2024-02-23 13:06:38 +01:00
Karthikeyan S b82d8bff0b
feat: specify history_visibility when creating group chat 2024-02-22 15:22:10 +05:30
td 3fba9a55b3
chore: remove state events both in imp and preview events list 2024-02-20 06:54:11 +05:30
td aa77812e8e
fix: ignore expired calls rather than killing them 2024-02-14 03:27:09 +05:30
Krille bef9a79f82
chore: Use some call events as last events 2024-01-31 13:48:19 +01:00
Krille 544888fe33
refactor: Use maxnumberofotk from olm instead hardcode 100 2024-01-15 13:56:54 +01:00
krille-chan a9508d8941
refactor: Throw client init exception on client init fail
This changes the behavior
when client init fails. It
no longer calls logout and does
only clear local data while
returning all available
information in a new
exception type so that the
SDK consumer can decide
to logout or try again to init
with these information. This
should make it much more rare
that users loose their sessions.
2024-01-05 09:46:38 +01:00
krille-chan b4607be5d0
feat: Make possible to fetch presence from database only 2023-12-27 10:22:54 +01:00
td 6a2f31de39
fix: ignore calls with age older than lifetime
feat: add barebones WebRTCDelegateMock
2023-12-18 21:28:26 +05:30
Krille c443e79d29
fix: Increase timeout for initial sync from 10 seconds to 2 minutes
This fixes the response
timeout for the initial
sync and sets it to 2
minutes instead of 10
seconds. This should increase
the speed for the initial
sync especially for large
accounts. This change
also adds some
documentation in the
code about what
timeout does what.
2023-12-15 13:18:10 +01:00
Nicolas Werner e1b80a1f3f
Merge branch 'main' into karthi/cache-get-config 2023-12-14 16:33:50 +01:00
Krille 55bfc92ee0
refactor: Make possible to wait for first sync and await first sync before create megolm session 2023-12-13 14:02:53 +01:00
Karthikeyan S db0762ad3f
feat: cache getConfig request 2023-12-13 18:28:44 +05:30
Krille eb869462aa
refactor: Add delete database method
This adds a delete database
method used for migration to
correctly delete the whole
legacy database instead just
empty it.
2023-12-12 12:57:23 +01:00
Krille 0b1281358f
fix: Do not hide matrix exceptions in sync 2023-12-05 09:04:51 +01:00
Krille 06669cbcac
refactor: Store fetched presence in db and deprecate own cache 2023-11-27 15:48:21 +01:00
Krille 193f404885
refactor: Add SyncConnectionException to syncloop 2023-11-27 09:11:57 +01:00
Nicolas Werner 8b8a647cf9
chore: enable discarded_futures lint
BREAKING CHANGE: This changes the runInRoot method to not return a
future. As a user, if you need the result of an async computation passed
to runInRoot, please await it directly. Also the KeyVerification start
and a few call methods now return a future.
2023-11-17 12:59:27 +01:00
Nicolas Werner e03826b1bb
Merge branch 'main' into krille/better-syncloop-error 2023-11-16 22:21:59 +01:00
Nicolas Werner 0b3542730d
Merge branch 'main' into krille/store-presences 2023-11-16 21:36:13 +01:00
Krille d1bbf57b6f
fix: Set presence when loading archive 2023-11-15 14:18:48 +01:00
Krille 8cc863b1a3
feat: Store presences in database 2023-11-15 06:59:58 +01:00
td 1ab06cb01a
fix: clear local database on logout even if server timesout 2023-11-13 18:12:47 +05:30
krille-chan b1b2b2ffe2
fix: catch correct exception type for connection problems 2023-11-05 09:52:08 +01:00
Nicolas Werner 37582a3a8e
fix: stale call checker leaks memory 2023-11-04 00:30:14 +01:00
Nicolas Werner 620187c772
Merge branch 'main' into braid/store-left-rooms-in-archive 2023-11-02 08:49:48 +01:00
Krille f0e4232930 refactor: Wait for room in sync until sync process and trigger cleanup call not before actually start clean up. 2023-10-23 12:30:14 +02:00
The one with the braid 5dea95f02c fix: Code style
Signed-off-by: The one with the braid <info@braid.business>
2023-10-20 14:58:56 +02:00
Clemens-Toegel 0ec6a64cc8 chore: store states to archived rooms (#1)
* chore: store states to archived rooms

* chore: PR fix

---------

Co-authored-by: Clemens Toegel <clemens.toegel@x-tention.at>
2023-10-20 14:04:11 +02:00
The one with the braid 053dddb76d chore: incrementally add left rooms to archive
- store left rooms in archive during sync (as well as they are removed
  on join already)
- refactor room archive code
- fix typo

Internal reference: SMC-385

Signed-off-by: The one with the braid <info@braid.business>
2023-10-20 14:04:11 +02:00
Krille 5c3c85ba3d
refactor: Trigger upload keys on sync and not in background job and upload them before logout 2023-10-20 10:18:05 +02:00
Mohammad Reza Moradi c38cbbc8dc
fix: apply state event before decryption on leaved room 2023-09-18 11:33:17 +02:00
Nicolas Werner 5b47a647b6
fix: userOwnsEncryptionKeys returns true for empty device lists 2023-09-13 14:26:41 +02:00
Nicolas Werner cce3646339
fix: startDirectChat might return an unjoined room
If you create DM room, but the other party doesn't join it, they might
be unable to create a new DM using startDirectChat. Since creating a new
DM is pretty much the same as joining the invite, we try to join the
pending DM invite first and fall back to creating a new room if that
fails.
2023-09-04 13:27:55 +02:00
Nicolas Werner 334c9e3b78
refactor: Simplify room sorting logic to make invite sorting more obvious
It wasn't quite obvious that invites were always sorted at the top, if
you just looked at the sort function. This makes it more explicit and
also makes invites always sort before favourited rooms.
2023-07-31 10:55:27 +02:00
Malin Errenst 395ef0eb8e
refactor: Use tryGet for type casts whenever possible 2023-06-21 15:04:46 +02:00
Malin Errenst 5943576b1b
refactor: Added type casts to match refactored matrix_api_lite 2023-06-16 12:42:10 +02:00
Nicolas Werner 663ab11ec5
feat: Support private read receipts
You can either set them to private on the client or overwrite the
behaviour for that on each readMarker call. This also handles incoming
thread receipts and tries its best to figure out what is the latest
receipt. This however breaks the old m.receipt account data event.
2023-04-21 18:31:15 +02:00
Nicolas Werner 7039c33f3a
chore: Upgrade to matrix_api_lite 1.6 2023-04-17 13:23:51 +02:00
Krille 710752060a
feat: Implement onMigration callback to Client.init() method 2023-03-29 15:30:38 +02:00
Philipp Grieshofer 9aff62a18c feat: Expose a getter for all rooms including archived rooms 2023-03-20 13:12:47 +00:00
Nicolas Werner 6f6f6b5d10 Merge branch 'kushal/http-call-issue-fix' into 'main'
fix: http api call replaced with httpClient

See merge request famedly/company/frontend/famedlysdk!1189
2023-03-03 15:21:28 +00:00
Nicolas Werner 99036ca178 Merge branch 'td/stopCheckerLeave' into 'main'
chore: stop stale group call checker on room leave

See merge request famedly/company/frontend/famedlysdk!1245
2023-03-03 12:43:27 +00:00
Nicolas Werner 2c3194b823
fix: archive takes 2 minutes to update
In Synapse 1.62.0 the default cache duration of initial sync responses
was changed to 2 minutes. That means our archive calls might return
stale data. Since different sync timeouts bust through the cache, we
make use of that to be able to load the new archive immediately.

fixes https://gitlab.com/famedly/company/frontend/famedly-web/-/issues/634
2023-03-03 13:08:31 +01:00
m_kushal d48542a023 fix: http api call replaced with httpClient
Signed-off-by: m_kushal <kushalmahapatro@gmail.com>
2023-03-03 01:16:10 +04:00
td fd4577ae84
chore: stop stale group call checker on room leave 2023-02-27 11:53:08 +05:30
td f7c7cb82de
chore: add useServerCache option to fetchOwnProfileFromServer and fix missing awaits 2023-02-20 17:57:29 +05:30
td eca98b14b9
chore: add a fetchOwnProfileFromServer method which tries to get ownProfile from server first, disk then 2023-02-16 19:22:32 +05:30
td 0c9e129347
fix: clean expired member state events in group calls 2023-02-14 23:08:50 +05:30
td 1219604dc9
fix: hasActiveGroup call now checks all group calls
fix: implement activeGroupCallEvents to get all active group call state events in a room

refactor: move staleCallChecker and expires_Ts stuff to an extension on Room, instead of Voip because it makes much more sense per room rather than on voip, also makes testing easier

fix: populate local groupCalls list on instantiating VOIP()

fix: starting stale call checker is now handled by the sdk itself because clients can forget to do so
2023-02-14 15:02:28 +05:30
Krille 05c945b042 fix: Last message set incorrectly on all session key received
This fixes a bug that the
last message was sent
incorrectly when a session
key received for example
from the key backup. It may
fix several issues like the
last message is set as a
very old one or the last
message is not decrypted.
2023-01-18 11:46:32 +01:00
Krille Fear 956a2f793f fix: Add timeout to sync http call 2022-12-27 09:30:04 +01:00
TheOneWithTheBraid 3cc4cd8410 fix: follow account kind in registration
- as of now, account kind ist simply ignored

Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
2022-11-22 07:53:59 +01:00
Grieshofer Philipp d60a3aa579 refactor: Add argument for custom CreateRoomPreset to startDirectChat method 2022-11-14 11:07:53 +01:00
Christian Pauly 7caab4d086 chore: Follow up fix for request users in invite rooms 2022-11-14 08:27:47 +01:00
Christian Pauly 0a6a813804 refactor: Get rid of unnecessary type cast 2022-11-07 11:09:20 +01:00
td aa03f5aa06
fix: filter list for adding p2p call events 2022-10-28 21:52:02 +05:30
Christian Pauly 6c307980a5 fix: Do not wait for first sync after migration init
If the first sync fails because of
a connection problem then the
migration is lost. This should not
happen.
2022-10-26 11:54:33 +02:00
Christian Pauly 7b1a519de0 fix: Do not assume that push rules are never malformed in account data 2022-10-21 10:48:40 +02:00
Nicolas Werner 99c77b9276 Merge branch 'nico/decryption-queue' into 'main'
feat: Implement a queue for events pending decryption

Closes famedly-web#535

See merge request famedly/company/frontend/famedlysdk!1143
2022-10-18 14:02:48 +00:00
Christian Pauly 69f82b2619 refactor: Remove unused imports 2022-10-18 11:42:11 +02:00
Nicolas Werner f55bb4776a feat: Support evaluating pushrules
fixes #339
2022-10-17 04:29:20 +02:00
Christian Pauly 779c278854 refactor: Use DateTime method instead of comparing milliseconds 2022-10-12 11:33:00 +02:00
Nicolas Werner c6a8f5a162 feat: Implement a queue for events pending decryption
fixes https://gitlab.com/famedly/company/frontend/famedly-web/-/issues/535
2022-10-12 11:07:50 +02:00
Nicolas Werner c3ec0ffa2a fix: messages not being processed after a new encryption event. 2022-09-29 12:18:18 +02:00
Christian Pauly dd375eddfd feat: Add getter for own unverified devices 2022-09-21 10:23:01 +02:00
henri2h 7b61f8eb01 fix: don't assume redacts attribute from content to be valid 2022-09-12 17:09:29 +02:00
Nicolas Werner 2b58ec2902 Merge branch 'krille/fix-get-push-rules' into 'main'
fix: Get push rules crashes if malformed

See merge request famedly/company/frontend/famedlysdk!1124
2022-09-09 10:14:35 +00:00
Nicolas Werner ab73047e51 fix: timeout when sending large files
fixes https://gitlab.com/famedly/company/frontend/famedly-web/-/issues/540
2022-09-06 21:18:53 +02:00
Christian Pauly 9a8da3c1e6 fix: Get push rules crashes if malformed 2022-09-06 20:19:52 +02:00
Nicolas Werner abbc474480 fix: Check ahead of download if a file exceeds the maximum file size
fixes https://gitlab.com/famedly/company/frontend/famedly-web/-/issues/539
2022-09-06 11:52:30 +02:00
Nicolas Werner 163ad0de6b fix: The initial sync waiting for a long time in some cases 2022-08-30 14:22:09 +02:00