Skip to content

Commit

Permalink
Merge pull request #21014 from wordpress-mobile/release/25.1
Browse files Browse the repository at this point in the history
Merge 25.1-rc-3 to trunk
  • Loading branch information
oguzkocer committed Jun 24, 2024
2 parents d87da4f + d3d11b5 commit 3b497cd
Show file tree
Hide file tree
Showing 31 changed files with 4,231 additions and 4,124 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1394,10 +1394,11 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
break;
}

if (site != null && post != null) {
View snackbarAttachView = findViewById(R.id.coordinator);
if (site != null && post != null && snackbarAttachView != null) {
mUploadUtilsWrapper.handleEditPostResultSnackbars(
this,
findViewById(R.id.coordinator),
snackbarAttachView,
data,
post,
site,
Expand Down Expand Up @@ -1805,21 +1806,24 @@ public void onPostUploaded(OnPostUploaded event) {
}
}

mUploadUtilsWrapper.onPostUploadedSnackbarHandler(
this,
findViewById(R.id.coordinator),
event.isError(),
event.isFirstTimePublish,
event.post,
null,
targetSite,
isFirstTimePublishing -> {
mBloggingRemindersViewModel.onPublishingPost(targetSite.getId(), isFirstTimePublishing);
if (isFirstTimePublishing) {
AppReviewManager.INSTANCE.onPostPublished();
View snackbarAttachView = findViewById(R.id.coordinator);
if (snackbarAttachView != null) {
mUploadUtilsWrapper.onPostUploadedSnackbarHandler(
this,
snackbarAttachView,
event.isError(),
event.isFirstTimePublish,
event.post,
null,
targetSite,
isFirstTimePublishing -> {
mBloggingRemindersViewModel.onPublishingPost(targetSite.getId(), isFirstTimePublishing);
if (isFirstTimePublishing) {
AppReviewManager.INSTANCE.onPostPublished();
}
}
}
);
);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1203,10 +1203,11 @@ public void onSiteChanged(OnSiteChanged event) {
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(UploadService.UploadErrorEvent event) {
EventBus.getDefault().removeStickyEvent(event);
if (event.mediaModelList != null && !event.mediaModelList.isEmpty()) {
View snackbarAttachView = findViewById(R.id.tab_layout);
if (event.mediaModelList != null && !event.mediaModelList.isEmpty() && snackbarAttachView != null) {
mUploadUtilsWrapper.onMediaUploadedSnackbarHandler(
this,
findViewById(R.id.tab_layout),
snackbarAttachView,
true,
!TextUtils.isEmpty(event.errorMessage)
&& event.errorMessage.contains(getString(R.string.error_media_quota_exceeded))
Expand All @@ -1223,10 +1224,10 @@ public void onEventMainThread(UploadService.UploadErrorEvent event) {
@Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
public void onEventMainThread(UploadService.UploadMediaSuccessEvent event) {
EventBus.getDefault().removeStickyEvent(event);
if (event.mediaModelList != null && !event.mediaModelList.isEmpty()) {
mUploadUtilsWrapper.onMediaUploadedSnackbarHandler(this,
findViewById(R.id.tab_layout), false,
event.mediaModelList, mSite, event.successMessage);
View snackbarAttachView = findViewById(R.id.tab_layout);
if (event.mediaModelList != null && !event.mediaModelList.isEmpty() && snackbarAttachView != null) {
mUploadUtilsWrapper.onMediaUploadedSnackbarHandler(this, snackbarAttachView, false, event.mediaModelList,
mSite, event.successMessage);
updateMediaGridForTheseMedia(event.mediaModelList);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,25 +328,21 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
return;
}

if (site != null && post != null) {
View snackbarAttachView = findViewById(R.id.coordinator);
if (site != null && post != null && snackbarAttachView != null) {
mUploadUtilsWrapper.handleEditPostResultSnackbars(
this,
findViewById(R.id.coordinator),
snackbarAttachView,
data,
post,
site,
mUploadActionUseCase.getUploadAction(post),
new View.OnClickListener() {
@Override
public void onClick(View v) {
UploadUtils.publishPost(
ReaderPostListActivity.this,
post,
site,
mDispatcher
);
}
});
v -> UploadUtils.publishPost(
ReaderPostListActivity.this,
post,
site,
mDispatcher
));
}
}
break;
Expand All @@ -357,10 +353,11 @@ public void onClick(View v) {
@Subscribe(threadMode = ThreadMode.MAIN)
public void onPostUploaded(OnPostUploaded event) {
SiteModel site = mSiteStore.getSiteByLocalId(mSelectedSiteRepository.getSelectedSiteLocalId());
if (site != null && event.post != null) {
View snackbarAttachView = findViewById(R.id.coordinator);
if (site != null && event.post != null && snackbarAttachView != null) {
mUploadUtilsWrapper.onPostUploadedSnackbarHandler(
this,
findViewById(R.id.coordinator),
snackbarAttachView,
event.isError(),
event.isFirstTimePublish,
event.post,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1091,10 +1091,11 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
break;
}

if (site != null && post != null) {
View snackbarAttachView = findViewById(R.id.coordinator);
if (site != null && post != null && snackbarAttachView != null) {
mUploadUtilsWrapper.handleEditPostResultSnackbars(
this,
findViewById(R.id.coordinator),
snackbarAttachView,
data,
post,
site,
Expand All @@ -1119,10 +1120,11 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
@Subscribe(threadMode = ThreadMode.MAIN)
public void onPostUploaded(OnPostUploaded event) {
SiteModel site = mSiteStore.getSiteByLocalId(mSelectedSiteRepository.getSelectedSiteLocalId());
if (site != null && event.post != null) {
View snackbarAttachView = findViewById(R.id.coordinator);
if (site != null && event.post != null && snackbarAttachView != null) {
mUploadUtilsWrapper.onPostUploadedSnackbarHandler(
this,
findViewById(R.id.coordinator),
snackbarAttachView,
event.isError(),
event.isFirstTimePublish,
event.post,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
*/
public class ReaderPostRenderer {
private static final String JAVASCRIPT_MESSAGE_HANDLER = "wvHandler";
private static final String JS_OBJECT_ADDED_TAG = "jsObjectAdded";
private final ReaderResourceVars mResourceVars;
private final ReaderPost mPost;
private final int mMinFullSizeWidthDp;
Expand Down Expand Up @@ -645,6 +646,11 @@ private String getContentTextProperties() {
}

private void setWebViewMessageHandler(@NonNull WebView webView) {
Object tag = webView.getTag(JS_OBJECT_ADDED_TAG.hashCode());
if (tag != null && (boolean) tag) {
return; // Exit if the object has already been added
}

Set<String> allowedOrigins = new HashSet<>();
allowedOrigins.add("*");

Expand All @@ -665,6 +671,9 @@ private void setWebViewMessageHandler(@NonNull WebView webView) {
}
return null;
});

// Set the tag that the JS object has been added, so we can check before adding it again
webView.setTag(JS_OBJECT_ADDED_TAG.hashCode(), true);
}

void setPostMessageListener(@Nullable ReaderPostMessageListener listener) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class UploadUtilsWrapper @Inject constructor(
@Suppress("LongParameterList")
fun onMediaUploadedSnackbarHandler(
activity: Activity?,
snackbarAttachView: View?,
snackbarAttachView: View,
isError: Boolean,
mediaList: List<MediaModel?>?,
site: SiteModel?,
Expand All @@ -53,7 +53,7 @@ class UploadUtilsWrapper @Inject constructor(
@Suppress("LongParameterList")
fun onPostUploadedSnackbarHandler(
activity: Activity?,
snackbarAttachView: View?,
snackbarAttachView: View,
isError: Boolean,
isFirstTimePublish: Boolean,
post: PostModel?,
Expand Down
6 changes: 5 additions & 1 deletion WordPress/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Translation-Revision-Date: 2024-05-29 19:54:08+0000
Translation-Revision-Date: 2024-06-12 14:54:07+0000
Plural-Forms: nplurals=6; plural=(n == 0) ? 0 : ((n == 1) ? 1 : ((n == 2) ? 2 : ((n % 100 >= 3 && n % 100 <= 10) ? 3 : ((n % 100 >= 11 && n % 100 <= 99) ? 4 : 5))));
Generator: GlotPress/4.0.1
Language: ar
-->
<resources>
<string name="permission_access_media_location">موقع الوسائط</string>
<string name="voice_to_content_permissions_required_title">صلاحية تسجيل الصوت مطلوبة</string>
<string name="voice_to_content_permissions_required_msg">لتسجيل صوت، يحتاج هذا التطبيق إلى صلاحية للوصول إلى الميكروفون الخاص بك. لقد سبق لك رفض هذه الصلاحية. يرجى تمكين صلاحية الميكروفون ضمن إعدادات التطبيق لاستخدام هذه الميزة.</string>
<string name="gutenberg_native_tap_to_edit">النقر للتحرير</string>
<string name="in_app_update_restart">إعادة البدء</string>
<string name="in_app_update_available">تم تنزيل التحديث. أعد التشغيل للتطبيق.</string>
<string name="my_site_bottom_sheet_add_post_from_audio">تدوينة من ملف صوتي</string>
Expand Down
6 changes: 5 additions & 1 deletion WordPress/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Translation-Revision-Date: 2024-05-31 22:58:44+0000
Translation-Revision-Date: 2024-06-12 12:54:07+0000
Plural-Forms: nplurals=2; plural=n != 1;
Generator: GlotPress/4.0.1
Language: de
-->
<resources>
<string name="gutenberg_native_tap_to_edit">Zum Bearbeiten tippen</string>
<string name="voice_to_content_permissions_required_msg">Für eine Audioaufzeichnung benötigt diese App die Berechtigung, auf dein Mikrofon zuzugreifen. Du hast diese Berechtigung kürzlich verweigert. Bitte aktiviere die Mikrofonberechtigung in den App-Einstellungen, um diese Funktion verwenden zu können.</string>
<string name="voice_to_content_permissions_required_title">Berechtigung für Audioaufzeichnung erforderlich</string>
<string name="permission_access_media_location">Medienstandort</string>
<string name="in_app_update_restart">Neu starten</string>
<string name="in_app_update_available">Update heruntergeladen. Zum Anwenden neu starten.</string>
<string name="my_site_bottom_sheet_add_post_from_audio">Beitrag aus Audio erstellen</string>
Expand Down
Loading

0 comments on commit 3b497cd

Please sign in to comment.