gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-taler-ops-www] branch master updated: fallback to ff


From: gnunet
Subject: [taler-taler-ops-www] branch master updated: fallback to ff
Date: Sun, 31 Mar 2024 16:58:39 +0200

This is an automated email from the git hooks/post-receive script.

nora-grothoff pushed a commit to branch master
in repository taler-ops-www.

The following commit(s) were added to refs/heads/master by this push:
     new cd0878f  fallback to ff
cd0878f is described below

commit cd0878f5ddff60ae338c7db4cfaaa6bf27982472
Author: Nullptrderef <nullptrderef@proton.me>
AuthorDate: Sun Mar 31 16:58:35 2024 +0200

    fallback to ff
---
 static/js/group-selection.ts | 47 ++++++++++++++++++++++++--------------------
 1 file changed, 26 insertions(+), 21 deletions(-)

diff --git a/static/js/group-selection.ts b/static/js/group-selection.ts
index 92a902b..34ecfce 100644
--- a/static/js/group-selection.ts
+++ b/static/js/group-selection.ts
@@ -1,11 +1,9 @@
-import UA, { OS } from './vendored/ua';
-
 type Key = 'firefox' | 'chrome' | 'android' | 'ios'; // an enum might be 
better but its 6am i havent slept for 18hrs ill deal with this later
 
 // Declare the group selection function as a global
 declare const selectGroup: (key: Key, scroll?: boolean) => void;
 
-(() => {
+(async () => {
   // Scope everything to not expose things that arent necessary
   const disableGroup = (key: Key) => {
     const group = document.querySelectorAll('.group-' + key);
@@ -53,23 +51,30 @@ declare const selectGroup: (key: Key, scroll?: boolean) => 
void;
   // Assign selectGroup to the global scope
   globalThis['selectGroup' as any] = selectGroup;
 
-  // Call it based on UA
-  const ua = new UA();
-  switch (true) {
-    case ua.os === OS.Android:
-      selectGroup('android', false);
-      break;
-    case ua.os === OS.iOS:
-      selectGroup('ios', false);
-      break;
-    case ua.browser === UA.Browser.Firefox:
-      selectGroup('firefox', false);
-      break;
-    case ua.browser === UA.Browser.Chromium:
-      selectGroup('chrome', false);
-      break;
-    default:
-      selectGroup('firefox', false);
-      break;
+  try {
+    const { default: UA } = await import('./vendored/ua');
+    // Call it based on UA
+    const ua = new UA();
+    switch (true) {
+      case ua.os === UA.OS.Android:
+        selectGroup('android', false);
+        break;
+      case ua.os === UA.OS.iOS:
+        selectGroup('ios', false);
+        break;
+      case ua.browser === UA.Browser.Firefox:
+        selectGroup('firefox', false);
+        break;
+      case ua.browser === UA.Browser.Chromium:
+        selectGroup('chrome', false);
+        break;
+      default:
+        selectGroup('firefox', false);
+        break;
+    }
+  } catch (error) {
+    console.warn('Failed to load UA Detection:', error);
+    // fall back to ff
+    selectGroup('firefox', false);
   }
 })();

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]