-
Notifications
You must be signed in to change notification settings - Fork 760
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
Refactor: split TimelineFragment into MessageComposerFragment and VoiceRecorderFragment #7285
Conversation
b6c58b8
to
b1aa29b
Compare
4f35ade
to
b571efb
Compare
b571efb
to
e1cad01
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, will do some tests. Please add a changelog.
super.onDestroyView() | ||
|
||
autoCompleter.clear() | ||
messageComposerViewModel.endAllVoiceActions() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe move this line to VoiceRecorderFragment.onDestroyView()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I think that line is not needed. Leaving the screen by either going back, leaving the app or going to a new screen sends the MessageComposerAction.OnEntersBackground
action, that always stops either the playback or the recording of a voice message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, I think I left if there because it would also stop any sent/received voice messages that were being played from the timeline items.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks for checking.
@Inject lateinit var audioMessagePlaybackTracker: AudioMessagePlaybackTracker | ||
@Inject lateinit var clock: Clock | ||
|
||
private val timelineViewModel: TimelineViewModel by existingViewModel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL about existingViewModel()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could change that to activityViewModel()
if we want the child fragments to work even if there's not a TimelineFragment
.
android:id="@+id/composerLayout" | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:background="?android:colorBackground" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚠️ Possible overdraw: Root element paints background?android:colorBackground
with a theme that also paints a background (inferred theme is@android:style/Theme.Holo
)⚠️ Possible overdraw: Root element paints background?android:colorBackground
with a theme that also paints a background (inferred theme is@android:style/Theme.Holo
)
SonarCloud Quality Gate failed. |
I have done a quick smoke test and it seems to work fine. I will merge the PR after the release though. Thanks! |
Thanks! I'll rebase #7288 then since it's based on this PR, someone will probably take it over while I'm away. |
Type of change
Content
Split
TimelineFragment
into 3 separate entities:Motivation and context
TimelineFragment
is a large class that has many responsibilities: rendering timeline events, handling composer input, handling voice recording, etc. This is an attempt to separate those into separate components that can be worked on independently.Screenshots / GIFs
UI hasn't changed.
Tests
Tested devices
Checklist