feat: add native android app with capacitor (#732)
* feat: add capacitor and android app * feat: add android build action * fix: add capacitor zoom and fix haptics * fix: padding on desktop
This commit is contained in:
1 parent
a1ccf4d9d0
commit
dfe6a7e67d
50 files changed
+1168
-30
No files matched your search
@@ -17,6 +17,9 @@
|
||||
import { Shell } from '$lib/ui/layout'
|
||||
import Navbar from '$lib/ui/navbar/Navbar.svelte'
|
||||
import Sidebar from '$lib/ui/sidebar/Sidebar.svelte'
|
||||
import { App } from '@capacitor/app'
|
||||
import { Capacitor } from '@capacitor/core'
|
||||
import { Haptics } from '@capacitor/haptics'
|
||||
import { Button, ModalContainer, Spinner, ToastContainer } from 'mono-svelte'
|
||||
import nProgress from 'nprogress'
|
||||
import 'nprogress/nprogress.css'
|
||||
@@ -38,6 +41,21 @@
|
||||
showSpinner: false,
|
||||
})
|
||||
|
||||
App.addListener('backButton', () => {
|
||||
history.back()
|
||||
})
|
||||
|
||||
if (Capacitor.isNativePlatform()) {
|
||||
navigator.vibrate = (pattern: VibratePattern | Iterable<number>) => {
|
||||
Haptics.vibrate({
|
||||
// @ts-expect-error Iterable is a thing
|
||||
duration: (Array.isArray(pattern) ? pattern[0] : pattern) ?? 100,
|
||||
})
|
||||
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
if (browser) {
|
||||
if (window.location.hash == 'main') {
|
||||
|
||||
Reference in new issue
Block a user