소스 검색

[RN] Only ask for calendar permission on user interaction

master
Bettenbuk Zoltan 7 년 전
부모
커밋
961e1d611f

+ 6
- 4
react/features/base/react/components/native/AbstractPagedList.js 파일 보기

82
      * @inheritdoc
82
      * @inheritdoc
83
      */
83
      */
84
     componentDidMount() {
84
     componentDidMount() {
85
-        this._maybeRefreshSelectedPage();
85
+        this._maybeRefreshSelectedPage(false);
86
     }
86
     }
87
 
87
 
88
     /**
88
     /**
118
         );
118
         );
119
     }
119
     }
120
 
120
 
121
-    _maybeRefreshSelectedPage: () => void;
121
+    _maybeRefreshSelectedPage: ?boolean => void;
122
 
122
 
123
     /**
123
     /**
124
      * Components that this PagedList displays may have a refresh function to
124
      * Components that this PagedList displays may have a refresh function to
126
      * function invokes this logic if it's present.
126
      * function invokes this logic if it's present.
127
      *
127
      *
128
      * @private
128
      * @private
129
+     * @param {boolean} isInteractive - If true this refresh was caused by
130
+     * direct user interaction, false otherwise.
129
      * @returns {void}
131
      * @returns {void}
130
      */
132
      */
131
-    _maybeRefreshSelectedPage() {
133
+    _maybeRefreshSelectedPage(isInteractive: boolean = true) {
132
         const selectedPage = this.props.pages[this.state.pageIndex];
134
         const selectedPage = this.props.pages[this.state.pageIndex];
133
         let component;
135
         let component;
134
 
136
 
136
             const { refresh } = component;
138
             const { refresh } = component;
137
 
139
 
138
             typeof refresh === 'function'
140
             typeof refresh === 'function'
139
-                && refresh.call(component, this.props.dispatch);
141
+                && refresh.call(component, this.props.dispatch, isInteractive);
140
         }
142
         }
141
     }
143
     }
142
 
144
 

+ 2
- 1
react/features/calendar-sync/actionTypes.js 파일 보기

5
  *
5
  *
6
  * {
6
  * {
7
  *     type: REFRESH_CALENDAR,
7
  *     type: REFRESH_CALENDAR,
8
- *     forcePermission: boolean
8
+ *     forcePermission: boolean,
9
+ *     isInteractive: boolean
9
  * }
10
  * }
10
  */
11
  */
11
 export const REFRESH_CALENDAR = Symbol('REFRESH_CALENDAR');
12
 export const REFRESH_CALENDAR = Symbol('REFRESH_CALENDAR');

+ 9
- 4
react/features/calendar-sync/actions.js 파일 보기

9
 /**
9
 /**
10
  * Sends an action to refresh the entry list (fetches new data).
10
  * Sends an action to refresh the entry list (fetches new data).
11
  *
11
  *
12
- * @param {boolean|undefined} forcePermission - Whether to force to re-ask for
12
+ * @param {boolean} forcePermission - Whether to force to re-ask for
13
  * the permission or not.
13
  * the permission or not.
14
+ * @param {boolean} isInteractive - If true this refresh was caused by
15
+ * direct user interaction, false otherwise.
14
  * @returns {{
16
  * @returns {{
15
  *     type: REFRESH_CALENDAR,
17
  *     type: REFRESH_CALENDAR,
16
- *     forcePermission: boolean
18
+ *     forcePermission: boolean,
19
+ *     isInteractive: boolean
17
  * }}
20
  * }}
18
  */
21
  */
19
-export function refreshCalendar(forcePermission: boolean = false) {
22
+export function refreshCalendar(
23
+        forcePermission: boolean = false, isInteractive: boolean = true) {
20
     return {
24
     return {
21
         type: REFRESH_CALENDAR,
25
         type: REFRESH_CALENDAR,
22
-        forcePermission
26
+        forcePermission,
27
+        isInteractive
23
     };
28
     };
24
 }
29
 }
25
 
30
 

+ 4
- 2
react/features/calendar-sync/components/MeetingList.native.js 파일 보기

65
      * change).
65
      * change).
66
      *
66
      *
67
      * @param {Function} dispatch - The Redux dispatch function.
67
      * @param {Function} dispatch - The Redux dispatch function.
68
+     * @param {boolean} isInteractive - If true this refresh was caused by
69
+     * direct user interaction, false otherwise.
68
      * @public
70
      * @public
69
      * @returns {void}
71
      * @returns {void}
70
      */
72
      */
71
-    static refresh(dispatch) {
72
-        dispatch(refreshCalendar());
73
+    static refresh(dispatch, isInteractive) {
74
+        dispatch(refreshCalendar(false, isInteractive));
73
     }
75
     }
74
 
76
 
75
     /**
77
     /**

+ 2
- 1
react/features/calendar-sync/middleware.js 파일 보기

75
         case REFRESH_CALENDAR: {
75
         case REFRESH_CALENDAR: {
76
             const result = next(action);
76
             const result = next(action);
77
 
77
 
78
-            _fetchCalendarEntries(store, true, action.forcePermission);
78
+            _fetchCalendarEntries(
79
+                store, action.isInteractive, action.forcePermission);
79
 
80
 
80
             return result;
81
             return result;
81
         }
82
         }

Loading…
취소
저장