From fec4e19c1d3816693a38bd1f24f000643115d0aa Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Thu, 1 Sep 2022 07:01:02 -0600 Subject: [PATCH 01/45] Selectively force long polling for ios only --- web/lib/firebase/init.ts | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/web/lib/firebase/init.ts b/web/lib/firebase/init.ts index b9c96a9b..44bc3a2a 100644 --- a/web/lib/firebase/init.ts +++ b/web/lib/firebase/init.ts @@ -10,9 +10,28 @@ import { connectFunctionsEmulator, getFunctions } from 'firebase/functions' // Initialize Firebase export const app = getApps().length ? getApp() : initializeApp(FIREBASE_CONFIG) -export const db = initializeFirestore(app, { - experimentalForceLongPolling: true, -}) +function iOS() { + if (typeof navigator === 'undefined') { + // we're on the server, do whatever + return false + } + return ( + [ + 'iPad Simulator', + 'iPhone Simulator', + 'iPod Simulator', + 'iPad', + 'iPhone', + 'iPod', + ].includes(navigator.platform) || + // iPad on iOS 13 detection + (navigator.userAgent.includes('Mac') && 'ontouchend' in document) + ) +} +// Necessary for ios, see: https://github.com/firebase/firebase-js-sdk/issues/6118 +const opts = iOS() ? { experimentalForceLongPolling: true } : {} +export const db = initializeFirestore(app, opts) + export const functions = getFunctions() export const storage = getStorage() From a8d7e91a022b64f8d50d54963889734ceb9201e4 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Thu, 1 Sep 2022 07:01:49 -0600 Subject: [PATCH 02/45] Clean comments --- web/lib/firebase/init.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/lib/firebase/init.ts b/web/lib/firebase/init.ts index 44bc3a2a..6740f8c6 100644 --- a/web/lib/firebase/init.ts +++ b/web/lib/firebase/init.ts @@ -12,7 +12,7 @@ export const app = getApps().length ? getApp() : initializeApp(FIREBASE_CONFIG) function iOS() { if (typeof navigator === 'undefined') { - // we're on the server, do whatever + // We're on the server, proceed normally return false } return ( @@ -28,7 +28,7 @@ function iOS() { (navigator.userAgent.includes('Mac') && 'ontouchend' in document) ) } -// Necessary for ios, see: https://github.com/firebase/firebase-js-sdk/issues/6118 +// Long polling is necessary for ios, see: https://github.com/firebase/firebase-js-sdk/issues/6118 const opts = iOS() ? { experimentalForceLongPolling: true } : {} export const db = initializeFirestore(app, opts) From 5dec6b4a22d0f97800499ab075a20bd6fbc2adb3 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Thu, 1 Sep 2022 07:23:43 -0600 Subject: [PATCH 03/45] Medium includes 10 bettors --- web/components/contract/contract-details.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/components/contract/contract-details.tsx b/web/components/contract/contract-details.tsx index 7226aace..c61a0fd1 100644 --- a/web/components/contract/contract-details.tsx +++ b/web/components/contract/contract-details.tsx @@ -296,9 +296,9 @@ export function ExtraMobileContractDetails(props: { const uniqueBettors = uniqueBettorCount ?? 0 const { resolvedDate } = contractMetrics(contract) const volumeTranslation = - volume > 800 || uniqueBettors > 20 + volume > 800 || uniqueBettors >= 20 ? 'High' - : volume > 300 || uniqueBettors > 10 + : volume > 300 || uniqueBettors >= 10 ? 'Medium' : 'Low' From a7c8b8aec4d008997d7f14500111f96aaa6a0538 Mon Sep 17 00:00:00 2001 From: Ian Philips Date: Thu, 1 Sep 2022 07:34:02 -0600 Subject: [PATCH 04/45] Hide bet panel when signed out --- web/components/bet-panel.tsx | 47 ++++++++++++++++++++---------------- 1 file changed, 26 insertions(+), 21 deletions(-) diff --git a/web/components/bet-panel.tsx b/web/components/bet-panel.tsx index 913216e9..d596dd46 100644 --- a/web/components/bet-panel.tsx +++ b/web/components/bet-panel.tsx @@ -67,27 +67,32 @@ export function BetPanel(props: { className )} > - -