fix keyboard and haptics
This commit is contained in:
@@ -11,6 +11,7 @@ apply from: "../capacitor-cordova-android-plugins/cordova.variables.gradle"
|
||||
dependencies {
|
||||
implementation project(':capacitor-dialog')
|
||||
implementation project(':capacitor-haptics')
|
||||
implementation project(':capacitor-keyboard')
|
||||
implementation project(':capacitor-status-bar')
|
||||
|
||||
}
|
||||
|
||||
@@ -8,5 +8,8 @@ project(':capacitor-dialog').projectDir = new File('../node_modules/@capacitor/d
|
||||
include ':capacitor-haptics'
|
||||
project(':capacitor-haptics').projectDir = new File('../node_modules/@capacitor/haptics/android')
|
||||
|
||||
include ':capacitor-keyboard'
|
||||
project(':capacitor-keyboard').projectDir = new File('../node_modules/@capacitor/keyboard/android')
|
||||
|
||||
include ':capacitor-status-bar'
|
||||
project(':capacitor-status-bar').projectDir = new File('../node_modules/@capacitor/status-bar/android')
|
||||
|
||||
@@ -6,6 +6,11 @@ const config: CapacitorConfig = {
|
||||
webDir: 'dist',
|
||||
server: {
|
||||
androidScheme: 'https'
|
||||
},
|
||||
plugins: {
|
||||
Keyboard: {
|
||||
resize: 'native'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ def capacitor_pods
|
||||
pod 'CapacitorCordova', :path => '../../node_modules/@capacitor/ios'
|
||||
pod 'CapacitorDialog', :path => '../../node_modules/@capacitor/dialog'
|
||||
pod 'CapacitorHaptics', :path => '../../node_modules/@capacitor/haptics'
|
||||
pod 'CapacitorKeyboard', :path => '../../node_modules/@capacitor/keyboard'
|
||||
pod 'CapacitorStatusBar', :path => '../../node_modules/@capacitor/status-bar'
|
||||
end
|
||||
|
||||
|
||||
@@ -6,6 +6,8 @@ PODS:
|
||||
- Capacitor
|
||||
- CapacitorHaptics (5.0.2):
|
||||
- Capacitor
|
||||
- CapacitorKeyboard (5.0.2):
|
||||
- Capacitor
|
||||
- CapacitorStatusBar (5.0.2):
|
||||
- Capacitor
|
||||
|
||||
@@ -14,6 +16,7 @@ DEPENDENCIES:
|
||||
- "CapacitorCordova (from `../../node_modules/@capacitor/ios`)"
|
||||
- "CapacitorDialog (from `../../node_modules/@capacitor/dialog`)"
|
||||
- "CapacitorHaptics (from `../../node_modules/@capacitor/haptics`)"
|
||||
- "CapacitorKeyboard (from `../../node_modules/@capacitor/keyboard`)"
|
||||
- "CapacitorStatusBar (from `../../node_modules/@capacitor/status-bar`)"
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
@@ -25,6 +28,8 @@ EXTERNAL SOURCES:
|
||||
:path: "../../node_modules/@capacitor/dialog"
|
||||
CapacitorHaptics:
|
||||
:path: "../../node_modules/@capacitor/haptics"
|
||||
CapacitorKeyboard:
|
||||
:path: "../../node_modules/@capacitor/keyboard"
|
||||
CapacitorStatusBar:
|
||||
:path: "../../node_modules/@capacitor/status-bar"
|
||||
|
||||
@@ -33,8 +38,9 @@ SPEC CHECKSUMS:
|
||||
CapacitorCordova: b1fe6bf1f36974a8e4a9044b342d22d49c0996d6
|
||||
CapacitorDialog: 01c49f7f4b37e7ad59e38fd317a6e5f006f23cdc
|
||||
CapacitorHaptics: 864585542a435bd41eaabf7f30d9ff5ec03024d3
|
||||
CapacitorKeyboard: e628d4e66d621c69e449945ebabded17c5b9c2e8
|
||||
CapacitorStatusBar: 48f2899f6846cc7d8431b251ebfc58e1c10e3d58
|
||||
|
||||
PODFILE CHECKSUM: ff860e33eb8ae1ae6b61d80c17c53ef471a81cdc
|
||||
PODFILE CHECKSUM: b469cdc64593e190968b9aa15066224f10938107
|
||||
|
||||
COCOAPODS: 1.12.1
|
||||
|
||||
15
package-lock.json
generated
15
package-lock.json
generated
@@ -13,6 +13,7 @@
|
||||
"@capacitor/dialog": "^5.0.2",
|
||||
"@capacitor/haptics": "^5.0.2",
|
||||
"@capacitor/ios": "^5.0.4",
|
||||
"@capacitor/keyboard": "^5.0.2",
|
||||
"@capacitor/status-bar": "^5.0.2",
|
||||
"@ckeditor/ckeditor5-autoformat": "^37.1.0",
|
||||
"@ckeditor/ckeditor5-basic-styles": "^37.1.0",
|
||||
@@ -293,6 +294,14 @@
|
||||
"@capacitor/core": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@capacitor/keyboard": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@capacitor/keyboard/-/keyboard-5.0.2.tgz",
|
||||
"integrity": "sha512-5qauopAd9Dlltzi87i/WHMBsocCf0BJqVxRZ3H+kifQm4BLHGokrzuanddEJd6MPOnglSl3H3C9oElJB3wkVVQ==",
|
||||
"peerDependencies": {
|
||||
"@capacitor/core": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@capacitor/status-bar": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@capacitor/status-bar/-/status-bar-5.0.2.tgz",
|
||||
@@ -13390,6 +13399,12 @@
|
||||
"integrity": "sha512-JVyggBTbHR1OWqxTRysgGKhZHDuM0AQwCIbylvEpza5X0zmaltbQxVC83abcwOKsgNJnrcuv+HUgV+LXg8Dk4Q==",
|
||||
"requires": {}
|
||||
},
|
||||
"@capacitor/keyboard": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@capacitor/keyboard/-/keyboard-5.0.2.tgz",
|
||||
"integrity": "sha512-5qauopAd9Dlltzi87i/WHMBsocCf0BJqVxRZ3H+kifQm4BLHGokrzuanddEJd6MPOnglSl3H3C9oElJB3wkVVQ==",
|
||||
"requires": {}
|
||||
},
|
||||
"@capacitor/status-bar": {
|
||||
"version": "5.0.2",
|
||||
"resolved": "https://registry.npmjs.org/@capacitor/status-bar/-/status-bar-5.0.2.tgz",
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
"@capacitor/dialog": "^5.0.2",
|
||||
"@capacitor/haptics": "^5.0.2",
|
||||
"@capacitor/ios": "^5.0.4",
|
||||
"@capacitor/keyboard": "^5.0.2",
|
||||
"@capacitor/status-bar": "^5.0.2",
|
||||
"@ckeditor/ckeditor5-autoformat": "^37.1.0",
|
||||
"@ckeditor/ckeditor5-basic-styles": "^37.1.0",
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import { Capacitor } from '@capacitor/core'
|
||||
import { Dialog } from '@capacitor/dialog'
|
||||
import type { ConfirmOptions } from '@capacitor/dialog'
|
||||
import { Haptics, ImpactStyle } from '@capacitor/haptics'
|
||||
|
||||
const props = defineProps<{
|
||||
note: Note
|
||||
@@ -44,7 +43,6 @@ const emit = defineEmits<{
|
||||
const openModal = async (open: () => void, modal: ModalOptions) => {
|
||||
if (['android', 'ios'].includes(Capacitor.getPlatform())) {
|
||||
const { value: confirmed } = await Dialog.confirm(modal.confirmOptions)
|
||||
await Haptics.impact({ style: ImpactStyle.Light });
|
||||
if (confirmed) emit('execute', modal.key)
|
||||
} else {
|
||||
open()
|
||||
|
||||
@@ -8,6 +8,7 @@ import { defaultNotes } from '@/utils/defaultNotes'
|
||||
import { mdToHtml } from '@/utils/markdown'
|
||||
import { getAllMatches } from '@/utils/helpers'
|
||||
import { preferredNotesSource } from '@/composables/useSettings'
|
||||
import { Haptics, ImpactStyle } from '@capacitor/haptics'
|
||||
|
||||
export const notesSources = computed(() => ({
|
||||
local: true,
|
||||
@@ -89,7 +90,7 @@ export const notes = computed<Note[]>(() => {
|
||||
})
|
||||
watch(notes, () => {
|
||||
if (notes.value.length > 0 && !activeNote.value && activeViewMode.value.name === 'Note')
|
||||
setActiveNote(rootNote.value?.id)
|
||||
setActiveNote(rootNote.value?.id, false)
|
||||
})
|
||||
|
||||
const activeNoteId = ref<string>()
|
||||
@@ -99,10 +100,11 @@ watch(activeNote, () => {
|
||||
useTitle(`${activeNote.value.title} | Contexted`)
|
||||
}
|
||||
})
|
||||
export const setActiveNote = (noteId: string | undefined) => {
|
||||
export const setActiveNote = (noteId: string | undefined, haptic: boolean = true) => {
|
||||
if (noteId) {
|
||||
activeNoteId.value = noteId
|
||||
activeViewMode.value = viewModes.find((mode) => mode.name === 'Note') || viewModes[0]
|
||||
if (haptic) Haptics.impact({ style: ImpactStyle.Light })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,7 +120,7 @@ export const setRootNote = (noteId: string) => {
|
||||
}
|
||||
const note = { ...baseNotes.value[noteId], isRoot: true }
|
||||
updateNote(noteId, note)
|
||||
setActiveNote(noteId)
|
||||
setActiveNote(noteId, false)
|
||||
}
|
||||
|
||||
export const insertDefaultNotes = (defaultNotes: BaseNote[]) => {
|
||||
@@ -268,5 +270,5 @@ export const getNotes = async () => {
|
||||
}
|
||||
baseNotes.value = parseBaseNotes(notes)
|
||||
if (!rootNote.value) insertDefaultNotes(defaultNotes)
|
||||
setActiveNote(rootNote.value?.id)
|
||||
setActiveNote(rootNote.value?.id, false)
|
||||
}
|
||||
|
||||
@@ -5,8 +5,10 @@ import App from './App.vue'
|
||||
import { usePreferredDark, useFavicon } from '@vueuse/core'
|
||||
import { initializeFirebase } from '@/composables/useFirebase'
|
||||
import { StatusBar, Style } from '@capacitor/status-bar'
|
||||
import { Keyboard } from '@capacitor/keyboard'
|
||||
|
||||
StatusBar.setStyle({ style: Style.Dark })
|
||||
Keyboard.setAccessoryBarVisible({ isVisible: true })
|
||||
|
||||
initializeFirebase()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user