Eluza133 commited on
Commit
1b9aded
·
verified ·
1 Parent(s): 8c69c89

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -0
app.py CHANGED
@@ -394,6 +394,7 @@ TMA_DASHBOARD_HTML_TEMPLATE = '''
394
  <div class="app-header">
395
  <div class="user-info">{{ display_name }}</div>
396
  <div class="view-toggle">
 
397
  <button id="reminders-btn" title="Напоминания"><i class="fa-solid fa-bell"></i></button>
398
  <button id="grid-view-btn" title="Сетка"><i class="fa fa-th-large"></i></button>
399
  <button id="list-view-btn" title="Список"><i class="fa fa-bars"></i></button>
@@ -782,6 +783,24 @@ TMA_DASHBOARD_HTML_TEMPLATE = '''
782
  backButton.show();
783
  backButton.onClick(() => { haptic.impactOccurred('light'); window.location.href = `{{ url_for('tma_dashboard') }}?folder_id=${parentFolderId}`; });
784
  } else { window.Telegram.WebApp.BackButton.hide(); }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
785
  });
786
  </script></body></html>
787
  '''
 
394
  <div class="app-header">
395
  <div class="user-info">{{ display_name }}</div>
396
  <div class="view-toggle">
397
+ <button id="install-app-btn" title="Установить приложение" style="display: none;"><i class="fa-solid fa-arrow-down-to-bracket"></i></button>
398
  <button id="reminders-btn" title="Напоминания"><i class="fa-solid fa-bell"></i></button>
399
  <button id="grid-view-btn" title="Сетка"><i class="fa fa-th-large"></i></button>
400
  <button id="list-view-btn" title="Список"><i class="fa fa-bars"></i></button>
 
783
  backButton.show();
784
  backButton.onClick(() => { haptic.impactOccurred('light'); window.location.href = `{{ url_for('tma_dashboard') }}?folder_id=${parentFolderId}`; });
785
  } else { window.Telegram.WebApp.BackButton.hide(); }
786
+ const installBtn = document.getElementById('install-app-btn');
787
+ if (installBtn) {
788
+ const checkAndShowInstallButton = () => {
789
+ if (Telegram.WebApp.isVersionAtLeast('6.9') && !Telegram.WebApp.isAddedToAttachmentMenu) {
790
+ installBtn.style.display = 'inline-block';
791
+ } else {
792
+ installBtn.style.display = 'none';
793
+ }
794
+ };
795
+ installBtn.addEventListener('click', () => {
796
+ haptic.impactOccurred('light');
797
+ Telegram.WebApp.addToAttachmentMenu();
798
+ });
799
+ Telegram.WebApp.onEvent('addedToAttachmentMenu', () => {
800
+ installBtn.style.display = 'none';
801
+ });
802
+ checkAndShowInstallButton();
803
+ }
804
  });
805
  </script></body></html>
806
  '''