Update status bar
This commit is contained in:
parent
c7378a5687
commit
17f6a4a64a
@ -6,6 +6,8 @@ import android.os.Build
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.WindowInsetsController
|
import android.view.WindowInsetsController
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
|
import androidx.core.view.ViewCompat
|
||||||
|
import androidx.core.view.WindowInsetsCompat
|
||||||
import com.getcapacitor.*
|
import com.getcapacitor.*
|
||||||
import com.getcapacitor.annotation.CapacitorPlugin
|
import com.getcapacitor.annotation.CapacitorPlugin
|
||||||
import com.getcapacitor.annotation.Permission
|
import com.getcapacitor.annotation.Permission
|
||||||
@ -138,53 +140,58 @@ class DumonGeolocation : Plugin() {
|
|||||||
fun configureEdgeToEdge(call: PluginCall) {
|
fun configureEdgeToEdge(call: PluginCall) {
|
||||||
val bgColorHex = call.getString("bgColor") ?: "#FFFFFF"
|
val bgColorHex = call.getString("bgColor") ?: "#FFFFFF"
|
||||||
val style = call.getString("style") ?: "DARK"
|
val style = call.getString("style") ?: "DARK"
|
||||||
|
val overlay = call.getBoolean("overlay") ?: false
|
||||||
|
|
||||||
val window = bridge?.activity?.window
|
val activity = bridge?.activity
|
||||||
if (window == null) {
|
val window = activity?.window
|
||||||
call.reject("No active window")
|
val view = bridge?.webView
|
||||||
|
|
||||||
|
if (window == null || view == null) {
|
||||||
|
call.reject("No active window or webView")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Background color
|
|
||||||
val parsedColor = Color.parseColor(bgColorHex)
|
val parsedColor = Color.parseColor(bgColorHex)
|
||||||
|
|
||||||
|
// Atur overlay (decor fit)
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
|
window.setDecorFitsSystemWindows(!overlay)
|
||||||
|
} else {
|
||||||
|
if (!overlay) {
|
||||||
|
@Suppress("DEPRECATION")
|
||||||
|
window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Atur warna status bar & nav bar
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
window.statusBarColor = parsedColor
|
window.statusBarColor = parsedColor
|
||||||
window.navigationBarColor = parsedColor
|
window.navigationBarColor = parsedColor
|
||||||
}
|
}
|
||||||
|
|
||||||
// Edge-to-edge fit
|
// Style icon (dark/light)
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||||
window.setDecorFitsSystemWindows(true)
|
|
||||||
val controller = window.insetsController
|
val controller = window.insetsController
|
||||||
if (controller != null) {
|
val flags = WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS or
|
||||||
|
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS
|
||||||
if (style.uppercase() == "DARK") {
|
if (style.uppercase() == "DARK") {
|
||||||
controller.setSystemBarsAppearance(
|
controller?.setSystemBarsAppearance(flags, flags)
|
||||||
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS or
|
|
||||||
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS,
|
|
||||||
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS or
|
|
||||||
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS
|
|
||||||
)
|
|
||||||
} else {
|
} else {
|
||||||
controller.setSystemBarsAppearance(
|
controller?.setSystemBarsAppearance(0, flags)
|
||||||
0,
|
|
||||||
WindowInsetsController.APPEARANCE_LIGHT_STATUS_BARS or
|
|
||||||
WindowInsetsController.APPEARANCE_LIGHT_NAVIGATION_BARS
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@Suppress("DEPRECATION")
|
@Suppress("DEPRECATION")
|
||||||
window.clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS)
|
view.systemUiVisibility = when (style.uppercase()) {
|
||||||
|
"DARK" -> View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
|
||||||
@Suppress("DEPRECATION")
|
else -> 0
|
||||||
val flags = if (style.uppercase() == "DARK") {
|
}
|
||||||
View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR or View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR
|
|
||||||
} else {
|
|
||||||
0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
// Handling insets agar konten tidak tertutup nav/status bar
|
||||||
window.decorView.systemUiVisibility = flags
|
ViewCompat.setOnApplyWindowInsetsListener(view) { v, insets ->
|
||||||
|
val sysInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars())
|
||||||
|
v.setPadding(sysInsets.left, sysInsets.top, sysInsets.right, sysInsets.bottom)
|
||||||
|
WindowInsetsCompat.CONSUMED
|
||||||
}
|
}
|
||||||
|
|
||||||
call.resolve()
|
call.resolve()
|
||||||
|
|||||||
4
dist/docs.json
vendored
4
dist/docs.json
vendored
@ -51,12 +51,12 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "configureEdgeToEdge",
|
"name": "configureEdgeToEdge",
|
||||||
"signature": "(options: { bgColor: string; style: 'LIGHT' | 'DARK'; }) => Promise<void>",
|
"signature": "(options: { bgColor: string; style: 'DARK' | 'LIGHT'; overlay?: boolean; }) => Promise<void>",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"name": "options",
|
"name": "options",
|
||||||
"docs": "",
|
"docs": "",
|
||||||
"type": "{ bgColor: string; style: 'LIGHT' | 'DARK'; }"
|
"type": "{ bgColor: string; style: 'DARK' | 'LIGHT'; overlay?: boolean | undefined; }"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"returns": "Promise<void>",
|
"returns": "Promise<void>",
|
||||||
|
|||||||
3
dist/esm/definitions.d.ts
vendored
3
dist/esm/definitions.d.ts
vendored
@ -21,7 +21,8 @@ export interface DumonGeolocationPlugin {
|
|||||||
checkAndRequestPermissions(): Promise<PermissionStatus>;
|
checkAndRequestPermissions(): Promise<PermissionStatus>;
|
||||||
configureEdgeToEdge(options: {
|
configureEdgeToEdge(options: {
|
||||||
bgColor: string;
|
bgColor: string;
|
||||||
style: 'LIGHT' | 'DARK';
|
style: 'DARK' | 'LIGHT';
|
||||||
|
overlay?: boolean;
|
||||||
}): Promise<void>;
|
}): Promise<void>;
|
||||||
addListener(eventName: 'onPositionUpdate', listenerFunc: (data: PositioningData) => void): PluginListenerHandle;
|
addListener(eventName: 'onPositionUpdate', listenerFunc: (data: PositioningData) => void): PluginListenerHandle;
|
||||||
}
|
}
|
||||||
|
|||||||
2
dist/esm/definitions.js.map
vendored
2
dist/esm/definitions.js.map
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n// export interface SatelliteStatus {\n// satellitesInView: number;\n// usedInFix: number;\n// constellationCounts: { [key: string]: number };\n// }\n\n// export interface WifiAp {\n// ssid: string;\n// bssid: string;\n// rssi: number;\n// distance?: number;\n// }\n\n// export interface WifiScanResult {\n// apCount: number;\n// aps: WifiAp[];\n// }\n\n// export interface ImuData {\n// accelX: number;\n// accelY: number;\n// accelZ: number;\n// gyroX: number;\n// gyroY: number;\n// gyroZ: number;\n// speed?: number;\n// acceleration?: number;\n// directionRad?: number;\n// }\n\n// export interface GpsData {\n// latitude: number;\n// longitude: number;\n// accuracy: number;\n// satellitesInView?: number;\n// usedInFix?: number;\n// constellationCounts?: { [key: string]: number };\n// }\n\n// export interface PositioningData {\n// source: 'GNSS' | 'WIFI' | 'FUSED' | 'MOCK';\n// timestamp: number;\n// latitude: number;\n// longitude: number;\n// accuracy: number;\n\n// gnssData?: SatelliteStatus;\n// wifiData?: WifiAp[];\n// imuData?: ImuData;\n// }\n\nexport interface PositioningData {\n source: 'GNSS' | 'WIFI' | 'FUSED' | 'MOCK';\n timestamp: number;\n latitude: number;\n longitude: number;\n accuracy: number;\n speed: number;\n acceleration: number;\n directionRad: number;\n isMocked: boolean;\n}\n\nexport interface PermissionStatus {\n location: 'granted' | 'denied' | 'prompt';\n wifi: 'granted' | 'denied' | 'prompt';\n}\n\nexport interface DumonGeolocationPlugin {\n startPositioning(): Promise<void>;\n stopPositioning(): Promise<void>;\n getLatestPosition(): Promise<PositioningData>;\n checkAndRequestPermissions(): Promise<PermissionStatus>;\n\n configureEdgeToEdge(options: {\n bgColor: string;\n style: 'LIGHT' | 'DARK';\n }): Promise<void>;\n\n addListener(\n eventName: 'onPositionUpdate',\n listenerFunc: (data: PositioningData) => void\n ): PluginListenerHandle;\n}"]}
|
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import type { PluginListenerHandle } from '@capacitor/core';\n\n// export interface SatelliteStatus {\n// satellitesInView: number;\n// usedInFix: number;\n// constellationCounts: { [key: string]: number };\n// }\n\n// export interface WifiAp {\n// ssid: string;\n// bssid: string;\n// rssi: number;\n// distance?: number;\n// }\n\n// export interface WifiScanResult {\n// apCount: number;\n// aps: WifiAp[];\n// }\n\n// export interface ImuData {\n// accelX: number;\n// accelY: number;\n// accelZ: number;\n// gyroX: number;\n// gyroY: number;\n// gyroZ: number;\n// speed?: number;\n// acceleration?: number;\n// directionRad?: number;\n// }\n\n// export interface GpsData {\n// latitude: number;\n// longitude: number;\n// accuracy: number;\n// satellitesInView?: number;\n// usedInFix?: number;\n// constellationCounts?: { [key: string]: number };\n// }\n\n// export interface PositioningData {\n// source: 'GNSS' | 'WIFI' | 'FUSED' | 'MOCK';\n// timestamp: number;\n// latitude: number;\n// longitude: number;\n// accuracy: number;\n\n// gnssData?: SatelliteStatus;\n// wifiData?: WifiAp[];\n// imuData?: ImuData;\n// }\n\nexport interface PositioningData {\n source: 'GNSS' | 'WIFI' | 'FUSED' | 'MOCK';\n timestamp: number;\n latitude: number;\n longitude: number;\n accuracy: number;\n speed: number;\n acceleration: number;\n directionRad: number;\n isMocked: boolean;\n}\n\nexport interface PermissionStatus {\n location: 'granted' | 'denied' | 'prompt';\n wifi: 'granted' | 'denied' | 'prompt';\n}\n\nexport interface DumonGeolocationPlugin {\n startPositioning(): Promise<void>;\n stopPositioning(): Promise<void>;\n getLatestPosition(): Promise<PositioningData>;\n checkAndRequestPermissions(): Promise<PermissionStatus>;\n\n configureEdgeToEdge(options: {\n bgColor: string;\n style: 'DARK' | 'LIGHT';\n overlay?: boolean;\n }): Promise<void>;\n\n addListener(\n eventName: 'onPositionUpdate',\n listenerFunc: (data: PositioningData) => void\n ): PluginListenerHandle;\n}"]}
|
||||||
9
dist/esm/web.d.ts
vendored
9
dist/esm/web.d.ts
vendored
@ -4,4 +4,13 @@ export declare class DumonGeolocationWeb extends WebPlugin {
|
|||||||
startPositioning(): Promise<void>;
|
startPositioning(): Promise<void>;
|
||||||
stopPositioning(): Promise<void>;
|
stopPositioning(): Promise<void>;
|
||||||
getLatestPosition(): Promise<PositioningData>;
|
getLatestPosition(): Promise<PositioningData>;
|
||||||
|
checkAndRequestPermissions(): Promise<{
|
||||||
|
location: 'granted';
|
||||||
|
wifi: 'granted';
|
||||||
|
}>;
|
||||||
|
configureEdgeToEdge(options: {
|
||||||
|
bgColor: string;
|
||||||
|
style: 'DARK' | 'LIGHT';
|
||||||
|
overlay?: boolean;
|
||||||
|
}): Promise<void>;
|
||||||
}
|
}
|
||||||
|
|||||||
8
dist/esm/web.js
vendored
8
dist/esm/web.js
vendored
@ -20,5 +20,13 @@ export class DumonGeolocationWeb extends WebPlugin {
|
|||||||
isMocked: false,
|
isMocked: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
async checkAndRequestPermissions() {
|
||||||
|
console.info('[dumon-geolocation] checkAndRequestPermissions mocked for web.');
|
||||||
|
return { location: 'granted', wifi: 'granted' };
|
||||||
|
}
|
||||||
|
async configureEdgeToEdge(options) {
|
||||||
|
console.info('[dumon-geolocation] configureEdgeToEdge called on web with:', options);
|
||||||
|
// No-op
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=web.js.map
|
//# sourceMappingURL=web.js.map
|
||||||
2
dist/esm/web.js.map
vendored
2
dist/esm/web.js.map
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAChD,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;QACtF,OAAO;YACL,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,QAAQ,EAAE,CAAC;YACX,SAAS,EAAE,CAAC;YACZ,QAAQ,EAAE,GAAG;YACb,KAAK,EAAE,CAAC;YACR,YAAY,EAAE,CAAC;YACf,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,KAAK;SAChB,CAAC;IACJ,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { PositioningData } from './definitions';\n\nexport class DumonGeolocationWeb extends WebPlugin {\n async startPositioning(): Promise<void> {\n console.log('DumonGeolocationWeb: startPositioning() called (no-op)');\n }\n\n async stopPositioning(): Promise<void> {\n console.log('DumonGeolocationWeb: stopPositioning() called (no-op)');\n }\n\n async getLatestPosition(): Promise<PositioningData> {\n console.log('DumonGeolocationWeb: getLatestPosition() called (returning dummy data)');\n return {\n source: 'GNSS',\n timestamp: Date.now(),\n latitude: 0,\n longitude: 0,\n accuracy: 999,\n speed: 0,\n acceleration: 0,\n directionRad: 0,\n isMocked: false,\n };\n }\n}"]}
|
{"version":3,"file":"web.js","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAG5C,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAChD,KAAK,CAAC,gBAAgB;QACpB,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC,CAAC;IACxE,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC,CAAC;IACvE,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;QACtF,OAAO;YACL,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;YACrB,QAAQ,EAAE,CAAC;YACX,SAAS,EAAE,CAAC;YACZ,QAAQ,EAAE,GAAG;YACb,KAAK,EAAE,CAAC;YACR,YAAY,EAAE,CAAC;YACf,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,KAAK;SAChB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,0BAA0B;QAI9B,OAAO,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;QAC/E,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;IAClD,CAAC;IAED,KAAK,CAAC,mBAAmB,CAAC,OAIzB;QACC,OAAO,CAAC,IAAI,CAAC,6DAA6D,EAAE,OAAO,CAAC,CAAC;QACrF,QAAQ;IACV,CAAC;CACF","sourcesContent":["import { WebPlugin } from '@capacitor/core';\nimport type { PositioningData } from './definitions';\n\nexport class DumonGeolocationWeb extends WebPlugin {\n async startPositioning(): Promise<void> {\n console.log('DumonGeolocationWeb: startPositioning() called (no-op)');\n }\n\n async stopPositioning(): Promise<void> {\n console.log('DumonGeolocationWeb: stopPositioning() called (no-op)');\n }\n\n async getLatestPosition(): Promise<PositioningData> {\n console.log('DumonGeolocationWeb: getLatestPosition() called (returning dummy data)');\n return {\n source: 'GNSS',\n timestamp: Date.now(),\n latitude: 0,\n longitude: 0,\n accuracy: 999,\n speed: 0,\n acceleration: 0,\n directionRad: 0,\n isMocked: false,\n };\n }\n\n async checkAndRequestPermissions(): Promise<{\n location: 'granted';\n wifi: 'granted';\n }> {\n console.info('[dumon-geolocation] checkAndRequestPermissions mocked for web.');\n return { location: 'granted', wifi: 'granted' };\n }\n\n async configureEdgeToEdge(options: {\n bgColor: string;\n style: 'DARK' | 'LIGHT';\n overlay?: boolean;\n }): Promise<void> {\n console.info('[dumon-geolocation] configureEdgeToEdge called on web with:', options);\n // No-op\n }\n}"]}
|
||||||
8
dist/plugin.cjs.js
vendored
8
dist/plugin.cjs.js
vendored
@ -27,6 +27,14 @@ class DumonGeolocationWeb extends core.WebPlugin {
|
|||||||
isMocked: false,
|
isMocked: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
async checkAndRequestPermissions() {
|
||||||
|
console.info('[dumon-geolocation] checkAndRequestPermissions mocked for web.');
|
||||||
|
return { location: 'granted', wifi: 'granted' };
|
||||||
|
}
|
||||||
|
async configureEdgeToEdge(options) {
|
||||||
|
console.info('[dumon-geolocation] configureEdgeToEdge called on web with:', options);
|
||||||
|
// No-op
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var web = /*#__PURE__*/Object.freeze({
|
var web = /*#__PURE__*/Object.freeze({
|
||||||
|
|||||||
2
dist/plugin.cjs.js.map
vendored
2
dist/plugin.cjs.js.map
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst DumonGeolocation = registerPlugin('DumonGeolocation', {\n web: () => import('./web').then((m) => new m.DumonGeolocationWeb()),\n});\nexport * from './definitions';\nexport { DumonGeolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class DumonGeolocationWeb extends WebPlugin {\n async startPositioning() {\n console.log('DumonGeolocationWeb: startPositioning() called (no-op)');\n }\n async stopPositioning() {\n console.log('DumonGeolocationWeb: stopPositioning() called (no-op)');\n }\n async getLatestPosition() {\n console.log('DumonGeolocationWeb: getLatestPosition() called (returning dummy data)');\n return {\n source: 'GNSS',\n timestamp: Date.now(),\n latitude: 0,\n longitude: 0,\n accuracy: 999,\n speed: 0,\n acceleration: 0,\n directionRad: 0,\n isMocked: false,\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;AAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;AACvE,CAAC;;ACFM,MAAM,mBAAmB,SAASC,cAAS,CAAC;AACnD,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC;AAC7E;AACA,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC;AAC5E;AACA,IAAI,MAAM,iBAAiB,GAAG;AAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC;AAC7F,QAAQ,OAAO;AACf,YAAY,MAAM,EAAE,MAAM;AAC1B,YAAY,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;AACjC,YAAY,QAAQ,EAAE,CAAC;AACvB,YAAY,SAAS,EAAE,CAAC;AACxB,YAAY,QAAQ,EAAE,GAAG;AACzB,YAAY,KAAK,EAAE,CAAC;AACpB,YAAY,YAAY,EAAE,CAAC;AAC3B,YAAY,YAAY,EAAE,CAAC;AAC3B,YAAY,QAAQ,EAAE,KAAK;AAC3B,SAAS;AACT;AACA;;;;;;;;;"}
|
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst DumonGeolocation = registerPlugin('DumonGeolocation', {\n web: () => import('./web').then((m) => new m.DumonGeolocationWeb()),\n});\nexport * from './definitions';\nexport { DumonGeolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class DumonGeolocationWeb extends WebPlugin {\n async startPositioning() {\n console.log('DumonGeolocationWeb: startPositioning() called (no-op)');\n }\n async stopPositioning() {\n console.log('DumonGeolocationWeb: stopPositioning() called (no-op)');\n }\n async getLatestPosition() {\n console.log('DumonGeolocationWeb: getLatestPosition() called (returning dummy data)');\n return {\n source: 'GNSS',\n timestamp: Date.now(),\n latitude: 0,\n longitude: 0,\n accuracy: 999,\n speed: 0,\n acceleration: 0,\n directionRad: 0,\n isMocked: false,\n };\n }\n async checkAndRequestPermissions() {\n console.info('[dumon-geolocation] checkAndRequestPermissions mocked for web.');\n return { location: 'granted', wifi: 'granted' };\n }\n async configureEdgeToEdge(options) {\n console.info('[dumon-geolocation] configureEdgeToEdge called on web with:', options);\n // No-op\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;AAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;AACvE,CAAC;;ACFM,MAAM,mBAAmB,SAASC,cAAS,CAAC;AACnD,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC;AAC7E;AACA,IAAI,MAAM,eAAe,GAAG;AAC5B,QAAQ,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC;AAC5E;AACA,IAAI,MAAM,iBAAiB,GAAG;AAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC;AAC7F,QAAQ,OAAO;AACf,YAAY,MAAM,EAAE,MAAM;AAC1B,YAAY,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;AACjC,YAAY,QAAQ,EAAE,CAAC;AACvB,YAAY,SAAS,EAAE,CAAC;AACxB,YAAY,QAAQ,EAAE,GAAG;AACzB,YAAY,KAAK,EAAE,CAAC;AACpB,YAAY,YAAY,EAAE,CAAC;AAC3B,YAAY,YAAY,EAAE,CAAC;AAC3B,YAAY,QAAQ,EAAE,KAAK;AAC3B,SAAS;AACT;AACA,IAAI,MAAM,0BAA0B,GAAG;AACvC,QAAQ,OAAO,CAAC,IAAI,CAAC,gEAAgE,CAAC;AACtF,QAAQ,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;AACvD;AACA,IAAI,MAAM,mBAAmB,CAAC,OAAO,EAAE;AACvC,QAAQ,OAAO,CAAC,IAAI,CAAC,6DAA6D,EAAE,OAAO,CAAC;AAC5F;AACA;AACA;;;;;;;;;"}
|
||||||
8
dist/plugin.js
vendored
8
dist/plugin.js
vendored
@ -26,6 +26,14 @@ var capacitorDumonGeolocation = (function (exports, core) {
|
|||||||
isMocked: false,
|
isMocked: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
async checkAndRequestPermissions() {
|
||||||
|
console.info('[dumon-geolocation] checkAndRequestPermissions mocked for web.');
|
||||||
|
return { location: 'granted', wifi: 'granted' };
|
||||||
|
}
|
||||||
|
async configureEdgeToEdge(options) {
|
||||||
|
console.info('[dumon-geolocation] configureEdgeToEdge called on web with:', options);
|
||||||
|
// No-op
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var web = /*#__PURE__*/Object.freeze({
|
var web = /*#__PURE__*/Object.freeze({
|
||||||
|
|||||||
2
dist/plugin.js.map
vendored
2
dist/plugin.js.map
vendored
@ -1 +1 @@
|
|||||||
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst DumonGeolocation = registerPlugin('DumonGeolocation', {\n web: () => import('./web').then((m) => new m.DumonGeolocationWeb()),\n});\nexport * from './definitions';\nexport { DumonGeolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class DumonGeolocationWeb extends WebPlugin {\n async startPositioning() {\n console.log('DumonGeolocationWeb: startPositioning() called (no-op)');\n }\n async stopPositioning() {\n console.log('DumonGeolocationWeb: stopPositioning() called (no-op)');\n }\n async getLatestPosition() {\n console.log('DumonGeolocationWeb: getLatestPosition() called (returning dummy data)');\n return {\n source: 'GNSS',\n timestamp: Date.now(),\n latitude: 0,\n longitude: 0,\n accuracy: 999,\n speed: 0,\n acceleration: 0,\n directionRad: 0,\n isMocked: false,\n };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;IAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;IACvE,CAAC;;ICFM,MAAM,mBAAmB,SAASC,cAAS,CAAC;IACnD,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC;IAC7E;IACA,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC;IAC5E;IACA,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC;IAC7F,QAAQ,OAAO;IACf,YAAY,MAAM,EAAE,MAAM;IAC1B,YAAY,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;IACjC,YAAY,QAAQ,EAAE,CAAC;IACvB,YAAY,SAAS,EAAE,CAAC;IACxB,YAAY,QAAQ,EAAE,GAAG;IACzB,YAAY,KAAK,EAAE,CAAC;IACpB,YAAY,YAAY,EAAE,CAAC;IAC3B,YAAY,YAAY,EAAE,CAAC;IAC3B,YAAY,QAAQ,EAAE,KAAK;IAC3B,SAAS;IACT;IACA;;;;;;;;;;;;;;;"}
|
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst DumonGeolocation = registerPlugin('DumonGeolocation', {\n web: () => import('./web').then((m) => new m.DumonGeolocationWeb()),\n});\nexport * from './definitions';\nexport { DumonGeolocation };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class DumonGeolocationWeb extends WebPlugin {\n async startPositioning() {\n console.log('DumonGeolocationWeb: startPositioning() called (no-op)');\n }\n async stopPositioning() {\n console.log('DumonGeolocationWeb: stopPositioning() called (no-op)');\n }\n async getLatestPosition() {\n console.log('DumonGeolocationWeb: getLatestPosition() called (returning dummy data)');\n return {\n source: 'GNSS',\n timestamp: Date.now(),\n latitude: 0,\n longitude: 0,\n accuracy: 999,\n speed: 0,\n acceleration: 0,\n directionRad: 0,\n isMocked: false,\n };\n }\n async checkAndRequestPermissions() {\n console.info('[dumon-geolocation] checkAndRequestPermissions mocked for web.');\n return { location: 'granted', wifi: 'granted' };\n }\n async configureEdgeToEdge(options) {\n console.info('[dumon-geolocation] configureEdgeToEdge called on web with:', options);\n // No-op\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,gBAAgB,GAAGA,mBAAc,CAAC,kBAAkB,EAAE;IAC5D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,mBAAmB,EAAE,CAAC;IACvE,CAAC;;ICFM,MAAM,mBAAmB,SAASC,cAAS,CAAC;IACnD,IAAI,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,OAAO,CAAC,GAAG,CAAC,wDAAwD,CAAC;IAC7E;IACA,IAAI,MAAM,eAAe,GAAG;IAC5B,QAAQ,OAAO,CAAC,GAAG,CAAC,uDAAuD,CAAC;IAC5E;IACA,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC;IAC7F,QAAQ,OAAO;IACf,YAAY,MAAM,EAAE,MAAM;IAC1B,YAAY,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;IACjC,YAAY,QAAQ,EAAE,CAAC;IACvB,YAAY,SAAS,EAAE,CAAC;IACxB,YAAY,QAAQ,EAAE,GAAG;IACzB,YAAY,KAAK,EAAE,CAAC;IACpB,YAAY,YAAY,EAAE,CAAC;IAC3B,YAAY,YAAY,EAAE,CAAC;IAC3B,YAAY,QAAQ,EAAE,KAAK;IAC3B,SAAS;IACT;IACA,IAAI,MAAM,0BAA0B,GAAG;IACvC,QAAQ,OAAO,CAAC,IAAI,CAAC,gEAAgE,CAAC;IACtF,QAAQ,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACvD;IACA,IAAI,MAAM,mBAAmB,CAAC,OAAO,EAAE;IACvC,QAAQ,OAAO,CAAC,IAAI,CAAC,6DAA6D,EAAE,OAAO,CAAC;IAC5F;IACA;IACA;;;;;;;;;;;;;;;"}
|
||||||
@ -3,4 +3,4 @@ include ':capacitor-android'
|
|||||||
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
|
project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor')
|
||||||
|
|
||||||
include ':dumon-geolocation'
|
include ':dumon-geolocation'
|
||||||
project(':dumon-geolocation').projectDir = new File('../../android')
|
project(':dumon-geolocation').projectDir = new File('../node_modules/dumon-geolocation/android')
|
||||||
|
|||||||
@ -39,8 +39,15 @@ async function getLatestPosition() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener('DOMContentLoaded', () => {
|
window.addEventListener('DOMContentLoaded', async () => {
|
||||||
document.getElementById('startButton').addEventListener('click', startGeolocation);
|
document.getElementById('startButton').addEventListener('click', startGeolocation);
|
||||||
document.getElementById('stopButton').addEventListener('click', stopGeolocation);
|
document.getElementById('stopButton').addEventListener('click', stopGeolocation);
|
||||||
document.getElementById('getLatestButton').addEventListener('click', getLatestPosition);
|
document.getElementById('getLatestButton').addEventListener('click', getLatestPosition);
|
||||||
|
|
||||||
|
|
||||||
|
await DumonGeolocation.configureEdgeToEdge({
|
||||||
|
bgColor: '#ffffff',
|
||||||
|
style: 'DARK',
|
||||||
|
overlay: false, // atau true jika kamu ingin konten masuk ke area statusbar/navbar
|
||||||
|
});
|
||||||
});
|
});
|
||||||
4164
package-lock.json
generated
Normal file
4164
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -76,7 +76,8 @@ export interface DumonGeolocationPlugin {
|
|||||||
|
|
||||||
configureEdgeToEdge(options: {
|
configureEdgeToEdge(options: {
|
||||||
bgColor: string;
|
bgColor: string;
|
||||||
style: 'LIGHT' | 'DARK';
|
style: 'DARK' | 'LIGHT';
|
||||||
|
overlay?: boolean;
|
||||||
}): Promise<void>;
|
}): Promise<void>;
|
||||||
|
|
||||||
addListener(
|
addListener(
|
||||||
|
|||||||
17
src/web.ts
17
src/web.ts
@ -24,4 +24,21 @@ export class DumonGeolocationWeb extends WebPlugin {
|
|||||||
isMocked: false,
|
isMocked: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async checkAndRequestPermissions(): Promise<{
|
||||||
|
location: 'granted';
|
||||||
|
wifi: 'granted';
|
||||||
|
}> {
|
||||||
|
console.info('[dumon-geolocation] checkAndRequestPermissions mocked for web.');
|
||||||
|
return { location: 'granted', wifi: 'granted' };
|
||||||
|
}
|
||||||
|
|
||||||
|
async configureEdgeToEdge(options: {
|
||||||
|
bgColor: string;
|
||||||
|
style: 'DARK' | 'LIGHT';
|
||||||
|
overlay?: boolean;
|
||||||
|
}): Promise<void> {
|
||||||
|
console.info('[dumon-geolocation] configureEdgeToEdge called on web with:', options);
|
||||||
|
// No-op
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user