mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-03 04:31:46 +02:00
show rate app message instead of dialog
This commit is contained in:
@@ -43,6 +43,7 @@ import Paragraph from '../Typography/Paragraph';
|
||||
import {checkVersion} from 'react-native-check-version';
|
||||
import {Placeholder, SvgToPngView} from '../ListPlaceholders';
|
||||
import {Update} from '../Update';
|
||||
import {setRateAppMessage} from '../../services/Message';
|
||||
|
||||
let passwordValue = null;
|
||||
let didVerifyUser = false;
|
||||
@@ -126,7 +127,7 @@ const AppLoader = ({onLoad}) => {
|
||||
presentSheet({
|
||||
noIcon: true,
|
||||
noProgess: true,
|
||||
component:(ref) => <Update version={version} fwdRef={ref} />
|
||||
component: ref => <Update version={version} fwdRef={ref} />
|
||||
});
|
||||
|
||||
return true;
|
||||
@@ -161,7 +162,9 @@ const AppLoader = ({onLoad}) => {
|
||||
if (askForRating !== 'never' || askForRating !== 'completed') {
|
||||
askForRating = JSON.parse(askForRating);
|
||||
if (askForRating?.timestamp < Date.now()) {
|
||||
eSendEvent(eOpenRateDialog);
|
||||
if (!useMessageStore.getState().message.visible) {
|
||||
setRateAppMessage();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@ import {Button} from '../Button';
|
||||
import Seperator from '../Seperator';
|
||||
import Heading from '../Typography/Heading';
|
||||
import Paragraph from '../Typography/Paragraph';
|
||||
import { STORE_LINK } from '../../utils';
|
||||
import {STORE_LINK} from '../../utils';
|
||||
import {clearMessage} from '../../services/Message';
|
||||
|
||||
const RateDialog = () => {
|
||||
const [visible, setVisible] = useState(false);
|
||||
@@ -49,6 +50,7 @@ const RateDialog = () => {
|
||||
})
|
||||
);
|
||||
setVisible(false);
|
||||
clearMessage();
|
||||
}}>
|
||||
<View
|
||||
style={{
|
||||
@@ -68,6 +70,7 @@ const RateDialog = () => {
|
||||
await Linking.openURL(STORE_LINK);
|
||||
await MMKV.setItem('askForRating', 'completed');
|
||||
setVisible(false);
|
||||
clearMessage();
|
||||
}}
|
||||
fontSize={SIZE.md}
|
||||
width="100%"
|
||||
@@ -88,6 +91,7 @@ const RateDialog = () => {
|
||||
onPress={async () => {
|
||||
await MMKV.setItem('askForRating', 'never');
|
||||
setVisible(false);
|
||||
clearMessage();
|
||||
}}
|
||||
fontSize={SIZE.md}
|
||||
type="error"
|
||||
@@ -104,6 +108,7 @@ const RateDialog = () => {
|
||||
})
|
||||
);
|
||||
setVisible(false);
|
||||
clearMessage();
|
||||
}}
|
||||
fontSize={SIZE.md}
|
||||
width="48%"
|
||||
|
||||
@@ -1,9 +1,32 @@
|
||||
import {useMessageStore} from '../provider/stores';
|
||||
import {eOpenLoginDialog, eOpenRecoveryKeyDialog} from '../utils/Events';
|
||||
import {
|
||||
eOpenLoginDialog,
|
||||
eOpenRateDialog,
|
||||
eOpenRecoveryKeyDialog
|
||||
} from '../utils/Events';
|
||||
import {eSendEvent} from './EventManager';
|
||||
import PremiumService from './PremiumService';
|
||||
import {verifyUser} from '../views/Settings/functions';
|
||||
import {MMKV} from '../utils/mmkv';
|
||||
import {Platform} from 'react-native';
|
||||
|
||||
const rateAppMessage = {
|
||||
visible: true,
|
||||
message: 'We would love to know what you think',
|
||||
actionText:
|
||||
'Rate Notesnook on ' +
|
||||
`${Platform.OS === 'ios' ? 'App store' : 'Play store'}`,
|
||||
onPress: () => {
|
||||
eSendEvent(eOpenRateDialog);
|
||||
},
|
||||
data: {},
|
||||
icon: 'star',
|
||||
type: 'normal'
|
||||
};
|
||||
|
||||
export function setRateAppMessage() {
|
||||
useMessageStore.getState().setMessage(rateAppMessage);
|
||||
}
|
||||
|
||||
const recoveryKeyMessage = {
|
||||
visible: true,
|
||||
|
||||
Reference in New Issue
Block a user