瀏覽代碼

fix(vpaas): Store billing id in parent lolcaStorage on Safari

master
Vlad Piersec 4 年之前
父節點
當前提交
23574e9edc

+ 3
- 3
package-lock.json 查看文件

3325
       }
3325
       }
3326
     },
3326
     },
3327
     "@jitsi/js-utils": {
3327
     "@jitsi/js-utils": {
3328
-      "version": "1.0.3",
3329
-      "resolved": "https://registry.npmjs.org/@jitsi/js-utils/-/js-utils-1.0.3.tgz",
3330
-      "integrity": "sha512-m6mZz7R716mHP21lTKQffyM0nNFu3Fe/EHCaOVLFY/vdPsaUl9DhypJqtPIYzRUfPnmnugdaxcxrUeSZQXQzVA==",
3328
+      "version": "1.0.5",
3329
+      "resolved": "https://registry.npmjs.org/@jitsi/js-utils/-/js-utils-1.0.5.tgz",
3330
+      "integrity": "sha512-1APQyuqQaYDR+W7cdgzsaBo6x8dpF8sfelcBf3ngNU3Jd+DzuuwUvCMTbr2+cCuy6w59ZAuQ7e2ixCnnOXOW4Q==",
3331
       "requires": {
3331
       "requires": {
3332
         "bowser": "2.7.0",
3332
         "bowser": "2.7.0",
3333
         "js-md5": "0.7.3"
3333
         "js-md5": "0.7.3"

+ 1
- 1
package.json 查看文件

32
     "@atlaskit/theme": "7.0.2",
32
     "@atlaskit/theme": "7.0.2",
33
     "@atlaskit/toggle": "5.0.14",
33
     "@atlaskit/toggle": "5.0.14",
34
     "@atlaskit/tooltip": "12.1.13",
34
     "@atlaskit/tooltip": "12.1.13",
35
-    "@jitsi/js-utils": "1.0.3",
35
+    "@jitsi/js-utils": "1.0.5",
36
     "@microsoft/microsoft-graph-client": "1.1.0",
36
     "@microsoft/microsoft-graph-client": "1.1.0",
37
     "@react-native-async-storage/async-storage": "1.13.2",
37
     "@react-native-async-storage/async-storage": "1.13.2",
38
     "@react-native-community/google-signin": "3.0.1",
38
     "@react-native-community/google-signin": "3.0.1",

+ 2
- 1
react/features/base/jitsi-local-storage/setup.web.js 查看文件

2
 
2
 
3
 import { jitsiLocalStorage } from '@jitsi/js-utils/jitsi-local-storage';
3
 import { jitsiLocalStorage } from '@jitsi/js-utils/jitsi-local-storage';
4
 
4
 
5
+import { browser } from '../lib-jitsi-meet';
5
 import { parseURLParams } from '../util/parseURLParams';
6
 import { parseURLParams } from '../util/parseURLParams';
6
 
7
 
7
 import logger from './logger';
8
 import logger from './logger';
23
  * @returns {void}
24
  * @returns {void}
24
  */
25
  */
25
 function setupJitsiLocalStorage() {
26
 function setupJitsiLocalStorage() {
26
-    if (jitsiLocalStorage.isLocalStorageDisabled()) {
27
+    if (jitsiLocalStorage.isLocalStorageDisabled() || browser.isSafari()) {
27
         const urlParams = parseURLParams(window.location);
28
         const urlParams = parseURLParams(window.location);
28
 
29
 
29
         try {
30
         try {

+ 0
- 5
react/features/billing-counter/actionTypes.js 查看文件

1
-/**
2
- * Action used to store the billing id.
3
- */
4
-export const SET_BILLING_ID = 'SET_BILLING_ID';
5
-
6
 /**
1
 /**
7
  * Action used to store the flag signaling the endpoint has been counted.
2
  * Action used to store the flag signaling the endpoint has been counted.
8
  */
3
  */

+ 2
- 23
react/features/billing-counter/actions.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
-import uuid from 'uuid';
4
-
5
-import { SET_BILLING_ID, SET_ENDPOINT_COUNTED } from './actionTypes';
3
+import { SET_ENDPOINT_COUNTED } from './actionTypes';
6
 import { extractVpaasTenantFromPath, getBillingId, sendCountRequest } from './functions';
4
 import { extractVpaasTenantFromPath, getBillingId, sendCountRequest } from './functions';
7
 
5
 
8
 /**
6
 /**
9
  * Sends a billing count request when needed.
7
  * Sends a billing count request when needed.
10
- * If there is no billingId, it presists one first and sends the request after.
11
  *
8
  *
12
  * @returns {Function}
9
  * @returns {Function}
13
  */
10
  */
20
         const shouldSendRequest = Boolean(baseUrl && jwt && tenant);
17
         const shouldSendRequest = Boolean(baseUrl && jwt && tenant);
21
 
18
 
22
         if (shouldSendRequest) {
19
         if (shouldSendRequest) {
23
-            let billingId = getBillingId();
24
-
25
-            if (!billingId) {
26
-                billingId = uuid.v4();
27
-                dispatch(setBillingId(billingId));
28
-            }
20
+            const billingId = getBillingId();
29
 
21
 
30
             sendCountRequest({
22
             sendCountRequest({
31
                 baseUrl,
23
                 baseUrl,
38
     };
30
     };
39
 }
31
 }
40
 
32
 
41
-/**
42
- * Action used to set the user billing id.
43
- *
44
- * @param {string} value - The uid.
45
- * @returns {Object}
46
- */
47
-function setBillingId(value) {
48
-    return {
49
-        type: SET_BILLING_ID,
50
-        value
51
-    };
52
-}
53
-
54
 /**
33
 /**
55
  * Action used to mark the endpoint as counted.
34
  * Action used to mark the endpoint as counted.
56
  *
35
  *

+ 10
- 11
react/features/billing-counter/functions.js 查看文件

1
 // @flow
1
 // @flow
2
 
2
 
3
 import { jitsiLocalStorage } from '@jitsi/js-utils';
3
 import { jitsiLocalStorage } from '@jitsi/js-utils';
4
+import uuid from 'uuid';
4
 
5
 
5
 import { BILLING_ID, VPAAS_TENANT_PREFIX } from './constants';
6
 import { BILLING_ID, VPAAS_TENANT_PREFIX } from './constants';
6
 import logger from './logger';
7
 import logger from './logger';
72
 }
73
 }
73
 
74
 
74
 /**
75
 /**
75
- * Returns the stored billing id.
76
+ * Returns the stored billing id (or generates a new one if none is present).
76
  *
77
  *
77
  * @returns {string}
78
  * @returns {string}
78
  */
79
  */
79
 export function getBillingId() {
80
 export function getBillingId() {
80
-    return jitsiLocalStorage.getItem(BILLING_ID);
81
-}
82
 
81
 
83
-/**
84
- * Stores the billing id.
85
- *
86
- * @param {string} value - The id to be stored.
87
- * @returns {void}
88
- */
89
-export function setBillingId(value: string) {
90
-    jitsiLocalStorage.setItem(BILLING_ID, value);
82
+    let billingId = jitsiLocalStorage.getItem(BILLING_ID);
83
+
84
+    if (!billingId) {
85
+        billingId = uuid.v4();
86
+        jitsiLocalStorage.setItem(BILLING_ID, billingId);
87
+    }
88
+
89
+    return billingId;
91
 }
90
 }

+ 1
- 7
react/features/billing-counter/middleware.js 查看文件

3
 import { PARTICIPANT_JOINED } from '../base/participants/actionTypes';
3
 import { PARTICIPANT_JOINED } from '../base/participants/actionTypes';
4
 import { MiddlewareRegistry } from '../base/redux';
4
 import { MiddlewareRegistry } from '../base/redux';
5
 
5
 
6
-import { SET_BILLING_ID } from './actionTypes';
7
 import { countEndpoint } from './actions';
6
 import { countEndpoint } from './actions';
8
-import { isVpaasMeeting, extractVpaasTenantFromPath, setBillingId } from './functions';
7
+import { isVpaasMeeting, extractVpaasTenantFromPath } from './functions';
9
 
8
 
10
 /**
9
 /**
11
  * The redux middleware for billing counter.
10
  * The redux middleware for billing counter.
21
 
20
 
22
         break;
21
         break;
23
     }
22
     }
24
-    case SET_BILLING_ID: {
25
-        setBillingId(action.value);
26
-
27
-        break;
28
-    }
29
 
23
 
30
     case PARTICIPANT_JOINED: {
24
     case PARTICIPANT_JOINED: {
31
         const shouldCount = !store.getState()['features/billing-counter'].endpointCounted
25
         const shouldCount = !store.getState()['features/billing-counter'].endpointCounted

Loading…
取消
儲存