|
@@ -1,5 +1,6 @@
|
1
|
1
|
// @flow
|
2
|
2
|
|
|
3
|
+import { NativeModules } from 'react-native';
|
3
|
4
|
import RNCalendarEvents from 'react-native-calendar-events';
|
4
|
5
|
|
5
|
6
|
import { APP_WILL_MOUNT } from '../app';
|
|
@@ -123,6 +124,11 @@ function _fetchCalendarEntries(
|
123
|
124
|
{ dispatch, getState },
|
124
|
125
|
maybePromptForPermission,
|
125
|
126
|
forcePermission) {
|
|
127
|
+ if (!_isCalendarEnabled()) {
|
|
128
|
+ // The calendar feature is not enabled.
|
|
129
|
+ return;
|
|
130
|
+ }
|
|
131
|
+
|
126
|
132
|
const state = getState()['features/calendar-sync'];
|
127
|
133
|
const promptForPermission
|
128
|
134
|
= (maybePromptForPermission && !state.authorization)
|
|
@@ -194,6 +200,20 @@ function _getURLFromEvent(event, knownDomains) {
|
194
|
200
|
return null;
|
195
|
201
|
}
|
196
|
202
|
|
|
203
|
+/**
|
|
204
|
+ * Determines whether the calendar feature is enabled by the app. For
|
|
205
|
+ * example, Apple through its App Store requires NSCalendarsUsageDescription in
|
|
206
|
+ * the app's Info.plist or App Store rejects the app.
|
|
207
|
+ *
|
|
208
|
+ * @returns {boolean} If the app has enabled the calendar feature, {@code true};
|
|
209
|
+ * otherwise, {@code false}.
|
|
210
|
+ */
|
|
211
|
+export function _isCalendarEnabled() {
|
|
212
|
+ const { calendarEnabled } = NativeModules.AppInfo;
|
|
213
|
+
|
|
214
|
+ return typeof calendarEnabled === 'undefined' ? true : calendarEnabled;
|
|
215
|
+}
|
|
216
|
+
|
197
|
217
|
/**
|
198
|
218
|
* Retreives the domain name of a room upon join and stores it in the known
|
199
|
219
|
* domain list, if not present yet.
|