Plugin Directory

Changeset 3204207


Ignore:
Timestamp:
12/07/2024 11:04:22 PM (15 months ago)
Author:
notificationmaster
Message:

version 1.4.10

Location:
notification-master
Files:
927 added
5 edited

Legend:

Unmodified
Added
Removed
  • notification-master/trunk/assets/js/webpush.js

    r3189998 r3204207  
    1111     *
    1212     * @param registration The service worker registration.
     13     * @param button The button that was clicked.
    1314     * @return A promise that resolves to the PushSubscription object.
    1415     */
    15     function subscribeUserToPush(registration) {
     16    function subscribeUserToPush(registration, button = true) {
    1617        var vapidPublicKey = WebPushConfig.vapidPublicKey;
    1718        var convertedVapidKey = urlBase64ToUint8Array(vapidPublicKey);
     
    2324            })
    2425            .then(function (subscription) {
    25                 sendSubscriptionToServer(subscription);
     26                sendSubscriptionToServer(subscription, button);
    2627
    2728                return subscription;
     
    5556     *
    5657     * @param subscription The PushSubscription object.
    57      */
    58     function sendSubscriptionToServer(subscription) {
     58     * @param button The button that was clicked.
     59     * @return The subscription object.
     60     */
     61    function sendSubscriptionToServer(subscription, button = true) {
    5962        var JSONSubscription = subscription.toJSON();
    6063        var key = JSONSubscription.keys && JSONSubscription.keys.p256dh;
     
    7174                p256dh: key,
    7275                expirationTime: expirationTime,
    73                 contentEncoding: contentEncoding
     76                contentEncoding: contentEncoding,
     77                action: button ? 'button' : 'automatic'
    7478            }
    7579        })
     
    121125                    return Notification.requestPermission().then(function (permission) {
    122126                        if (permission === 'granted') {
    123                             subscribeUserToPush(registration);
     127                            subscribeUserToPush(registration, button);
    124128                        } else {
    125129                            if (button) {
  • notification-master/trunk/includes/rest-api/controllers/v1/class-rest-subscriptions-controller.php

    r3204184 r3204207  
    261261        $expiration_time  = sanitize_text_field( $request->get_param( 'expiration_time' ) );
    262262        $content_encoding = sanitize_text_field( $request->get_param( 'contentEncoding' ) );
     263        $action           = sanitize_text_field( $request->get_param( 'action' ) );
     264        $action           = $action ? $action : 'automatic';
    263265
    264266        if ( empty( $endpoint ) || empty( $auth ) || empty( $p256dh ) ) {
     
    289291
    290292            // Add action to send webpush.
    291             do_action( 'notification_master_send_webpush', $subscription_data, true );
     293            do_action( 'notification_master_send_webpush', $subscription_data, true, $action );
    292294
    293295            return new WP_REST_Response(
     
    302304
    303305        // Add action to send webpush.
    304         do_action( 'notification_master_send_webpush', $subscription_data, false );
     306        do_action( 'notification_master_send_webpush', $subscription_data, false, $action );
    305307
    306308        return new WP_REST_Response(
  • notification-master/trunk/includes/webpush/class-loader.php

    r3204184 r3204207  
    7070        add_action( 'wp_footer', array( $this, 'maybe_add_floating_button' ) );
    7171
    72         add_action( 'notification_master_send_webpush', array( $this, 'send_webpush' ), 10, 2 );
     72        add_action( 'notification_master_send_webpush', array( $this, 'send_webpush' ), 10, 3 );
    7373    }
    7474
     
    7878     * @since 1.4.0
    7979     *
    80      * @param array $subscription Subscription.
    81      * @param bool  $exsited    Existing.
     80     * @param array  $subscription Subscription.
     81     * @param bool   $exsited    Existing.
     82     * @param string $type      Type.
    8283     *
    8384     * @return void
    8485     */
    85     public function send_webpush( $subscription, $exsited = false ) {
     86    public function send_webpush( $subscription, $exsited = false, $type ) {
     87        $enabled = Settings::get_setting( 'webpush_welcome_notification', true );
     88        if ( ! $enabled ) {
     89            return;
     90        }
     91
     92        if ( $exsited && 'button' !== $type ) {
     93            return;
     94        }
     95
    8696        if ( is_array( $subscription ) ) {
    8797            $subscription = (object) $subscription;
  • notification-master/trunk/notifications-master.php

    r3204184 r3204207  
    55 * Description: Enhance user engagement. Trigger notifications for events, support multiple channels like email and Discord, and personalize with dynamic merge tags. Easy setup and customization.
    66 *
    7  * Version: 1.4.9
     7 * Version: 1.4.10
    88 *
    99 * Author: Notification Master
     
    2626
    2727// Define notification-master constants.
    28 define( 'NOTIFICATION_MASTER_VERSION', '1.4.9' );
     28define( 'NOTIFICATION_MASTER_VERSION', '1.4.10' );
    2929define( 'NOTIFICATION_MASTER_FILE', __FILE__ );
    3030define( 'NOTIFICATION_MASTER_DIR', plugin_dir_path( __FILE__ ) );
  • notification-master/trunk/readme.txt

    r3204184 r3204207  
    33Donate link: https://notification-master.com
    44Tags: web push, email, alerts, notifications, push notifications
    5 Stable tag: 1.4.9
     5Stable tag: 1.4.10
    66Requires at least: 4.9
    77Tested up to: 6.7
     
    160160== Changelog ==
    161161
     162= 1.4.10 =
     163* Fixed: Web push welcome message in auto mode.
     164* Fixed: Web push welcome message disable option not working.
     165
    162166= 1.4.9 =
    163167* Added: Web push floating button hide on devices option.
Note: See TracChangeset for help on using the changeset viewer.