* Add performance on mobile admin note

* use MONTH_IN_DAYS constant

Co-authored-by: Rebecca Scott <me@becdetat.com>
This commit is contained in:
Bec Scott 2020-09-09 08:35:59 +10:00 committed by GitHub
parent 2002c74289
commit 55a9944911
3 changed files with 67 additions and 0 deletions

View File

@ -37,6 +37,7 @@ use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Customize_Store_With_Bloc
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Facebook_Marketing_Expert;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Test_Checkout;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Edit_Products_On_The_Move;
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Performance_On_Mobile;
/**
* WC_Admin_Events Class.
@ -107,6 +108,7 @@ class Events {
WC_Admin_Notes_Facebook_Marketing_Expert::possibly_add_note();
WC_Admin_Notes_Test_Checkout::possibly_add_note();
WC_Admin_Notes_Edit_Products_On_The_Move::possibly_add_note();
WC_Admin_Notes_Performance_On_Mobile::possibly_add_note();
if ( Loader::is_feature_enabled( 'remote-inbox-notifications' ) ) {
DataSourcePoller::read_specs_from_data_sources();

View File

@ -42,6 +42,10 @@ class WC_Admin_Notes_Edit_Products_On_The_Move {
return;
}
if ( WC_Admin_Notes_Performance_On_Mobile::has_note_been_actioned() ) {
return;
}
$note = new WC_Admin_Note();
$note->set_title( __( 'Edit products on the move', 'woocommerce-admin' ) );

View File

@ -0,0 +1,61 @@
<?php
/**
* WooCommerce Admin Performance on mobile note.
*
* Adds a note to download the mobile app, performance on mobile.
*/
namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit;
/**
* WC_Admin_Notes_Performance_On_Mobile
*/
class WC_Admin_Notes_Performance_On_Mobile {
/**
* Note traits.
*/
use NoteTraits;
/**
* Name of the note for use in the database.
*/
const NOTE_NAME = 'wc-admin-performance-on-mobile';
/**
* Get the note.
*/
public static function get_note() {
// Only add this note if this store is at least 9 months old.
$nine_months_in_seconds = MONTH_IN_SECONDS * 9;
if ( ! self::wc_admin_active_for( $nine_months_in_seconds ) ) {
return;
}
// Check that the previous mobile app notes have not been actioned.
if ( WC_Admin_Notes_Mobile_App::has_note_been_actioned() ) {
return;
}
if ( WC_Admin_Notes_Real_Time_Order_Alerts::has_note_been_actioned() ) {
return;
}
$note = new WC_Admin_Note();
$note->set_title( __( 'Track your store performance on mobile', 'woocommerce-admin' ) );
$note->set_content( __( 'Monitor your sales and high performing products with the Woo app.', 'woocommerce-admin' ) );
$note->set_content_data( (object) array() );
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL );
$note->set_name( self::NOTE_NAME );
$note->set_source( 'woocommerce-admin' );
$note->add_action(
'learn-more',
__( 'Learn more', 'woocommerce-admin' ),
'https://woocommerce.com/mobile/?utm_source=inbox'
);
return $note;
}
}