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: ua sel


From: gnunet
Subject: [taler-taler-ops-www] branch master updated: ua sel
Date: Sun, 31 Mar 2024 16:46:07 +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 96a2ecc  ua sel
96a2ecc is described below

commit 96a2ecc3a6f79cd39f5a40b6ab6f5b129f80f762
Author: Nullptrderef <nullptrderef@proton.me>
AuthorDate: Sun Mar 31 16:46:03 2024 +0200

    ua sel
---
 static/js/group-selection.ts | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/static/js/group-selection.ts b/static/js/group-selection.ts
index 2851b20..92a902b 100644
--- a/static/js/group-selection.ts
+++ b/static/js/group-selection.ts
@@ -1,3 +1,5 @@
+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
@@ -51,6 +53,23 @@ declare const selectGroup: (key: Key, scroll?: boolean) => 
void;
   // Assign selectGroup to the global scope
   globalThis['selectGroup' as any] = selectGroup;
 
-  // Call it - we should implement basic UA detection here
-  selectGroup('firefox', false);
+  // 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;
+  }
 })();

-- 
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]