Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Mobile): Add a correct check to show or not keybinds section #899

Merged
merged 9 commits into from
Dec 4, 2024
1 change: 1 addition & 0 deletions android/app/capacitor.build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ android {
apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
dependencies {
implementation project(':capacitor-camera')
implementation project(':capacitor-device')
implementation project(':capacitor-filesystem')
implementation project(':capacitor-splash-screen')

Expand Down
3 changes: 3 additions & 0 deletions android/capacitor.settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/
include ':capacitor-camera'
project(':capacitor-camera').projectDir = new File('../node_modules/@capacitor/camera/android')

include ':capacitor-device'
project(':capacitor-device').projectDir = new File('../node_modules/@capacitor/device/android')

include ':capacitor-filesystem'
project(':capacitor-filesystem').projectDir = new File('../node_modules/@capacitor/filesystem/android')

Expand Down
1 change: 1 addition & 0 deletions ios/App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def capacitor_pods
pod 'Capacitor', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
pod 'CapacitorCamera', :path => '../../node_modules/@capacitor/camera'
pod 'CapacitorDevice', :path => '../../node_modules/@capacitor/device'
pod 'CapacitorFilesystem', :path => '../../node_modules/@capacitor/filesystem'
pod 'CapacitorSplashScreen', :path => '../../node_modules/@capacitor/splash-screen'
end
Expand Down
24 changes: 15 additions & 9 deletions ios/App/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
PODS:
- Capacitor (6.1.2):
- Capacitor (6.2.0):
- CapacitorCordova
- CapacitorCamera (6.1.0):
- CapacitorCamera (6.1.1):
- Capacitor
- CapacitorCordova (6.1.2)
- CapacitorFilesystem (6.0.1):
- CapacitorCordova (6.2.0)
- CapacitorDevice (6.0.2):
- Capacitor
- CapacitorFilesystem (6.0.2):
- Capacitor
- CapacitorSplashScreen (6.0.2):
- Capacitor
Expand All @@ -13,6 +15,7 @@ DEPENDENCIES:
- "Capacitor (from `../../node_modules/@capacitor/ios`)"
- "CapacitorCamera (from `../../node_modules/@capacitor/camera`)"
- "CapacitorCordova (from `../../node_modules/@capacitor/ios`)"
- "CapacitorDevice (from `../../node_modules/@capacitor/device`)"
- "CapacitorFilesystem (from `../../node_modules/@capacitor/filesystem`)"
- "CapacitorSplashScreen (from `../../node_modules/@capacitor/splash-screen`)"

Expand All @@ -23,18 +26,21 @@ EXTERNAL SOURCES:
:path: "../../node_modules/@capacitor/camera"
CapacitorCordova:
:path: "../../node_modules/@capacitor/ios"
CapacitorDevice:
:path: "../../node_modules/@capacitor/device"
CapacitorFilesystem:
:path: "../../node_modules/@capacitor/filesystem"
CapacitorSplashScreen:
:path: "../../node_modules/@capacitor/splash-screen"

SPEC CHECKSUMS:
Capacitor: 679f9673fdf30597493a6362a5d5bf233d46abc2
CapacitorCamera: 81ce64062cd82b82cc75a79616fda4bd09d7f643
CapacitorCordova: f48c89f96c319101cd2f0ce8a2b7449b5fb8b3dd
CapacitorFilesystem: 37fb3aa5c945b4539ab11c74a5c57925a302bf24
Capacitor: 1f3c7b9802d958cd8c4eb63895fff85dff2e1eea
CapacitorCamera: b9904b48258a91a48930e72a400638a5fc223b27
CapacitorCordova: b33e7f4aa4ed105dd43283acdd940964374a87d9
CapacitorDevice: 1a215717f0b5061503b21a03508b0ec458a57d78
CapacitorFilesystem: c832a3f6d4870c3872688e782ae8e33665e6ecbf
CapacitorSplashScreen: 250df9ef8014fac5c7c1fd231f0f8b1d8f0b5624

PODFILE CHECKSUM: 46011c4258f4c76d658cc7d9721149c3759c52d7
PODFILE CHECKSUM: 015bc35d2d66cac4def58809b8cd4edb68ad23f7

COCOAPODS: 1.16.1
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@capacitor/camera": "^6.1.0",
"@capacitor/cli": "^6.1.2",
"@capacitor/core": "^6.1.2",
"@capacitor/device": "^6.0.2",
"@capacitor/filesystem": "^6.0.1",
"@capacitor/ios": "^6.1.2",
"@capacitor/splash-screen": "^6.0.2",
Expand Down
7 changes: 7 additions & 0 deletions src/lib/utils/Mobile.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import { Device } from "@capacitor/device"

export function checkMobile(): boolean {
return window.matchMedia("screen and (max-width: 800px)").matches
}

export async function isAndroidOriOS(): Promise<boolean> {
const info = await Device.getInfo()
return info.platform === "ios" || info.platform === "android"
}
6 changes: 3 additions & 3 deletions src/routes/settings/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import { SettingsStore } from "$lib/state"
import { UIStore } from "$lib/state/ui"
import type { NavRoute } from "$lib/types"
import { checkMobile } from "$lib/utils/Mobile"
import { checkMobile, isAndroidOriOS } from "$lib/utils/Mobile"
import { onMount } from "svelte"
import { _ } from "svelte-i18n"
import { get, writable, type Writable } from "svelte/store"
Expand Down Expand Up @@ -136,8 +136,8 @@
UIStore.state.sidebarOpen.subscribe(s => (sidebarOpen = s))
$: setRoutes = get(settingsRoutes)
SettingsStore.state.subscribe(value => {
let isMobile: boolean = checkMobile()
SettingsStore.state.subscribe(async value => {
let isMobile: boolean = await isAndroidOriOS()
if (value.devmode) {
if (!get(settingsRoutes).find(route => route.to === SettingsRoute.Developer)) {
settingsRoutes.update(routes => [
Expand Down
Loading