|
@@ -1,6 +1,7 @@
|
1
|
1
|
/* @flow */
|
2
|
2
|
|
3
|
3
|
import { setConfigFromURLParams } from '../../base/config';
|
|
4
|
+import { toState } from '../../base/redux';
|
4
|
5
|
import { loadScript } from '../../base/util';
|
5
|
6
|
|
6
|
7
|
import JitsiMeetJS from './_';
|
|
@@ -31,6 +32,26 @@ export function createLocalTrack(type: string, deviceId: string) {
|
31
|
32
|
.then(([ jitsiLocalTrack ]) => jitsiLocalTrack));
|
32
|
33
|
}
|
33
|
34
|
|
|
35
|
+/**
|
|
36
|
+ * Determines whether analytics is enabled in a specific redux {@code store}.
|
|
37
|
+ *
|
|
38
|
+ * @param {Function|Object} stateful - The redux store, state, or
|
|
39
|
+ * {@code getState} function.
|
|
40
|
+ * @returns {boolean} If analytics is enabled, {@code true}; {@code false},
|
|
41
|
+ * otherwise.
|
|
42
|
+ */
|
|
43
|
+export function isAnalyticsEnabled(stateful: Function | Object) {
|
|
44
|
+ const {
|
|
45
|
+ analyticsScriptUrls,
|
|
46
|
+ disableThirdPartyRequests
|
|
47
|
+ } = toState(stateful)['features/base/config'];
|
|
48
|
+
|
|
49
|
+ return (
|
|
50
|
+ !disableThirdPartyRequests
|
|
51
|
+ && Array.isArray(analyticsScriptUrls)
|
|
52
|
+ && Boolean(analyticsScriptUrls.length));
|
|
53
|
+}
|
|
54
|
+
|
34
|
55
|
/**
|
35
|
56
|
* Determines whether a specific JitsiConnectionErrors instance indicates a
|
36
|
57
|
* fatal JitsiConnection error.
|
|
@@ -102,23 +123,3 @@ export function loadConfig(url: string) {
|
102
|
123
|
|
103
|
124
|
return promise;
|
104
|
125
|
}
|
105
|
|
-
|
106
|
|
-/**
|
107
|
|
- * Evaluates whether analytics is enabled or not based on
|
108
|
|
- * the redux {@code store}.
|
109
|
|
- *
|
110
|
|
- * @param {Store} store - The redux store in which the specified {@code action}
|
111
|
|
- * is being dispatched.
|
112
|
|
- * @returns {boolean} True if analytics is enabled, false otherwise.
|
113
|
|
- */
|
114
|
|
-export function isAnalyticsEnabled({ getState }: { getState: Function }) {
|
115
|
|
- const {
|
116
|
|
- analyticsScriptUrls,
|
117
|
|
- disableThirdPartyRequests
|
118
|
|
- } = getState()['features/base/config'];
|
119
|
|
-
|
120
|
|
- const scriptURLs = Array.isArray(analyticsScriptUrls)
|
121
|
|
- ? analyticsScriptUrls : [];
|
122
|
|
-
|
123
|
|
- return Boolean(scriptURLs.length) && !disableThirdPartyRequests;
|
124
|
|
-}
|