@greatdayhr/capacitor-datetime-setting 2.0.0 → 2.0.1

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.
@@ -1,20 +1,59 @@
1
1
  package com.datetimesetting;
2
2
 
3
+ import android.content.Context;
4
+ import android.provider.Settings;
5
+
6
+ import com.getcapacitor.JSObject;
3
7
  import com.getcapacitor.Plugin;
8
+ import com.getcapacitor.PluginCall;
9
+ import com.getcapacitor.PluginMethod;
4
10
  import com.getcapacitor.annotation.CapacitorPlugin;
5
11
 
6
12
  /**
7
13
  * DateTimeSettingPlugin - Android Implementation
8
14
  *
9
- * Note: All date/time detection methods are iOS-only.
10
- * Android does not implement the comprehensive features from date_change_checker
11
- * because the source plugin itself only has basic Settings checks on Android.
12
- *
13
- * For Android auto time detection, use native Settings API directly:
14
- * Settings.Global.getInt(context.getContentResolver(), Settings.Global.AUTO_TIME, 0) == 1
15
+ * Cloned from date_change_checker Flutter plugin.
16
+ * Android implementation provides simple Settings check.
15
17
  */
16
18
  @CapacitorPlugin(name = "DateTimeSetting")
17
19
  public class DateTimeSettingPlugin extends Plugin {
18
- // All methods are iOS-only
19
- // Android implementation intentionally left minimal as per date_change_checker source
20
+
21
+ /**
22
+ * Check if date/time has been manually changed.
23
+ * Returns true if auto date/time is disabled.
24
+ *
25
+ * This is the inverse of isAutoDateTimeEnabled check.
26
+ * Matches date_change_checker Android implementation.
27
+ */
28
+ @PluginMethod
29
+ public void isDateTimeChanged(PluginCall call) {
30
+ try {
31
+ Context context = getContext();
32
+ boolean isAutoEnabled = isAutoDateTimeEnabled(context);
33
+
34
+ JSObject result = new JSObject();
35
+ // Return !isAutoEnabled to indicate if date/time might be changed
36
+ result.put("changed", !isAutoEnabled);
37
+ call.resolve(result);
38
+ } catch (Exception e) {
39
+ call.reject("Failed to detect date/time change", e);
40
+ }
41
+ }
42
+
43
+ /**
44
+ * Helper method to check if automatic date/time is enabled.
45
+ * Uses Settings.Global.AUTO_TIME.
46
+ */
47
+ private boolean isAutoDateTimeEnabled(Context context) {
48
+ try {
49
+ int autoTime = Settings.Global.getInt(
50
+ context.getContentResolver(),
51
+ Settings.Global.AUTO_TIME
52
+ );
53
+ return autoTime == 1;
54
+ } catch (Settings.SettingNotFoundException e) {
55
+ // If setting is not found, assume it's disabled
56
+ return false;
57
+ }
58
+ }
20
59
  }
@@ -32,6 +32,26 @@ export interface DateTimeChangeResult {
32
32
  currentDate: number;
33
33
  }
