瀏覽代碼

[RN] Fix calendar alerts when case sensitive URLs are used

master
Zoltan Bettenbuk 7 年之前
父節點
當前提交
cc6e04ddf8

+ 18
- 0
react/features/base/connection/functions.js 查看文件

52
     return url;
52
     return url;
53
 }
53
 }
54
 
54
 
55
+/**
56
+ * Gets a URL string without hash and query/search params from a specific
57
+ * {@code URL}.
58
+ *
59
+ * @param {URL} url - The {@code URL} which may have hash and query/search
60
+ * params.
61
+ * @returns {string}
62
+ */
63
+export function getURLWithoutParamsNormalized(url: URL): string {
64
+    const urlWithoutParams = getURLWithoutParams(url).href;
65
+
66
+    if (urlWithoutParams) {
67
+        return urlWithoutParams.toLowerCase();
68
+    }
69
+
70
+    return '';
71
+}
72
+
55
 /**
73
 /**
56
  * Converts a specific id to jid if it's not jid yet.
74
  * Converts a specific id to jid if it's not jid yet.
57
  *
75
  *

+ 8
- 3
react/features/calendar-sync/components/ConferenceNotification.native.js 查看文件

8
 import { connect } from 'react-redux';
8
 import { connect } from 'react-redux';
9
 
9
 
10
 import { appNavigate } from '../../app';
10
 import { appNavigate } from '../../app';
11
-import { getURLWithoutParams } from '../../base/connection';
11
+import { getURLWithoutParamsNormalized } from '../../base/connection';
12
 import { getLocalizedDateFormatter, translate } from '../../base/i18n';
12
 import { getLocalizedDateFormatter, translate } from '../../base/i18n';
13
 import { Icon } from '../../base/font-icons';
13
 import { Icon } from '../../base/font-icons';
14
 import { ASPECT_RATIO_NARROW } from '../../base/responsive-ui';
14
 import { ASPECT_RATIO_NARROW } from '../../base/responsive-ui';
223
             const now = Date.now();
223
             const now = Date.now();
224
 
224
 
225
             for (const event of _eventList) {
225
             for (const event of _eventList) {
226
-                if (event.url !== _currentConferenceURL) {
226
+                const eventUrl = getURLWithoutParamsNormalized(
227
+                    new URL(event.url)
228
+                );
229
+
230
+                if (eventUrl !== _currentConferenceURL) {
227
                     if ((!eventToShow
231
                     if ((!eventToShow
228
                         && event.startDate > now
232
                         && event.startDate > now
229
                         && event.startDate < now + ALERT_MILLISECONDS)
233
                         && event.startDate < now + ALERT_MILLISECONDS)
275
     return {
279
     return {
276
         _aspectRatio: state['features/base/responsive-ui'].aspectRatio,
280
         _aspectRatio: state['features/base/responsive-ui'].aspectRatio,
277
         _currentConferenceURL:
281
         _currentConferenceURL:
278
-            locationURL ? getURLWithoutParams(locationURL)._url : '',
282
+            locationURL
283
+                ? getURLWithoutParamsNormalized(locationURL) : '',
279
         _eventList: state['features/calendar-sync'].events
284
         _eventList: state['features/calendar-sync'].events
280
     };
285
     };
281
 }
286
 }

Loading…
取消
儲存