Plugin Directory

Changeset 2447754


Ignore:
Timestamp:
12/30/2020 07:21:04 AM (5 years ago)
Author:
rnlab
Message:

bump: 1.4.2

Location:
mobile-builder/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • mobile-builder/trunk/README.txt

    r2447220 r2447754  
    4242
    4343== Changelog ==
     44= 1.4.2 =
     45
     46* Add: Send notification for vendor *
     47* Add: API get attribute for product *
     48* Improved: Decode token *
     49* Improved: Meta required version *
     50
    4451= 1.4.0 =
    4552
  • mobile-builder/trunk/api/class-mobile-builder-vendor.php

    r2364781 r2447754  
    6868        register_rest_route( $namespace, 'vendors', array(
    6969            array(
    70                 'methods'  => WP_REST_Server::READABLE,
    71                 'callback' => array( $this, 'vendors' ),
    72                 'permission_callback'   => '__return_true',
     70                'methods'             => WP_REST_Server::READABLE,
     71                'callback'            => array( $this, 'vendors' ),
     72                'permission_callback' => '__return_true',
    7373            ),
    7474            array(
    75                 'methods'  => WP_REST_Server::CREATABLE,
    76                 'callback' => array( $this, 'vendors' ),
    77                 'permission_callback'   => '__return_true',
     75                'methods'             => WP_REST_Server::CREATABLE,
     76                'callback'            => array( $this, 'vendors' ),
     77                'permission_callback' => '__return_true',
    7878            )
    7979        ) );
    8080
    8181        register_rest_route( $namespace, 'directions', array(
    82             'methods'  => WP_REST_Server::READABLE,
    83             'callback' => array( $this, 'directions' ),
    84             'permission_callback'   => '__return_true',
     82            'methods'             => WP_REST_Server::READABLE,
     83            'callback'            => array( $this, 'directions' ),
     84            'permission_callback' => '__return_true',
    8585        ) );
    8686
    8787        register_rest_route( $namespace, 'vendor' . '/(?P<id>[\d]+)', array(
    88             'methods'  => WP_REST_Server::READABLE,
    89             'callback' => array( $this, 'vendor' ),
    90             'permission_callback'   => '__return_true',
     88            'methods'             => WP_REST_Server::READABLE,
     89            'callback'            => array( $this, 'vendor' ),
     90            'permission_callback' => '__return_true',
    9191        ) );
    9292
    9393        register_rest_route( $namespace, 'delivery-boy-delivery-stat', array(
    94             'methods'  => WP_REST_Server::READABLE,
    95             'callback' => array( $this, 'delivery_boy_delivery_stat' ),
    96             'permission_callback'   => '__return_true',
     94            'methods'             => WP_REST_Server::READABLE,
     95            'callback'            => array( $this, 'delivery_boy_delivery_stat' ),
     96            'permission_callback' => '__return_true',
    9797        ) );
    9898
    9999        register_rest_route( $namespace, 'messages-mark-read', array(
    100             'methods'  => WP_REST_Server::CREATABLE,
    101             'callback' => array( $this, 'messages_mark_read' ),
    102             'permission_callback'   => '__return_true',
     100            'methods'             => WP_REST_Server::CREATABLE,
     101            'callback'            => array( $this, 'messages_mark_read' ),
     102            'permission_callback' => '__return_true',
    103103        ) );
    104104
    105105        register_rest_route( $namespace, 'messages-delete', array(
    106             'methods'  => WP_REST_Server::CREATABLE,
    107             'callback' => array( $this, 'messages_delete' ),
    108             'permission_callback'   => '__return_true',
     106            'methods'             => WP_REST_Server::CREATABLE,
     107            'callback'            => array( $this, 'messages_delete' ),
     108            'permission_callback' => '__return_true',
    109109        ) );
    110110
    111111        register_rest_route( $namespace, 'mark-order-delivered', array(
    112             'methods'  => WP_REST_Server::CREATABLE,
    113             'callback' => array( $this, 'mark_order_delivered' ),
    114             'permission_callback'   => '__return_true',
     112            'methods'             => WP_REST_Server::CREATABLE,
     113            'callback'            => array( $this, 'mark_order_delivered' ),
     114            'permission_callback' => '__return_true',
    115115        ) );
    116116
     
    475475    }
    476476
     477    function custom_after_wcfm_notification( $author_id, $message_to, $author_is_admin, $author_is_vendor, $wcfm_messages, $message_type ) {
     478        $message_to = absint( $message_to );
     479        if ( $message_to ) {
     480            $content = array(
     481                "en" => strip_tags( $wcfm_messages )
     482            );
     483
     484            $fields = array(
     485                'app_id'   => MOBILE_BUILDER_ONESIGNAL_APP_ID_STORE_MANAGER_APP,
     486                'filters'  => array(
     487                    array(
     488                        "field"    => "tag",
     489                        "key"      => "user_id",
     490                        "relation" => "=",
     491                        "value"    => $message_to
     492                    )
     493                ),
     494                'data'     => array( "user_id" => $message_to ),
     495                'contents' => $content
     496            );
     497
     498            mobile_builder_send_notification( $fields, MOBILE_BUILDER_ONESIGNAL_API_KEY_STORE_MANAGER_APP );
     499        }
     500    }
     501
     502
    477503    /**
    478504     * Send a Notification event when an order status is changed.
  • mobile-builder/trunk/includes/class-mobile-builder.php

    r2423337 r2447754  
    230230        $this->loader->add_action( 'wcfmd_after_delivery_boy_assigned', $plugin_api, 'delivery_boy_assigned_notification', 10, 6 );
    231231        $this->loader->add_action( 'woocommerce_order_status_changed', $plugin_api, 'notification_order_status_changed', 10, 3 );
     232        $this->loader->add_action( 'after_wcfm_notification', $plugin_api, 'custom_after_wcfm_notification', 600, 6 );
    232233
    233234        // WCFM
  • mobile-builder/trunk/mobile-builder.php

    r2447220 r2447754  
    1111 * Plugin URI:        https://doc-oreo.rnlab.io
    1212 * Description:       The most advanced drag & drop app builder. Create multi templates and app controls.
    13  * Version:           1.4.1
     13 * Version:           1.4.2
    1414 * Author:            Rnlab.io
    1515 * Author URI:        https://rnlab.io
  • mobile-builder/trunk/product/class-mobile-builder-product.php

    r2447220 r2447754  
    6868
    6969        register_rest_route( $namespace, 'rating-count', array(
    70             'methods'             => 'GET',
     70            'methods'             => WP_REST_Server::READABLE,
    7171            'callback'            => array( $this, 'rating_count' ),
    7272            'permission_callback' => '__return_true',
     
    7474
    7575        register_rest_route( 'wc/v3', 'products-distance', array(
    76             'methods'             => 'GET',
     76            'methods'             => WP_REST_Server::READABLE,
    7777            'callback'            => array( $this, 'get_items' ),
    7878            'permission_callback' => array( $products, 'get_items_permissions_check' ),
     
    8080
    8181        register_rest_route( $namespace, 'attributes/(?P<product_id>[a-zA-Z0-9-]+)', array(
    82             'methods'             => 'GET',
     82            'methods'             => WP_REST_Server::READABLE,
    8383            'callback'            => array( $this, 'get_all_product_attributes' ),
     84            'permission_callback' => '__return_true',
     85        ) );
     86
     87        register_rest_route( $namespace, 'variations/(?P<product_id>[a-zA-Z0-9-]+)', array(
     88            'methods'             => WP_REST_Server::READABLE,
     89            'callback'            => array( $this, 'get_all_product_variations' ),
    8490            'permission_callback' => '__return_true',
    8591        ) );
     
    154160
    155161        return $product_attributes;
     162    }
     163
     164
     165    function get_all_product_variations( $request ) {
     166        $product_id = $request->get_param('product_id');
     167        $handle = new WC_Product_Variable($product_id);
     168        $variation_attributes = $handle->get_variation_attributes();
     169        $variation_attributes_data = array();
     170        $variation_attributes_label = array();
     171        foreach($variation_attributes as $key => $attribute){
     172            $variation_attributes_result['attribute_' . sanitize_title( $key )] = $attribute;
     173            $variation_attributes_label['attribute_' . sanitize_title( $key )] = $key;
     174        }
     175        return array(
     176            'variation_attributes_label' => $variation_attributes_label,
     177            'variation_attributes'=> $variation_attributes_result,
     178            'available_variations' => $handle->get_available_variations()
     179        );
    156180    }
    157181
Note: See TracChangeset for help on using the changeset viewer.