diff --git a/src/assets/phone-holding.png b/src/assets/phone-holding.png new file mode 100644 index 000000000..d5fcb4cf1 Binary files /dev/null and b/src/assets/phone-holding.png differ diff --git a/src/components/actionModal/view/actionModalStyles.ts b/src/components/actionModal/view/actionModalStyles.ts index 69a531deb..ec8af55c0 100644 --- a/src/components/actionModal/view/actionModalStyles.ts +++ b/src/components/actionModal/view/actionModalStyles.ts @@ -29,7 +29,7 @@ export default EStyleSheet.create({ imageStyle:{ marginTop:8, height:150, - width:150, + width:'100%', } as ImageStyle, textContainer:{ diff --git a/src/components/actionModal/view/actionModalView.tsx b/src/components/actionModal/view/actionModalView.tsx index 9f2a14569..674668870 100644 --- a/src/components/actionModal/view/actionModalView.tsx +++ b/src/components/actionModal/view/actionModalView.tsx @@ -60,7 +60,10 @@ const ActionModalView = ({onClose, data}: ActionModalViewProps, ref) => { {title} - {body} + {!!body && ( + {body} + )} + diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index 5f6d8271a..e83ae416f 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -411,7 +411,11 @@ "something_wrong_alt": "Meanwhile, try Ecency.com from your Browser", "something_wrong_reload": "Try again?", "can_not_be_empty": "Title and body can not be empty!", - "wrong_filter_count":"Please select 3 filters" + "wrong_filter_count":"Please select 3 filters", + "update_available_title":"Update available v{version}", + "update_available_body":"Using latest version of Ecency gives you the best experience", + "update": "Update Now", + "remind_later": "Remind Later" }, "post": { "reblog_alert": "Are you sure, you want to reblog?", diff --git a/src/screens/application/container/applicationContainer.js b/src/screens/application/container/applicationContainer.js index 4ef977fba..020312385 100644 --- a/src/screens/application/container/applicationContainer.js +++ b/src/screens/application/container/applicationContainer.js @@ -87,6 +87,7 @@ import { hideActionModal, setAvatarCacheStamp, setRcOffer, + showActionModal, toastNotification, updateActiveBottomTab, } from '../../../redux/actions/uiAction'; @@ -176,8 +177,6 @@ class ApplicationContainer extends Component { } }); - this._compareRemoteVersion(); - ReceiveSharingIntent.getReceivedFiles( () => { navigate({ @@ -354,11 +353,28 @@ class ApplicationContainer extends Component { } }; - _compareRemoteVersion = async () => { + _compareAndPromptForUpdate = async () => { + const { dispatch, intl } = this.props; const remoteVersion = await fetchLatestAppVersion(); if (remoteVersion !== VersionNumber.appVersion) { - Alert.alert('Update app version: ' + remoteVersion + '-----' + VersionNumber.appVersion); + dispatch( + showActionModal( + intl.formatMessage({ id: 'alert.update_available_title' }, { version: remoteVersion }), + intl.formatMessage({ id: 'alert.update_available_body' }), + [ + { + text: intl.formatMessage({ id: 'alert.remind_later' }), + onPress: () => {}, + }, + { + text: intl.formatMessage({ id: 'alert.update' }), + onPress: () => {}, + }, + ], + require('../../../assets/phone-holding.png'), + ), + ); } }; @@ -416,7 +432,8 @@ class ApplicationContainer extends Component { isReady: true, }); this._refreshGlobalProps(); - this._getUserDataFromRealm(); + await this._getUserDataFromRealm(); + this._compareAndPromptForUpdate(); }; _pushNavigate = (notification) => {