diff --git a/class.jetpack.php b/class.jetpack.php index ac971f7a3f130..54ca5405e3f1f 100644 --- a/class.jetpack.php +++ b/class.jetpack.php @@ -6306,6 +6306,9 @@ public function deprecated_hooks() { 'atd_http_post_error' => null, 'atd_service_domain' => null, 'jetpack_widget_authors_exclude' => 'jetpack_widget_authors_params', + // Removed in Jetpack 7.9.0 + 'jetpack_pwa_manifest' => null, + 'jetpack_pwa_background_color' => null, ); // This is a silly loop depth. Better way? diff --git a/modules/module-headings.php b/modules/module-headings.php index 90477ae4123c6..65bba2e8ee1fe 100644 --- a/modules/module-headings.php +++ b/modules/module-headings.php @@ -137,11 +137,6 @@ function jetpack_get_module_i18n( $key ) { 'description' => _x( 'Publicize makes it easy to share your site’s posts on several social media networks automatically when you publish a new post.', 'Module Description', 'jetpack' ), ), - 'pwa' => array( - 'name' => _x( 'Progressive Web Apps', 'Module Name', 'jetpack' ), - 'description' => _x( 'Speed up and improve the reliability of your site using the latest in web technology.', 'Module Description', 'jetpack' ), - ), - 'related-posts' => array( 'name' => _x( 'Related posts', 'Module Name', 'jetpack' ), 'description' => _x( 'Keep visitors engaged on your blog by highlighting relevant and new content at the bottom of each published post.', 'Module Description', 'jetpack' ), @@ -297,7 +292,6 @@ function jetpack_get_module_i18n_tag( $key ) { // Modules with `Developers` tag: // - modules/json-api.php - // - modules/pwa.php // - modules/sso.php 'Developers' =>_x( 'Developers', 'Module Tag', 'jetpack' ), diff --git a/modules/module-info.php b/modules/module-info.php index 0897521c080c9..24f2dd160e0b7 100644 --- a/modules/module-info.php +++ b/modules/module-info.php @@ -858,25 +858,6 @@ function jetpack_comment_likes_more_info() { } add_action( 'jetpack_module_more_info_comment-likes', 'jetpack_comment_likes_more_info' ); -/** - * Progressive Web Apps support link. - */ -function jetpack_pwa_more_link() { - echo 'https://jetpack.com/support/progressive-web-apps/'; -} -add_action( 'jetpack_learn_more_button_pwa', 'jetpack_pwa_more_link' ); - -/** - * Progressive Web Apps description. - */ -function jetpack_pwa_more_info() { - esc_html_e( - 'Speed up and improve the reliability of your site using the latest in web technology.', - 'jetpack' - ); -} -add_action( 'jetpack_module_more_info_pwa', 'jetpack_pwa_more_info' ); - /** * Asset CDN support link. */ diff --git a/modules/pwa.php b/modules/pwa.php index b5e5e6a2c3699..f372fac50935e 100644 --- a/modules/pwa.php +++ b/modules/pwa.php @@ -1,42 +1,4 @@ - - - get_bloginfo( 'name' ), - 'start_url' => get_home_url(), - 'short_name' => substr( get_bloginfo( 'name' ), 0, 12 ), - 'display' => 'standalone', - 'background_color' => $theme_color, - 'theme_color' => $theme_color, - ); - - if ( $description = get_bloginfo( 'description' ) ) { - $manifest['description'] = $description; - } - - $manifest['icons'] = array_map( - array( $this, 'build_icon_object' ), - Jetpack_PWA_Helpers::get_default_manifest_icon_sizes() - ); - - /** - * Allow overriding the manifest. - * - * @since 5.6.0 - * - * @param array $manifest - */ - $manifest = apply_filters( 'jetpack_pwa_manifest', $manifest ); - - wp_send_json( $manifest ); - } - } - - function build_icon_object( $size ) { - return array( - 'src' => Jetpack_PWA_Helpers::site_icon_url( $size ), - 'sizes' => sprintf( '%1$dx%1$d', $size ), - ); - } -} +/** + * Deprecated. No longer needed. + */ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 5e697bd657d04..81f8d858d1102 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -81,9 +81,6 @@ tests/php/3rd-party - - tests/php/pwa - tests/php/modules/lazy-images diff --git a/tests/php/pwa/test_class.jetpack-pwa-helpers.php b/tests/php/pwa/test_class.jetpack-pwa-helpers.php deleted file mode 100644 index 24dc9c21dd8ad..0000000000000 --- a/tests/php/pwa/test_class.jetpack-pwa-helpers.php +++ /dev/null @@ -1,79 +0,0 @@ - '#000' - ); - } -} - -class WP_Test_PWA_Helpers extends WP_UnitTestCase { - function setup() { - global $_wp_theme_features; - $this->initial_theme_features = $_wp_theme_features; // Should be assign by copy - - $this->mods_option_name = sprintf( "theme_mods_%s", get_option( 'stylesheet' ) ); - update_option( - $this->mods_option_name, - array( - 'background_color' => 'efefef' - ) - ); - } - - function tearDown() { - global $_wp_theme_features; - $_wp_theme_features = $this->initial_theme_features; - remove_all_filters( 'amp_post_template_customizer_settings' ); - } - - function test_default_icon_size_values() { - $defaults = Jetpack_PWA_Helpers::get_default_manifest_icon_sizes(); - - $this->assertNotEmpty( $defaults ); - $this->assertContainsOnly( 'int', $defaults ); - } - - function test_site_icon_url_defaults_to_packaged_icons() { - delete_option( 'site_icon' ); - $icon = Jetpack_PWA_Helpers::site_icon_url(); - - $this->assertContains( 'modules/pwa/images/wp-512.png', $icon ); - } - - function test_site_icon_url_when_site_icon_set() { - $attachment_id = $this->factory->attachment->create_upload_object( JETPACK__PLUGIN_DIR . 'tests/php/jetpack-icon.jpg', 0 ); - update_option( 'site_icon', $attachment_id ); - $icon = Jetpack_PWA_Helpers::site_icon_url(); - - $this->assertContains( 'jetpack-icon', $icon ); - } - - function test_theme_color_defaults_to_white() { - global $_wp_theme_features; - unset( $_wp_theme_features['custom-background'] ); - add_filter( 'amp_post_template_customizer_settings', '__return_empty_array' ); - - $color = Jetpack_PWA_Helpers::get_theme_color(); - - $this->assertSame( '#fff', $color ); - } - - function test_theme_color_prefers_amp() { - $color = Jetpack_PWA_Helpers::get_theme_color(); - $this->assertSame( '#000', $color ); - } - - function test_theme_color_uses_custom_background_when_no_amp() { - global $_wp_theme_features; - $_wp_theme_features['custom-background'] = true; - - add_filter( 'amp_post_template_customizer_settings', '__return_empty_array' ); - - $color = Jetpack_PWA_Helpers::get_theme_color(); - $this->assertSame( '#efefef', $color ); - } -}