@capgo/capacitor-flash 8.0.37 → 8.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -15,7 +15,7 @@ import com.getcapacitor.annotation.CapacitorPlugin;
|
|
|
15
15
|
@CapacitorPlugin(name = "CapacitorFlash")
|
|
16
16
|
public class CapacitorFlashPlugin extends Plugin {
|
|
17
17
|
|
|
18
|
-
private final String pluginVersion = "8.0.
|
|
18
|
+
private final String pluginVersion = "8.0.38";
|
|
19
19
|
|
|
20
20
|
private String cameraId;
|
|
21
21
|
boolean isFlashStateOn = false;
|
package/dist/plugin.cjs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorFlash = registerPlugin('CapacitorFlash', {\n web: () => import('./web').then((m) => new m.CapacitorFlashWeb()),\n});\nexport * from './definitions';\nexport { CapacitorFlash };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorFlashWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.stream = null;\n this.track = null;\n this.torchOn = false;\n }\n async isAvailable() {\n var _a, _b;\n try {\n if (!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia)) {\n return { value: false };\n }\n const stream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode: 'environment' },\n });\n const track = stream.getVideoTracks()[0];\n const capabilities = (_b = track.getCapabilities) === null || _b === void 0 ? void 0 : _b.call(track);\n const hasTorch = (capabilities === null || capabilities === void 0 ? void 0 : capabilities.torch) === true;\n // Stop the test stream\n track.stop();\n return { value: hasTorch };\n }\n catch (_c) {\n return { value: false };\n }\n }\n async switchOn(_options) {\n var _a;\n try {\n // If we already have a stream with torch on, just return\n if (this.stream && this.torchOn) {\n return;\n }\n // Get camera stream if we don't have one\n if (!this.stream) {\n this.stream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode: 'environment' },\n });\n this.track = this.stream.getVideoTracks()[0];\n }\n // Apply torch constraint\n await ((_a = this.track) === null || _a === void 0 ? void 0 : _a.applyConstraints({\n advanced: [{ torch: true }],\n }));\n this.torchOn = true;\n }\n catch (e) {\n throw new Error(`Failed to switch on torch: ${e}`);\n }\n }\n async switchOff() {\n try {\n if (this.track) {\n // Turn off torch by stopping the track\n this.track.stop();\n this.track = null;\n }\n if (this.stream) {\n this.stream = null;\n }\n this.torchOn = false;\n }\n catch (e) {\n throw new Error(`Failed to switch off torch: ${e}`);\n }\n }\n async isSwitchedOn() {\n return { value: this.torchOn };\n }\n async toggle() {\n if (this.torchOn) {\n await this.switchOff();\n }\n else {\n await this.switchOn({});\n }\n return { value: this.torchOn };\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;AACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACrE,CAAC;;ACFM,MAAM,iBAAiB,SAASC,cAAS,CAAC;AACjD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;AAC3B,QAAQ,IAAI,CAAC,MAAM,GAAG,IAAI;AAC1B,QAAQ,IAAI,CAAC,KAAK,GAAG,IAAI;AACzB,QAAQ,IAAI,CAAC,OAAO,GAAG,KAAK;AAC5B,IAAI;AACJ,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,IAAI,EAAE,EAAE,EAAE;AAClB,QAAQ,IAAI;AACZ,YAAY,IAAI,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,YAAY,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GA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IAAI,CAAC,SAAS,EAAE;AAClC,QAAQ;AACR,aAAa;AACb,YAAY,MAAM,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC;AACnC,QAAQ;AACR,QAAQ,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE;AACtC,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ
|
|
1
|
+
{"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorFlash = registerPlugin('CapacitorFlash', {\n web: () => import('./web').then((m) => new m.CapacitorFlashWeb()),\n});\nexport * from './definitions';\nexport { CapacitorFlash };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorFlashWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.stream = null;\n this.track = null;\n this.torchOn = false;\n }\n async isAvailable() {\n var _a, _b;\n try {\n if (!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia)) {\n return { value: false };\n }\n const stream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode: 'environment' },\n });\n const track = stream.getVideoTracks()[0];\n const capabilities = (_b = track.getCapabilities) === null || _b === void 0 ? void 0 : _b.call(track);\n const hasTorch = (capabilities === null || capabilities === void 0 ? void 0 : capabilities.torch) === true;\n // Stop the test stream\n track.stop();\n return { value: hasTorch };\n }\n catch (_c) {\n return { value: false };\n }\n }\n async switchOn(_options) {\n var _a;\n try {\n // If we already have a stream with torch on, just return\n if (this.stream && this.torchOn) {\n return;\n }\n // Get camera stream if we don't have one\n if (!this.stream) {\n this.stream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode: 'environment' },\n });\n this.track = this.stream.getVideoTracks()[0];\n }\n // Apply torch constraint\n await ((_a = this.track) === null || _a === void 0 ? void 0 : _a.applyConstraints({\n advanced: [{ torch: true }],\n }));\n this.torchOn = true;\n }\n catch (e) {\n throw new Error(`Failed to switch on torch: ${e}`);\n }\n }\n async switchOff() {\n try {\n if (this.track) {\n // Turn off torch by stopping the track\n this.track.stop();\n this.track = null;\n }\n if (this.stream) {\n this.stream = null;\n }\n this.torchOn = false;\n }\n catch (e) {\n throw new Error(`Failed to switch off torch: ${e}`);\n }\n }\n async isSwitchedOn() {\n return { value: this.torchOn };\n }\n async toggle() {\n if (this.torchOn) {\n await this.switchOff();\n }\n else {\n await this.switchOn({});\n }\n return { value: this.torchOn };\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;AACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;AACrE,CAAC;;ACFM,MAAM,iBAAiB,SAASC,cAAS,CAAC;AACjD,IAAI,WAAW,GAAG;AAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;AAC3B,QAAQ,IAAI,CAAC,MAAM,GAAG,IAAI;AAC1B,QAAQ,IAAI,CAAC,KAAK,GAAG,IAAI;AACzB,QAAQ,IAAI,CAAC,OAAO,GAAG,KAAK;AAC5B,IAAI;AACJ,IAAI,MAAM,WAAW,GAAG;AACxB,QAAQ,IAAI,EAAE,EAAE,EAAE;AAClB,QAAQ,IAAI;AACZ,YAAY,IAAI,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,YAAY,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE;AACvG,gBAAgB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;AACvC,YAAY;AACZ,YAAY,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,YAAY,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,IAAI,CAAC,OAAO,EAAE;AACtC,IAAI;AACJ,IAAI,MAAM,gBAAgB,GAAG;AAC7B,QAAQ,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;AACjC,IAAI;AACJ;;;;;;;"}
|
package/dist/plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorFlash = registerPlugin('CapacitorFlash', {\n web: () => import('./web').then((m) => new m.CapacitorFlashWeb()),\n});\nexport * from './definitions';\nexport { CapacitorFlash };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorFlashWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.stream = null;\n this.track = null;\n this.torchOn = false;\n }\n async isAvailable() {\n var _a, _b;\n try {\n if (!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia)) {\n return { value: false };\n }\n const stream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode: 'environment' },\n });\n const track = stream.getVideoTracks()[0];\n const capabilities = (_b = track.getCapabilities) === null || _b === void 0 ? void 0 : _b.call(track);\n const hasTorch = (capabilities === null || capabilities === void 0 ? void 0 : capabilities.torch) === true;\n // Stop the test stream\n track.stop();\n return { value: hasTorch };\n }\n catch (_c) {\n return { value: false };\n }\n }\n async switchOn(_options) {\n var _a;\n try {\n // If we already have a stream with torch on, just return\n if (this.stream && this.torchOn) {\n return;\n }\n // Get camera stream if we don't have one\n if (!this.stream) {\n this.stream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode: 'environment' },\n });\n this.track = this.stream.getVideoTracks()[0];\n }\n // Apply torch constraint\n await ((_a = this.track) === null || _a === void 0 ? void 0 : _a.applyConstraints({\n advanced: [{ torch: true }],\n }));\n this.torchOn = true;\n }\n catch (e) {\n throw new Error(`Failed to switch on torch: ${e}`);\n }\n }\n async switchOff() {\n try {\n if (this.track) {\n // Turn off torch by stopping the track\n this.track.stop();\n this.track = null;\n }\n if (this.stream) {\n this.stream = null;\n }\n this.torchOn = false;\n }\n catch (e) {\n throw new Error(`Failed to switch off torch: ${e}`);\n }\n }\n async isSwitchedOn() {\n return { value: this.torchOn };\n }\n async toggle() {\n if (this.torchOn) {\n await this.switchOff();\n }\n else {\n await this.switchOn({});\n }\n return { value: this.torchOn };\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;IACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACrE,CAAC;;ICFM,MAAM,iBAAiB,SAASC,cAAS,CAAC;IACjD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;IAC3B,QAAQ,IAAI,CAAC,MAAM,GAAG,IAAI;IAC1B,QAAQ,IAAI,CAAC,KAAK,GAAG,IAAI;IACzB,QAAQ,IAAI,CAAC,OAAO,GAAG,KAAK;IAC5B,IAAI;IACJ,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,IAAI,EAAE,EAAE,EAAE;IAClB,QAAQ,IAAI;IACZ,YAAY,IAAI,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,YAAY,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE;IACvG,gBAAgB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;IACvC,YAAY;IACZ,YAAY,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,YAAY,CAAC,YAAY,CAAC;IACrE,gBAAgB,KAAK,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE;IACpD,aAAa,CAAC;IACd,YAA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,EAAE,KAAK,EAAE;IACjC,IAAI;IACJ
|
|
1
|
+
{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst CapacitorFlash = registerPlugin('CapacitorFlash', {\n web: () => import('./web').then((m) => new m.CapacitorFlashWeb()),\n});\nexport * from './definitions';\nexport { CapacitorFlash };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class CapacitorFlashWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.stream = null;\n this.track = null;\n this.torchOn = false;\n }\n async isAvailable() {\n var _a, _b;\n try {\n if (!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia)) {\n return { value: false };\n }\n const stream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode: 'environment' },\n });\n const track = stream.getVideoTracks()[0];\n const capabilities = (_b = track.getCapabilities) === null || _b === void 0 ? void 0 : _b.call(track);\n const hasTorch = (capabilities === null || capabilities === void 0 ? void 0 : capabilities.torch) === true;\n // Stop the test stream\n track.stop();\n return { value: hasTorch };\n }\n catch (_c) {\n return { value: false };\n }\n }\n async switchOn(_options) {\n var _a;\n try {\n // If we already have a stream with torch on, just return\n if (this.stream && this.torchOn) {\n return;\n }\n // Get camera stream if we don't have one\n if (!this.stream) {\n this.stream = await navigator.mediaDevices.getUserMedia({\n video: { facingMode: 'environment' },\n });\n this.track = this.stream.getVideoTracks()[0];\n }\n // Apply torch constraint\n await ((_a = this.track) === null || _a === void 0 ? void 0 : _a.applyConstraints({\n advanced: [{ torch: true }],\n }));\n this.torchOn = true;\n }\n catch (e) {\n throw new Error(`Failed to switch on torch: ${e}`);\n }\n }\n async switchOff() {\n try {\n if (this.track) {\n // Turn off torch by stopping the track\n this.track.stop();\n this.track = null;\n }\n if (this.stream) {\n this.stream = null;\n }\n this.torchOn = false;\n }\n catch (e) {\n throw new Error(`Failed to switch off torch: ${e}`);\n }\n }\n async isSwitchedOn() {\n return { value: this.torchOn };\n }\n async toggle() {\n if (this.torchOn) {\n await this.switchOff();\n }\n else {\n await this.switchOn({});\n }\n return { value: this.torchOn };\n }\n async getPluginVersion() {\n return { version: 'web' };\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,cAAc,GAAGA,mBAAc,CAAC,gBAAgB,EAAE;IACxD,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACrE,CAAC;;ICFM,MAAM,iBAAiB,SAASC,cAAS,CAAC;IACjD,IAAI,WAAW,GAAG;IAClB,QAAQ,KAAK,CAAC,GAAG,SAAS,CAAC;IAC3B,QAAQ,IAAI,CAAC,MAAM,GAAG,IAAI;IAC1B,QAAQ,IAAI,CAAC,KAAK,GAAG,IAAI;IACzB,QAAQ,IAAI,CAAC,OAAO,GAAG,KAAK;IAC5B,IAAI;IACJ,IAAI,MAAM,WAAW,GAAG;IACxB,QAAQ,IAAI,EAAE,EAAE,EAAE;IAClB,QAAQ,IAAI;IACZ,YAAY,IAAI,EAAE,CAAC,EAAE,GAAG,SAAS,CAAC,YAAY,MAAM,IAAI,IAAI,EAAE,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE;IACvG,gBAAgB,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE;IACvC,YAAY;IACZ,YAAY,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,YAAY,CAAC,YAAY,CAAC;IACrE,gBAAgB,KAAK,EAAE,EAAE,UAAU,EAAE,aAAa,EAAE;IACpD,aAAa,CAAC;IACd,YAAY,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;IACpD,YAAY,MAAM,YAAY,GAAG,CAAC,EAAE,GAAG,KAAK,CAAC,eAAe,MAAM,IAAI,IAAI,EAAE,KAA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orFlashPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
10
|
-
private let pluginVersion: String = "8.0.
|
|
10
|
+
private let pluginVersion: String = "8.0.38"
|
|
11
11
|
public let identifier = "CapacitorFlashPlugin"
|
|
12
12
|
public let jsName = "CapacitorFlash"
|
|
13
13
|
public let pluginMethods: [CAPPluginMethod] = [
|