Plugin Directory

Changeset 3313015


Ignore:
Timestamp:
06/17/2025 07:53:52 AM (9 months ago)
Author:
webtonative
Message:

Deploy plugin version 2.8.7

Location:
webtonative/trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • webtonative/trunk/README.md

    r3301312 r3313015  
    44Requires at least: 2.0.2
    55Tested up to: 6.7.1
    6 Stable tag: 2.8.5
     6Stable tag: 2.8.7
    77License: GPLv2 or later
    88
  • webtonative/trunk/admin/iap/rest.php

    r3301312 r3313015  
    128128      }
    129129
    130       error_log('Latest transaction: yaha se agaya');
    131130      return [
    132131        'success' => true,
     
    247246    $is_valid = $this->verify_apple_payment($native_product_id, $receipt_data, $product_type);
    248247
    249     if ($is_valid['success'] === false && $is_valid['isAlreadyPurchased'] === true) {
     248    if ($is_valid['success'] === false && array_key_exists('isAlreadyPurchased', $is_valid) && $is_valid['isAlreadyPurchased'] === true) {
    250249      return new WP_REST_Response([
    251250        'success' => false,
  • webtonative/trunk/index.php

    r3301312 r3313015  
    33  Plugin Name: webtonative
    44  Description: webtonative Plugin
    5   Version: 2.8.5
     5  Version: 2.8.7
    66  Author: webtonative
    77*/
  • webtonative/trunk/qtmedia-native-control/qtmedia-native-control.js

    r3216434 r3313015  
    11(function () {
    2     // Ensure WTN.MediaPlayer exists
    3     if (typeof window.WTN === "undefined" || typeof window.WTN.MediaPlayer === "undefined") {
    4         console.error("WTN MediaPlayer is not available.");
    5         return;
     2  // Ensure WTN.MediaPlayer exists
     3  if (typeof window.WTN === 'undefined' || typeof window.WTN.MediaPlayer === 'undefined') {
     4    console.error('WTN MediaPlayer is not available.');
     5    return;
     6  }
     7
     8  // Check QTMediaSettings for enabled monitoring
     9  const audioMonitoringEnabled = QTMediaSettings.audioMonitoring === 'yes';
     10  const videoMonitoringEnabled = QTMediaSettings.videoMonitoring === 'yes';
     11
     12  // Initialize global active media element tracker
     13  window.activeMediaElement = null;
     14
     15  // Native media control functions
     16  function playMedia(url, image) {
     17    window.WTN.MediaPlayer.playMedia({ url, imageUrl: image });
     18  }
     19
     20  function pauseMedia() {
     21    window.WTN.MediaPlayer.pauseMedia();
     22  }
     23
     24  function stopMedia() {
     25    window.WTN.MediaPlayer.stopMedia();
     26  }
     27
     28  // Function to bind media controls to <audio> and <video> elements
     29  function bindMediaElement(mediaElement) {
     30    mediaElement.addEventListener('play', () => {
     31      if (window.activeMediaElement && window.activeMediaElement !== mediaElement) {
     32        window.activeMediaElement.pause();
     33      }
     34      window.activeMediaElement = mediaElement;
     35      const mediaUrl = mediaElement.currentSrc;
     36      const mediaImage = mediaElement.getAttribute('data-thumbnail') || '';
     37      playMedia(mediaUrl, mediaImage);
     38    });
     39
     40    mediaElement.addEventListener('pause', () => {
     41      if (window.activeMediaElement === mediaElement) {
     42        pauseMedia();
     43      }
     44    });
     45
     46    mediaElement.addEventListener('ended', () => {
     47      if (window.activeMediaElement === mediaElement) {
     48        stopMedia();
     49        window.activeMediaElement = null;
     50      }
     51    });
     52  }
     53
     54  // Initialize media controls for <audio> and <video> elements
     55  function initializeMediaControls() {
     56    if (audioMonitoringEnabled) {
     57      const audioElements = document.querySelectorAll('audio');
     58      audioElements.forEach((audioElement) => bindMediaElement(audioElement));
    659    }
    760
    8     // Check QTMediaSettings for enabled monitoring
    9     const audioMonitoringEnabled = QTMediaSettings.audioMonitoring === "yes";
    10     const videoMonitoringEnabled = QTMediaSettings.videoMonitoring === "yes";
     61    if (videoMonitoringEnabled) {
     62      const videoElements = document.querySelectorAll('video');
     63      videoElements.forEach((videoElement) => bindMediaElement(videoElement));
     64    }
     65  }
    1166
    12     // Initialize global active media element tracker
    13     window.activeMediaElement = null;
     67  // Monitor for dynamically added media elements
     68  function monitorDynamicMedia() {
     69    const container = document.body;
     70    const observer = new MutationObserver((mutations) => {
     71      mutations.forEach((mutation) => {
     72        mutation.addedNodes.forEach((node) => {
     73          if (node.tagName === 'AUDIO' && audioMonitoringEnabled) {
     74            console.log('New audio element detected:', node);
     75            bindMediaElement(node);
     76          }
    1477
    15     // Native media control functions
    16     function playMedia(url, image) {
    17         window.WTN.MediaPlayer.playMedia({ url, image });
    18     }
     78          if (node.tagName === 'VIDEO' && videoMonitoringEnabled) {
     79            console.log('New video element detected:', node);
     80            bindMediaElement(node);
     81          }
     82        });
     83      });
     84    });
    1985
    20     function pauseMedia() {
    21         window.WTN.MediaPlayer.pauseMedia();
    22     }
     86    observer.observe(container, {
     87      childList: true,
     88      subtree: true,
     89    });
    2390
    24     function stopMedia() {
    25         window.WTN.MediaPlayer.stopMedia();
    26     }
     91    console.log('Dynamic media monitoring initialized.');
     92  }
    2793
    28     // Function to bind media controls to <audio> and <video> elements
    29     function bindMediaElement(mediaElement) {
    30         mediaElement.addEventListener("play", () => {
    31             if (window.activeMediaElement && window.activeMediaElement !== mediaElement) {
    32                 window.activeMediaElement.pause();
    33             }
    34             window.activeMediaElement = mediaElement;
    35             const mediaUrl = mediaElement.currentSrc;
    36             const mediaImage = mediaElement.getAttribute("data-thumbnail") || "";
    37             playMedia(mediaUrl, mediaImage);
    38         });
    39 
    40         mediaElement.addEventListener("pause", () => {
    41             if (window.activeMediaElement === mediaElement) {
    42                 pauseMedia();
    43             }
    44         });
    45 
    46         mediaElement.addEventListener("ended", () => {
    47             if (window.activeMediaElement === mediaElement) {
    48                 stopMedia();
    49                 window.activeMediaElement = null;
    50             }
    51         });
    52     }
    53 
    54     // Initialize media controls for <audio> and <video> elements
    55     function initializeMediaControls() {
    56         if (audioMonitoringEnabled) {
    57             const audioElements = document.querySelectorAll("audio");
    58             audioElements.forEach((audioElement) => bindMediaElement(audioElement));
    59         }
    60 
    61         if (videoMonitoringEnabled) {
    62             const videoElements = document.querySelectorAll("video");
    63             videoElements.forEach((videoElement) => bindMediaElement(videoElement));
    64         }
    65     }
    66 
    67     // Monitor for dynamically added media elements
    68     function monitorDynamicMedia() {
    69         const container = document.body;
    70         const observer = new MutationObserver((mutations) => {
    71             mutations.forEach((mutation) => {
    72                 mutation.addedNodes.forEach((node) => {
    73                     if (node.tagName === "AUDIO" && audioMonitoringEnabled) {
    74                         console.log("New audio element detected:", node);
    75                         bindMediaElement(node);
    76                     }
    77 
    78                     if (node.tagName === "VIDEO" && videoMonitoringEnabled) {
    79                         console.log("New video element detected:", node);
    80                         bindMediaElement(node);
    81                     }
    82                 });
    83             });
    84         });
    85 
    86         observer.observe(container, {
    87             childList: true,
    88             subtree: true,
    89         });
    90 
    91         console.log("Dynamic media monitoring initialized.");
    92     }
    93 
    94     // Initialize functionality when DOM is fully loaded
    95     document.addEventListener("DOMContentLoaded", () => {
    96         initializeMediaControls();
    97         monitorDynamicMedia();
    98     });
     94  // Initialize functionality when DOM is fully loaded
     95  document.addEventListener('DOMContentLoaded', () => {
     96    initializeMediaControls();
     97    monitorDynamicMedia();
     98  });
    9999})();
  • webtonative/trunk/qtmedia-native-control/qtmedia-native-control.php

    r3216434 r3313015  
    2020        wp_enqueue_script(
    2121            'qtmedia-native-control',
    22             plugin_dir_url(__FILE__) . 'qtmedia-native-control.js',
     22            plugin_dir_url(__FILE__) . 'qtmedia-native-control.js?ver=1.1.0',
    2323            [],
    2424            '1.2',
  • webtonative/trunk/webtonative-biometric/assets/biometric.js

    r3301312 r3313015  
    11document.addEventListener('DOMContentLoaded', () => {
    22  const isBiometricEnabled = WTN_Biometric_Settings.biometricEnabled === '1';
    3   let isEnableBiometricChecked = false;
    43
    54  const urlParams = new URLSearchParams(window.location.search);
     
    1817  const biometricToggle = document.getElementById('wtn-biometric-settings');
    1918  const loginBiometricBtnWrapper = document.getElementById('wtn-biometric-login');
    20 
    21   // Check if WordPress session cookie exists
    22   function isSessionExpired() {
    23     return !WTN_Biometric_Settings.isLoggedIn;
    24   }
    25 
    26   // Check if forced logout flag is set
    27   function hasForcedLogout() {
    28     return localStorage.getItem('wtnForcedLogout') === 'true';
    29   }
    3019
    3120  // Clear forced logout flag when user logs in again
     
    4635          biometricToggle.style.display = 'block';
    4736        }
    48         isEnableBiometricChecked = !!WTN_Biometric_Settings?.userSecret && data?.hasSecret;
     37        const isEnableBiometricChecked = !!WTN_Biometric_Settings?.userSecret && data?.hasSecret;
    4938        if (enableBiometric) {
    5039          enableBiometric.checked = !!WTN_Biometric_Settings?.userSecret && data?.hasSecret;
    5140          enableBiometric.addEventListener('change', handleBiometricToggle);
    5241        }
     42
     43        if (isSessionExpired()) return;
     44        if (!isEnableBiometricChecked) return;
     45
     46        // handle promt on app open
     47        if (WTN_Biometric_Settings.promptOnOpen === '1') {
     48          if (typeof window.WTN.appFirstLoad === 'undefined') return;
     49          window?.WTN?.appFirstLoad()?.then((aplRes) => {
     50            if (!aplRes.result) return;
     51            showBiometricPrompt();
     52          });
     53        }
     54
     55        // handle promt on app resume
     56        // Event: When the document visibility changes
     57        document.addEventListener('visibilitychange', () => {
     58          if (WTN_Biometric_Settings.promptOnResume !== '1') return;
     59          if (document.visibilityState === 'hidden') {
     60            // App is inactive, record the time on global level
     61            lastActiveTime = Date.now();
     62          } else if (document.visibilityState === 'visible') {
     63            // App is active again, check the time difference
     64            const currentTime = Date.now();
     65            const timeElapsed = currentTime - lastActiveTime;
     66
     67            if (timeElapsed > activeExpireTime) {
     68              showBiometricPrompt();
     69            }
     70          }
     71        });
    5372      } else {
    5473        biometricToggle.style.display = 'none';
     
    128147  }
    129148
    130   // handle promt on app resume
    131   // Event: When the document visibility changes
    132   document.addEventListener('visibilitychange', () => {
    133     if (isSessionExpired()) return;
    134     if (!isBiometricEnabled || !isEnableBiometricChecked) return;
    135     if (WTN_Biometric_Settings.promptOnResume !== '1') return;
    136     if (document.visibilityState === 'hidden') {
    137       // App is inactive, record the time on global level
    138       lastActiveTime = Date.now();
    139     } else if (document.visibilityState === 'visible') {
    140       // App is active again, check the time difference
    141       const currentTime = Date.now();
    142       const timeElapsed = currentTime - lastActiveTime;
    143 
    144       if (timeElapsed > activeExpireTime) {
    145         showBiometricPrompt();
    146       }
    147     }
    148   });
    149 
    150   // handle promt on app open
    151   if (!isSessionExpired() && isBiometricEnabled && WTN_Biometric_Settings.promptOnOpen === '1' && isEnableBiometricChecked) {
    152     if (typeof window.WTN.appFirstLoad === 'undefined') return;
    153     setTimeout(() => {
    154       window?.WTN?.appFirstLoad()?.then((aplRes) => {
    155         if (!aplRes.result) return;
    156         showBiometricPrompt();
    157       });
    158     }, 50);
    159   }
    160 
    161149  function showBiometricPrompt() {
    162150    window.WTN.Biometric.show({
     
    190178  }
    191179
     180  // Check if WordPress session cookie exists
     181  function isSessionExpired() {
     182    return !WTN_Biometric_Settings.isLoggedIn;
     183  }
     184
     185  // Check if forced logout flag is set
     186  function hasForcedLogout() {
     187    return localStorage.getItem('wtnForcedLogout') === 'true';
     188  }
     189
    192190  // Function to get query parameters
    193191  function getQueryParam(param) {
  • webtonative/trunk/webtonative-biometric/webtonative-biometric.php

    r3301312 r3313015  
    1313function wtn_biometric_enqueue_scripts()
    1414{
    15     wp_enqueue_script('wtn-biometric-js', plugins_url('assets/biometric.js?ver=1.1.10', __FILE__), ['jquery'], '1.0.0', true);
     15    wp_enqueue_script('wtn-biometric-js', plugins_url('assets/biometric.js?ver=1.1.11', __FILE__), ['jquery'], '1.0.0', true);
    1616
    1717    wp_localize_script('wtn-biometric-js', 'WTN_Biometric_Settings', [
  • webtonative/trunk/webtonative-radio-player/js/player.js

    r3298119 r3313015  
    3333    if (!isPlaying) {
    3434      // audio.play();
    35       window?.WTN?.MediaPlayer?.playMedia({ url: tracks[currentTrackIndex]?.url, image: tracks[currentTrackIndex]?.image });
     35      window?.WTN?.MediaPlayer?.playMedia({ url: tracks[currentTrackIndex]?.url, imageUrl: tracks[currentTrackIndex]?.image });
    3636      $(this).text('⏸');
    3737      isPlaying = true;
     
    5353      loadTrack(currentTrackIndex);
    5454      // audio.play();
    55       window?.WTN?.MediaPlayer?.playMedia({ url: tracks[currentTrackIndex]?.url, image: tracks[currentTrackIndex]?.image });
     55      window?.WTN?.MediaPlayer?.playMedia({ url: tracks[currentTrackIndex]?.url, imageUrl: tracks[currentTrackIndex]?.image });
    5656      $('#wtn-play-pause').text('⏸'); // Update button state
    5757      isPlaying = true;
     
    6767      loadTrack(currentTrackIndex);
    6868      // audio.play();
    69       window?.WTN?.MediaPlayer?.playMedia({ url: tracks[currentTrackIndex]?.url, image: tracks[currentTrackIndex]?.image });
     69      window?.WTN?.MediaPlayer?.playMedia({ url: tracks[currentTrackIndex]?.url, imageUrl: tracks[currentTrackIndex]?.image });
    7070      $('#wtn-play-pause').text('⏸'); // Update button state
    7171      isPlaying = true;
  • webtonative/trunk/webtonative-radio-player/webtonative-radio-player.php

    r3298119 r3313015  
    1111{
    1212    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);
     13    wp_enqueue_script('wtn-player-js', plugin_dir_url(__FILE__) . 'js/player.js?ver=1.0.10', array('jquery'), null, true);
    1414
    1515    // Pass settings to JavaScript
Note: See TracChangeset for help on using the changeset viewer.