* Rename admin notes classes and file names to fit conventions

* Use a facade class that adds deprecation warnings to each function call

* Add "Manage orders on the go" admin note

* Remove a rebase zombie 🙀

Co-authored-by: Rebecca Scott <me@becdetat.com>
This commit is contained in:
Bec Scott 2020-10-13 14:35:53 +10:00 committed by GitHub
parent ad7cf64303
commit 209dbef800
4 changed files with 70 additions and 3 deletions

View File

@ -37,6 +37,7 @@ use \Automattic\WooCommerce\Admin\Notes\Google_Ads_And_Marketing;
use \Automattic\WooCommerce\Admin\Notes\Test_Checkout;
use \Automattic\WooCommerce\Admin\Notes\Edit_Products_On_The_Move;
use \Automattic\WooCommerce\Admin\Notes\Performance_On_Mobile;
use \Automattic\WooCommerce\Admin\Notes\Manage_Orders_On_The_Go;
/**
* WC_Admin_Events Class.
@ -107,6 +108,7 @@ class Events {
Test_Checkout::possibly_add_note();
Edit_Products_On_The_Move::possibly_add_note();
Performance_On_Mobile::possibly_add_note();
Manage_Orders_On_The_Go::possibly_add_note();
if ( $this->is_remote_inbox_notifications_enabled() ) {
DataSourcePoller::read_specs_from_data_sources();

View File

@ -39,11 +39,12 @@ class Edit_Products_On_The_Move {
if ( Mobile_App::has_note_been_actioned() ) {
return;
}
if ( Real_Time_Order_Alerts::has_note_been_actioned() ) {
return;
}
if ( Manage_Orders_On_The_Go::has_note_been_actioned() ) {
return;
}
if ( Performance_On_Mobile::has_note_been_actioned() ) {
return;
}

View File

@ -0,0 +1,62 @@
<?php
/**
* WooCommerce Admin Manage orders on the go note.
*
* Adds a note to download the mobile app to manage orders on the go.
*/
namespace Automattic\WooCommerce\Admin\Notes;
defined( 'ABSPATH' ) || exit;
/**
* Manage_Orders_On_The_Go
*/
class Manage_Orders_On_The_Go {
/**
* Note traits.
*/
use NoteTraits;
/**
* Name of the note for use in the database.
*/
const NOTE_NAME = 'wc-admin-manage-orders-on-the-go';
/**
* Get the note.
*
* @return Note|null
*/
public static function get_note() {
// Only add this note if this store is at least 6 months old.
$six_months_in_seconds = MONTH_IN_SECONDS * 6;
if ( ! self::wc_admin_active_for( $six_months_in_seconds ) ) {
return;
}
// Check that the previous mobile app notes have not been actioned.
if ( Mobile_App::has_note_been_actioned() ) {
return;
}
if ( Real_Time_Order_Alerts::has_note_been_actioned() ) {
return;
}
$note = new Note();
$note->set_title( __( 'Manage your orders on the go', 'woocommerce-admin' ) );
$note->set_content( __( 'Look for orders, customer info, and process refunds in one click with the Woo app.', 'woocommerce-admin' ) );
$note->set_content_data( (object) array() );
$note->set_type( 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;
}
}

View File

@ -39,10 +39,12 @@ class Performance_On_Mobile {
if ( Mobile_App::has_note_been_actioned() ) {
return;
}
if ( Real_Time_Order_Alerts::has_note_been_actioned() ) {
return;
}
if ( Manage_Orders_On_The_Go::has_note_been_actioned() ) {
return;
}
$note = new Note();