Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start DM on first message (UI) #6051

Merged
merged 31 commits into from
Jul 12, 2022
Merged

Conversation

Florian14
Copy link
Contributor

@Florian14 Florian14 commented May 13, 2022

Type of change

  • WIP Feature
  • Bugfix
  • Technical
  • Other :

Content

This PR displays a "fake" local timeline after selecting the users to create a DM. Sending a message or event is not handled yet, so the real room cannot be created for now.
The flow is hidden behind a debug feature flag accessible from the debug menu.

Motivation and context

UI: #5525

Screenshots / GIFs

start_dm_on_first_msg.mp4

Tests

  • Activate the start DM feature in the debug menu -> Features
  • On the home screen, select the first tab (Direct Messages)
  • Click on the fab button to start a DM, select several users and press "GO"
  • A kind of timeline should now appear, there is no action in the toolbar (except the close button)
  • It is not possible to access the room settings or details
  • Composer actions are not working (an error appears when we try to send an event to the room)
  • When we go back to the room list or relaunch the app, the "fake" room is deleted from the DB and disappears from the room list

Tested devices

  • Physical
  • Emulator
  • OS version(s): API 32

Checklist

@github-actions
Copy link

github-actions bot commented May 13, 2022

Unit Test Results

124 files  ±0  124 suites  ±0   2m 22s ⏱️ -3s
220 tests ±0  220 ✔️ ±0  0 💤 ±0  0 ±0 
726 runs  ±0  726 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit 521ecfb. ± Comparison against base commit 8b2d6c8.

♻️ This comment has been updated with latest results.

@Florian14 Florian14 force-pushed the feature/fre/start_dm_on_first_msg branch 7 times, most recently from 0bef89f to f62b4d0 Compare May 18, 2022 09:32
@Florian14 Florian14 marked this pull request as ready for review May 18, 2022 09:54
@Florian14 Florian14 requested review from a team, ouchadam and fedrunov and removed request for a team May 18, 2022 09:54
@Florian14 Florian14 requested a review from gaelledel May 18, 2022 10:07
@ouchadam
Copy link
Contributor

we can use the .wip extension for creating work in progress (behind a feature flag) change log entries

@Florian14 Florian14 mentioned this pull request May 23, 2022
15 tasks