34
34
  export interface DateTimeSettingPlugin {
35
+ /**
36
+ * Check if date/time has been manually changed.
37
+ * Returns true if auto date/time is disabled (inverse of auto time enabled).
38
+ *
39
+ * This is a simple wrapper from date_change_checker source.
40
+ *
41
+ * @returns Promise with boolean indicating if auto time is disabled
42
+ * @since 2.0.1
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const result = await DateTimeSetting.isDateTimeChanged();
47
+ * if (result.changed) {
48
+ * console.log('Auto date/time is disabled - might be manually changed');
49
+ * }
50
+ * ```
51
+ */
52
+ isDateTimeChanged(): Promise<{
53
+ changed: boolean;
54
+ }>;
35
55
  /**
36
56
  * Detects if the device's date/time has been manually changed.
37
57
  * Uses network time comparison for accuracy when available.
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/definitions.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC;;OAEG;IACH,UAAU,EAAE,UAAU,GAAG,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;IAEjE;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IAErB;;OAEG;IACH,qBAAqB,EAAE,OAAO,CAAC;IAE/B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,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;;;OAcG;IACH,kBAAkB,CAAC,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElE;;;;;;;;;;;;;;;;OAgBG;IACH,kBAAkB,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAE5D;;;;;;;;;;;OAWG;IACH,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAClC"}
package/dist/esm/web.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
2
  import type { DateTimeSettingPlugin, DateTimeChangeResult } from './definitions';
3
3
  export declare class DateTimeSettingWeb extends WebPlugin implements DateTimeSettingPlugin {
4
+ isDateTimeChanged(): Promise<{
5
+ changed: boolean;
6
+ }>;
4
7
  detectDateTimeChange(): Promise<{
5
8
  changed: boolean;
6
9
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../src/web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAEjF,qBAAa,kBAAmB,SAAQ,SAAU,YAAW,qBAAqB;IAExE,oBAAoB,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAIrD,iCAAiC,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAIlE,oBAAoB,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAIrD,8BAA8B,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAK/D,YAAY,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC;IAI9C,kBAAkB,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,CAAA;KAA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kB,CAAC,OAAO,EAAE;QAAE,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAIjE,kBAAkB,IAAI,OAAO,CAAC;QAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAI3D,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;CAGvC"}
package/dist/esm/web.js CHANGED
@@ -1,5 +1,8 @@
1
1
  import { WebPlugin } from '@capacitor/core';
2
2
  export class DateTimeSettingWeb extends WebPlugin {
3
+ async isDateTimeChanged() {
4
+ throw this.unimplemented('Not implemented on web.');
5
+ }
3
6
  // Date/Time Change Detection
4
7
  async detectDateTimeChange() {
5
8
  throw this.unimplemented('Not implemented on web.');
@@ -7,6 +7,9 @@ const DateTimeSetting = core.registerPlugin('DateTimeSetting', {
7
7
  });
8
8
 
9
9
  class DateTimeSettingWeb extends core.WebPlugin {
10
+ async isDateTimeChanged() {
11
+ throw this.unimplemented('Not implemented on web.');
12
+ }
10
13
  // Date/Time Change Detection
11
14
  async detectDateTimeChange() {
12
15
  throw this.unimplemented('Not implemented on web.');
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst DateTimeSetting = registerPlugin('DateTimeSetting', {\n web: () => import('./web').then(m => new m.DateTimeSettingWeb()),\n});\nexport * from './definitions';\nexport { DateTimeSetting };\n","import { WebPlugin } from '@capacitor/core';\nexport class DateTimeSettingWeb extends WebPlugin {\n // Date/Time Change Detection\n async detectDateTimeChange() {\n throw this.unimplemented('Not implemented on web.');\n }\n async detectComprehensiveDateTimeChange() {\n throw this.unimplemented('Not implemented on web.');\n }\n async detectDateOnlyChange() {\n throw this.unimplemented('Not implemented on web.');\n }\n async detectAndNotifyDateTimeChanges() {\n throw this.unimplemented('Not implemented on web.');\n }\n // Time Utilities\n async getLocalTime() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getInternetUTCTime() {\n throw this.unimplemented('Not implemented on web.');\n }\n async convertToLocalTime(options) {\n throw this.unimplemented('Not implemented on web.');\n }\n // Timestamp Management\n async setStoredTimestamp(options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async getStoredTimestamp() {\n throw this.unimplemented('Not implemented on web.');\n }\n async resetDetector() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;AAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACpE,CAAC;;ACFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;AAClD;AACA,IAAI,MAAM,oBAAoB,GAAG;AACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,iCAAiC,GAAG;AAC9C,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,oBAAoB,GAAG;AACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,8BAA8B,GAAG;AAC3C,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ;AACA,IAAI,MAAM,YAAY,GAAG;AACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;AACtC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ;AACA,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;AACtC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,kBAAkB,GAAG;AAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.cjs.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst DateTimeSetting = registerPlugin('DateTimeSetting', {\n web: () => import('./web').then(m => new m.DateTimeSettingWeb()),\n});\nexport * from './definitions';\nexport { DateTimeSetting };\n","import { WebPlugin } from '@capacitor/core';\nexport class DateTimeSettingWeb extends WebPlugin {\n async isDateTimeChanged() {\n throw this.unimplemented('Not implemented on web.');\n }\n // Date/Time Change Detection\n async detectDateTimeChange() {\n throw this.unimplemented('Not implemented on web.');\n }\n async detectComprehensiveDateTimeChange() {\n throw this.unimplemented('Not implemented on web.');\n }\n async detectDateOnlyChange() {\n throw this.unimplemented('Not implemented on web.');\n }\n async detectAndNotifyDateTimeChanges() {\n throw this.unimplemented('Not implemented on web.');\n }\n // Time Utilities\n async getLocalTime() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getInternetUTCTime() {\n throw this.unimplemented('Not implemented on web.');\n }\n async convertToLocalTime(options) {\n throw this.unimplemented('Not implemented on web.');\n }\n // Timestamp Management\n async setStoredTimestamp(options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async getStoredTimestamp() {\n throw this.unimplemented('Not implemented on web.');\n }\n async resetDetector() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"],"names":["registerPlugin","WebPlugin"],"mappings":";;;;AACK,MAAC,eAAe,GAAGA,mBAAc,CAAC,iB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C;AAC3D,IAAI;AACJ,IAAI,MAAM,aAAa,GAAG;AAC1B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;AAC3D,IAAI;AACJ;;;;;;;;;"}
package/dist/plugin.js CHANGED
@@ -6,6 +6,9 @@ var capacitorDatetimeSetting = (function (exports, core) {
6
6
  });
7
7
 
8
8
  class DateTimeSettingWeb extends core.WebPlugin {
9
+ async isDateTimeChanged() {
10
+ throw this.unimplemented('Not implemented on web.');
11
+ }
9
12
  // Date/Time Change Detection
10
13
  async detectDateTimeChange() {
11
14
  throw this.unimplemented('Not implemented on web.');
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst DateTimeSetting = registerPlugin('DateTimeSetting', {\n web: () => import('./web').then(m => new m.DateTimeSettingWeb()),\n});\nexport * from './definitions';\nexport { DateTimeSetting };\n","import { WebPlugin } from '@capacitor/core';\nexport class DateTimeSettingWeb extends WebPlugin {\n // Date/Time Change Detection\n async detectDateTimeChange() {\n throw this.unimplemented('Not implemented on web.');\n }\n async detectComprehensiveDateTimeChange() {\n throw this.unimplemented('Not implemented on web.');\n }\n async detectDateOnlyChange() {\n throw this.unimplemented('Not implemented on web.');\n }\n async detectAndNotifyDateTimeChanges() {\n throw this.unimplemented('Not implemented on web.');\n }\n // Time Utilities\n async getLocalTime() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getInternetUTCTime() {\n throw this.unimplemented('Not implemented on web.');\n }\n async convertToLocalTime(options) {\n throw this.unimplemented('Not implemented on web.');\n }\n // Timestamp Management\n async setStoredTimestamp(options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async getStoredTimestamp() {\n throw this.unimplemented('Not implemented on web.');\n }\n async resetDetector() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,eAAe,GAAGA,mBAAc,CAAC,iBAA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C3D,IAAI;IACJ;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst DateTimeSetting = registerPlugin('DateTimeSetting', {\n web: () => import('./web').then(m => new m.DateTimeSettingWeb()),\n});\nexport * from './definitions';\nexport { DateTimeSetting };\n","import { WebPlugin } from '@capacitor/core';\nexport class DateTimeSettingWeb extends WebPlugin {\n async isDateTimeChanged() {\n throw this.unimplemented('Not implemented on web.');\n }\n // Date/Time Change Detection\n async detectDateTimeChange() {\n throw this.unimplemented('Not implemented on web.');\n }\n async detectComprehensiveDateTimeChange() {\n throw this.unimplemented('Not implemented on web.');\n }\n async detectDateOnlyChange() {\n throw this.unimplemented('Not implemented on web.');\n }\n async detectAndNotifyDateTimeChanges() {\n throw this.unimplemented('Not implemented on web.');\n }\n // Time Utilities\n async getLocalTime() {\n throw this.unimplemented('Not implemented on web.');\n }\n async getInternetUTCTime() {\n throw this.unimplemented('Not implemented on web.');\n }\n async convertToLocalTime(options) {\n throw this.unimplemented('Not implemented on web.');\n }\n // Timestamp Management\n async setStoredTimestamp(options) {\n throw this.unimplemented('Not implemented on web.');\n }\n async getStoredTimestamp() {\n throw this.unimplemented('Not implemented on web.');\n }\n async resetDetector() {\n throw this.unimplemented('Not implemented on web.');\n }\n}\n"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,eAAe,GAAGA,mBAAc,CAAC,iBAAiB,EAAE;IAC1D,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,kBAAkB,EAAE,CAAC;IACpE,CAAC;;ICFM,MAAM,kBAAkB,SAASC,cAAS,CAAC;IAClD,IAAI,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ;IACA,IAAI,MAAM,oBAAoB,GAAG;IACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,iCAAiC,GAAG;IAC9C,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,oBAAoB,GAAG;IACjC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,8BAA8B,GAAG;IAC3C,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ;IACA,IAAI,MAAM,YAAY,GAAG;IACzB,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;IACtC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ;IACA,IAAI,MAAM,kBAAkB,CAAC,OAAO,EAAE;IACtC,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ,IAAI,MAAM,aAAa,GAAG;IAC1B,QAAQ,MAAM,IAAI,CAAC,aAAa,CAAC,yBAAyB,CAAC;IAC3D,IAAI;IACJ;;;;;;;;;;;;;;;"}
@@ -5,6 +5,9 @@
5
5
  // Define the plugin using the CAP_PLUGIN Macro, and
6
6
  // each method the plugin supports using the CAP_PLUGIN_METHOD macro.
7
7
  CAP_PLUGIN(DateTimeSettingPlugin, "DateTimeSetting",
8
+ // Simple change detection
9
+ CAP_PLUGIN_METHOD(isDateTimeChanged, CAPPluginReturnPromise);
10
+
8
11
  // Date/Time Change Detection
9
12
  CAP_PLUGIN_METHOD(detectDateTimeChange, CAPPluginReturnPromise);
10
13
  CAP_PLUGIN_METHOD(detectComprehensiveDateTimeChange, CAPPluginReturnPromise);
@@ -24,6 +24,24 @@ public class DateTimeSettingPlugin: CAPPlugin {
24
24
  AutoDateTimeDetector.stopNetworkMonitoring()
25
25
  }
26
26
 
27
+ /**
28
+ * Check if date/time has been manually changed (inverse of auto time enabled).
29
+ * This is a simple wrapper that returns !isAutoDateTimeEnabled.
30
+ *
31
+ * From date_change_checker source:
32
+ * Returns true if auto date/time is disabled, indicating possible manual changes.
33
+ */
34
+ @objc func isDateTimeChanged(_ call: CAPPluginCall) {
35
+ AutoDateTimeDetector.isAutoDateTimeEnabled { isEnabled in
36
+ DispatchQueue.main.async {
37
+ // Return !isEnabled to indicate if date/time has been changed
38
+ call.resolve([
39
+ "changed": !isEnabled
40
+ ])
41
+ }
42
+ }
43
+ }
44
+
27
45
  // MARK: - Date/Time Change Detection
28
46
 
29
47
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatdayhr/capacitor-datetime-setting",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Capacitor plugin for comprehensive iOS date/time change detection. Cloned from date_change_checker Flutter plugin.",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",