Plugin Directory

Changeset 3298119


Ignore:
Timestamp:
05/21/2025 01:39:04 PM (10 months ago)
Author:
webtonative
Message:

Deploy plugin version 2.8.3

Location:
webtonative/trunk
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • webtonative/trunk/README.md

    r3297334 r3298119  
    44Requires at least: 2.0.2
    55Tested up to: 6.7.1
    6 Stable tag: 2.8.2
     6Stable tag: 2.8.3
    77License: GPLv2 or later
    88
  • webtonative/trunk/admin/iap/rest.php

    r3296993 r3298119  
    140140
    141141    $product_data = wc_get_product($product_id);
    142     $order = wc_create_order();
     142    $order = wc_create_order(array(
     143      'customer_id' => $current_user->ID,
     144    ));
    143145    $order->add_product($product_data);
    144146    $order->set_payment_method('webtonative');
    145147    $order->set_status('wc-completed');
    146     $order->set_customer_id($current_user->ID);
     148    // $order->set_customer_id($current_user->ID);
    147149    $order->calculate_totals();
    148150    $order->save();
     
    188190
    189191    $product_data = wc_get_product($product_id);
    190     $order = wc_create_order();
     192    $order = wc_create_order(array(
     193      'customer_id' => $current_user->ID,
     194    ));
    191195    $order->add_product($product_data);
    192196    $order->set_payment_method('webtonative');
    193197    $order->set_status('wc-completed');
    194     $order->set_customer_id($current_user->ID);
     198    // $order->set_customer_id($current_user->ID);
    195199    $order->calculate_totals();
    196200    $order->save();
  • webtonative/trunk/index.php

    r3297334 r3298119  
    33  Plugin Name: webtonative
    44  Description: webtonative Plugin
    5   Version: 2.8.2
     5  Version: 2.8.3
    66  Author: webtonative
    77*/
  • webtonative/trunk/simple-iap/js/wtn-iap.js

    r3227974 r3298119  
    11document.addEventListener('DOMContentLoaded', function () {
    2     if (!window.WTN) return;
     2  if (!window.WTN) return;
    33
    4     const isAndroidApp = window.WTN.isAndroidApp;
    5     const isLoggedIn = simpleIAPData.isLoggedIn;
    6     const iosSecretKey = simpleIAPData.iosSecretKey;
     4  const isAndroidApp = window.WTN.isAndroidApp;
     5  const isLoggedIn = simpleIAPData.isLoggedIn;
     6  const iosSecretKey = simpleIAPData.iosSecretKey;
    77
    8     document.querySelectorAll('.iap-button').forEach(button => {
    9         button.addEventListener('click', function () {
    10             if (!isLoggedIn) {
    11                 alert('Please login to continue');
    12                 return;
    13             }
     8  document.querySelectorAll('.iap-button').forEach((button) => {
     9    button.addEventListener('click', function () {
     10      if (!isLoggedIn) {
     11        alert('Please login to continue');
     12        return;
     13      }
    1414
    15             if(!isAndroidApp && !iosSecretKey) {
    16                 alert('Please configure the App store secret key in settings');
    17                 return;
    18             }
     15      if (!isAndroidApp && !iosSecretKey) {
     16        alert('Please configure the App store secret key in settings');
     17        return;
     18      }
    1919
    20             const dataToProcess = {
    21                 productId: isAndroidApp ? button.dataset.googlePlayId : button.dataset.appStoreId,
    22                 productType: button.dataset.productType,
    23                 isConsumable: button.dataset.isConsumable === 'true',
    24             };
     20      const dataToProcess = {
     21        productId: isAndroidApp ? button.dataset.googlePlayId : button.dataset.appStoreId,
     22        productType: button.dataset.productType,
     23        isConsumable: button.dataset.isConsumable === 'true',
     24      };
    2525
    26             button.disabled = true;
    27             button.textContent = 'Processing...';
     26      button.disabled = true;
     27      button.textContent = 'Processing...';
    2828
    29             window.WTN.inAppPurchase({
    30                 ...dataToProcess,
    31                 callback: (data) => handlePaymentResponse(data, button),
    32             });
    33         });
     29      window.WTN.inAppPurchase({
     30        ...dataToProcess,
     31        callback: (data) => handlePaymentResponse(data, button),
     32      });
    3433    });
     34  });
    3535
    36     function handlePaymentResponse(data, button) {
    37         button.disabled = false;
    38         button.textContent = 'Buy Now';
     36  function handlePaymentResponse(data, button) {
     37    button.disabled = false;
     38    button.textContent = 'Buy Now';
    3939
    40         if (!data.isSuccess) {
    41             alert('Payment failed');
    42             return;
     40    if (!data.isSuccess) {
     41      alert('Payment failed');
     42      return;
     43    }
     44
     45    const receiptData = typeof data.receiptData === 'string' ? data.receiptData : JSON.stringify(data.receiptData);
     46
     47    const formData = new FormData();
     48    formData.append('action', 'simple_iap_verify');
     49    formData.append('nonce', simpleIAPData.nonce);
     50    formData.append('platform', /iPhone|iPad|iPod/.test(navigator.userAgent) ? 'ios' : 'android');
     51    formData.append('receipt', receiptData);
     52
     53    fetch(simpleIAPData.ajax_url, {
     54      method: 'POST',
     55      body: formData,
     56    })
     57      .then((response) => response.json())
     58      .then((result) => {
     59        if (result.success) {
     60          alert('Purchase successful!');
     61        } else {
     62          alert('Verification failed: ' + result?.data?.message);
    4363        }
    44 
    45         const formData = new FormData();
    46         formData.append('action', 'simple_iap_verify');
    47         formData.append('nonce', simpleIAPData.nonce);
    48         formData.append('platform', /iPhone|iPad|iPod/.test(navigator.userAgent) ? 'ios' : 'android');
    49         formData.append('receipt', data.receiptData);
    50 
    51         fetch(simpleIAPData.ajax_url, {
    52             method: 'POST',
    53             body: formData,
    54         })
    55             .then(response => response.json())
    56             .then(result => {
    57                 if (result.success) {
    58                     alert('Purchase successful!');
    59                 } else {
    60                     alert('Verification failed: '+ result?.data?.message);
    61                 }
    62             })
    63             .catch(error => {
    64                 console.error('Error:', error);
    65                 alert('Verification error: ' + error.message);
    66             });
    67     }
     64      })
     65      .catch((error) => {
     66        console.error('Error:', error);
     67        alert('Verification error: ' + error.message);
     68      });
     69  }
    6870});
  • webtonative/trunk/simple-iap/simple-iap.php

    r3227974 r3298119  
    8080// Enqueue scripts
    8181add_action('wp_enqueue_scripts', function () {
    82     wp_enqueue_script('simple-iap-js', plugin_dir_url(__FILE__) . 'js/wtn-iap.js', [], '1.1', true);
     82    wp_enqueue_script('simple-iap-js', plugin_dir_url(__FILE__) . 'js/wtn-iap.js?ver=1.1.6', [], '1.1', true);
    8383
    8484    wp_localize_script('simple-iap-js', 'simpleIAPData', [
     
    123123
    124124    $platform = sanitize_text_field($_POST['platform'] ?? '');
    125     $receipt  = sanitize_text_field($_POST['receipt'] ?? '');
     125    $receipt  = ($platform === 'ios') ? sanitize_text_field($_POST['receipt'] ?? '') : $_POST['receipt'];
    126126
    127127    if (empty($platform) || empty($receipt)) {
     
    136136            $callback_function = get_option('simple_iap_callback_function');
    137137            if (!empty($callback_function) && function_exists($callback_function)) {
    138                 call_user_func($callback_function, $platform, ['receipt' => $receipt, 'verification_result' => $result]);
     138                call_user_func($callback_function, $platform, ['receipt' => ($platform === 'ios') ? $receipt : '', 'verification_result' => $result]);
    139139            }
    140140
     
    232232}
    233233
    234 
    235234// Placeholder for Android receipt verification
    236235function simple_iap_verify_android_receipt($receipt)
    237236{
    238     return ['success' => true, 'data' => $receipt]; // Implement actual Android verification here
    239 }
     237    $receipt_json = json_decode(stripslashes($receipt), true);
     238    return ['success' => true, 'data' => $receipt_json]; // Implement actual Android verification here
     239}
  • webtonative/trunk/website/iap.php

    r3297334 r3298119  
    2121    $webtonative_settings = get_option('woocommerce_webtonative_settings');
    2222
    23     wp_register_script('webtonative-iap', plugins_url('scripts/woocommerce.js?var=6.13.10', __FILE__), array('webtonative', 'jquery'), filemtime(plugin_dir_path(__FILE__) . 'scripts/woocommerce.js'), true);
     23    wp_register_script('webtonative-iap', plugins_url('scripts/woocommerce.js?var=6.14.2', __FILE__), array('webtonative', 'jquery'), filemtime(plugin_dir_path(__FILE__) . 'scripts/woocommerce.js'), true);
    2424    wp_localize_script('webtonative-iap', 'wtn_biometric_settings', array(
    2525      'btn_proccessing_text' => $saved_settings['processing_button_text'],
  • webtonative/trunk/website/scripts/woocommerce.js

    r3297334 r3298119  
    2727
    2828  let productListCache = null;
     29  let isIAPInitialized = false;
    2930
    3031  async function fetchProductList() {
     
    7879
    7980    try {
     81      isIAPInitialized = true;
    8082      const productData = await getProductIds(productId);
    8183      WTN.inAppPurchase({
     
    8587            alert(btnTexts.failed);
    8688            toggleButtonState(button, false, btnTexts.buyNow);
     89            isIAPInitialized = false;
    8790            return;
    8891          }
     
    9194            alert('Already purchased');
    9295            toggleButtonState(button, false, btnTexts.buyNow);
     96            isIAPInitialized = false;
    9397            return;
    9498          }
     
    106110              toggleButtonState(button, false, btnTexts.success);
    107111            }
     112            isIAPInitialized = false;
    108113          } catch (orderError) {
    109114            toggleButtonState(button, false, btnTexts.failed);
     115            isIAPInitialized = false;
    110116          }
    111117        },
     
    114120      console.error('Error in processPayment:', error);
    115121      toggleButtonState(button, false, btnTexts.failed);
     122      isIAPInitialized = false;
    116123    }
    117124  }
     
    168175
    169176  $(document).ajaxComplete(async function () {
     177    if (isIAPInitialized) return;
    170178    debounce(setupButtons, 300)();
    171179  });
  • webtonative/trunk/webtonative-biometric/assets/biometric.js

    r3296993 r3298119  
    160160  function showBiometricPrompt() {
    161161    window.WTN.Biometric.show({
     162      isAuthenticationOptional: true,
    162163      prompt: 'Authenticate to continue!',
    163164      callback: function (data) {
     
    176177    return new Promise((resolve) => {
    177178      window.WTN.Biometric.show({
     179        isAuthenticationOptional: true,
    178180        prompt: promptText,
    179181        callback: resolve,
  • webtonative/trunk/webtonative-biometric/webtonative-biometric.php

    r3296993 r3298119  
    1313function wtn_biometric_enqueue_scripts()
    1414{
    15     wp_enqueue_script('wtn-biometric-js', plugins_url('assets/biometric.js?ver=1.1.8', __FILE__), ['jquery'], '1.0.0', true);
     15    wp_enqueue_script('wtn-biometric-js', plugins_url('assets/biometric.js?ver=1.1.9', __FILE__), ['jquery'], '1.0.0', true);
    1616
    1717    wp_localize_script('wtn-biometric-js', 'WTN_Biometric_Settings', [
     
    233233            loginButton.addEventListener('click', () => {
    234234                window.WTN.Biometric.show({
     235                    isAuthenticationOptional: true,
    235236                    prompt: "Authenticate to login",
    236237                    callback: function(data) {
  • webtonative/trunk/webtonative-radio-player/css/player.css

    r3216434 r3298119  
    7979}
    8080
     81.d-none {
     82    display: none !important;
     83}
     84
    8185/* Disabled Buttons */
    8286button:disabled {
  • webtonative/trunk/webtonative-radio-player/js/player.js

    r3216434 r3298119  
    11(function ($) {
    2     let tracks = wtnPlayerData.tracks || [];
    3     let currentTrackIndex = 0;
    4     let audio = new Audio();
     2  const wtnPlayerWrapper = $('#wtn-player');
     3  const isAndroidApp = window.WTN && window.WTN.isAndroidApp;
     4  if (!isAndroidApp) return;
    55
    6     function loadTrack(index) {
    7         let track = tracks[index];
    8         if (!track) return;
     6  wtnPlayerWrapper.removeClass('d-none');
    97
    10         $('#track-title').text(track.name || 'Unknown Track');
    11         $('#track-image').attr('src', track.image || '');
    12         audio.src = track.url || '';
     8  let tracks = wtnPlayerData.tracks || [];
     9  let currentTrackIndex = 0;
     10  // let audio = new Audio();
     11  let isPlaying = false;
    1312
    14         // Disable/Enable Prev and Next buttons based on track availability
    15         $('#wtn-prev').prop('disabled', index === 0).toggle(tracks.length > 1);
    16         $('#wtn-next').prop('disabled', index === tracks.length - 1).toggle(tracks.length > 1);
     13  function loadTrack(index) {
     14    let track = tracks[index];
     15    if (!track) return;
     16
     17    $('#track-title').text(track.name || 'Unknown Track');
     18    $('#track-image').attr('src', track.image || '');
     19    // audio.src = track.url || '';
     20
     21    // Disable/Enable Prev and Next buttons based on track availability
     22    $('#wtn-prev')
     23      .prop('disabled', index === 0)
     24      .toggle(tracks.length > 1);
     25    $('#wtn-next')
     26      .prop('disabled', index === tracks.length - 1)
     27      .toggle(tracks.length > 1);
     28  }
     29
     30  // Play/Pause Button
     31  $('#wtn-play-pause').on('click', function () {
     32    // alert('Play/Pause button clicked => ' + audio.paused);
     33    if (!isPlaying) {
     34      // audio.play();
     35      window?.WTN?.MediaPlayer?.playMedia({ url: tracks[currentTrackIndex]?.url, image: tracks[currentTrackIndex]?.image });
     36      $(this).text('⏸');
     37      isPlaying = true;
     38      // alert('Audio is paused, playing now');
     39    } else {
     40      // audio.pause();
     41      window?.WTN?.MediaPlayer?.pauseMedia();
     42      $(this).text('▶');
     43      isPlaying = false;
     44      // alert('Audio is playing, pausing now');
    1745    }
     46  });
    1847
    19     // Play/Pause Button
    20     $('#wtn-play-pause').on('click', function () {
    21         if (audio.paused) {
    22             audio.play();
    23             window?.WTN?.MediaPlayer?.playMedia({ url: tracks[currentTrackIndex]?.url, image: tracks[currentTrackIndex]?.image });
    24             $(this).text('⏸');
    25         } else {
    26             audio.pause();
    27             window?.WTN?.MediaPlayer?.pauseMedia();
    28             $(this).text('▶');
    29         }
    30     });
     48  // Previous Button
     49  $('#wtn-prev').on('click', function () {
     50    if (currentTrackIndex > 0) {
     51      window?.WTN?.MediaPlayer?.stopMedia();
     52      currentTrackIndex--;
     53      loadTrack(currentTrackIndex);
     54      // audio.play();
     55      window?.WTN?.MediaPlayer?.playMedia({ url: tracks[currentTrackIndex]?.url, image: tracks[currentTrackIndex]?.image });
     56      $('#wtn-play-pause').text('⏸'); // Update button state
     57      isPlaying = true;
     58      // alert('Prev track loaded =>' + tracks[currentTrackIndex]?.url);
     59    }
     60  });
    3161
    32     // Previous Button
    33     $('#wtn-prev').on('click', function () {
    34         if (currentTrackIndex > 0) {
    35             currentTrackIndex--;
    36             loadTrack(currentTrackIndex);
    37             audio.play();
    38             window?.WTN?.MediaPlayer?.playMedia({ url: tracks[currentTrackIndex]?.url, image: tracks[currentTrackIndex]?.image });
    39             $('#wtn-play-pause').text('⏸'); // Update button state
    40         }
    41     });
     62  // Next Button
     63  $('#wtn-next').on('click', function () {
     64    if (currentTrackIndex < tracks.length - 1) {
     65      window?.WTN?.MediaPlayer?.stopMedia();
     66      currentTrackIndex++;
     67      loadTrack(currentTrackIndex);
     68      // audio.play();
     69      window?.WTN?.MediaPlayer?.playMedia({ url: tracks[currentTrackIndex]?.url, image: tracks[currentTrackIndex]?.image });
     70      $('#wtn-play-pause').text('⏸'); // Update button state
     71      isPlaying = true;
     72      // alert('Next track loaded =>' + tracks[currentTrackIndex]?.url);
     73    }
     74  });
    4275
    43     // Next Button
    44     $('#wtn-next').on('click', function () {
    45         if (currentTrackIndex < tracks.length - 1) {
    46             currentTrackIndex++;
    47             loadTrack(currentTrackIndex);
    48             audio.play();
    49             window?.WTN?.MediaPlayer?.playMedia({ url: tracks[currentTrackIndex]?.url, image: tracks[currentTrackIndex]?.image });
    50             $('#wtn-play-pause').text('⏸'); // Update button state
    51         }
    52     });
     76  // Hide Prev/Next buttons if only one track is present
     77  if (tracks.length === 1) {
     78    $('#wtn-prev, #wtn-next').hide();
     79  }
    5380
    54     // Hide Prev/Next buttons if only one track is present
    55     if (tracks.length === 1) {
    56         $('#wtn-prev, #wtn-next').hide();
    57     }
    58 
    59     // Load the initial track without autoplay
    60     if (tracks.length > 0) {
    61         loadTrack(currentTrackIndex);
    62     }
     81  // Load the initial track without autoplay
     82  if (tracks.length > 0) {
     83    loadTrack(currentTrackIndex);
     84  }
    6385})(jQuery);
  • webtonative/trunk/webtonative-radio-player/webtonative-radio-player.php

    r3216434 r3298119  
    1010function wtn_enqueue_assets()
    1111{
    12     wp_enqueue_style('wtn-player-css', plugin_dir_url(__FILE__) . 'css/player.css');
    13     wp_enqueue_script('wtn-player-js', plugin_dir_url(__FILE__) . 'js/player.js', array('jquery'), null, true);
     12    wp_enqueue_style('wtn-player-css', plugin_dir_url(__FILE__) . 'css/player.css?ver=1.0.2');
     13    wp_enqueue_script('wtn-player-js', plugin_dir_url(__FILE__) . 'js/player.js?ver=1.0.9', array('jquery'), null, true);
    1414
    1515    // Pass settings to JavaScript
     
    5555    ob_start();
    5656?>
    57     <div id="wtn-player">
     57    <div id="wtn-player" class="d-none">
    5858        <div id="track-info">
    5959            <img id="track-image" src="" alt="Track Image">
Note: See TracChangeset for help on using the changeset viewer.