From c4e3f08c82e624ff85a5fa0a3a5e6b36c404487f Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Mon, 28 Jan 2019 12:48:07 -0300 Subject: [PATCH] MM-13846 Alert boxes to follow UX Guidelines (#2525) --- app/components/attachment_button.js | 14 +++++++------- app/screens/terms_of_service/terms_of_service.js | 9 +++++---- app/utils/status.js | 1 + 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/components/attachment_button.js b/app/components/attachment_button.js index bc1a1d33b..4f39b0a2f 100644 --- a/app/components/attachment_button.js +++ b/app/components/attachment_button.js @@ -61,10 +61,10 @@ export default class AttachmentButton extends PureComponent { }; attachPhotoFromCamera = () => { - return this.attachFileFromCamera('photo'); + return this.attachFileFromCamera('photo', 'camera'); }; - attachFileFromCamera = async (mediaType) => { + attachFileFromCamera = async (mediaType, source) => { const {formatMessage} = this.context.intl; const options = { quality: 0.8, @@ -92,7 +92,7 @@ export default class AttachmentButton extends PureComponent { }, }; - const hasPhotoPermission = await this.hasPhotoPermission(); + const hasPhotoPermission = await this.hasPhotoPermission(source); if (hasPhotoPermission) { ImagePicker.launchCamera(options, (response) => { @@ -141,7 +141,7 @@ export default class AttachmentButton extends PureComponent { }; attachVideoFromCamera = () => { - return this.attachFileFromCamera('video'); + return this.attachFileFromCamera('video', 'camera'); }; attachVideoFromLibraryAndroid = () => { @@ -206,11 +206,11 @@ export default class AttachmentButton extends PureComponent { } }; - hasPhotoPermission = async () => { + hasPhotoPermission = async (source) => { if (Platform.OS === 'ios') { const {formatMessage} = this.context.intl; let permissionRequest; - const hasPermissionToStorage = await Permissions.check('photo'); + const hasPermissionToStorage = await Permissions.check(source || 'photo'); switch (hasPermissionToStorage) { case PermissionTypes.UNDETERMINED: @@ -295,13 +295,13 @@ export default class AttachmentButton extends PureComponent { defaultMessage: 'To upload images from your Android device, please change your permission settings.', }), [ - grantOption, { text: formatMessage({ id: 'mobile.android.permission_denied_dismiss', defaultMessage: 'Dismiss', }), }, + grantOption, ] ); return false; diff --git a/app/screens/terms_of_service/terms_of_service.js b/app/screens/terms_of_service/terms_of_service.js index 543db1fc9..f6dd2ba13 100644 --- a/app/screens/terms_of_service/terms_of_service.js +++ b/app/screens/terms_of_service/terms_of_service.js @@ -186,7 +186,7 @@ export default class TermsOfService extends PureComponent { siteName, }), [{ - text: intl.formatMessage({id: 'mobile.terms_of_service.alert_ok', defaultMessage: 'Ok'}), + text: intl.formatMessage({id: 'mobile.terms_of_service.alert_ok', defaultMessage: 'OK'}), onPress: this.closeTermsAndLogout, }], ); @@ -221,11 +221,12 @@ export default class TermsOfService extends PureComponent { defaultMessage: 'Unable to complete the request. If this issue persists, contact your System Administrator.', }), [{ + text: intl.formatMessage({id: 'mobile.terms_of_service.alert_cancel', defaultMessage: 'Cancel'}), + style: 'cancel', + onPress: this.closeTermsAndLogout, + }, { text: intl.formatMessage({id: 'mobile.terms_of_service.alert_retry', defaultMessage: 'Try Again'}), onPress: retry, - }, { - text: intl.formatMessage({id: 'mobile.terms_of_service.alert_cancel', defaultMessage: 'Cancel'}), - onPress: this.closeTermsAndLogout, }], ); } diff --git a/app/utils/status.js b/app/utils/status.js index b295461b8..89f211c29 100644 --- a/app/utils/status.js +++ b/app/utils/status.js @@ -39,6 +39,7 @@ export function confirmOutOfOfficeDisabled(intl, status, updateStatus) { }, {status: translatedStatus}), [{ text: intl.formatMessage({id: 'mobile.reset_status.alert_cancel', defaultMessage: 'Cancel'}), + style: 'cancel', }, { text: intl.formatMessage({id: 'mobile.reset_status.alert_ok', defaultMessage: 'OK'}), onPress: () => updateStatus(status),