Your browser does not support the audio element.
MOBILE NOTICE
The mobile experience is currently being optimized and requires a DApp browser for full functionality.
We recommend using desktop for the best experience.
CLOSE
币安女友
Language:
EN
中文
Fliza
Basic Info
↗
Age
22
Birthday
June 5
Zodiac
Gemini
Personality
Loading...
Daily Interests
Loading...
Likes & Dislikes
Likes
—
Dislikes
—
Favorites
↗
Food
—
Music
—
Movies
—
Games
—
Fliza
🇯🇵
🇺🇸
LOADING
‹
A
Select
›
START CHATTING
const copyBtn = document.getElementById('copy-address-btn'); if (copyBtn) { copyBtn.addEventListener('click', () => this.copyAddress()); } // Disconnect const disconnectBtn = document.getElementById('disconnect-wallet-btn'); if (disconnectBtn) { disconnectBtn.addEventListener('click', () => this.disconnect()); } // clicked elsewhere to close dropdown document.addEventListener('click', () => { this.hideDropdown(); }); } showWalletModal() { const modal = document.getElementById('wallet-modal'); if (modal) { modal.style.display = 'flex'; document.body.style.overflow = 'hidden'; } } hideWalletModal() { const modal = document.getElementById('wallet-modal'); if (modal) { modal.style.display = 'none'; document.body.style.overflow = ''; } } async connectWallet(walletName) { try { (window.AppConfig?.debug?.log || console.log)(`Connect wallet: ${walletName}`); // Check if wallet is configured const walletConfig = this.wallets.find(w => w.name.toLowerCase() === walletName.toLowerCase()); if (!walletConfig) { throw new Error(`wallet ${walletName} 未找to或未installed`); } const adapter = walletConfig.adapter(); if (!adapter) { this.showToast(`${walletName} wallet未installed`, 'error'); return; } // Update button status this.updateConnectButton(true); // Connect wallet let response; if (adapter.connect) { response = await adapter.connect(); } else if (adapter.publicKey && adapter.isConnected) { response = { publicKey: adapter.publicKey }; } else { throw new Error('walletadaptive器不supportedconnected'); } const address = response.publicKey.toString(); // savedconnectedstatus this.selectedWallet = { name: walletName, adapter, address, config: walletConfig }; this.isConnected = true; // Save to localStorage localStorage.setItem('wallet_address', address); localStorage.setItem('wallet_type', walletName.toLowerCase()); (window.AppConfig?.debug?.log || console.log)(`Wallet connected: ${walletName}`, address); // Update UI this.updateUI(); this.hideWalletModal(); this.showToast(`${walletName} Connection successful!`, 'success'); // Trigger global event window.dispatchEvent(new CustomEvent('walletConnected', { detail: { address, provider: walletName.toLowerCase() } })); } catch (error) { console.error('❌ Wallet connection failed:', error); this.updateConnectButton(false); this.showToast(`Connection failed: ${error.message}`, 'error'); } } async disconnect() { try { (window.AppConfig?.debug?.log || console.log)('Disconnect wallet...'); if (this.selectedWallet?.adapter?.disconnect) { await this.selectedWallet.adapter.disconnect(); } // clean up status this.selectedWallet = null; this.isConnected = false; // Clear localStorage localStorage.removeItem('wallet_address'); localStorage.removeItem('wallet_type'); localStorage.removeItem('selectedCharacter'); // Update UI this.updateUI(); this.hideDropdown(); this.showToast(i18n.t('wallet.disconnected'), 'success'); // Trigger global event window.dispatchEvent(new CustomEvent('walletDisconnected')); } catch (error) { console.error('❌ Disconnect failed:', error); // Force clean up status this.selectedWallet = null; this.isConnected = false; localStorage.clear(); this.updateUI(); } } checkExistingConnection() { const savedAddress = localStorage.getItem('wallet_address'); const savedType = localStorage.getItem('wallet_type'); if (savedAddress && savedType) { (window.AppConfig?.debug?.log || console.log)('Check saved wallet connection...'); const walletConfig = this.wallets.find(w => w.name.toLowerCase() === savedType.toLowerCase()); if (walletConfig) { const adapter = walletConfig.adapter(); if (adapter && adapter.isConnected && adapter.publicKey) { this.selectedWallet = { name: walletConfig.name, adapter, address: savedAddress, config: walletConfig }; this.isConnected = true; this.updateUI(); (window.AppConfig?.debug?.log || console.log)('Auto reconnected:', savedAddress); } } } } updateUI() { const connectButton = document.getElementById('wallet-connect-button'); const walletInfo = document.getElementById('wallet-info'); const walletAddress = document.getElementById('wallet-address'); const walletAvatar = document.getElementById('wallet-avatar'); if (this.isConnected && this.selectedWallet) { // Connected status if (connectButton) connectButton.style.display = 'none'; if (walletInfo) walletInfo.style.display = 'flex'; if (walletAddress) walletAddress.textContent = this.formatAddress(this.selectedWallet.address); if (walletAvatar) walletAvatar.textContent = this.selectedWallet.config.icon; } else { // display not connected status if (connectButton) connectButton.style.display = 'flex'; if (walletInfo) walletInfo.style.display = 'none'; } } updateConnectButton(loading) { const button = document.getElementById('wallet-connect-button'); if (!button) return; const textSpan = button.querySelector('.wallet-text'); if (loading) { button.disabled = true; if (textSpan) textSpan.textContent = 'Connecting...'; } else { button.disabled = false; if (textSpan) textSpan.textContent = 'Connect'; } } toggleDropdown() { const dropdown = document.getElementById('wallet-dropdown'); if (dropdown) { dropdown.style.display = dropdown.style.display === 'none' ? 'block' : 'none'; } } hideDropdown() { const dropdown = document.getElementById('wallet-dropdown'); if (dropdown) { dropdown.style.display = 'none'; } } copyAddress() { if (this.selectedWallet?.address) { navigator.clipboard.writeText(this.selectedWallet.address).then(() => { this.showToast('address已copyto剪贴板', 'success'); }).catch(() => { this.showToast('copyfailed', 'error'); }); } this.hideDropdown(); } formatAddress(address) { if (!address) return ''; return `${address.slice(0, 6)}...${address.slice(-4)}`; } showToast(message, type = 'info') { const toast = document.createElement('div'); toast.className = `wallet-toast wallet-toast-${type}`; toast.textContent = message; document.body.appendChild(toast); setTimeout(() => { toast.remove(); }, 3000); } (window.AppConfig?.debug?.log || console.log)('ProfileManager initialized'); // Initialize wallet manager let walletManager; document.addEventListener('DOMContentLoaded', () => { walletManager = new SolanaWalletManager(); window.walletManager = walletManager; // Expose to global window.modernWalletUI = walletManager; // For backward compatibility }); // compatible with old global function window.connectWallet = function() { if (walletManager) { walletManager.showWalletModal(); } }; window.disconnectWallet = function() { if (walletManager) { walletManager.disconnect(); } }; // user profile management system class UserProfileManager { constructor() { this.currentUserId = null; } // Check if user needs to fill profile - pure API driven, no localStorage async checkUserProfile(userId) { // Extract wallet address from userId const walletAddress = userId.replace('wallet_', ''); // display profile registration panel showProfilePanel(userId = null, existingProfile = null) { const overlay = document.getElementById('user-profile-overlay'); if (overlay) { // If in edit mode, fill existing data if (existingProfile) { this.fillFormWithProfile(existingProfile); // Change title to edit mode const title = overlay.querySelector('.profile-panel-title'); if (title) title.textContent = i18n.t('registration.edit.title'); } else { // Reset form this.resetForm(); const title = overlay.querySelector('.profile-panel-title'); if (title) title.textContent = i18n.t('registration.title'); } // Initialize month and date selectors setTimeout(() => { this.initDateSelectors(); }, 100); overlay.style.display = 'flex'; (window.AppConfig?.debug?.log || console.log)('Show user registration panel'); } } // hide profile registration panel hideProfilePanel() { const overlay = document.getElementById('user-profile-overlay'); if (overlay) { overlay.style.display = 'none'; } } // Initialize month and date selectors initDateSelectors() { const yearSelect = document.getElementById('birthYear'); const monthSelect = document.getElementById('birthMonth'); const daySelect = document.getElementById('birthDay'); if (!yearSelect || !monthSelect || !daySelect) { console.error('Date selectors not found'); return; } // Clear and fill years (1950-2010, suitable for adult users) yearSelect.innerHTML = '
年
'; const currentYear = new Date().getFullYear(); for (let i = currentYear - 15; i >= 1950; i--) { const option = document.createElement('option'); option.value = i; option.textContent = i; yearSelect.appendChild(option); } // Clear and fill months monthSelect.innerHTML = '
月
'; for (let i = 1; i <= 12; i++) { const option=document.createElement('option'); option.value=i; option.textContent=i; monthSelect.appendChild(option); } // Clear and fill dates (default 31 days) daySelect.innerHTML='
日
' ; for (let i=1; i <=31; i++) { const option=document.createElement('option'); option.value=i; option.textContent=i; daySelect.appendChild(option); } // Update dates when month changes monthSelect.addEventListener('change', ()=> { this.updateDayOptions(monthSelect.value); }); } // Update date options based on month updateDayOptions(month) { const daySelect = document.getElementById('birthDay'); const daysInMonth = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; const maxDays = month ? daysInMonth[month - 1] : 31; daySelect.innerHTML = '
日
'; for (let i = 1; i <= maxDays; i++) { const option=document.createElement('option'); option.value=i; const walletAddress=localStorage.getItem('wallet_address'); if (walletAddress) { const userId=`wallet_${walletAddress}`; const profile=window.profileManager.getUserProfile(userId); if (profile) { window.profileManager.showProfilePanel(userId, profile); (window.AppConfig?.debug?.log || console.log)('Editing user profile'); } else { (window.AppConfig?.debug?.log || console.log)('Profile not found; show registration'); window.profileManager.showProfilePanel(); } } else { (window.AppConfig?.debug?.warn || console.warn)('Wallet not connected'); } }; // getcurrentuserprofile window.getCurrentProfile=function() { const walletAddress=localStorage.getItem('wallet_address'); if (walletAddress) { const userId=`wallet_${walletAddress}`; const profile=window.profileManager.getUserProfile(userId); (window.AppConfig?.debug?.log || console.log)('Current user profile available'); return profile; } else { (window.AppConfig?.debug?.warn || console.warn)('Wallet not connected'); return null; } };