// Wait for room to be created in DB
try {
awaitNotEmptyResult(realmConfiguration, TimeUnit.MINUTES.toMillis(1L)) { realm ->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for my understanding, are we relying on another task to asynchronously update the room entity? if possible it would be safer to sequentially run the tasks rather than rely on a timeout (is this a common pattern in the sdk?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ouchadam I agree with you, I'd like to remove it but I have a non-systematic but recurrent crash when I try to navigate to the local room (in the stacktrace, it seems that we try to navigate to un unknown room). It's a bit confusing because the awaitTransaction seems ok, I can log the entity before returning the roomId from the task. Did I miss something else?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not too familiar with this area, would need to delegate to @bmarty / @ganfra to answer that

it looks like other tasks are using the same pattern of awaitNotEmptyResult, not a blocker for me, was curious 😄

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second task is waiting to get the room from the sync but in the current case, the room is created locally and put in DB, so we should not have to wait for it 😕

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the cross conversations, I did not see @ouchadam 's comments at first sight.
Please see my suggestion at #6051 (comment)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just replacing with this line can help (I let you do some test):

        // Ensure that Realm is up to date before returning the roomId.
        monarchy.doWithRealm { it.refresh() }

It continues crashing...

* This room will not be synchronized with the server and will not come back from the sync, so all the events related to this room will be generated
* locally.
*/
suspend fun createLocalRoom(createRoomParams: CreateRoomParams): String
Copy link
Contributor

@ouchadam ouchadam May 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thinking out loud about about the api design~ not a blocker!

from a consumer api perspective, are local rooms semantically the same as normal rooms? would we handle interacting with rooms differently if they're normal vs local?

I'm wondering if CreateRoomParams could have a isLocal option and reusing createRoom and leaveRoom 🤔

Copy link
Contributor

@ouchadam ouchadam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 💯

Copy link
Contributor

@fedrunov fedrunov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Florian Renaud added 7 commits June 30, 2022 11:48
* develop: (174 commits)
  Bump libphonenumber from 8.12.50 to 8.12.51
  LoadRoomMember: fix presence
  Cleanup
  LoadRoomMembers: add changelog
  LoadRoomMembers: handle room member event a bit more efficiently
  LoadRoomMembers: exclude Membership.Leave
  LoadRoomMembers: divide by chunk
  Bump soloader from 0.10.3 to 0.10.4
  Code review fix.
  Try no using the gradle daemon on CI
  Harmonize values of `CI_GRADLE_ARG_PROPERTIES`
  removing unused dependencies and marking soloader and ignored from dependency check (as it's dynamic)
  Remove non necessary prefix in logs
  Adding changelog entry
  Updating the unit tests
  Stopping existing active live when starting a new one
  Avoid multiple PR from Dependabot when Flipper is upgraded.
  Change context inside the get live summary use case
  Use a TestDispatcher in the FakeSession
  Code review fixes.
  ...
* develop: (91 commits)
  Remove unused import
  Update versions
  Update CHANGES
  Improve readability.
  Weblate: also clean trads
  Changelog
  Format file
  Add android:hasFragileUserData="true" to the manifest. See details in #2352
  Clean the TODO delete (UnusedResource not compatible with string template)
  showing a toast on password reset confirmation
  lifting duplicated event_base layout to the base class, with the option for children to override
  using vector model for consistency
  Replace 5 manual steps to 1 command line step
  Translated using Weblate (Italian)
  Translated using Weblate (Swedish)
  Translated using Weblate (Swedish)
  Translated using Weblate (Russian)
  extracting common breaker background selection to ftue extensions
  removing unused imports
  adding changelog entry
  ...
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I focused my review on the SDK part.

createLocalRoomSummaryEntity(realm, roomId, createRoomBody)
}

// Wait for room to be created in DB
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think we need to wait in this case. We are not waiting for a sync response including the new room.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bmarty I agree with you but during my tests, I had a frequent crash because the roomId was returned before having the object in DB. Adam did the same comment, did I miss something?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just replacing with this line can help (I let you do some test):

        // Ensure that Realm is up to date before returning the roomId.
        monarchy.doWithRealm { it.refresh() }

@bmarty bmarty mentioned this pull request Jul 4, 2022
* develop: (156 commits)
  adding test case for showing html entities are processed
  adding tests around the event html rendering - the test helper is a little hacky in order to covert the spans to something human readable
  removing extra line
  adding changelog entry
  overriding the default list handler with an implementation that takes into account the initial starting position
  trigger CI
  Use executeTransactionAwait (need realm refresh in this case)
  Bump flipper from 0.152.0 to 0.153.0
  Use executeTransactionAwait (need realm refresh in this case)
  generating 1.4.27 changelog and updating version
  Fixing crash when sharing plain text, such as a url
  Fix crashes when opening Thread (#6463)
  Timeline: fix validation of timeline event changes
  Fix ConcurrentModificationException on BackgroundDetectionObserver
  Fix crashes when opening Thread (#6463)
  suppressing unused string resource
  Changelog
  Fix ConcurrentModificationException on BackgroundDetectionObserver
  Fix typo
  adding changelog entry
  ...
Copy link

@gaelledel gaelledel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved given we change the title to "Direct message" (singular)

@Florian14 Florian14 requested a review from bmarty July 11, 2022 15:22
Florian Renaud added 2 commits July 12, 2022 09:14
* develop:
  Group if together
  io.element.android:opusencoder:1.0.3 - should fix lint false positive issues
  Indentation, move comment above the block.
  Do the check on towncrier only for PR targeting develop branch
  Format file
  io.element.android:opusencoder:1.0.1
  Add a VectorFeatures to force usage of the library OpusEncoder
  Add dependency to opusencoder and remove module from this project
  shorter name
  Add GitHub action to check for a towncrier file
* develop:
  Comment the GHA towncrier, there is a syntax error
Copy link
Member

@bmarty bmarty left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.3% 0.3% Duplication

@Florian14 Florian14 merged commit 909ce29 into develop Jul 12, 2022
@Florian14 Florian14 deleted the feature/fre/start_dm_on_first_msg branch July 12, 2022 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants