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

[RNMobile] Add paused media state handlers to Android bridge code #57476

Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
573d7f0
Fix incorrect heading level in Editor curation docs (#57409)
ndiego Dec 28, 2023
970e925
NumberControl: Make increment and decrement buttons keyboard accessib…
afercia Dec 28, 2023
9c8001a
DataViews: update names for `DropdownMenuRadioItemCustom` (#57416)
oandregal Dec 28, 2023
3f6c738
Navigation Block: Use dom.focus for focus control (#57362)
t-hamano Dec 28, 2023
ec2c51d
DataViews: hide actions menu upon selecting a layout (#57418)
oandregal Dec 28, 2023
1f9b753
Server directive processing: Stop processing non-interactive blocks (…
cbravobernal Dec 28, 2023
1c79fd8
Performance: Avoid extra `useMarkPersistent` dispatch calls (#57435)
ntsekouras Dec 28, 2023
36396cc
Font Library: remove "has_font_mime_type" function (#57364)
HrithikDalal Dec 28, 2023
10facf1
Update modal description and button label (#57368)
HrithikDalal Dec 28, 2023
663916f
Update tutorial based on user feedback. (#57403)
ndiego Dec 28, 2023
83e1a2c
Change the slug for the theme.json doc to avoid conflicts (#57410)
ndiego Dec 28, 2023
6f6b083
Migrate 'allowed patterns' e2e tests to Playwright (#57399)
Mamaduka Dec 29, 2023
3591f4d
DataViews: fallback to `(no title)` if there's no rendered title (#57…
oandregal Dec 29, 2023
b85da47
DataViews: make fields dependant on view.type (#57450)
oandregal Dec 29, 2023
af8c530
DataViews: prevent unnecessary re-renders (#57452)
oandregal Dec 29, 2023
2888084
Docs/tutorial: Fix opposite condition for content generation in rende…
atachibana Dec 29, 2023
2dbd8a5
DataViews: prevent unnecessary renders for Pagination (#57454)
oandregal Dec 29, 2023
0d2bf01
Make the Replace featured image button perceivable by assistive techn…
afercia Dec 29, 2023
9431114
DataViews: memoize onSetSelection (#57458)
oandregal Dec 29, 2023
63a6321
Fix Template preview menu item accessibility. (#57456)
afercia Dec 30, 2023
fc36077
Migrate 'preferences' e2e tests to Playwright (#57446)
Mamaduka Dec 30, 2023
a87f24e
Migrate remaining 'publish panel' e2e tests to Playwright (#57432)
Mamaduka Jan 1, 2024
06b5fa5
Core Data: Pass the 'options' argument to data action shortcuts (#57383)
Mamaduka Jan 1, 2024
4eb3b74
Editor: Unify the DocumentTools component (#57214)
youknowriad Jan 1, 2024
18dd101
Avoid using a memoized selector without dependencies (#57257)
youknowriad Jan 1, 2024
1014dc6
Quality: avoid React warning when changing rendering mode (#57413)
t-hamano Jan 1, 2024
31e67ea
Global style revisions: move change summary code and tests to block e…
ramonjd Jan 2, 2024
5831320
Adding padding to entity save panel header (#57471)
ramonjd Jan 2, 2024
3c80f02
use a classname instead of the element in case a strong element is pa…
ramonjd Jan 2, 2024
f70554c
Passed progress values to failed media uploads and add paused media h…
derekblank Jan 2, 2024
2d43054
Migrate 'sidebar' e2e tests to Playwright (#57448)
Mamaduka Jan 2, 2024
0aabb54
Add onMediaFileSavePaused handler
derekblank Jan 2, 2024
f364b68
[RNMobile] Auto-scroll upon block insertion (#57273)
fluiddot Jan 2, 2024
9e0747e
Add individual headings to the elements translations (#57472)
ramonjd Jan 2, 2024
7ebb55c
DataViews: Use in patterns page (#57333)
ntsekouras Jan 2, 2024
1ed7ba2
[Mobile] Unselect blocks using the hardware back button (Android) (#5…
Jan 2, 2024
50a8314
Remove deprecated `behaviors` syntax (#57165)
michalczaplinski Jan 2, 2024
60bf21e
Add `compact` size variant to InputControl-based components (#57398)
mirka Jan 2, 2024
1b2dac7
Block editor: give iframe fallback background color (#57330)
ramonjd Jan 2, 2024
45dc4b1
Background image block support: Add tests for size and repeat output …
andrewserong Jan 2, 2024
78f28c1
Update paused handlers from merge
derekblank Jan 3, 2024
a33a090
Merge branch 'rnmobile/media-upload-progress-connection-subscription'…
derekblank Jan 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,19 @@ interface MediaSelectedCallback {
}

interface MediaUploadEventEmitter {
void onUploadMediaFileClear(int mediaId);
void onUploadMediaFileClear(int mediaId, float progress);
void onMediaFileUploadProgress(int mediaId, float progress);
void onMediaFileUploadSucceeded(int mediaId, String mediaUrl, int serverId, WritableNativeMap metadata);
void onMediaFileUploadFailed(int mediaId);
void onMediaFileUploadFailed(int mediaId, float progress);
void onMediaFileUploadPaused(int mediaId, float progress);
}

interface MediaSaveEventEmitter {
void onSaveMediaFileClear(String mediaId);
void onSaveMediaFileClear(String mediaId, float progress);
void onMediaFileSaveProgress(String mediaId, float progress);
void onMediaFileSaveSucceeded(String mediaId, String mediaUrl);
void onMediaFileSaveFailed(String mediaId);
void onMediaFileSaveFailed(String mediaId, float progress);
Copy link
Member

Choose a reason for hiding this comment

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

Were the float progress additions in the name of consistency? I noted the Android implementation has a dedicated progress event/method.

public void mediaFileSaveProgress(final String mediaId, final float progress) {
mDeferredEventEmitter.onMediaFileSaveProgress(mediaId, progress);
}

I.e., I wondered if Android is currently implemented in a way that negates the need to pass progress to the other methods. Should we avoid adding these float progress?

iOS is implemented very differently and does not have a dedicated progress event/method. iOS relies upon a enum state that is passed to a single media observer method with a switch statement that communicates different states/progresses to the JavaScript app. The single method can receive a progress event with a value.

void onMediaFileSavePaused(String mediaId, float progress);
void onMediaCollectionSaveResult(String firstMediaIdInCollection, boolean success);
void onMediaIdChanged(final String oldId, final String newId, final String oldUrl);
void onReplaceMediaFilesEditedBlock(final String mediaFiles, final String blockId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ private boolean isCriticalMessage(int state) {
}

@Override
public void onUploadMediaFileClear(int mediaId) {
setMediaFileUploadDataInJS(MEDIA_UPLOAD_STATE_RESET, mediaId, null, 0);
public void onUploadMediaFileClear(int mediaId, float progress) {
setMediaFileUploadDataInJS(MEDIA_UPLOAD_STATE_RESET, mediaId, null, progress);
}

@Override
Expand All @@ -176,14 +176,19 @@ public void onMediaFileUploadSucceeded(int mediaId, String mediaUrl, int mediaSe
}

@Override
public void onMediaFileUploadFailed(int mediaId) {
setMediaFileUploadDataInJS(MEDIA_UPLOAD_STATE_FAILED, mediaId, null, 0);
public void onMediaFileUploadFailed(int mediaId, float progress) {
setMediaFileUploadDataInJS(MEDIA_UPLOAD_STATE_FAILED, mediaId, null, progress);
}

@Override
public void onMediaFileUploadPaused(int mediaId, float progress) {
setMediaFileUploadDataInJS(MEDIA_UPLOAD_STATE_PAUSED, mediaId, null, progress);
Copy link
Member

Choose a reason for hiding this comment

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

I believe MEDIA_UPLOAD_STATE_PAUSED needs to be defined as 11 atop this file. Currently it is undefined.

}

// Media file save events emitter
@Override
public void onSaveMediaFileClear(String mediaId) {
setMediaSaveResultDataInJS(MEDIA_SAVE_STATE_RESET, mediaId, null, 0);
public void onSaveMediaFileClear(String mediaId, float progress) {
setMediaSaveResultDataInJS(MEDIA_SAVE_STATE_RESET, mediaId, null, progress);
}

@Override
Expand All @@ -197,8 +202,13 @@ public void onMediaFileSaveSucceeded(String mediaId, String mediaUrl) {
}

@Override
public void onMediaFileSaveFailed(String mediaId) {
setMediaSaveResultDataInJS(MEDIA_SAVE_STATE_FAILED, mediaId, null, 0);
public void onMediaFileSaveFailed(String mediaId, float progress) {
setMediaSaveResultDataInJS(MEDIA_SAVE_STATE_FAILED, mediaId, null, progress);
}

@Override
public void onMediaFileSavePaused(String mediaId, float progress) {
setMediaSaveResultDataInJS(MEDIA_SAVE_STATE_PAUSED, mediaId, null, progress);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1121,29 +1121,37 @@ public void mediaFileUploadProgress(final int mediaId, final float progress) {
mDeferredEventEmitter.onMediaFileUploadProgress(mediaId, progress);
}

public void mediaFileUploadFailed(final int mediaId) {
mDeferredEventEmitter.onMediaFileUploadFailed(mediaId);
public void mediaFileUploadFailed(final int mediaId, final float progress) {
mDeferredEventEmitter.onMediaFileUploadFailed(mediaId, progress);
}

public void mediaFileUploadPaused(final int mediaId, final float progress) {
mDeferredEventEmitter.onMediaFileUploadPaused(mediaId, progress);
}

public void mediaFileUploadSucceeded(final int mediaId, final String mediaUrl, final int serverMediaId, final
WritableNativeMap metadata) {
mDeferredEventEmitter.onMediaFileUploadSucceeded(mediaId, mediaUrl, serverMediaId, metadata);
}

public void clearMediaFileURL(final int mediaId) {
mDeferredEventEmitter.onUploadMediaFileClear(mediaId);
public void clearMediaFileURL(final int mediaId, final float progress) {
mDeferredEventEmitter.onUploadMediaFileClear(mediaId, progress);
}

public void clearFileSaveStatus(final String mediaId) {
mDeferredEventEmitter.onSaveMediaFileClear(mediaId);
public void clearFileSaveStatus(final String mediaId, final float progress) {
mDeferredEventEmitter.onSaveMediaFileClear(mediaId, progress);
}

public void mediaFileSaveProgress(final String mediaId, final float progress) {
mDeferredEventEmitter.onMediaFileSaveProgress(mediaId, progress);
}

public void mediaFileSaveFailed(final String mediaId) {
mDeferredEventEmitter.onMediaFileSaveFailed(mediaId);
public void mediaFileSaveFailed(final String mediaId, final float progress) {
mDeferredEventEmitter.onMediaFileSaveFailed(mediaId, progress);
}

public void mediaFileSavePaused(final String mediaId, final float progress) {
mDeferredEventEmitter.onMediaFileSavePaused(mediaId, progress);
}

public void mediaFileSaveSucceeded(final String mediaId, final String mediaUrl) {
Expand Down
Loading