Add: get mobile app task in additional tasks (#34651)
This commit is contained in:
parent
6e2ada3706
commit
641bdabc5e
|
@ -5,6 +5,8 @@ import { useState, useEffect, useCallback } from '@wordpress/element';
|
|||
import { Guide } from '@wordpress/components';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import { updateQueryString } from '@woocommerce/navigation';
|
||||
import { useDispatch } from '@wordpress/data';
|
||||
import { OPTIONS_STORE_NAME } from '@woocommerce/data';
|
||||
|
||||
/**
|
||||
* Internal dependencies
|
||||
|
@ -26,6 +28,7 @@ export const MobileAppModal = () => {
|
|||
const [ guideIsOpen, setGuideIsOpen ] = useState( true );
|
||||
|
||||
const { state, jetpackConnectionData } = useJetpackPluginState();
|
||||
const { updateOptions } = useDispatch( OPTIONS_STORE_NAME );
|
||||
|
||||
const [ pageContent, setPageContent ] = useState< React.ReactNode >();
|
||||
const [ searchParams ] = useSearchParams();
|
||||
|
@ -99,6 +102,9 @@ export const MobileAppModal = () => {
|
|||
{ guideIsOpen && (
|
||||
<Guide
|
||||
onFinish={ () => {
|
||||
updateOptions( {
|
||||
woocommerce_admin_dismissed_mobile_app_modal: 'yes',
|
||||
} );
|
||||
// clear the search params that we use so that the URL is clean
|
||||
updateQueryString(
|
||||
{
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: add
|
||||
|
||||
Added the get mobile app task to the additional tasklist
|
|
@ -51,6 +51,7 @@ class TaskLists {
|
|||
'Appearance',
|
||||
'AdditionalPayments',
|
||||
'ReviewShippingOptions',
|
||||
'GetMobileApp',
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -145,6 +146,7 @@ class TaskLists {
|
|||
),
|
||||
'tasks' => array(
|
||||
'AdditionalPayments',
|
||||
'GetMobileApp',
|
||||
),
|
||||
)
|
||||
);
|
||||
|
@ -182,6 +184,7 @@ class TaskLists {
|
|||
),
|
||||
'tasks' => array(
|
||||
'AdditionalPayments',
|
||||
'GetMobileApp',
|
||||
),
|
||||
'event_prefix' => 'extended_tasklist_',
|
||||
)
|
||||
|
|
|
@ -0,0 +1,73 @@
|
|||
<?php
|
||||
|
||||
namespace Automattic\WooCommerce\Admin\Features\OnboardingTasks\Tasks;
|
||||
|
||||
use Automattic\WooCommerce\Admin\Features\OnboardingTasks\Task;
|
||||
|
||||
/**
|
||||
* Get Mobile App Task
|
||||
*/
|
||||
class GetMobileApp extends Task {
|
||||
/**
|
||||
* ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_id() {
|
||||
return 'get-mobile-app';
|
||||
}
|
||||
|
||||
/**
|
||||
* Title.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_title() {
|
||||
return __( 'Get the free WooCommerce mobile app', 'woocommerce' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Content.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_content() {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Time.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_time() {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Task completion.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function is_complete() {
|
||||
return get_option( 'woocommerce_admin_dismissed_mobile_app_modal' ) === 'yes';
|
||||
}
|
||||
|
||||
/**
|
||||
* Task visibility.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function can_view() {
|
||||
return current_user_can( 'manage_woocommerce' ) && current_user_can( 'install_plugins' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Action URL.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function get_action_url() {
|
||||
return admin_url( 'admin.php?page=wc-admin&mobileAppModal=true' );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue