mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 15:09:33 +01:00
fix all actionsheet dialogs on tablet
This commit is contained in:
@@ -283,23 +283,22 @@ const setTheme = function () {
|
|||||||
|
|
||||||
#titleInput {
|
#titleInput {
|
||||||
color:${pageTheme.colors.pri};
|
color:${pageTheme.colors.pri};
|
||||||
font-size:${32 * 1.5 * pageTheme.colors.factor};
|
font-size:${32 * 1 * pageTheme.colors.factor};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#textCopy {
|
#textCopy {
|
||||||
color:${pageTheme.colors.pri};
|
color:${pageTheme.colors.pri};
|
||||||
font-size:${32 * 1.5 * pageTheme.colors.factor};
|
font-size:${32 * pageTheme.colors.factor};
|
||||||
|
min-height: ${32 * pageTheme.colors.factor + 6};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#titleInput::-webkit-input-placeholder {
|
#titleInput::-webkit-input-placeholder {
|
||||||
color:${pageTheme.colors.icon}
|
color:${pageTheme.colors.icon}
|
||||||
}
|
}
|
||||||
|
|
||||||
#titlebar {
|
|
||||||
background-color:${pageTheme.colors.shade};
|
|
||||||
}
|
|
||||||
|
|
||||||
.ql-picker-options {
|
.ql-picker-options {
|
||||||
background-color: ${pageTheme.colors.nav};
|
background-color: ${pageTheme.colors.nav};
|
||||||
@@ -368,11 +367,7 @@ const setTheme = function () {
|
|||||||
font-family: 'Poppins', sans-serif;
|
font-family: 'Poppins', sans-serif;
|
||||||
margin: 0px;
|
margin: 0px;
|
||||||
position: relative;
|
position: relative;
|
||||||
height:${
|
height:calc(100% - 115px) !important
|
||||||
isTablet
|
|
||||||
? 'calc(100% - 260px) !important'
|
|
||||||
: 'calc(100% - 110px) !important'
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -84,7 +84,7 @@
|
|||||||
</body>
|
</body>
|
||||||
<script>
|
<script>
|
||||||
let editor;
|
let editor;
|
||||||
let isTablet = false;
|
let isTablet = true;
|
||||||
</script>
|
</script>
|
||||||
<script src="quill.js"></script>
|
<script src="quill.js"></script>
|
||||||
<script src="constants.js"></script>
|
<script src="constants.js"></script>
|
||||||
@@ -472,8 +472,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
attachMessageListener();
|
attachMessageListener();
|
||||||
function loadAction(premium, tab) {
|
function loadAction(premium) {
|
||||||
isTablet = tab;
|
isTablet = true;
|
||||||
let titleIn = document.getElementById('titlebar');
|
let titleIn = document.getElementById('titlebar');
|
||||||
titleIn.style['padding-left'] = 0;
|
titleIn.style['padding-left'] = 0;
|
||||||
titleIn.style['padding-right'] = 0;
|
titleIn.style['padding-right'] = 0;
|
||||||
@@ -565,6 +565,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadAction(true)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
@@ -72,9 +72,25 @@ function onTitleChange(ele) {
|
|||||||
|
|
||||||
function autosize() {
|
function autosize() {
|
||||||
if (isTablet) {
|
if (isTablet) {
|
||||||
document.getElementById('textCopy').innerHTML = document
|
let ele = document.getElementById('textCopy');
|
||||||
|
ele.innerHTML = document
|
||||||
.getElementById(titleInput)
|
.getElementById(titleInput)
|
||||||
.value.replace(/\n/g, '<br/>');
|
.value.replace(/\n/g, '<br/>');
|
||||||
|
console.log(document.getElementById('titlebar').scrollHeight);
|
||||||
|
let newHeight = document.getElementById('titlebar').scrollHeight;
|
||||||
|
let css = document.createElement('style');
|
||||||
|
css.type = 'text/css';
|
||||||
|
let node = `
|
||||||
|
.ql-container {
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-family: 'Poppins', sans-serif;
|
||||||
|
margin: 0px;
|
||||||
|
position: relative;
|
||||||
|
height:calc(100% - ${newHeight + 65}px) !important
|
||||||
|
};
|
||||||
|
`;
|
||||||
|
css.appendChild(document.createTextNode(node));
|
||||||
|
document.getElementsByTagName('head')[0].appendChild(css);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,14 +212,12 @@ function attachMessageListener() {
|
|||||||
if (range.length == 0) {
|
if (range.length == 0) {
|
||||||
let correction = isTablet ? 265 : 110;
|
let correction = isTablet ? 265 : 110;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
document
|
document.querySelector('.app-main').scrollTo({
|
||||||
.querySelector('.app-main')
|
top:
|
||||||
.scrollTo({
|
editor.getBounds(editor.getSelection().index).bottom -
|
||||||
top:
|
(window.innerHeight - correction),
|
||||||
editor.getBounds(editor.getSelection().index).bottom -
|
behavior: 'smooth',
|
||||||
(window.innerHeight - correction),
|
});
|
||||||
behavior: 'smooth',
|
|
||||||
});
|
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@
|
|||||||
outline: none;
|
outline: none;
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
padding: 12px 12px;
|
padding: 12px 12px;
|
||||||
|
padding-top: 0px;
|
||||||
tab-size: 4;
|
tab-size: 4;
|
||||||
-moz-tab-size: 4;
|
-moz-tab-size: 4;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
@@ -1103,7 +1104,7 @@
|
|||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
padding-left: 12px;
|
padding-left: 12px;
|
||||||
padding-right: 12px;
|
padding-right: 12px;
|
||||||
min-height: 195px;
|
min-height: 60px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: flex-end;
|
justify-content: flex-end;
|
||||||
@@ -1128,9 +1129,12 @@
|
|||||||
font-weight: 600 !important;
|
font-weight: 600 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#titleInput {
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
#formBox > div {
|
#formBox > div {
|
||||||
visibility: hidden;
|
visibility: hidden;
|
||||||
min-height: 60px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.info-bar {
|
.info-bar {
|
||||||
|
|||||||
@@ -170,8 +170,10 @@ const AppStack = React.memo(
|
|||||||
let size = event?.nativeEvent?.layout;
|
let size = event?.nativeEvent?.layout;
|
||||||
updatedDimensions = size;
|
updatedDimensions = size;
|
||||||
if (!size || (size.width === dimensions.width && mode !== null)) {
|
if (!size || (size.width === dimensions.width && mode !== null)) {
|
||||||
|
console.log(mode);
|
||||||
|
DDS.setSize(size);
|
||||||
dispatch({type: Actions.DEVICE_MODE, state: mode});
|
dispatch({type: Actions.DEVICE_MODE, state: mode});
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,9 +190,8 @@ const AppStack = React.memo(
|
|||||||
});
|
});
|
||||||
|
|
||||||
setWidthHeight(size);
|
setWidthHeight(size);
|
||||||
|
console.log(size,"SIZES")
|
||||||
DDS.setSize(size);
|
DDS.setSize(size);
|
||||||
DDS.checkSmallTab(size.width > size.height ? 'LANDSCAPE' : 'PORTRAIT');
|
|
||||||
|
|
||||||
if (DDS.isLargeTablet()) {
|
if (DDS.isLargeTablet()) {
|
||||||
setDeviceMode('tablet', size);
|
setDeviceMode('tablet', size);
|
||||||
} else if (DDS.isSmallTab) {
|
} else if (DDS.isSmallTab) {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export const styles = StyleSheet.create({
|
|||||||
borderRadius: 100,
|
borderRadius: 100,
|
||||||
backgroundColor: '#f0f0f0',
|
backgroundColor: '#f0f0f0',
|
||||||
marginVertical: 5,
|
marginVertical: 5,
|
||||||
marginTop: 10,
|
marginTop: 0,
|
||||||
alignSelf: 'center',
|
alignSelf: 'center',
|
||||||
},
|
},
|
||||||
parentContainer: {
|
parentContainer: {
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {Platform} from 'react-native';
|
||||||
|
import {ScrollView} from 'react-native';
|
||||||
|
import {useTracked} from '../../provider';
|
||||||
|
import {DDS} from '../../services/DeviceDetection';
|
||||||
|
import { hexToRGBA } from '../../utils/ColorUtils';
|
||||||
|
import ActionSheet from '../ActionSheet';
|
||||||
|
import {GetPremium} from './GetPremium';
|
||||||
|
|
||||||
|
const ActionSheetWrapper = ({
|
||||||
|
children,
|
||||||
|
fwdRef,
|
||||||
|
gestureEnabled=true,
|
||||||
|
onClose,
|
||||||
|
onOpen,
|
||||||
|
closeOnTouchBackdrop=true
|
||||||
|
}) => {
|
||||||
|
const [state] = useTracked();
|
||||||
|
const {colors} = state;
|
||||||
|
const largeTablet = DDS.isLargeTablet();
|
||||||
|
|
||||||
|
const style = React.useMemo(() => {
|
||||||
|
return {
|
||||||
|
width: largeTablet ? 500 : '100%',
|
||||||
|
minHeight: largeTablet ? 100 : null,
|
||||||
|
maxHeight: largeTablet ? 500 : '90%',
|
||||||
|
borderTopRightRadius: 10,
|
||||||
|
borderTopLeftRadius: 10,
|
||||||
|
backgroundColor: colors.bg,
|
||||||
|
padding: largeTablet ? 8 : 0,
|
||||||
|
zIndex: 10,
|
||||||
|
paddingVertical: 12,
|
||||||
|
borderBottomRightRadius: largeTablet ? 10 : 1,
|
||||||
|
borderBottomLeftRadius: largeTablet ? 10 : 1,
|
||||||
|
marginBottom: largeTablet ? 50 : 0,
|
||||||
|
alignSelf: 'center',
|
||||||
|
};
|
||||||
|
}, [colors.bg]);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<ActionSheet
|
||||||
|
ref={fwdRef}
|
||||||
|
containerStyle={style}
|
||||||
|
gestureEnabled={gestureEnabled}
|
||||||
|
extraScroll={largeTablet ? 50 : 0}
|
||||||
|
initialOffsetFromBottom={1}
|
||||||
|
closeOnTouchBackdrop={closeOnTouchBackdrop}
|
||||||
|
indicatorColor={
|
||||||
|
Platform.OS === 'ios'
|
||||||
|
? hexToRGBA(colors.accent + '19')
|
||||||
|
: hexToRGBA(colors.shade)
|
||||||
|
}
|
||||||
|
onOpen={onOpen}
|
||||||
|
keyboardShouldPersistTaps="always"
|
||||||
|
premium={
|
||||||
|
<GetPremium
|
||||||
|
context="sheet"
|
||||||
|
close={() => fwdRef?.current?._hideModal()}
|
||||||
|
offset={50}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
onClose={onClose}>
|
||||||
|
{children}
|
||||||
|
</ActionSheet>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default ActionSheetWrapper;
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import React, {useEffect, useState} from 'react';
|
import React, {useEffect, useState} from 'react';
|
||||||
import {Keyboard} from 'react-native';
|
import {Keyboard} from 'react-native';
|
||||||
|
import {ScrollView} from 'react-native';
|
||||||
import {
|
import {
|
||||||
ActivityIndicator,
|
ActivityIndicator,
|
||||||
Clipboard,
|
Clipboard,
|
||||||
@@ -511,7 +512,7 @@ export const ActionSheetComponent = ({
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<ScrollView
|
||||||
onLayout={() => {
|
onLayout={() => {
|
||||||
if (!item.dateDeleted) {
|
if (!item.dateDeleted) {
|
||||||
localRefresh(item.type, true);
|
localRefresh(item.type, true);
|
||||||
@@ -521,6 +522,8 @@ export const ActionSheetComponent = ({
|
|||||||
paddingBottom: 30,
|
paddingBottom: 30,
|
||||||
backgroundColor: colors.bg,
|
backgroundColor: colors.bg,
|
||||||
paddingHorizontal: 0,
|
paddingHorizontal: 0,
|
||||||
|
borderBottomRightRadius:DDS.isLargeTablet()? 10 : 1,
|
||||||
|
borderBottomLeftRadius:DDS.isLargeTablet()? 10 : 1
|
||||||
}}>
|
}}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
style={{
|
style={{
|
||||||
@@ -763,6 +766,6 @@ export const ActionSheetComponent = ({
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
<Toast context="local" />
|
<Toast context="local" />
|
||||||
</View>
|
</ScrollView>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ const DialogHeader = ({icon, title, paragraph, button}) => {
|
|||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
height: 50,
|
height: 50,
|
||||||
}}>
|
}}>
|
||||||
<View>
|
<View
|
||||||
|
style={{
|
||||||
|
width: '100%',
|
||||||
|
}}>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import React, {Component} from 'react';
|
import React, {Component, createRef} from 'react';
|
||||||
import {Platform} from 'react-native';
|
import {Platform} from 'react-native';
|
||||||
import {DDS} from '../../services/DeviceDetection';
|
import {DDS} from '../../services/DeviceDetection';
|
||||||
import {
|
import {
|
||||||
@@ -29,6 +29,7 @@ import {
|
|||||||
} from '../../utils/Events';
|
} from '../../utils/Events';
|
||||||
import ActionSheet from '../ActionSheet';
|
import ActionSheet from '../ActionSheet';
|
||||||
import {ActionSheetComponent} from '../ActionSheetComponent';
|
import {ActionSheetComponent} from '../ActionSheetComponent';
|
||||||
|
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||||
import {GetPremium, translatePrem} from '../ActionSheetComponent/GetPremium';
|
import {GetPremium, translatePrem} from '../ActionSheetComponent/GetPremium';
|
||||||
import {AddNotebookDialog} from '../AddNotebookDialog';
|
import {AddNotebookDialog} from '../AddNotebookDialog';
|
||||||
import {AddTopicDialog} from '../AddTopicDialog';
|
import {AddTopicDialog} from '../AddTopicDialog';
|
||||||
@@ -52,7 +53,7 @@ import {TEMPLATE_DELETE, TEMPLATE_PERMANANT_DELETE} from './Templates';
|
|||||||
export class DialogManager extends Component {
|
export class DialogManager extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.actionSheet;
|
this.actionSheet = createRef();
|
||||||
this.opened = false;
|
this.opened = false;
|
||||||
this.state = {
|
this.state = {
|
||||||
item: {},
|
item: {},
|
||||||
@@ -89,13 +90,13 @@ export class DialogManager extends Component {
|
|||||||
actionSheetVisible: true,
|
actionSheetVisible: true,
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.actionSheet._setModalVisible();
|
this.actionSheet.current?._setModalVisible();
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
_hideActionSheet = () => {
|
_hideActionSheet = () => {
|
||||||
this.actionSheet._setModalVisible(false);
|
this.actionSheet.current?._setModalVisible(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
_showMoveNote = () => {
|
_showMoveNote = () => {
|
||||||
@@ -300,49 +301,12 @@ export class DialogManager extends Component {
|
|||||||
render() {
|
render() {
|
||||||
let {colors} = this.props;
|
let {colors} = this.props;
|
||||||
let {actionSheetData, item, simpleDialog} = this.state;
|
let {actionSheetData, item, simpleDialog} = this.state;
|
||||||
|
console.log(DDS.isLargeTablet())
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{!this.state.actionSheetVisible ? null : (
|
{!this.state.actionSheetVisible ? null : (
|
||||||
<ActionSheet
|
<ActionSheetWrapper
|
||||||
ref={(ref) => (this.actionSheet = ref)}
|
fwdRef={this.actionSheet}
|
||||||
containerStyle={{
|
|
||||||
backgroundColor: colors.bg,
|
|
||||||
width: DDS.isLargeTablet() ? 500 : '100%',
|
|
||||||
alignSelf: 'center',
|
|
||||||
borderRadius: 10,
|
|
||||||
marginBottom: DDS.isLargeTablet() ? 50 : 0,
|
|
||||||
borderBottomRightRadius: DDS.isLargeTablet() ? 10 : 1,
|
|
||||||
borderBottomLeftRadius: DDS.isLargeTablet() ? 10 : 1,
|
|
||||||
}}
|
|
||||||
extraScroll={DDS.isTab ? 50 : 0}
|
|
||||||
indicatorColor={
|
|
||||||
Platform.ios
|
|
||||||
? hexToRGBA(colors.accent + '19')
|
|
||||||
: hexToRGBA(colors.shade)
|
|
||||||
}
|
|
||||||
premium={
|
|
||||||
<GetPremium
|
|
||||||
context="sheet"
|
|
||||||
close={() => this.actionSheet._hideModal()}
|
|
||||||
offset={50}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
keyboardShouldPersistTaps="always"
|
|
||||||
//delayActionSheetDraw={true}
|
|
||||||
//delayActionSheetDrawTime={10}
|
|
||||||
footerAlwaysVisible={DDS.isTab}
|
|
||||||
footerHeight={DDS.isTab ? 20 : 10}
|
|
||||||
footerStyle={
|
|
||||||
DDS.isTab
|
|
||||||
? {
|
|
||||||
borderRadius: 10,
|
|
||||||
backgroundColor: colors.bg,
|
|
||||||
}
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
initialOffsetFromBottom={1}
|
|
||||||
bounceOnOpen={false}
|
|
||||||
gestureEnabled={true}
|
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
translatePrem.setValue(-dWidth * 5);
|
translatePrem.setValue(-dWidth * 5);
|
||||||
this.onActionSheetHide();
|
this.onActionSheetHide();
|
||||||
@@ -369,7 +333,7 @@ export class DialogManager extends Component {
|
|||||||
this.actionSheet._setModalVisible();
|
this.actionSheet._setModalVisible();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</ActionSheet>
|
</ActionSheetWrapper>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Dialog
|
<Dialog
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import {ActivityIndicator, TouchableOpacity, View} from 'react-native';
|
|||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import {Actions} from '../../provider/Actions';
|
import {Actions} from '../../provider/Actions';
|
||||||
|
import {DDS} from '../../services/DeviceDetection';
|
||||||
import {eSendEvent, ToastEvent} from '../../services/EventManager';
|
import {eSendEvent, ToastEvent} from '../../services/EventManager';
|
||||||
import {getElevation, SUBSCRIPTION_STATUS_STRINGS} from '../../utils';
|
import {getElevation, SUBSCRIPTION_STATUS_STRINGS} from '../../utils';
|
||||||
import {db} from '../../utils/DB';
|
import {db} from '../../utils/DB';
|
||||||
@@ -16,7 +17,7 @@ export const UserSection = ({noTextMode}) => {
|
|||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const {colors, syncing, user} = state;
|
const {colors, syncing, user} = state;
|
||||||
|
|
||||||
return user && user.email ? (
|
return !user && !user?.email ? (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
@@ -25,7 +26,7 @@ export const UserSection = ({noTextMode}) => {
|
|||||||
backgroundColor: colors.shade,
|
backgroundColor: colors.shade,
|
||||||
marginTop: 10,
|
marginTop: 10,
|
||||||
}}>
|
}}>
|
||||||
<View
|
{/* <View
|
||||||
style={{
|
style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
@@ -42,7 +43,7 @@ export const UserSection = ({noTextMode}) => {
|
|||||||
<Paragraph color="white" size={SIZE.xs}>
|
<Paragraph color="white" size={SIZE.xs}>
|
||||||
{SUBSCRIPTION_STATUS_STRINGS[user.subscription.status]}
|
{SUBSCRIPTION_STATUS_STRINGS[user.subscription.status]}
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
</View>
|
</View> */}
|
||||||
|
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
activeOpacity={0.8}
|
activeOpacity={0.8}
|
||||||
@@ -57,7 +58,10 @@ export const UserSection = ({noTextMode}) => {
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
ToastEvent.show(e.message, 'error');
|
ToastEvent.show(e.message, 'error');
|
||||||
} finally {
|
} finally {
|
||||||
dispatch({type: Actions.LAST_SYNC,lastSync: await db.lastSynced()});
|
dispatch({
|
||||||
|
type: Actions.LAST_SYNC,
|
||||||
|
lastSync: await db.lastSynced(),
|
||||||
|
});
|
||||||
dispatch({type: Actions.ALL});
|
dispatch({type: Actions.ALL});
|
||||||
dispatch({
|
dispatch({
|
||||||
type: Actions.SYNCING,
|
type: Actions.SYNCING,
|
||||||
@@ -84,17 +88,16 @@ export const UserSection = ({noTextMode}) => {
|
|||||||
{syncing ? 'Syncing ' : 'Last synced: '}
|
{syncing ? 'Syncing ' : 'Last synced: '}
|
||||||
{!syncing ? (
|
{!syncing ? (
|
||||||
user?.lastSynced ? (
|
user?.lastSynced ? (
|
||||||
<TimeSince time={user.lastSynced} />
|
<TimeSince time={user?.lastSynced} />
|
||||||
) : (
|
) : (
|
||||||
'never'
|
'never'
|
||||||
)
|
)
|
||||||
) : null}
|
) : null}
|
||||||
{'\n'}
|
{'\n'}
|
||||||
<Paragraph
|
<Paragraph
|
||||||
size={SIZE.xs}
|
size={DDS.isLargeTablet() ? SIZE.xxs : SIZE.xs}
|
||||||
color={colors.icon}
|
color={colors.icon}
|
||||||
style={{
|
style={{
|
||||||
fontSize: SIZE.xs,
|
|
||||||
color: colors.icon,
|
color: colors.icon,
|
||||||
}}>
|
}}>
|
||||||
{syncing ? 'Fetching your notes ' : 'Tap to sync '}
|
{syncing ? 'Fetching your notes ' : 'Tap to sync '}
|
||||||
@@ -147,12 +150,21 @@ export const UserSection = ({noTextMode}) => {
|
|||||||
{noTextMode ? null : (
|
{noTextMode ? null : (
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
marginLeft: 10,
|
marginLeft: DDS.isLargeTablet() ? 5 : 10,
|
||||||
|
flex: 1,
|
||||||
}}>
|
}}>
|
||||||
<Paragraph size={SIZE.xs} color={colors.icon}>
|
{DDS.isLargeTablet() ? null : (
|
||||||
You are not logged in
|
<Paragraph size={SIZE.xs} color={colors.icon}>
|
||||||
|
You are not logged in
|
||||||
|
</Paragraph>
|
||||||
|
)}
|
||||||
|
<Paragraph
|
||||||
|
style={{
|
||||||
|
flexWrap: 'wrap',
|
||||||
|
}}
|
||||||
|
color={colors.accent}>
|
||||||
|
Login to sync notes.
|
||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Paragraph color={colors.accent}>Login to sync notes.</Paragraph>
|
|
||||||
</View>
|
</View>
|
||||||
)}
|
)}
|
||||||
</PressableButton>
|
</PressableButton>
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import { UserSection } from './UserSection';
|
|||||||
export const Menu = React.memo(
|
export const Menu = React.memo(
|
||||||
() => {
|
() => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const {colors} = state;
|
const {colors,deviceMode} = state;
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
const noTextMode = false;
|
const noTextMode = false;
|
||||||
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
|
function changeColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
|
||||||
@@ -59,7 +59,7 @@ export const Menu = React.memo(
|
|||||||
style={{
|
style={{
|
||||||
height: '100%',
|
height: '100%',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
backgroundColor: colors.bg,
|
backgroundColor:deviceMode !== "mobile"? colors.nav : colors.bg,
|
||||||
paddingTop: insets.top,
|
paddingTop: insets.top,
|
||||||
}}>
|
}}>
|
||||||
<FlatList
|
<FlatList
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
} from '../../utils/Events';
|
} from '../../utils/Events';
|
||||||
import {pv, SIZE, WEIGHT} from '../../utils/SizeUtils';
|
import {pv, SIZE, WEIGHT} from '../../utils/SizeUtils';
|
||||||
import ActionSheet from '../ActionSheet';
|
import ActionSheet from '../ActionSheet';
|
||||||
|
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||||
import DialogHeader from '../Dialog/dialog-header';
|
import DialogHeader from '../Dialog/dialog-header';
|
||||||
import {PressableButton} from '../PressableButton';
|
import {PressableButton} from '../PressableButton';
|
||||||
import {Toast} from '../Toast';
|
import {Toast} from '../Toast';
|
||||||
@@ -38,8 +39,7 @@ const notebookInput = createRef();
|
|||||||
const topicInput = createRef();
|
const topicInput = createRef();
|
||||||
const actionSheetRef = createRef();
|
const actionSheetRef = createRef();
|
||||||
const MoveNoteDialog = () => {
|
const MoveNoteDialog = () => {
|
||||||
const [state, dispatch] = useTracked();
|
const [, dispatch] = useTracked();
|
||||||
const {colors} = state;
|
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [note, setNote] = useState(null);
|
const [note, setNote] = useState(null);
|
||||||
function open(note) {
|
function open(note) {
|
||||||
@@ -75,36 +75,16 @@ const MoveNoteDialog = () => {
|
|||||||
setNote(note);
|
setNote(note);
|
||||||
};
|
};
|
||||||
|
|
||||||
const style = React.useMemo(() => {
|
|
||||||
return {
|
|
||||||
width: DDS.isLargeTablet() ? 500 : '100%',
|
|
||||||
height: DDS.isLargeTablet() ? 500 : null,
|
|
||||||
maxHeight: DDS.isLargeTablet() ? 500 : '90%',
|
|
||||||
borderTopRightRadius: DDS.isLargeTablet() ? 5 : 10,
|
|
||||||
borderTopLeftRadius: DDS.isLargeTablet() ? 5 : 10,
|
|
||||||
backgroundColor: colors.bg,
|
|
||||||
padding: DDS.isLargeTablet() ? 8 : 0,
|
|
||||||
zIndex: 10,
|
|
||||||
paddingVertical: 12,
|
|
||||||
};
|
|
||||||
}, [colors.bg]);
|
|
||||||
|
|
||||||
return !visible ? null : (
|
return !visible ? null : (
|
||||||
<ActionSheet
|
<ActionSheetWrapper fwdRef={actionSheetRef} onClose={_onClose}>
|
||||||
ref={actionSheetRef}
|
<MoveNoteComponent close={close} note={note} setNote={update} />
|
||||||
animationType="slide"
|
</ActionSheetWrapper>
|
||||||
containerStyle={style}
|
|
||||||
gestureEnabled
|
|
||||||
initialOffsetFromBottom={1}
|
|
||||||
onClose={_onClose}>
|
|
||||||
<IntComponent close={close} note={note} setNote={update} />
|
|
||||||
</ActionSheet>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default MoveNoteDialog;
|
export default MoveNoteDialog;
|
||||||
|
|
||||||
const IntComponent = ({close, note, setNote}) => {
|
const MoveNoteComponent = ({close, note, setNote}) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const {colors, selectedItemsList} = state;
|
const {colors, selectedItemsList} = state;
|
||||||
const [expanded, setExpanded] = useState('');
|
const [expanded, setExpanded] = useState('');
|
||||||
@@ -137,7 +117,7 @@ const IntComponent = ({close, note, setNote}) => {
|
|||||||
newTopicTitle = null;
|
newTopicTitle = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePress = async (item,index) => {
|
const handlePress = async (item, index) => {
|
||||||
if (
|
if (
|
||||||
note?.notebooks?.findIndex(
|
note?.notebooks?.findIndex(
|
||||||
(o) =>
|
(o) =>
|
||||||
@@ -398,7 +378,7 @@ const IntComponent = ({close, note, setNote}) => {
|
|||||||
}
|
}
|
||||||
renderItem={({item, index}) => (
|
renderItem={({item, index}) => (
|
||||||
<PressableButton
|
<PressableButton
|
||||||
onPress={() => handlePress(item,index)}
|
onPress={() => handlePress(item, index)}
|
||||||
type="gray"
|
type="gray"
|
||||||
customStyle={{
|
customStyle={{
|
||||||
height: 50,
|
height: 50,
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
import React, { createRef } from 'react';
|
import React, {createRef} from 'react';
|
||||||
import { Platform, View } from 'react-native';
|
import {Platform, View} from 'react-native';
|
||||||
import { DDS } from '../../services/DeviceDetection';
|
import {DDS} from '../../services/DeviceDetection';
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
|
||||||
import { dWidth } from '../../utils';
|
import {dWidth} from '../../utils';
|
||||||
import { hexToRGBA } from '../../utils/ColorUtils';
|
import {hexToRGBA} from '../../utils/ColorUtils';
|
||||||
import { db } from '../../utils/DB';
|
import {db} from '../../utils/DB';
|
||||||
import { eClosePendingDialog, eOpenPendingDialog } from '../../utils/Events';
|
import {eClosePendingDialog, eOpenPendingDialog} from '../../utils/Events';
|
||||||
import { SIZE } from '../../utils/SizeUtils';
|
import {SIZE} from '../../utils/SizeUtils';
|
||||||
import ActionSheet from '../ActionSheet';
|
import ActionSheet from '../ActionSheet';
|
||||||
|
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../Seperator';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../Typography/Heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../Typography/Paragraph';
|
||||||
@@ -37,8 +38,8 @@ class PendingDialog extends React.Component {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
eSubscribeEvent(eOpenPendingDialog, this.open.bind(this));
|
eSubscribeEvent(eOpenPendingDialog, this.open.bind(this));
|
||||||
eSubscribeEvent(eClosePendingDialog, this.close.bind(this));
|
eSubscribeEvent(eClosePendingDialog, this.close.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
@@ -49,36 +50,10 @@ class PendingDialog extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
const {colors} = this.props;
|
const {colors} = this.props;
|
||||||
return (
|
return (
|
||||||
<ActionSheet
|
<ActionSheetWrapper fwdRef={actionSheet}>
|
||||||
containerStyle={{
|
|
||||||
backgroundColor: colors.bg,
|
|
||||||
alignSelf: 'center',
|
|
||||||
width: DDS.isTab ? 500 : '100%',
|
|
||||||
borderRadius: 10,
|
|
||||||
marginBottom: DDS.isTab ? 50 : 0,
|
|
||||||
}}
|
|
||||||
indicatorColor={
|
|
||||||
Platform.ios
|
|
||||||
? hexToRGBA(colors.accent + '19')
|
|
||||||
: hexToRGBA(colors.shade)
|
|
||||||
}
|
|
||||||
extraScroll={DDS.isTab ? 50 : 0}
|
|
||||||
gestureEnabled={true}
|
|
||||||
footerAlwaysVisible={DDS.isTab}
|
|
||||||
footerHeight={DDS.isTab ? 20 : 10}
|
|
||||||
footerStyle={
|
|
||||||
DDS.isTab
|
|
||||||
? {
|
|
||||||
borderRadius: 10,
|
|
||||||
backgroundColor: colors.bg,
|
|
||||||
}
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
ref={actionSheet}
|
|
||||||
initialOffsetFromBottom={1}>
|
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
width: DDS.isTab ? 500 : dWidth,
|
width: '100%',
|
||||||
backgroundColor: colors.bg,
|
backgroundColor: colors.bg,
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
paddingHorizontal: 12,
|
paddingHorizontal: 12,
|
||||||
@@ -111,7 +86,7 @@ class PendingDialog extends React.Component {
|
|||||||
</Paragraph>
|
</Paragraph>
|
||||||
<Seperator />
|
<Seperator />
|
||||||
</View>
|
</View>
|
||||||
</ActionSheet>
|
</ActionSheetWrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import {db} from '../../utils/DB';
|
|||||||
import {eOpenLoginDialog, eOpenPendingDialog} from '../../utils/Events';
|
import {eOpenLoginDialog, eOpenPendingDialog} from '../../utils/Events';
|
||||||
import {SIZE} from '../../utils/SizeUtils';
|
import {SIZE} from '../../utils/SizeUtils';
|
||||||
import ActionSheet from '../ActionSheet';
|
import ActionSheet from '../ActionSheet';
|
||||||
|
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||||
import {Button} from '../Button';
|
import {Button} from '../Button';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../Seperator';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../Typography/Heading';
|
||||||
@@ -23,7 +24,7 @@ class PremiumDialog extends React.Component {
|
|||||||
products: null,
|
products: null,
|
||||||
scrollEnabled: false,
|
scrollEnabled: false,
|
||||||
product: null,
|
product: null,
|
||||||
visible: false,
|
visible: true,
|
||||||
};
|
};
|
||||||
this.routeIndex = 0;
|
this.routeIndex = 0;
|
||||||
this.count = 0;
|
this.count = 0;
|
||||||
@@ -46,9 +47,13 @@ class PremiumDialog extends React.Component {
|
|||||||
this.actionSheetRef.current?._setModalVisible(false);
|
this.actionSheetRef.current?._setModalVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.actionSheetRef.current?._setModalVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
async getSkus() {
|
async getSkus() {
|
||||||
try {
|
try {
|
||||||
let u = await db.user.getUser()
|
let u = await db.user.getUser();
|
||||||
this.setState({
|
this.setState({
|
||||||
user: u,
|
user: u,
|
||||||
});
|
});
|
||||||
@@ -67,21 +72,7 @@ class PremiumDialog extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
const {colors} = this.props;
|
const {colors} = this.props;
|
||||||
return !this.state.visible ? null : (
|
return !this.state.visible ? null : (
|
||||||
<ActionSheet
|
<ActionSheetWrapper
|
||||||
containerStyle={{
|
|
||||||
backgroundColor: colors.bg,
|
|
||||||
width: DDS.isLargeTablet() ? 500 : '100%',
|
|
||||||
alignSelf: 'center',
|
|
||||||
borderRadius: 10,
|
|
||||||
marginBottom: DDS.isLargeTablet() ? 50 : 0,
|
|
||||||
borderBottomRightRadius: 0,
|
|
||||||
borderBottomLeftRadius: 0,
|
|
||||||
}}
|
|
||||||
indicatorColor={
|
|
||||||
Platform.ios
|
|
||||||
? hexToRGBA(colors.accent + '19')
|
|
||||||
: hexToRGBA(colors.shade)
|
|
||||||
}
|
|
||||||
onOpen={async () => {
|
onOpen={async () => {
|
||||||
try {
|
try {
|
||||||
await this.getSkus();
|
await this.getSkus();
|
||||||
@@ -89,28 +80,15 @@ class PremiumDialog extends React.Component {
|
|||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
extraScroll={DDS.isLargeTablet() ? 50 : 10}
|
|
||||||
footerAlwaysVisible={DDS.isLargeTablet()}
|
|
||||||
footerHeight={DDS.isLargeTablet() ? 20 : 10}
|
|
||||||
footerStyle={
|
|
||||||
DDS.isLargeTablet()
|
|
||||||
? {
|
|
||||||
borderRadius: 10,
|
|
||||||
backgroundColor: colors.bg,
|
|
||||||
}
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
onClose={() => {
|
onClose={() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
visible: false,
|
visible: false,
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
gestureEnabled={true}
|
fwdRef={this.actionSheetRef}>
|
||||||
ref={this.actionSheetRef}
|
|
||||||
initialOffsetFromBottom={1}>
|
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
width: DDS.isLargeTablet() ? 500 : dWidth,
|
width: "100%",
|
||||||
backgroundColor: colors.bg,
|
backgroundColor: colors.bg,
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
paddingHorizontal: 12,
|
paddingHorizontal: 12,
|
||||||
@@ -139,7 +117,7 @@ class PremiumDialog extends React.Component {
|
|||||||
style={{
|
style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
maxHeight: DDS.isLargeTablet() ? dHeight * 0.35 : dHeight * 0.45,
|
maxHeight: DDS.isLargeTablet() ? dHeight * 0.35 : dHeight * 0.45,
|
||||||
}}>
|
}}>
|
||||||
{[
|
{[
|
||||||
{
|
{
|
||||||
title: 'Cross Platfrom Sync',
|
title: 'Cross Platfrom Sync',
|
||||||
@@ -264,9 +242,7 @@ class PremiumDialog extends React.Component {
|
|||||||
paddingVertical: 10,
|
paddingVertical: 10,
|
||||||
marginRight: 10,
|
marginRight: 10,
|
||||||
}}>
|
}}>
|
||||||
<Paragraph
|
<Paragraph size={SIZE.lg}>
|
||||||
size={SIZE.lg}
|
|
||||||
>
|
|
||||||
{item.localizedPrice}
|
{item.localizedPrice}
|
||||||
<Paragraph color={colors.accent} size={SIZE.sm}>
|
<Paragraph color={colors.accent} size={SIZE.sm}>
|
||||||
/mo
|
/mo
|
||||||
@@ -300,7 +276,7 @@ class PremiumDialog extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</ActionSheet>
|
</ActionSheetWrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ import {SIZE} from '../../utils/SizeUtils';
|
|||||||
import storage from '../../utils/storage';
|
import storage from '../../utils/storage';
|
||||||
import {sleep, timeConverter} from '../../utils/TimeUtils';
|
import {sleep, timeConverter} from '../../utils/TimeUtils';
|
||||||
import ActionSheet from '../ActionSheet';
|
import ActionSheet from '../ActionSheet';
|
||||||
|
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||||
import {Button} from '../Button';
|
import {Button} from '../Button';
|
||||||
import BaseDialog from '../Dialog/base-dialog';
|
import BaseDialog from '../Dialog/base-dialog';
|
||||||
import DialogButtons from '../Dialog/dialog-buttons';
|
import DialogButtons from '../Dialog/dialog-buttons';
|
||||||
@@ -32,12 +33,8 @@ import Paragraph from '../Typography/Paragraph';
|
|||||||
const actionSheetRef = createRef();
|
const actionSheetRef = createRef();
|
||||||
|
|
||||||
const RestoreDialog = () => {
|
const RestoreDialog = () => {
|
||||||
const [state, dispatch] = useTracked();
|
|
||||||
const {colors} = state;
|
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
const [files, setFiles] = useState([]);
|
const [restoring, setRestoring] = useState(false);
|
||||||
const [restoring, setRestoring] = useState(true);
|
|
||||||
const insets = useSafeAreaInsets();
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
eSubscribeEvent(eOpenRestoreDialog, open);
|
eSubscribeEvent(eOpenRestoreDialog, open);
|
||||||
eSubscribeEvent(eCloseRestoreDialog, close);
|
eSubscribeEvent(eCloseRestoreDialog, close);
|
||||||
@@ -53,6 +50,14 @@ const RestoreDialog = () => {
|
|||||||
actionSheetRef.current?._setModalVisible(true);
|
actionSheetRef.current?._setModalVisible(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const close = () => {
|
||||||
|
if (restoring) {
|
||||||
|
showIsWorking();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
const showIsWorking = () => {
|
const showIsWorking = () => {
|
||||||
ToastEvent.show(
|
ToastEvent.show(
|
||||||
'Please wait, we are restoring your data.',
|
'Please wait, we are restoring your data.',
|
||||||
@@ -61,14 +66,31 @@ const RestoreDialog = () => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const close = () => {
|
return !visible ? null : (
|
||||||
if (restoring) {
|
<ActionSheetWrapper
|
||||||
showIsWorking();
|
fwdRef={actionSheetRef}
|
||||||
return;
|
gestureEnabled={!restoring}
|
||||||
}
|
closeOnTouchBackdrop={!restoring}
|
||||||
|
onClose={close}>
|
||||||
|
<RestoreDataComponent
|
||||||
|
close={close}
|
||||||
|
restoring={restoring}
|
||||||
|
setRestoring={setRestoring}
|
||||||
|
/>
|
||||||
|
</ActionSheetWrapper>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
setVisible(false);
|
export default RestoreDialog;
|
||||||
};
|
|
||||||
|
const RestoreDataComponent = ({close, setRestoring, restoring}) => {
|
||||||
|
const [state, dispatch] = useTracked();
|
||||||
|
const {colors} = state;
|
||||||
|
const [files, setFiles] = useState([]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
checkBackups();
|
||||||
|
}, []);
|
||||||
|
|
||||||
const restore = async (item, index) => {
|
const restore = async (item, index) => {
|
||||||
if (restoring) {
|
if (restoring) {
|
||||||
@@ -93,7 +115,7 @@ const RestoreDialog = () => {
|
|||||||
setRestoring(false);
|
setRestoring(false);
|
||||||
dispatch({type: Actions.ALL});
|
dispatch({type: Actions.ALL});
|
||||||
ToastEvent.show('Restore Complete!', 'success', 'local');
|
ToastEvent.show('Restore Complete!', 'success', 'local');
|
||||||
setVisible(false);
|
close();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
setRestoring(false);
|
setRestoring(false);
|
||||||
ToastEvent.show(e.message, 'error', 'local');
|
ToastEvent.show(e.message, 'error', 'local');
|
||||||
@@ -127,35 +149,15 @@ const RestoreDialog = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const style = React.useMemo(() => {
|
return (
|
||||||
return {
|
<>
|
||||||
width: DDS.isLargeTablet() ? 500 : '100%',
|
|
||||||
height: DDS.isLargeTablet() ? 500 : null,
|
|
||||||
maxHeight: DDS.isLargeTablet() ? 500 : '90%',
|
|
||||||
borderTopRightRadius: DDS.isLargeTablet() ? 5 : 10,
|
|
||||||
borderTopLeftRadius: DDS.isLargeTablet() ? 5 : 10,
|
|
||||||
backgroundColor: colors.bg,
|
|
||||||
padding: DDS.isLargeTablet() ? 8 : 0,
|
|
||||||
zIndex: 10,
|
|
||||||
paddingVertical: 12,
|
|
||||||
};
|
|
||||||
}, [colors.bg]);
|
|
||||||
|
|
||||||
return !visible ? null : (
|
|
||||||
<ActionSheet
|
|
||||||
ref={actionSheetRef}
|
|
||||||
containerStyle={style}
|
|
||||||
gestureEnabled={!restoring}
|
|
||||||
closeOnTouchBackdrop={!restoring}
|
|
||||||
initialOffsetFromBottom={1}
|
|
||||||
onClose={close}
|
|
||||||
onOpen={() => checkBackups()}>
|
|
||||||
<View>
|
<View>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
paddingHorizontal: 12,
|
paddingHorizontal: 8,
|
||||||
|
paddingRight: 8,
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
paddingTop: restoring ? 25 : 0,
|
paddingTop: restoring ? 25 : 0,
|
||||||
}}>
|
}}>
|
||||||
@@ -284,8 +286,6 @@ const RestoreDialog = () => {
|
|||||||
</ScrollView>
|
</ScrollView>
|
||||||
</View>
|
</View>
|
||||||
<Toast context="local" />
|
<Toast context="local" />
|
||||||
</ActionSheet>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default RestoreDialog;
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {MMKV} from '../../utils/mmkv';
|
|||||||
import {SIZE} from '../../utils/SizeUtils';
|
import {SIZE} from '../../utils/SizeUtils';
|
||||||
import {sleep} from '../../utils/TimeUtils';
|
import {sleep} from '../../utils/TimeUtils';
|
||||||
import ActionSheet from '../ActionSheet';
|
import ActionSheet from '../ActionSheet';
|
||||||
|
import ActionSheetWrapper from '../ActionSheetComponent/ActionSheetWrapper';
|
||||||
import {updateEvent} from '../DialogManager/recievers';
|
import {updateEvent} from '../DialogManager/recievers';
|
||||||
import {PressableButton} from '../PressableButton';
|
import {PressableButton} from '../PressableButton';
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../Seperator';
|
||||||
@@ -74,39 +75,12 @@ class SortDialog extends React.Component {
|
|||||||
if (!this.state.visible) return null;
|
if (!this.state.visible) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ActionSheet
|
<ActionSheetWrapper fwdRef={actionSheet}>
|
||||||
containerStyle={{
|
|
||||||
backgroundColor: colors.bg,
|
|
||||||
alignSelf: 'center',
|
|
||||||
width: DDS.isTab ? 500 : '100%',
|
|
||||||
borderRadius: 10,
|
|
||||||
marginBottom: DDS.isTab ? 50 : 0,
|
|
||||||
}}
|
|
||||||
indicatorColor={
|
|
||||||
Platform.ios
|
|
||||||
? hexToRGBA(colors.accent + '19')
|
|
||||||
: hexToRGBA(colors.shade)
|
|
||||||
}
|
|
||||||
extraScroll={DDS.isTab ? 50 : 0}
|
|
||||||
gestureEnabled={true}
|
|
||||||
footerAlwaysVisible={DDS.isTab}
|
|
||||||
footerHeight={DDS.isTab ? 20 : 10}
|
|
||||||
footerStyle={
|
|
||||||
DDS.isTab
|
|
||||||
? {
|
|
||||||
borderRadius: 10,
|
|
||||||
backgroundColor: colors.bg,
|
|
||||||
}
|
|
||||||
: null
|
|
||||||
}
|
|
||||||
ref={actionSheet}
|
|
||||||
initialOffsetFromBottom={1}>
|
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
width: DDS.isTab ? 500 : dWidth,
|
width: '100%',
|
||||||
backgroundColor: colors.bg,
|
backgroundColor: colors.bg,
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
|
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
paddingTop: 10,
|
paddingTop: 10,
|
||||||
}}>
|
}}>
|
||||||
@@ -186,8 +160,8 @@ class SortDialog extends React.Component {
|
|||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
borderRadius:0,
|
borderRadius: 0,
|
||||||
paddingHorizontal:12
|
paddingHorizontal: 12,
|
||||||
}}>
|
}}>
|
||||||
<Heading
|
<Heading
|
||||||
size={SIZE.sm}
|
size={SIZE.sm}
|
||||||
@@ -211,7 +185,7 @@ class SortDialog extends React.Component {
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</ActionSheet>
|
</ActionSheetWrapper>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,22 +30,25 @@ export class DeviceDetectionService {
|
|||||||
this.isPhoneOrTablet();
|
this.isPhoneOrTablet();
|
||||||
this.isIosOrAndroid();
|
this.isIosOrAndroid();
|
||||||
this.detectIphoneX();
|
this.detectIphoneX();
|
||||||
this.checkSmallTab();
|
this.checkSmallTab(size.width > size.height ? 'LANDSCAPE' : 'PORTRAIT');
|
||||||
}
|
}
|
||||||
|
|
||||||
getDeviceSize = () => {
|
getDeviceSize = () => {
|
||||||
let dpi = this.pixelDensity * 160;
|
let dpi = this.pixelDensity * 160;
|
||||||
let deviceWidthInInches = this.adjustedWidth / dpi;
|
let deviceWidthInInches = this.adjustedWidth / dpi;
|
||||||
let deviceHeightInInches = this.adjustedHeight / dpi;
|
let deviceHeightInInches = this.adjustedHeight / dpi;
|
||||||
return Math.sqrt(
|
let diagonalSize = Math.sqrt(
|
||||||
Math.pow(deviceWidthInInches, 2) + Math.pow(deviceHeightInInches, 2),
|
Math.pow(deviceWidthInInches, 2) + Math.pow(deviceHeightInInches, 2),
|
||||||
);
|
);
|
||||||
|
return Platform.isPad ? diagonalSize + 2 : diagonalSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
checkSmallTab(orientation) {
|
checkSmallTab(orientation) {
|
||||||
this.width = Dimensions.get('screen').width;
|
this.width = Dimensions.get('screen').width;
|
||||||
this.height = Dimensions.get('screen').height;
|
this.height = Dimensions.get('screen').height;
|
||||||
let deviceSize = this.getDeviceSize();
|
let deviceSize = this.getDeviceSize();
|
||||||
|
|
||||||
|
console.log(deviceSize, orientation, DeviceInfo.isTablet(), 'DATA');
|
||||||
if (
|
if (
|
||||||
(!DeviceInfo.isTablet() && orientation === 'LANDSCAPE') ||
|
(!DeviceInfo.isTablet() && orientation === 'LANDSCAPE') ||
|
||||||
(DeviceInfo.isTablet() && (orientation === 'PORTRAIT' || deviceSize < 9))
|
(DeviceInfo.isTablet() && (orientation === 'PORTRAIT' || deviceSize < 9))
|
||||||
@@ -53,6 +56,15 @@ export class DeviceDetectionService {
|
|||||||
this.isTab = true;
|
this.isTab = true;
|
||||||
this.isPhone = false;
|
this.isPhone = false;
|
||||||
this.isSmallTab = true;
|
this.isSmallTab = true;
|
||||||
|
} else if (
|
||||||
|
DeviceInfo.isTablet() &&
|
||||||
|
orientation === 'LANDSCAPE' &&
|
||||||
|
deviceSize > 9
|
||||||
|
) {
|
||||||
|
console.log('setting large tablet');
|
||||||
|
this.isTab = true;
|
||||||
|
this.isPhone = false;
|
||||||
|
this.isSmallTab = false;
|
||||||
} else {
|
} else {
|
||||||
if (!DeviceInfo.isTablet()) {
|
if (!DeviceInfo.isTablet()) {
|
||||||
this.isTab = false;
|
this.isTab = false;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import React, {useEffect} from 'react';
|
|||||||
import {BackHandler, Keyboard, Platform, View} from 'react-native';
|
import {BackHandler, Keyboard, Platform, View} from 'react-native';
|
||||||
import RNExitApp from 'react-native-exit-app';
|
import RNExitApp from 'react-native-exit-app';
|
||||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||||
import { notesnook } from '../../../e2e/test.ids';
|
import {notesnook} from '../../../e2e/test.ids';
|
||||||
import {ActionIcon} from '../../components/ActionIcon';
|
import {ActionIcon} from '../../components/ActionIcon';
|
||||||
import {
|
import {
|
||||||
ActionSheetEvent,
|
ActionSheetEvent,
|
||||||
@@ -50,7 +50,7 @@ let tapCount = 0;
|
|||||||
|
|
||||||
const EditorHeader = () => {
|
const EditorHeader = () => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const {colors, premiumUser, fullscreen,deviceMode} = state;
|
const {colors, premiumUser, fullscreen, deviceMode} = state;
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -58,7 +58,7 @@ const EditorHeader = () => {
|
|||||||
}, [colors.bg]);
|
}, [colors.bg]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
post("tablet",DDS.isLargeTablet())
|
post('tablet', DDS.isLargeTablet());
|
||||||
}, [deviceMode]);
|
}, [deviceMode]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -71,8 +71,6 @@ const EditorHeader = () => {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (fullscreen && DDS.isTab) {
|
if (fullscreen && DDS.isTab) {
|
||||||
handleBack = BackHandler.addEventListener('hardwareBackPress', () => {
|
handleBack = BackHandler.addEventListener('hardwareBackPress', () => {
|
||||||
@@ -122,8 +120,6 @@ const EditorHeader = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const _onBackPress = async () => {
|
const _onBackPress = async () => {
|
||||||
if (getIntent() && sideMenuRef.current === null) {
|
if (getIntent() && sideMenuRef.current === null) {
|
||||||
if (tapCount > 0) {
|
if (tapCount > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user