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

feat: Pause media upload when internet connection unavailable #19878

Merged
merged 19 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
4107505
feat: Failed uploads while offline communicate paused state
dcalhoun Jan 3, 2024
a929e1f
build: Update Gutenberg ref
dcalhoun Jan 3, 2024
04af69f
build: Fix incorrect Gutenberg PR reference
dcalhoun Jan 3, 2024
578ee6a
build: Fix incorrect Gutenberg PR reference
dcalhoun Jan 3, 2024
b22021a
Add discrete onMediaUploadPaused handler to media uploads when offline
derekblank Jan 4, 2024
d8a7bff
refactor: Fix parameter name typo
dcalhoun Jan 4, 2024
8d46802
refactor: Annotate override of `onMediaUploadPaused` method
dcalhoun Jan 4, 2024
8ed6850
refactor: Remove unused `onMediaUploadFailed` error type parameter
dcalhoun Jan 4, 2024
ad1ca04
feat: Aztec `onMediaUploadPaused` passes onto `onMediaUploadFailed`
dcalhoun Jan 4, 2024
594f989
feat: Only consider failed media uploads to be paused
dcalhoun Jan 4, 2024
00df84c
feat: Track failed media upload event when pausing media uploads
dcalhoun Jan 4, 2024
b1f7e3b
feat: When lacking connectivity, pause completed upload w/o remote URLs
dcalhoun Jan 4, 2024
2a5075d
Merge pull request #19884 from wordpress-mobile/feat/update-image-blo…
dcalhoun Jan 4, 2024
51d141b
docs: Add release note
dcalhoun Jan 4, 2024
4c92efe
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android…
dcalhoun Jan 4, 2024
b97dbec
build: Update Gutenberg ref
dcalhoun Jan 4, 2024
92c2b99
Merge branch 'trunk' into feat/update-image-block-upload-visuals
derekblank Jan 10, 2024
eb6ccca
Merge branch 'trunk' of github.com:wordpress-mobile/WordPress-Android…
dcalhoun Jan 10, 2024
e3ad26b
build: Update Gutenberg ref
dcalhoun Jan 10, 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 @@ -295,7 +295,7 @@ class EditorMedia @Inject constructor(
}
}
analyticsTrackerWrapper.track(EDITOR_UPLOAD_MEDIA_FAILED, properties)
listener.onMediaUploadFailed(media.id.toString())
listener.onMediaUploadFailed(media.id.toString(), error.type.name)
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved
}

sealed class AddMediaToPostUiState(
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ext {
automatticRestVersion = '1.0.8'
automatticStoriesVersion = '2.4.0'
automatticTracksVersion = '3.3.0'
gutenbergMobileVersion = 'v1.110.0-alpha2'
gutenbergMobileVersion = '6491-291d9bdd1d9e0b29a2911a5381115e10c626f81c'
wordPressAztecVersion = 'v1.9.0'
wordPressFluxCVersion = 'trunk-67afc3a620b4ad56b981d21637db6b3509b07ab6'
wordPressLoginVersion = '1.10.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ public void onMediaUploadProgress(final String localMediaId, final float progres
}

@Override
public void onMediaUploadFailed(final String localMediaId) {
public void onMediaUploadFailed(final String localMediaId, final String errorType) {
if (!isAdded() || mContent == null) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ public interface EditorMediaUploadListener {
void onMediaUploadReattached(String localId, float currentProgress);
void onMediaUploadSucceeded(String localId, MediaFile mediaFile);
void onMediaUploadProgress(String localId, float progress);
void onMediaUploadFailed(String localId);
void onMediaUploadFailed(String localId, String errorType);
void onGalleryMediaUploadSucceeded(long galleryId, long remoteId, int remaining);
}
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,10 @@ public void mediaFileUploadFailed(final int mediaId) {
mWPAndroidGlueCode.mediaFileUploadFailed(mediaId);
}

public void mediaFileUploadPaused(final int mediaId) {
mWPAndroidGlueCode.mediaFileUploadPaused(mediaId);
}

public void mediaFileUploadSucceeded(final int mediaId, final String mediaUrl, final int serverMediaId) {
mWPAndroidGlueCode.mediaFileUploadSucceeded(mediaId, mediaUrl, serverMediaId, new WritableNativeMap());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,11 @@ private void updateFailedMediaState() {
for (String mediaId : mFailedMediaIds) {
// upload progress should work on numeric mediaIds only
if (!TextUtils.isEmpty(mediaId) && TextUtils.isDigitsOnly(mediaId)) {
getGutenbergContainerFragment().mediaFileUploadFailed(Integer.valueOf(mediaId));
if (NetworkUtils.isNetworkAvailable(getActivity())) {
getGutenbergContainerFragment().mediaFileUploadFailed(Integer.valueOf(mediaId));
} else {
getGutenbergContainerFragment().mediaFileUploadPaused(Integer.valueOf(mediaId));
}
} else {
getGutenbergContainerFragment().mediaFileSaveFailed(mediaId);
}
Expand Down Expand Up @@ -1483,8 +1487,15 @@ public void onMediaUploadProgress(final String localMediaId, final float progres
}

@Override
public void onMediaUploadFailed(final String localMediaId) {
getGutenbergContainerFragment().mediaFileUploadFailed(Integer.valueOf(localMediaId));
public void onMediaUploadFailed(final String localMediaId, String errorType) {
switch (errorType) {
case "CONNECTION_ERROR":
dcalhoun marked this conversation as resolved.
Show resolved Hide resolved
getGutenbergContainerFragment().mediaFileUploadPaused(Integer.valueOf(localMediaId));
break;
default:
getGutenbergContainerFragment().mediaFileUploadFailed(Integer.valueOf(localMediaId));
break;
}
mFailedMediaIds.add(localMediaId);
mUploadingMediaProgressMax.remove(localMediaId);
}
Expand Down
Loading