Skip to content

Commit

Permalink
Merge pull request #1 from proximiio/feat/image-management
Browse files Browse the repository at this point in the history
feat: image management
  • Loading branch information
wirrareka authored Oct 16, 2024
2 parents e183959 + b3a58c2 commit 3035a7f
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ interface Props {
}

const uri =
'https://proximiio-map-mobile.ams3.cdn.digitaloceanspaces.com/1.0.0-b16/index.html';
'https://proximiio-map-mobile.ams3.cdn.digitaloceanspaces.com/1.0.0-b17/index.html';

export interface Feature {
id: string;
Expand Down Expand Up @@ -93,6 +93,9 @@ enum Action {
getFeatures = 'getFeatures',
routeFind = 'routeFind',
routeStart = 'routeStart',
addImage = 'addImage',
hasImage = 'hasImage',
removeImage = 'removeImage',
}

export function metersToSteps(meters: number) {
Expand All @@ -104,6 +107,22 @@ export class ProximiioMap extends Component<Props> {
callbacks: { [id: string]: (params: never) => void } = {};
ready = false;

async addImage(id: string, _uri: string): Promise<boolean> {
const params = `'${id}', '${_uri}'`;
const result = await this.asyncTask(Action.addImage, params);
return result as boolean;
}

async hasImage(id: string): Promise<boolean> {
const result = await this.asyncTask(Action.hasImage, `'${id}'`);
return result as boolean;
}

async removeImage(id: string): Promise<boolean> {
const result = await this.asyncTask(Action.removeImage, `'${id}'`);
return result as boolean;
}

setCenter(lat: number, lng: number) {
this.dispatch(`mapController.setCenter(${lat}, ${lng});`);
}
Expand Down

0 comments on commit 3035a7f

Please sign in to comment.