mappls-map-react-native
Version:
A Mappls GL react native module for creating custom maps
115 lines (99 loc) • 3.23 kB
text/typescript
import { NativeModules } from "react-native";
import NativeRCTMGLModule from '../specs/NativeRCTMGLModule';
import * as PermissionUtils from "./requestAndroidLocationPermissions";
import type { CameraMode } from "./types/CameraMode";
interface IMapplsGLModule {
CameraModes: {
Flight: CameraMode.Flight;
Ease: CameraMode.Ease;
Linear: CameraMode.Linear;
None: CameraMode.None;
};
OfflinePackDownloadState: {
Inactive: string | number;
Active: string | number;
Complete: string | number;
Unknown?: string | number;
};
StyleSource: {
DefaultSourceID: string;
};
StyleURL: {
Default: string;
};
LineJoin: {
Bevel: string;
Round: string;
Miter: string;
}
setRegion(region: string): void;
setDeveloperShowingSplash(developerShowingSplash: boolean): void;
setEnablePromotion(enablePromotion: boolean): void;
setAssociationId(associationId: string): void;
setUsingRasterStyle(usingRasterStyle: boolean): void;
setAllowOtherUrls(allowOtherUrls: boolean): void;
removeCustomHeader(headerName: string): void;
addCustomHeader(headerName: string, headerValue: string): void;
settingClusterId(clusterId: string | null, vin?: string | null): void;
getClusterId(): Promise<string>;
setConnected(connected: boolean): void;
setShowLastSelectedStyle(showLastStyle: boolean): void;
isShowLastSelectedStyle(): Promise<boolean>;
isUsingRasterStyle(): Promise<boolean>;
isAllowOtherUrls(): Promise<boolean>;
isDeveloperShowingSplash(): Promise<boolean>;
isEnablePromotion(): Promise<boolean>;
getAssociationId(): Promise<string|null>;
getDeviceAlias(): Promise<string|null>;
getRegion(): Promise<string|null>;
getUserId(): Promise<string|null>;
setUserId(userId: string): void;
setProxy(proxyHost: string, proxyPort: number): void;
getDigipinFromCoordinate(coordinates: Array<number>): Promise<string>;
getCoordinateFromDigipin(digipin: string): Promise<Array<number>>;
setClusterId(clusterId: string| null, vin?: string|null): void;
requestAndroidLocationPermissions(): Promise<boolean>
}
const MapplsGL: IMapplsGLModule = NativeRCTMGLModule == null ? Object.create(NativeModules.MGLModule): NativeRCTMGLModule;
const setInternalClusterId = (clusterId: string|null, vin?: string|null) => {
if (vin) {
MapplsGL.settingClusterId(clusterId, vin);
} else {
MapplsGL.settingClusterId(clusterId, null);
}
}
MapplsGL.requestAndroidLocationPermissions = PermissionUtils.requestAndroidLocationPermissions
MapplsGL.setClusterId = setInternalClusterId
export const {
CameraModes,
OfflinePackDownloadState,
StyleSource,
StyleURL,
LineJoin,
setRegion,
setDeveloperShowingSplash,
setEnablePromotion,
setAssociationId,
setUsingRasterStyle,
setAllowOtherUrls,
removeCustomHeader,
addCustomHeader,
setClusterId,
getClusterId,
setConnected,
setShowLastSelectedStyle,
isShowLastSelectedStyle,
isUsingRasterStyle,
isAllowOtherUrls,
isDeveloperShowingSplash,
isEnablePromotion,
getAssociationId,
getDeviceAlias,
getRegion,
getUserId,
setUserId,
setProxy,
getDigipinFromCoordinate,
getCoordinateFromDigipin,
requestAndroidLocationPermissions,
} = MapplsGL;