[RN] Only ask for calendar permission on user interaction
This commit is contained in:
parent
bd449be20d
commit
961e1d611f
@ -82,7 +82,7 @@ export default class AbstractPagedList extends Component<Props, State> {
|
|||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
componentDidMount() {
|
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
|
* 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.
|
* function invokes this logic if it's present.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
|
* @param {boolean} isInteractive - If true this refresh was caused by
|
||||||
|
* direct user interaction, false otherwise.
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
_maybeRefreshSelectedPage() {
|
_maybeRefreshSelectedPage(isInteractive: boolean = true) {
|
||||||
const selectedPage = this.props.pages[this.state.pageIndex];
|
const selectedPage = this.props.pages[this.state.pageIndex];
|
||||||
let component;
|
let component;
|
||||||
|
|
||||||
@ -136,7 +138,7 @@ export default class AbstractPagedList extends Component<Props, State> {
|
|||||||
const { refresh } = component;
|
const { refresh } = component;
|
||||||
|
|
||||||
typeof refresh === 'function'
|
typeof refresh === 'function'
|
||||||
&& refresh.call(component, this.props.dispatch);
|
&& refresh.call(component, this.props.dispatch, isInteractive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,8 @@
|
|||||||
*
|
*
|
||||||
* {
|
* {
|
||||||
* type: REFRESH_CALENDAR,
|
* type: REFRESH_CALENDAR,
|
||||||
* forcePermission: boolean
|
* forcePermission: boolean,
|
||||||
|
* isInteractive: boolean
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const REFRESH_CALENDAR = Symbol('REFRESH_CALENDAR');
|
export const REFRESH_CALENDAR = Symbol('REFRESH_CALENDAR');
|
||||||
|
|||||||
@ -9,17 +9,22 @@ import {
|
|||||||
/**
|
/**
|
||||||
* Sends an action to refresh the entry list (fetches new data).
|
* 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.
|
* the permission or not.
|
||||||
|
* @param {boolean} isInteractive - If true this refresh was caused by
|
||||||
|
* direct user interaction, false otherwise.
|
||||||
* @returns {{
|
* @returns {{
|
||||||
* type: REFRESH_CALENDAR,
|
* 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 {
|
return {
|
||||||
type: REFRESH_CALENDAR,
|
type: REFRESH_CALENDAR,
|
||||||
forcePermission
|
forcePermission,
|
||||||
|
isInteractive
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -65,11 +65,13 @@ class MeetingList extends Component<Props> {
|
|||||||
* change).
|
* change).
|
||||||
*
|
*
|
||||||
* @param {Function} dispatch - The Redux dispatch function.
|
* @param {Function} dispatch - The Redux dispatch function.
|
||||||
|
* @param {boolean} isInteractive - If true this refresh was caused by
|
||||||
|
* direct user interaction, false otherwise.
|
||||||
* @public
|
* @public
|
||||||
* @returns {void}
|
* @returns {void}
|
||||||
*/
|
*/
|
||||||
static refresh(dispatch) {
|
static refresh(dispatch, isInteractive) {
|
||||||
dispatch(refreshCalendar());
|
dispatch(refreshCalendar(false, isInteractive));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -75,7 +75,8 @@ CALENDAR_ENABLED
|
|||||||
case REFRESH_CALENDAR: {
|
case REFRESH_CALENDAR: {
|
||||||
const result = next(action);
|
const result = next(action);
|
||||||
|
|
||||||
_fetchCalendarEntries(store, true, action.forcePermission);
|
_fetchCalendarEntries(
|
||||||
|
store, action.isInteractive, action.forcePermission);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user