-
Notifications
You must be signed in to change notification settings - Fork 8
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
geolocation and position packages #37
base: main
Are you sure you want to change the base?
Conversation
in: { data: { | ||
type_id: containTypeLinkId, | ||
from_id: packageLinkId, | ||
string: { data: { value: 'earth' } }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Earth
@@ -0,0 +1,15 @@ | |||
import { Geolocation } from '@capacitor/geolocation'; | |||
|
|||
export const checkPermissions = async ({callback}: {callback?: ({newPermissionStatus}: {newPermissionStatus: any}) => any}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are not you able to add type to newPermissionStatus from capacitor?
imports/position/clear-watch.ts
Outdated
export const clearWatch = async ({watchId, callback}: { watchId: string, callback?: ({ result, error }: { result?: string, error?: any }) => void} ) => { | ||
try { | ||
await Geolocation.clearWatch({id: watchId}); | ||
callback && callback({result: 'success'}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callback?.()
imports/position/clear-watch.ts
Outdated
callback && callback({result: 'success'}); | ||
} catch (error) { | ||
console.error(error); | ||
callback && callback({error}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callback?.()
export const getCurrentPosition = async ({callback}: {callback?: ({coordinates: Position}) => void}) => { | ||
try { | ||
const coordinates: Position = await Geolocation.getCurrentPosition(); | ||
callback && callback({coordinates}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callback?.()
return coordinates; | ||
} catch (error) { | ||
console.log(error); | ||
callback && callback({coordinates: null}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callback?.()
imports/position/watch-position.ts
Outdated
const newWatchId = await Geolocation.watchPosition(options, (newPosition, error) => { | ||
if (error) { | ||
console.error(error); | ||
callback && callback({error}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callback?.()
imports/position/watch-position.ts
Outdated
callback && callback({error}); | ||
return {error}; | ||
} | ||
callback && callback({newPosition}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callback?.()
imports/position/watch-position.ts
Outdated
} | ||
callback && callback({newPosition}); | ||
}); | ||
callback && callback({newWatchId}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callback?.()
imports/position/watch-position.ts
Outdated
return {newWatchId}; | ||
} catch (error) { | ||
console.error(error); | ||
callback && callback({error}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
callback?.()
…check if undefind
Fixed |
}, | ||
] }, | ||
}); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
imports/position/save-position.ts
Outdated
if (coordinates?.x) { | ||
const { | ||
data: [{ id: xLinkId }], | ||
} = await deep.insert({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reduce amount of deep network requests
This comment applies to all the places working like these lines of code
No description provided.