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

Merge 22.2-rc-3 to trunk #18318

Merged
merged 15 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
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 @@ -1005,12 +1005,8 @@ private void doAddMediaItemClicked(@NonNull AddMenuItem item) {
if (item != AddMenuItem.ITEM_CHOOSE_STOCK_MEDIA) {
String[] permissions = null;
if (item == AddMenuItem.ITEM_CAPTURE_PHOTO || item == AddMenuItem.ITEM_CAPTURE_VIDEO) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
permissions = new String[]{Manifest.permission.CAMERA};
} else {
permissions = new String[]{Manifest.permission.CAMERA, Manifest.permission.WRITE_EXTERNAL_STORAGE};
}
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
permissions = PermissionUtils.getCameraAndStoragePermissions();
} else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
permissions = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE};
}
if (permissions != null && !PermissionUtils.checkAndRequestPermissions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ import org.wordpress.android.ui.utils.UiString.UiStringRes
import org.wordpress.android.util.AccessibilityUtils
import org.wordpress.android.util.AniUtils
import org.wordpress.android.util.AniUtils.Duration.MEDIUM
import org.wordpress.android.util.PermissionUtils
import org.wordpress.android.util.SnackbarItem
import org.wordpress.android.util.SnackbarItem.Action
import org.wordpress.android.util.SnackbarItem.Info
Expand Down Expand Up @@ -678,13 +679,7 @@ class MediaPickerFragment : Fragment(), MenuProvider {

@Suppress("DEPRECATION")
private fun requestCameraPermission() {
// For devices lower than API 30, in addition to CAMERA permission we also need a storage permission, to store
// media from the camera
val permissions = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
arrayOf(permission.CAMERA, permission.WRITE_EXTERNAL_STORAGE)
} else {
arrayOf(permission.CAMERA)
}
val permissions = PermissionUtils.getCameraAndStoragePermissions()
requestPermissions(permissions, WPPermissionUtils.PHOTO_PICKER_CAMERA_PERMISSION_REQUEST_CODE)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1634,7 +1634,7 @@ class MySiteViewModel @Inject constructor(
private fun onDashboardCardDomainClick() {
val selectedSite = requireNotNull(selectedSiteRepository.getSelectedSite())
dashboardCardDomainUtils.trackDashboardCardDomainTapped(uiModel.value?.state as? SiteSelected)
_onNavigation.value = Event(SiteNavigationAction.OpenDomainRegistration(selectedSite))
_onNavigation.value = Event(SiteNavigationAction.OpenPaidDomainSearch(selectedSite))
}

private fun onDashboardCardDomainHideMenuItemClick() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ sealed class SiteNavigationAction {
) : SiteNavigationAction()

data class OpenDomainRegistration(val site: SiteModel) : SiteNavigationAction()
data class OpenPaidDomainSearch(val site: SiteModel) : SiteNavigationAction()
data class AddNewSite(val hasAccessToken: Boolean, val source: SiteCreationSource) : SiteNavigationAction()
data class ShowQuickStartDialog(
@StringRes val title: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import org.wordpress.android.ui.TextInputDialogFragment
import org.wordpress.android.ui.accounts.LoginEpilogueActivity
import org.wordpress.android.ui.domains.DomainRegistrationActivity.Companion.RESULT_REGISTERED_DOMAIN_EMAIL
import org.wordpress.android.ui.domains.DomainRegistrationActivity.DomainRegistrationPurpose.CTA_DOMAIN_CREDIT_REDEMPTION
import org.wordpress.android.ui.domains.DomainRegistrationActivity.DomainRegistrationPurpose.DOMAIN_PURCHASE
import org.wordpress.android.ui.jetpackoverlay.JetpackFeatureFullScreenOverlayFragment
import org.wordpress.android.ui.jetpackoverlay.JetpackFeatureRemovalOverlayUtil.JetpackFeatureCollectionOverlaySource
import org.wordpress.android.ui.jetpackplugininstall.fullplugin.onboarding.JetpackFullPluginInstallOnboardingDialogFragment
Expand Down Expand Up @@ -399,6 +400,12 @@ class MySiteTabFragment : Fragment(R.layout.my_site_tab_fragment),
action.site,
CTA_DOMAIN_CREDIT_REDEMPTION
)
is SiteNavigationAction.OpenPaidDomainSearch -> ActivityLauncher.viewDomainRegistrationActivityForResult(
this,
action.site,
DOMAIN_PURCHASE
)

is SiteNavigationAction.AddNewSite -> SitePickerActivity.addSite(activity, action.hasAccessToken, action.source)
is SiteNavigationAction.ShowQuickStartDialog -> showQuickStartDialog(
action.title,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import android.content.pm.PackageManager
import android.os.Build
import androidx.annotation.RequiresApi
import androidx.core.content.ContextCompat
import org.wordpress.android.util.PermissionUtils
import javax.inject.Inject

class PermissionsHandler
@Inject constructor(private val context: Context) {
fun hasPermissionsToTakePhoto(): Boolean {
return hasCameraPermission() && (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R || hasWriteStoragePermission())
return PermissionUtils.checkCameraAndStoragePermissions(context)
}

fun hasPhotosVideosPermission(): Boolean {
Expand All @@ -32,15 +33,6 @@ class PermissionsHandler
}
}

fun hasWriteStoragePermission(): Boolean {
// WRITE_EXTERNAL_STORAGE is not required for SDK higher than 29.
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.R ||
ContextCompat.checkSelfPermission(
context,
permission.WRITE_EXTERNAL_STORAGE
) == PackageManager.PERMISSION_GRANTED
}

@RequiresApi(Build.VERSION_CODES.TIRAMISU)
private fun hasReadMediaImagesPermission(): Boolean {
return ContextCompat.checkSelfPermission(
Expand All @@ -67,11 +59,4 @@ class PermissionsHandler
context, permission.READ_EXTERNAL_STORAGE
) == PackageManager.PERMISSION_GRANTED
}

private fun hasCameraPermission(): Boolean {
return ContextCompat.checkSelfPermission(
context,
permission.CAMERA
) == PackageManager.PERMISSION_GRANTED
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import org.wordpress.android.util.AniUtils.Duration.MEDIUM
import org.wordpress.android.util.AppLog
import org.wordpress.android.util.AppLog.T.POSTS
import org.wordpress.android.util.DisplayUtils
import org.wordpress.android.util.PermissionUtils
import org.wordpress.android.util.UriWrapper
import org.wordpress.android.util.ViewWrapper
import org.wordpress.android.util.WPMediaUtils
Expand Down Expand Up @@ -472,13 +473,7 @@ class PhotoPickerFragment : Fragment(R.layout.photo_picker_fragment) {

@Suppress("DEPRECATION")
private fun requestCameraPermission() {
// For devices lower than API 30, in addition to CAMERA permission we also need a storage permission, to store
// media from the camera
val permissions = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
arrayOf(permission.CAMERA, permission.WRITE_EXTERNAL_STORAGE)
} else {
arrayOf(permission.CAMERA)
}
val permissions = PermissionUtils.getCameraAndStoragePermissions()
requestPermissions(permissions, WPPermissionUtils.PHOTO_PICKER_CAMERA_PERMISSION_REQUEST_CODE)
}

Expand Down
5 changes: 0 additions & 5 deletions WordPress/src/main/res/values-ar/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,6 @@ Language: ar
<string name="preference_open_links_in_jetpack">فتح الروابط في Jetpack</string>
<string name="jp_migration_need_help_button">هل تحتاج إلى مساعدة؟</string>
<string name="jp_migration_got_it_button">فهمت</string>
<string name="jp_migration_delete_message">يرجى &lt;b&gt;حذف تطبيق ووردبريس&lt;/b&gt; لتفادي تعارضات البيانات.</string>
<string name="jp_migration_delete_subtitle">يبدو أن تطبيق ووردبريس لا يزال مثبتًا لديك. نوصي بأن تحذف تطبيق ووردبريس لتفادي تعارضات البيانات.</string>
<string name="jp_migration_delete_title">لن تحتاج إلى تطبيق ووردبريس بعد الآن</string>
<string name="jp_migration_network_error_message">يتعذر علينا نقل بياناتك وإعداداتك من دون اتصال الشبكة.</string>
<string name="jp_migration_network_error_subtitle">يرجى التحقق للتأكد من أن اتصال الشبكة لديك قيد العمل، وحاول مجددًا.</string>
<string name="jp_migration_network_error_title">يتعذر الاتصال بالإنترنت.</string>
Expand All @@ -220,13 +217,11 @@ Language: ar
<string name="jp_migration_try_again_button">المحاولة مجددًا</string>
<string name="jp_migration_finish_button">إنهاء</string>
<string name="jp_migration_remove_wp_app_icon_content_description">إزالة أيقونة تطبيق ووردبريس</string>
<string name="jp_migration_done_delete_wp_message">يرجى &lt;b&gt;حذف تطبيق ووردبريس&lt;/b&gt; لتفادي تعارضات البيانات.</string>
<string name="jp_migration_done_subtitle">لقد نقلنا كل بياناتك وإعداداتك. يصبح كل شيء صحيحًا عندما تتركه.</string>
<string name="jp_migration_done_title">شكرًا على التبديل إلى Jetpack!</string>
<string name="jp_migration_notifications_disabled_in_wp_message">سنقوم بإيقاف تشغيل التنبيهات من تطبيق ووردبريس.</string>
<string name="jp_migration_notifications_subtitle">ستتلقى كل التنبيهات نفسها ولكنها ستأتي الآن من تطبيق Jetpack.</string>
<string name="jp_migration_notifications_title">تأتي التنبيهات الآن من Jetpack</string>
<string name="jp_migration_success_card_message">يرجى حذف تطبيق ووردبريس</string>
<string name="wordpress_help_center_button">مركز مساعدة ووردبريس</string>
<string name="support_title">دعم</string>
<string name="notification_disable_broadcast_permission_desc">يسمح للتطبيق بتعطيل تنبيهات ووردبريس.</string>
Expand Down
10 changes: 4 additions & 6 deletions WordPress/src/main/res/values-cs/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Translation-Revision-Date: 2023-04-13 19:36:51+0000
Translation-Revision-Date: 2023-04-21 07:37:11+0000
Plural-Forms: nplurals=3; plural=(n == 1) ? 0 : ((n >= 2 && n <= 4) ? 1 : 2);
Generator: GlotPress/4.0.0-alpha.4
Language: cs_CZ
Expand Down Expand Up @@ -176,9 +176,6 @@ Language: cs_CZ
<string name="preference_open_links_in_jetpack">Otevřít odkazy v Jetpacku</string>
<string name="jp_migration_need_help_button">Potřebujete pomoci?</string>
<string name="jp_migration_got_it_button">Mám to</string>
<string name="jp_migration_delete_message">&lt;b&gt;Smažte aplikaci WordPress&lt;/b&gt;, abyste předešli konfliktům dat.</string>
<string name="jp_migration_delete_title">Už nepotřebujete WordPress aplikaci</string>
<string name="jp_migration_delete_subtitle">Vypadá to, že máte stále nainstalovanou aplikaci WordPress. Doporučujeme smazat WordPress aplikaci, abyste předešli konfliktům dat.</string>
<string name="jp_migration_network_error_message">Bez připojení k síti nemůžeme přenést vaše data a nastavení.</string>
<string name="jp_migration_network_error_subtitle">Zkontrolujte, zda vaše síťové připojení funguje, a zkuste to znovu.</string>
<string name="jp_migration_network_error_title">Nelze se připojit k internetu.</string>
Expand All @@ -188,7 +185,6 @@ Language: cs_CZ
<string name="jp_migration_try_again_button">Zkuste to znovu</string>
<string name="jp_migration_finish_button">Dokončit</string>
<string name="jp_migration_remove_wp_app_icon_content_description">Odstranit ikonu aplikace WordPress</string>
<string name="jp_migration_done_delete_wp_message">&lt;b&gt;Smažte aplikaci WordPress&lt;/b&gt;, abyste předešli konfliktům dat.</string>
<string name="jp_migration_done_subtitle">Přenesli jsme všechna vaše data a nastavení. Všechno je tam, kde jsi to nechal.</string>
<string name="jp_migration_done_title">Děkujeme, že jste přešli na Jetpack!</string>
<string name="jp_migration_notifications_subtitle">Budete dostávat všechna stejná oznámení, ale nyní budou pocházet z aplikace Jetpack.</string>
Expand All @@ -198,7 +194,6 @@ Language: cs_CZ
<string name="support_title">Podpora</string>
<string name="notification_disable_broadcast_permission_desc">Umožňuje aplikaci zakázat WordPress oznámení.</string>
<string name="notification_disable_broadcast_permission_label">zakázat WordPress oznámení</string>
<string name="jp_migration_success_card_message">Odstraňte WordPress aplikaci</string>
<string name="jp_migration_help_button">Potřebujete pomoci?</string>
<string name="jp_migration_continue_button">Pokračovat</string>
<string name="jp_migration_welcome_site_found_message">Našli jsme vaše stránky. Pokračujte v přenosu všech dat a automaticky se přihlaste k Jetpacku.</string>
Expand Down Expand Up @@ -781,6 +776,7 @@ Language: cs_CZ
<string name="gutenberg_native_custom_url">Vlastní URL</string>
<string name="gutenberg_native_create_embed">Vytvořit vložení</string>
<string name="gutenberg_native_column_d">Sloupec %d</string>
<string name="gutenberg_native_more">Více</string>
<string name="gutenberg_native_briefly_describe_the_link_to_help_screen_reader_user">Stručně popište odkaz, abyste pomohli uživatelům s čtečkou obrazovky.</string>
<string name="gutenberg_native_add_blocks">Přidat bloky</string>
<string name="login_no_jetpack_sites">Nebyly nalezeny žádné stránky Jetpack</string>
Expand Down Expand Up @@ -1676,6 +1672,7 @@ Language: cs_CZ
<string name="gutenberg_native_alt_text">Alternativní text</string>
<string name="gutenberg_native_an_unknown_error_occurred_please_try_again">Nastala neznámá chyba. Prosím zkuste to znovu.</string>
<string name="gutenberg_native_add_alt_text">Přidejte alternativní text</string>
<string name="gutenberg_native_add_description">Přidat popis</string>
<string name="reader_acessibility_list_loaded">\"Seznam má načteno %1$d položek.\"</string>
<string name="reader_empty_saved_posts_content_description">Klepnutím na tlačítko Přidat k uložení příspěvků uložíte příspěvek do svého seznamu.</string>
<string name="notifications_tab_dialog_main_off_message">Vypnutím oznámení pro tento web zakážete zobrazování oznámení na kartě oznámení pro tento web. Po zapnutí oznámení pro tento web můžete doladit, jaký druh oznámení se vám zobrazí.</string>
Expand Down Expand Up @@ -2699,6 +2696,7 @@ Language: cs_CZ
<string name="media_documents">Dokumenty</string>
<string name="media_videos">Videa</string>
<string name="media_images">Obrázky</string>
<string name="media_picker_soft_ask_media_permissions_denied">%1$s byl odepřen přístup k vašim fotografiím. Chcete-li to vyřešit, upravte oprávnění a zapněte %2$s.</string>
<string name="reader_view_comments">Zobrazit komentáře</string>
<string name="site_settings_video_quality_hint">Kvalita videí. Vyšší hodnoty znamenají lepší kvalitu videí.</string>
<string name="site_settings_video_width_hint">Změní velikost videí v příspěvcích na tuto velikost</string>
Expand Down
Loading