Agentic
4 months ago
BlockTemplates
4 weeks ago
EmailImprovements
1 year ago
EmailPreview
4 weeks ago
Emails
1 year ago
ImportExport
1 year ago
Logging
1 year ago
Marketing
2 years ago
Notes
4 weeks ago
Onboarding
5 months ago
Orders
4 weeks ago
ProductForm
2 years ago
ProductReviews
4 weeks ago
RemoteFreeExtensions
4 weeks ago
Schedulers
4 weeks ago
Settings
2 weeks ago
Suggestions
4 weeks ago
WCPayPromotion
10 months ago
ActivityPanels.php
3 years ago
Analytics.php
4 weeks ago
CategoryLookup.php
4 years ago
Coupons.php
1 year ago
CouponsMovedTrait.php
5 months ago
CustomerEffortScoreTracks.php
7 months ago
Events.php
2 months ago
FeaturePlugin.php
4 months ago
Homescreen.php
1 month ago
Loader.php
4 weeks ago
Marketing.php
1 year ago
Marketplace.php
5 months ago
MobileAppBanner.php
4 years ago
OrderMilestoneEasterEgg.php
4 weeks ago
RemoteInboxNotifications.php
3 years ago
Settings.php
2 weeks ago
ShippingLabelBanner.php
1 year ago
ShippingLabelBannerDisplayRules.php
1 year ago
SiteHealth.php
3 years ago
Survey.php
4 years ago
SystemStatusReport.php
1 year ago
Translations.php
1 year ago
WCAdminAssets.php
2 weeks ago
WCAdminSharedSettings.php
1 year ago
WCAdminUser.php
9 months ago
WcPayWelcomePage.php
1 year ago
MobileAppBanner.php
50 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Automattic\WooCommerce\Internal\Admin; |
| 4 | |
| 5 | defined( 'ABSPATH' ) || exit; |
| 6 | |
| 7 | /** |
| 8 | * Determine if the mobile app banner shows on Android devices |
| 9 | */ |
| 10 | class MobileAppBanner { |
| 11 | /** |
| 12 | * Class instance. |
| 13 | * |
| 14 | * @var Analytics instance |
| 15 | */ |
| 16 | protected static $instance = null; |
| 17 | |
| 18 | /** |
| 19 | * Get class instance. |
| 20 | */ |
| 21 | public static function get_instance() { |
| 22 | if ( ! self::$instance ) { |
| 23 | self::$instance = new self(); |
| 24 | } |
| 25 | return self::$instance; |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Hook into WooCommerce. |
| 30 | */ |
| 31 | public function __construct() { |
| 32 | add_filter( 'woocommerce_admin_get_user_data_fields', array( $this, 'add_user_data_fields' ) ); |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Adds fields so that we can store user preferences for the mobile app banner |
| 37 | * |
| 38 | * @param array $user_data_fields User data fields. |
| 39 | * @return array |
| 40 | */ |
| 41 | public function add_user_data_fields( $user_data_fields ) { |
| 42 | return array_merge( |
| 43 | $user_data_fields, |
| 44 | array( |
| 45 | 'android_app_banner_dismissed', |
| 46 | ) |
| 47 | ); |
| 48 | } |
| 49 | } |
| 50 |