[RN] Only ask for calendar permission on user interaction

pull/3234/head jitsi-meet_3213
Bettenbuk Zoltan 6 years ago committed by Saúl Ibarra Corretgé
parent bd449be20d
commit 961e1d611f
  1. 10
      react/features/base/react/components/native/AbstractPagedList.js
  2. 3
      react/features/calendar-sync/actionTypes.js
  3. 13
      react/features/calendar-sync/actions.js
  4. 6
      react/features/calendar-sync/components/MeetingList.native.js
  5. 3
      react/features/calendar-sync/middleware.js

@ -82,7 +82,7 @@ export default class AbstractPagedList extends Component<Props, State> {
* @inheritdoc
*/
componentDidMount() {
this._maybeRefreshSelectedPage();
this._maybeRefreshSelectedPage(false);
}
/**
@ -118,7 +118,7 @@ export default class AbstractPagedList extends Component<Props, State> {
);
}
_maybeRefreshSelectedPage: () => void;
_maybeRefreshSelectedPage: ?boolean => void;
/**
* Components that this PagedList displays may have a refresh function to
@ -126,9 +126,11 @@ export default class AbstractPagedList extends Component<Props, State> {
* function invokes this logic if it's present.
*
* @private
* @param {boolean} isInteractive - If true this refresh was caused by
* direct user interaction, false otherwise.
* @returns {void}
*/
_maybeRefreshSelectedPage() {
_maybeRefreshSelectedPage(isInteractive: boolean = true) {
const selectedPage = this.props.pages[this.state.pageIndex];
let component;
@ -136,7 +138,7 @@ export default class AbstractPagedList extends Component<Props, State> {
const { refresh } = component;
typeof refresh === 'function'
&& refresh.call(component, this.props.dispatch);
&& refresh.call(component, this.props.dispatch, isInteractive);
}
}

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

@ -9,17 +9,22 @@ import {
/**
* Sends an action to refresh the entry list (fetches new data).
*
* @param {boolean|undefined} forcePermission - Whether to force to re-ask for
* @param {boolean} forcePermission - Whether to force to re-ask for
* the permission or not.
* @param {boolean} isInteractive - If true this refresh was caused by
* direct user interaction, false otherwise.
* @returns {{
* type: REFRESH_CALENDAR,
* forcePermission: boolean
* forcePermission: boolean,
* isInteractive: boolean
* }}
*/
export function refreshCalendar(forcePermission: boolean = false) {
export function refreshCalendar(
forcePermission: boolean = false, isInteractive: boolean = true) {
return {
type: REFRESH_CALENDAR,
forcePermission
forcePermission,
isInteractive
};
}

@ -65,11 +65,13 @@ class MeetingList extends Component<Props> {
* change).
*
* @param {Function} dispatch - The Redux dispatch function.
* @param {boolean} isInteractive - If true this refresh was caused by
* direct user interaction, false otherwise.
* @public
* @returns {void}
*/
static refresh(dispatch) {
dispatch(refreshCalendar());
static refresh(dispatch, isInteractive) {
dispatch(refreshCalendar(false, isInteractive));
}
/**

@ -75,7 +75,8 @@ CALENDAR_ENABLED
case REFRESH_CALENDAR: {
const result = next(action);
_fetchCalendarEntries(store, true, action.forcePermission);
_fetchCalendarEntries(
store, action.isInteractive, action.forcePermission);
return result;
}

Loading…
Cancel
Save