mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-03 11:40:44 +03:00
linked up 48 hour ignore support
This commit is contained in:
parent
05591b632f
commit
0d09103663
@ -310,6 +310,31 @@ export const getTheme = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
export const getLastUpdateCheck = async (lastUpdateCheck) => {
|
||||
try {
|
||||
const setting = await getItemFromStorage(SETTINGS_SCHEMA);
|
||||
if (setting) {
|
||||
return setting.lastUpdateCheck - 48 * 3600 * 1000;
|
||||
}
|
||||
return false;
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
};
|
||||
|
||||
export const setLastUpdateCheck = async (lastUpdateCheck) => {
|
||||
try {
|
||||
const setting = await getItemFromStorage(SETTINGS_SCHEMA);
|
||||
|
||||
setting.lastUpdateCheck = lastUpdateCheck;
|
||||
await setItemToStorage(SETTINGS_SCHEMA, setting);
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
return error;
|
||||
}
|
||||
};
|
||||
|
||||
export const setDefaultFooter = async (isDefaultFooter) => {
|
||||
try {
|
||||
const setting = await getItemFromStorage(SETTINGS_SCHEMA);
|
||||
@ -527,6 +552,7 @@ export const getSettings = async () => {
|
||||
reblogNotification: true,
|
||||
transfersNotification: true,
|
||||
isPinCodeOpen: false,
|
||||
lastUpdateCheck: null,
|
||||
};
|
||||
await setItemToStorage(SETTINGS_SCHEMA, settingData);
|
||||
return settingData;
|
||||
|
@ -37,6 +37,8 @@ import {
|
||||
setExistUser,
|
||||
getVersionForWelcomeModal,
|
||||
setVersionForWelcomeModal,
|
||||
getLastUpdateCheck,
|
||||
setLastUpdateCheck,
|
||||
} from '../../../realm/realm';
|
||||
import { getUser, getPost, getDigitPinCode } from '../../../providers/hive/dhive';
|
||||
import {
|
||||
@ -104,6 +106,7 @@ import darkTheme from '../../../themes/darkTheme';
|
||||
import lightTheme from '../../../themes/lightTheme';
|
||||
import persistAccountGenerator from '../../../utils/persistAccountGenerator';
|
||||
import parseVersionNumber from '../../../utils/parseVersionNumber';
|
||||
import { getTimeFromNow } from '../../../utils/time';
|
||||
|
||||
// Workaround
|
||||
let previousAppState = 'background';
|
||||
@ -354,7 +357,18 @@ class ApplicationContainer extends Component {
|
||||
};
|
||||
|
||||
_compareAndPromptForUpdate = async () => {
|
||||
const recheckInterval = 48 * 3600 * 1000; //2 days
|
||||
const { dispatch, intl } = this.props;
|
||||
|
||||
const lastUpdateCheck = await getLastUpdateCheck();
|
||||
|
||||
if (lastUpdateCheck) {
|
||||
const timeDiff = new Date().getTime() - lastUpdateCheck;
|
||||
if (timeDiff < recheckInterval) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const remoteVersion = await fetchLatestAppVersion();
|
||||
|
||||
if (remoteVersion !== VersionNumber.appVersion) {
|
||||
@ -365,11 +379,21 @@ class ApplicationContainer extends Component {
|
||||
[
|
||||
{
|
||||
text: intl.formatMessage({ id: 'alert.remind_later' }),
|
||||
onPress: () => {},
|
||||
onPress: () => {
|
||||
setLastUpdateCheck(new Date().getTime());
|
||||
},
|
||||
},
|
||||
{
|
||||
text: intl.formatMessage({ id: 'alert.update' }),
|
||||
onPress: () => {},
|
||||
onPress: () => {
|
||||
setLastUpdateCheck(null);
|
||||
Linking.openURL(
|
||||
Platform.select({
|
||||
ios: 'itms-apps://itunes.apple.com/us/app/apple-store/id1451896376?mt=8',
|
||||
android: 'market://details?id=app.esteem.mobile.android',
|
||||
}),
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
require('../../../assets/phone-holding.png'),
|
||||
@ -1015,6 +1039,7 @@ export default connect(
|
||||
api: state.application.api,
|
||||
isGlobalRenderRequired: state.application.isRenderRequired,
|
||||
isAnalytics: state.application.isAnalytics,
|
||||
lastUpdateCheck: state.application.lastUpdateCheck,
|
||||
|
||||
// Account
|
||||
unreadActivityCount: state.account.currentAccount.unread_activity_count,
|
||||
|
Loading…
Reference in New Issue
Block a user