This repository has been archived by the owner on Feb 4, 2022. It is now read-only.
✨ "Media is loading" indicator in create post modal #529
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a placeholder in the create post modal which indicates that media is being loaded. This appears after the user selects a media file but before the file has been processed (e.g. copied or converted) to indicate to the user that something is happening.
To accomplish this I've added an EventService which functions like an event bus. Different services and widgets can subscribe to events or post events. For example, the MediaService posts events to notify about its progress while OBSavePostModal subscribes to these media events in order to update the media attached to the post.
I implemented the event bus system myself since it was necessary that an event subscriber be able to "consume" the event and thus prevent it from being processed by other subscribers down the line. For example, both the OBHomePage and OBSavePostModal subscribe to share events, but if the modal is open the OBHomePage should not receive any of these events (since they're handled by the post modal).
This is a draft since there are a few bugs to iron out and I want to test a couple of variations on the visuals of the indicator.