Changeset 3313015
- Timestamp:
- 06/17/2025 07:53:52 AM (9 months ago)
- Location:
- webtonative/trunk
- Files:
-
- 9 edited
-
README.md (modified) (1 diff)
-
admin/iap/rest.php (modified) (2 diffs)
-
index.php (modified) (1 diff)
-
qtmedia-native-control/qtmedia-native-control.js (modified) (1 diff)
-
qtmedia-native-control/qtmedia-native-control.php (modified) (1 diff)
-
webtonative-biometric/assets/biometric.js (modified) (5 diffs)
-
webtonative-biometric/webtonative-biometric.php (modified) (1 diff)
-
webtonative-radio-player/js/player.js (modified) (3 diffs)
-
webtonative-radio-player/webtonative-radio-player.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
webtonative/trunk/README.md
r3301312 r3313015 4 4 Requires at least: 2.0.2 5 5 Tested up to: 6.7.1 6 Stable tag: 2.8. 56 Stable tag: 2.8.7 7 7 License: GPLv2 or later 8 8 -
webtonative/trunk/admin/iap/rest.php
r3301312 r3313015 128 128 } 129 129 130 error_log('Latest transaction: yaha se agaya');131 130 return [ 132 131 'success' => true, … … 247 246 $is_valid = $this->verify_apple_payment($native_product_id, $receipt_data, $product_type); 248 247 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) { 250 249 return new WP_REST_Response([ 251 250 'success' => false, -
webtonative/trunk/index.php
r3301312 r3313015 3 3 Plugin Name: webtonative 4 4 Description: webtonative Plugin 5 Version: 2.8. 55 Version: 2.8.7 6 6 Author: webtonative 7 7 */ -
webtonative/trunk/qtmedia-native-control/qtmedia-native-control.js
r3216434 r3313015 1 1 (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)); 6 59 } 7 60 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 } 11 66 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 } 14 77 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 }); 19 85 20 function pauseMedia() { 21 window.WTN.MediaPlayer.pauseMedia(); 22 } 86 observer.observe(container, { 87 childList: true, 88 subtree: true, 89 }); 23 90 24 function stopMedia() { 25 window.WTN.MediaPlayer.stopMedia(); 26 } 91 console.log('Dynamic media monitoring initialized.'); 92 } 27 93 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 }); 99 99 })(); -
webtonative/trunk/qtmedia-native-control/qtmedia-native-control.php
r3216434 r3313015 20 20 wp_enqueue_script( 21 21 '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', 23 23 [], 24 24 '1.2', -
webtonative/trunk/webtonative-biometric/assets/biometric.js
r3301312 r3313015 1 1 document.addEventListener('DOMContentLoaded', () => { 2 2 const isBiometricEnabled = WTN_Biometric_Settings.biometricEnabled === '1'; 3 let isEnableBiometricChecked = false;4 3 5 4 const urlParams = new URLSearchParams(window.location.search); … … 18 17 const biometricToggle = document.getElementById('wtn-biometric-settings'); 19 18 const loginBiometricBtnWrapper = document.getElementById('wtn-biometric-login'); 20 21 // Check if WordPress session cookie exists22 function isSessionExpired() {23 return !WTN_Biometric_Settings.isLoggedIn;24 }25 26 // Check if forced logout flag is set27 function hasForcedLogout() {28 return localStorage.getItem('wtnForcedLogout') === 'true';29 }30 19 31 20 // Clear forced logout flag when user logs in again … … 46 35 biometricToggle.style.display = 'block'; 47 36 } 48 isEnableBiometricChecked = !!WTN_Biometric_Settings?.userSecret && data?.hasSecret;37 const isEnableBiometricChecked = !!WTN_Biometric_Settings?.userSecret && data?.hasSecret; 49 38 if (enableBiometric) { 50 39 enableBiometric.checked = !!WTN_Biometric_Settings?.userSecret && data?.hasSecret; 51 40 enableBiometric.addEventListener('change', handleBiometricToggle); 52 41 } 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 }); 53 72 } else { 54 73 biometricToggle.style.display = 'none'; … … 128 147 } 129 148 130 // handle promt on app resume131 // Event: When the document visibility changes132 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 level138 lastActiveTime = Date.now();139 } else if (document.visibilityState === 'visible') {140 // App is active again, check the time difference141 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 open151 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 161 149 function showBiometricPrompt() { 162 150 window.WTN.Biometric.show({ … … 190 178 } 191 179 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 192 190 // Function to get query parameters 193 191 function getQueryParam(param) { -
webtonative/trunk/webtonative-biometric/webtonative-biometric.php
r3301312 r3313015 13 13 function wtn_biometric_enqueue_scripts() 14 14 { 15 wp_enqueue_script('wtn-biometric-js', plugins_url('assets/biometric.js?ver=1.1.1 0', __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); 16 16 17 17 wp_localize_script('wtn-biometric-js', 'WTN_Biometric_Settings', [ -
webtonative/trunk/webtonative-radio-player/js/player.js
r3298119 r3313015 33 33 if (!isPlaying) { 34 34 // 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 }); 36 36 $(this).text('⏸'); 37 37 isPlaying = true; … … 53 53 loadTrack(currentTrackIndex); 54 54 // 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 }); 56 56 $('#wtn-play-pause').text('⏸'); // Update button state 57 57 isPlaying = true; … … 67 67 loadTrack(currentTrackIndex); 68 68 // 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 }); 70 70 $('#wtn-play-pause').text('⏸'); // Update button state 71 71 isPlaying = true; -
webtonative/trunk/webtonative-radio-player/webtonative-radio-player.php
r3298119 r3313015 11 11 { 12 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);13 wp_enqueue_script('wtn-player-js', plugin_dir_url(__FILE__) . 'js/player.js?ver=1.0.10', array('jquery'), null, true); 14 14 15 15 // Pass settings to JavaScript
Note: See TracChangeset
for help on using the changeset viewer.