Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix tablet check on android

ammarahm-ed6056bb8310e5
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index a7da5240b..530a7e384 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -15,7 +15,6 @@ import {
Appearance,
useColorScheme,
StatusBar} from "react-native";
-
const App = () => {
const [state, dispatch] = useTracked();
const [init, setInit] = useState(false);
@@ -32,7 +31,6 @@ const App = () => {
};
useEffect(() => {
-
systemThemeChange();
},[colorScheme])
diff --git a/apps/mobile/src/common/common.js b/apps/mobile/src/common/common.js
index a0d9fd384..d9520eb69 100755
--- a/apps/mobile/src/common/common.js
+++ b/apps/mobile/src/common/common.js
@@ -26,7 +26,7 @@ const fixedColors = {
normal: 'black',
icon: 'gray',
errorBg: '#FFD2D2',
- errorText: '#D8000C',
+ errorText: '#ff6961',
successBg: '#DFF2BF',
successText: '#4F8A10',
warningBg: '#FEEFB3',
@@ -64,11 +64,13 @@ export const COLOR_SCHEME_DARK = {
...fixedColors,
};
-const windowSize = Dimensions.get('window');
-const adjustedWidth = windowSize.width * PixelRatio.get();
-const adjustedHeight = windowSize.height * PixelRatio.get();
+let windowSize = Dimensions.get('window');
+let adjustedWidth = windowSize.width * PixelRatio.get();
+let adjustedHeight = windowSize.height * PixelRatio.get();
const pixelDensity = PixelRatio.get();
+
+
const getDeviceSize = () => {
let dpi = getDpi(pixelDensity);
let deviceWidthInInches = adjustedWidth / dpi;
@@ -81,28 +83,11 @@ const getDeviceSize = () => {
};
const getDpi = pd => {
- if (pd === 1 || pd < 1) {
- return 160 * pd;
- } else if (pd > 1 && pd <= 1.5) {
- let multiplier = pd / 1.5;
- return 240 * multiplier;
- } else if (pd > 1.5 && pd <= 2) {
- let multiplier = pd / 2;
- return 320 * multiplier;
- } else if (pd > 2 && pd <= 3) {
- let multiplier = pd / 3;
- return 480 * multiplier;
- } else if (pd > 3 && pd <= 3.5) {
- let multiplier = pd / 3.5;
- return 520 * multiplier;
- } else if (pd > 3.5) {
- return 550;
- }
+ return 160 * pd;
};
const correction = (size, multiplier) => {
let dSize = getDeviceSize();
-
if (dSize >= 4 && dSize <= 5.3 && pixelDensity <= 3) {
return size * 0.92;
} else if (dSize > 5.3 && dSize < 7 && pixelDensity < 3 && !DDS.isTab) {
@@ -152,6 +137,8 @@ export const SIZE = {
};
export function updateSize() {
+
+
SIZE.xxs = 10 * scale.fontScale;
SIZE.xs = 12 * scale.fontScale;
SIZE.sm = normalize(15) * scale.fontScale;
diff --git a/apps/mobile/src/utils/deviceDetection.js b/apps/mobile/src/utils/deviceDetection.js
index 906b346a0..e2dd83c91 100644
--- a/apps/mobile/src/utils/deviceDetection.js
+++ b/apps/mobile/src/utils/deviceDetection.js
@@ -1,5 +1,6 @@
import {Dimensions, PixelRatio, Platform} from 'react-native';
+import DeviceInfo from 'react-native-device-info';
const windowSize = Dimensions.get('window');
export class DeviceDetectionService {
@@ -29,7 +30,7 @@ export class DeviceDetectionService {
}
isPhoneOrTablet() {
- if (Platform.isPad) {
+ /* if (Platform.isPad) {
this.isTab = true;
this.isPhone = false;
}
@@ -48,6 +49,13 @@ export class DeviceDetectionService {
} else {
this.isTab = false;
this.isPhone = true;
+ } */
+ if (DeviceInfo.isTablet()) {
+ this.isTab = true;
+ this.isPhone = false;
+ } else {
+ this.isTab = false;
+ this.isPhone = false;
}
}
diff --git a/apps/mobile/src/utils/utils.js b/apps/mobile/src/utils/utils.js
index d9d909874..7768eb1d4 100755
--- a/apps/mobile/src/utils/utils.js
+++ b/apps/mobile/src/utils/utils.js
@@ -82,7 +82,7 @@ export const ToastEvent = {
message,
type,
context = 'global',
- duration = 3000,
+ duration = 6000,
func = null,
actionText = '',
) => {
@@ -99,7 +99,7 @@ export const ToastEvent = {
message,
type,
context = 'global',
- duration = 3000,
+ duration = 6000,
func = null,
actionText = '',
) => {