Commit graph

1898 commits

Author SHA1 Message Date
David Langley
db70c98af9 Merge branch 'develop' of https://github.com/vector-im/element-x-android into langleyd/live_waveform 2023-10-27 08:44:25 +01:00
Benoit Marty
aaaad23612
Merge pull request #1653 from vector-im/feature/bma/secureBackupSdk
SecureBackup: update matrix sdk module.
2023-10-27 09:35:19 +02:00
David Langley
1389c9ed24 Simple live waveform implementation. 2023-10-26 23:46:03 +01:00
Marco Romano
0457e5915c
Convert mx waveform to floats as early as possible in the chain (#1652)
This way we're sure that internally we always deal with [0;1] float samples. the [0;1024] int range is used only at the rust sdk boundary.
2023-10-26 16:58:00 +00:00
Benoit Marty
3a15b92eb6 SecureBackup: update matrix sdk module. 2023-10-26 18:02:34 +02:00
Marco Romano
00d24ce4b1
Include waveform when sending voice messages (#1650)
- New `AudioLevelCalculator` that outputs dB0v rescaled to the [0;1] range.
- `VoiceRecorder` now stores the audio levels sampled while recording, then resamples them to 100 samples to use as waveform preview.
- Waveform data is carried all the way as a `List<Float>` and converted to `List<Int>` in the [0;1024] range as per matrix spec only before sending it.
2023-10-26 17:37:24 +02:00
jonnyandrew
a67410f573
Add voice message preview player (#1646)
---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2023-10-26 15:33:58 +00:00
jonnyandrew
acd7aef6be
Move waveform UI to design system library (#1649) 2023-10-26 15:15:42 +00:00
ganfra
ec9b6ba62f
Merge pull request #1642 from vector-im/feature/fga/pin_settings
PIN : settings and branch flow
2023-10-26 16:40:38 +02:00
Jorge Martin Espinosa
030e86f56b
Update the chat screen UI using RoomInfo. (#1640)
* Update the chat screen UI using `RoomInfo`.

This is specially useful for getting live values for `hasRoomCall`.

* Ensure the first `MatrixRoomInfo` is emitted ASAP

* Try excluding `*Present$present$*` inner functions from kover as separate entities

* Update strings

---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2023-10-26 14:27:42 +00:00
ganfra
b355d9fb64 PIN: address PR review 2023-10-26 15:28:18 +02:00
ganfra
ca6a30d6cc PIN : fix quality 2023-10-26 15:25:40 +02:00
Marco Romano
3ec62ad58a
Use Float instead of Double for all the level metering logic. (#1645)
This is in preparation of further changes to the way the audio level is computed and to allow recording and sending of the waveform. The main reasoning behind the change is twofold:
1) We don't need the precision of Double in our context (we just need a rough indication of the changes in audio level to successfully draw a level meter or a waveform in our UI).
2) Performance: It is true that on 64 bit CPUs single operations involving Floats or Doubles take the same amount of time (i.e one clock cycle). But there are other aspects here that vouch in favor of Floats:
	- A float takes half the space in memory compared to a double, so when storing long lists of them this can add up.
	- On Android O and greater the ART runtime can "vectorize" certain operations on lists and make use of the CPU's SIMD registers which are generally 128 bits. So by using floats 4 of them can fit and be computed at the same time whilst with doubles only 2 will fit halving the throughput.

References:
- https://source.android.com/docs/core/runtime/improvements
- https://www.slideshare.net/linaroorg/automatic-vectorization-in-art-android-runtime-sfo17216
2023-10-26 12:55:23 +00:00
ganfra
a7c83a94d3 PIN : Fix SetupPinPresenterTest 2023-10-26 14:39:13 +02:00
ganfra
e864871c0e PIN : Fix test compilation 2023-10-26 13:10:25 +02:00
Marco Romano
eca7d705a7
Merge branch 'develop' into langleyd/custom_waveform 2023-10-26 13:07:45 +02:00
Marco Romano
7d1b671426
Refactor of voice message playing code (#1643)
After PR review suggestions from @jonnyandrew 
User facing functionality doesn't change, but overall architecture and testing is better.
2023-10-26 12:51:12 +02:00
ganfra
5d98f645d2 Merge branch 'develop' into feature/fga/pin_settings 2023-10-26 11:13:52 +02:00
David Langley
bcb928cf30 -Fix waveform preview 2023-10-26 09:10:38 +01:00
David Langley
20cef08367 Don't need added state from bad merge. 2023-10-26 09:06:08 +01:00
David Langley
5529cb4457 Remove WaveformProgressIndicator call. 2023-10-26 09:02:31 +01:00
David Langley
4de6a5cdd9 Merge branch 'develop' of https://github.com/vector-im/element-x-android into langleyd/custom_waveform 2023-10-26 09:02:14 +01:00
David Langley
827edecda4 Remove WaveformProgressIndicator and waveform library and lint.
-Remove WaveformProgressIndicator - Remove waveform library
- lint.
2023-10-26 08:58:03 +01:00
David Langley
296cd7ca14 Add custom waveform with cursor and nice gesture support. 2023-10-25 22:12:01 +01:00
ganfra
fdd9396089 Pin: add tests and make LockScreenConfig an injectable data class 2023-10-25 18:39:39 +02:00
Marco Romano
9cf17dfa12
Voice message bubble design improvements (#1637)
- Fixes color and size of both text and icons.
2023-10-25 17:33:50 +02:00
ganfra
3c5bff0927 Pin : clean remaining pin code attempts 2023-10-25 16:54:34 +02:00
ganfra
626a884e1f PIN: clean pin code storage 2023-10-25 16:45:42 +02:00
ganfra
adf21e0e02 PIN: fix and add tests 2023-10-25 16:13:30 +02:00
ganfra
49e2060961 PIN unlock : makes sure to load the pin size from storage 2023-10-25 15:07:05 +02:00
ganfra
2cb0addd3e PIN: add callback on LockScreenEntryPoint 2023-10-25 11:27:19 +02:00
ganfra
54cd62ab76 PIN: branch SignOut 2023-10-25 11:15:15 +02:00
David Langley
ef0110d9d7
Merge pull request #1610 from vector-im/dla/feature/custom_room_notification_settings_list
Custom room notification settings list
2023-10-24 23:02:16 +01:00
Marco Romano
6e66c989f4
Receive and play a voice message (#1503)
## Type of change

- [x] Feature
- [ ] Bugfix
- [ ] Technical
- [ ] Other :

## Content

This PR consists of several macro-blocks separated by path/package:
- `messages.impl.mediaplayer` : Global (room-wide) media player, now used only for voice messages but could be used for all media within EX in the future. It is backed by media3's exoplayer. Currently not unit-tested because mocking exoplayer is not trivial.
- `messages.impl.voicemessages.play` : Business logic of a timeline voice message. This is all the logic that manages the voice message bubble.
- `messages.impl.timeline.model` & `messages.impl.timeline.factories`: Timeline code that takes care of creating the `content` object for voice messages.
-  `messages.impl.timeline.components` : The actual View composable that shows the UI inside a voice message bubble.

All the rest is just small related changes that must be done here and there in existing code.

From a high level perspective this is how it works:
- Voice messages are unlike other message bubbles because they carry state (i.e. playing, downloading...) so they have a Presenter managing this state.
- Media content (i.e. the ogg file) of a voice message is downloaded from the rust SDK on first play then stored in a voice messages cache (see the `VoiceMessageCache` class, it is just a subdirectory in the app's cacheDir which is indexed by the matrix content uri). All further play attempts are done from the cache without hitting the rust SDK anymore.
- Playback of the ogg file is handled with the `VoiceMessagePlayer` class which is basically a "view" of the global `MediaPlayer` that allow the voice message to only see the media player state belonging to its media content. 
- Drawing of the waveform is done with an OSS library wrapped in the `WaveformProgressIndicator` composable.

Known issues:
 - The waveform has no position slider.
 - The waveform (and together with it the whole message bubble) is taller than the actual Figma design.
 - Swipe to reply for voice messages is disabled to avoid conflict with the audio scrubbing gesture (to reply to a voice message you have to use the long press menu).
 - The loading indicator is always shown (there is no delay).
 - Voice messages don't stop playing when redacted.

## Motivation and context

https://github.com/vector-im/element-meta/issues/2083

## Screenshots / GIFs

Provided by Screenshot tests in the PR itself.
2023-10-24 21:47:51 +00:00
David Langley
6fa73963c1
Merge branch 'develop' into dla/feature/custom_room_notification_settings_list 2023-10-24 22:18:38 +01:00
jonnyandrew
8c7a0c0e0a
Allow deleting a recorded voice message (#1635)
---------

Co-authored-by: ElementBot <benoitm+elementbot@element.io>
2023-10-24 21:02:19 +00:00
David Langley
75e95333a8 Unit and Snapshot tests for error and loading states. 2023-10-24 21:39:53 +01:00
David Langley
1239edb4a6 Merge branch 'dla/feature/custom_room_notification_settings_list' of https://github.com/vector-im/element-x-android into dla/feature/custom_room_notification_settings_list 2023-10-24 19:15:18 +01:00
David Langley
02de87235a Fix indentation 2023-10-24 19:15:14 +01:00
David Langley
4784235f8d
Merge branch 'develop' into dla/feature/custom_room_notification_settings_list 2023-10-24 17:20:15 +01:00
David Langley
117614d59d Fix compile error. 2023-10-24 17:14:48 +01:00
ganfra
f1988e3093 PIN : branch the mandatory flow 2023-10-24 18:13:41 +02:00
David Langley
03315ae77b Merge branch 'dla/feature/custom_room_notification_settings_list' of https://github.com/vector-im/element-x-android into dla/feature/room_notification_settings_ui_update 2023-10-24 16:36:27 +01:00
David Langley
d7386856a1 Remove debugging code. 2023-10-24 16:34:47 +01:00
David Langley
5324eb0f1a Address comments
- Add additional states to preview.
- Add TODO description for commented code
- Move showUserDefinedSettingStyle from the node to the view for testability.
2023-10-24 16:27:26 +01:00
Benoit Marty
aadfb79945 Test coverage: Add missing preview for RoomDetailsView. 2023-10-24 17:17:15 +02:00
Benoit Marty
b5839aa42a Test coverage: Add missing preview for MessagesView. 2023-10-24 17:17:15 +02:00
Benoit Marty
307680c62a Test coverage: extract EmojiItem to improve coverage. 2023-10-24 17:17:15 +02:00
jonnyandrew
9b027fcb67
Update package of voice message composer (#1633) 2023-10-24 14:48:35 +00:00
ganfra
d2d6cab839 PIN : start branching logic 2023-10-24 14:19:52 +02:00