DawnC commited on
Commit
376120c
·
1 Parent(s): da84f24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -39
app.py CHANGED
@@ -443,57 +443,41 @@ def get_pwa_html():
443
  <meta charset="UTF-8">
444
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
445
  <meta name="apple-mobile-web-app-capable" content="yes">
446
- <meta name="apple-mobile-web-app-status-bar-style" content="black">
447
  <meta name="theme-color" content="#4299e1">
448
- <link rel="manifest" href="manifest.json" crossorigin="use-credentials">
449
- <link rel="apple-touch-icon" href="icon-192.png">
450
- <link rel="apple-touch-startup-image" href="icon-512.png">
451
 
452
- <!-- Safari 特定的 meta 標籤 -->
453
- <meta name="apple-mobile-web-app-title" content="PawMatch AI">
454
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
455
-
456
- <!-- iOS 啟動畫面 -->
457
- <link rel="apple-touch-startup-image"
458
- media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)"
459
- href="icon-512.png">
460
- <link rel="apple-touch-startup-image"
461
- media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)"
462
- href="icon-512.png">
463
 
464
  <script>
465
- window.addEventListener('load', function() {
466
- if ('serviceWorker' in navigator) {
467
- navigator.serviceWorker.register('/service-worker.js', {
468
- scope: '/',
469
- updateViaCache: 'none'
470
- }).then(function(registration) {
471
- console.log('ServiceWorker 註冊成功:', registration.scope);
472
- }).catch(function(err) {
473
- console.log('ServiceWorker 註冊失敗:', err);
474
- });
475
- }
476
-
477
- // Safari 特定處理
478
- if (navigator.standalone) {
479
- document.documentElement.classList.add('standalone');
480
- }
481
- });
482
  </script>
483
 
484
  <style>
485
- /* 防止 iOS 上的橡皮筋效果 */
486
- html {
487
- overflow: hidden;
488
  position: fixed;
489
  width: 100%;
490
  height: 100%;
 
491
  }
492
 
493
- /* PWA 模式樣式 */
494
- html.standalone {
495
- -webkit-user-select: none;
496
- -webkit-touch-callout: none;
 
497
  }
498
  </style>
499
  """
 
443
  <meta charset="UTF-8">
444
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
445
  <meta name="apple-mobile-web-app-capable" content="yes">
446
+ <meta name="apple-mobile-web-app-status-bar-style" content="default">
447
  <meta name="theme-color" content="#4299e1">
 
 
 
448
 
449
+ <link rel="manifest" href="./manifest.json">
450
+ <link rel="apple-touch-icon" href="./icon-192.png">
 
 
 
 
 
 
 
 
 
451
 
452
  <script>
453
+ if ('serviceWorker' in navigator) {
454
+ window.addEventListener('load', function() {
455
+ navigator.serviceWorker.register('./service-worker.js')
456
+ .then(function(registration) {
457
+ console.log('ServiceWorker registration successful');
458
+ })
459
+ .catch(function(err) {
460
+ console.log('ServiceWorker registration failed: ', err);
461
+ });
462
+ });
463
+ }
 
 
 
 
 
 
464
  </script>
465
 
466
  <style>
467
+ body {
468
+ overscroll-behavior-y: none;
469
+ -webkit-overflow-scrolling: touch;
470
  position: fixed;
471
  width: 100%;
472
  height: 100%;
473
+ overflow: auto;
474
  }
475
 
476
+ @media (display-mode: standalone) {
477
+ body {
478
+ padding-top: env(safe-area-inset-top);
479
+ padding-bottom: env(safe-area-inset-bottom);
480
+ }
481
  }
482
  </style>
483
  """