nativine 1.0.2

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.
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Pedometer / Step Counter Module
3
+ *
4
+ * Access the device's built-in step counter sensor to track steps.
5
+ * Uses Android's TYPE_STEP_COUNTER hardware sensor.
6
+ * Requires ACTIVITY_RECOGNITION permission on Android 10+.
7
+ */
8
+ export interface StepCountResult {
9
+ /** Number of steps since tracking started */
10
+ steps: number;
11
+ }
12
+ export interface PedometerAvailability {
13
+ /** Whether the device has a step counter sensor */
14
+ available: boolean;
15
+ }
16
+ /**
17
+ * Check if the device has a step counter sensor.
18
+ *
19
+ * @returns Promise resolving with availability info
20
+ *
21
+ * @example
22
+ * ```js
23
+ * const { available } = await nativine.pedometer.isAvailable();
24
+ * if (available) {
25
+ * nativine.pedometer.startTracking();
26
+ * }
27
+ * ```
28
+ */
29
+ export declare function isAvailable(): Promise<PedometerAvailability>;
30
+ /**
31
+ * Get the current step count since tracking started.
32
+ * Returns 0 if tracking hasn't been started yet.
33
+ *
34
+ * @returns Promise resolving with the step count
35
+ *
36
+ * @example
37
+ * ```js
38
+ * const { steps } = await nativine.pedometer.getStepCount();
39
+ * console.log(`You've taken ${steps} steps`);
40
+ * ```
41
+ */
42
+ export declare function getStepCount(): Promise<StepCountResult>;
43
+ /**
44
+ * Start tracking steps. The step count resets to 0 when tracking begins.
45
+ * Step updates are dispatched as 'stepUpdate' events via `nativine.on()`.
46
+ *
47
+ * @example
48
+ * ```js
49
+ * nativine.pedometer.startTracking();
50
+ *
51
+ * // Listen for real-time step updates
52
+ * nativine.on('stepUpdate', ({ steps }) => {
53
+ * document.getElementById('step-count').textContent = steps;
54
+ * });
55
+ * ```
56
+ */
57
+ export declare function startTracking(): void;
58
+ /**
59
+ * Stop tracking steps. The sensor listener is unregistered to save battery.
60
+ *
61
+ * @example
62
+ * ```js
63
+ * nativine.pedometer.stopTracking();
64
+ * ```
65
+ */
66
+ export declare function stopTracking(): void;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Print Module
3
+ *
4
+ * Trigger native print dialog for the current page.
5
+ */
6
+ /**
7
+ * Open the native print dialog for the current WebView content.
8
+ *
9
+ * @example
10
+ * ```js
11
+ * nativine.print();
12
+ * ```
13
+ */
14
+ export declare function printPage(): void;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Reviews Module
3
+ *
4
+ * Trigger the native in-app review dialog (Google Play / App Store).
5
+ */
6
+ /**
7
+ * Request an in-app review from the user.
8
+ * Uses Google Play In-App Review API (Android) or StoreKit (iOS).
9
+ *
10
+ * Note: The system may not show the dialog if the user has already reviewed
11
+ * or if the request is too frequent. This is controlled by the platform.
12
+ *
13
+ * @example
14
+ * ```js
15
+ * // After a positive user interaction
16
+ * nativine.reviews.request();
17
+ * ```
18
+ */
19
+ export declare function request(): void;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Screenshot Module
3
+ *
4
+ * Control screenshot protection (prevent screenshots of sensitive screens).
5
+ */
6
+ /**
7
+ * Enable or disable screenshot/screen recording protection.
8
+ * When enabled, the app content appears black in screenshots and screen recordings.
9
+ *
10
+ * @param enabled - Whether to enable screenshot protection
11
+ *
12
+ * @example
13
+ * ```js
14
+ * // Protect a banking page
15
+ * nativine.screenshot.setProtection(true);
16
+ *
17
+ * // Remove protection when leaving
18
+ * nativine.screenshot.setProtection(false);
19
+ * ```
20
+ */
21
+ export declare function setProtection(enabled: boolean): void;
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Share Module
3
+ *
4
+ * Trigger the native share sheet to share text, URLs, and files.
5
+ */
6
+ export interface ShareOptions {
7
+ /** Title for the share sheet (Android) */
8
+ title?: string;
9
+ /** Text content to share */
10
+ text?: string;
11
+ /** URL to share */
12
+ url?: string;
13
+ }
14
+ export interface ShareFileOptions {
15
+ /** Absolute file path or content:// URI */
16
+ filePath: string;
17
+ /** MIME type of the file */
18
+ mimeType?: string;
19
+ /** Title for the share sheet */
20
+ title?: string;
21
+ }
22
+ /**
23
+ * Open the native share sheet with the specified content.
24
+ *
25
+ * @example
26
+ * ```js
27
+ * nativine.share.share({
28
+ * title: 'Check this out',
29
+ * text: 'Amazing app!',
30
+ * url: 'https://example.com'
31
+ * });
32
+ * ```
33
+ */
34
+ export declare function share(options: ShareOptions): void;
35
+ /**
36
+ * Share a file using the native share sheet.
37
+ *
38
+ * @example
39
+ * ```js
40
+ * nativine.share.shareFile({
41
+ * filePath: '/storage/emulated/0/Download/report.pdf',
42
+ * mimeType: 'application/pdf'
43
+ * });
44
+ * ```
45
+ */
46
+ export declare function shareFile(options: ShareFileOptions): void;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Storage Module
3
+ *
4
+ * Persistent key-value storage that survives WebView cache clears.
5
+ * Data is stored in Android SharedPreferences / iOS UserDefaults,
6
+ * not in the WebView's localStorage.
7
+ */
8
+ /**
9
+ * Store a value persistently in native storage.
10
+ * This data persists even when the WebView cache is cleared.
11
+ *
12
+ * @param key - The storage key
13
+ * @param value - The value to store (will be serialized to string)
14
+ *
15
+ * @example
16
+ * ```js
17
+ * await nativine.storage.set('auth_token', 'abc123');
18
+ * await nativine.storage.set('user', JSON.stringify({ name: 'John' }));
19
+ * ```
20
+ */
21
+ export declare function set(key: string, value: string): void;
22
+ /**
23
+ * Retrieve a value from native persistent storage.
24
+ *
25
+ * @param key - The storage key
26
+ * @param defaultValue - Value to return if key doesn't exist (default: '')
27
+ * @returns The stored value, or defaultValue if not found
28
+ *
29
+ * @example
30
+ * ```js
31
+ * const token = nativine.storage.get('auth_token');
32
+ * const user = JSON.parse(nativine.storage.get('user', '{}'));
33
+ * ```
34
+ */
35
+ export declare function get(key: string, defaultValue?: string): string;
36
+ /**
37
+ * Remove a specific key from native persistent storage.
38
+ *
39
+ * @param key - The storage key to remove
40
+ *
41
+ * @example
42
+ * ```js
43
+ * nativine.storage.remove('auth_token');
44
+ * ```
45
+ */
46
+ export declare function remove(key: string): void;
47
+ /**
48
+ * Clear all data from native persistent storage.
49
+ *
50
+ * @example
51
+ * ```js
52
+ * // On logout
53
+ * nativine.storage.clear();
54
+ * ```
55
+ */
56
+ export declare function clear(): void;
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Toast Module
3
+ *
4
+ * Show native Android toast messages.
5
+ */
6
+ export type ToastDuration = 'short' | 'long';
7
+ /**
8
+ * Show a native toast message.
9
+ *
10
+ * @param message - The text to display
11
+ * @param duration - 'short' (~2s) or 'long' (~3.5s)
12
+ *
13
+ * @example
14
+ * ```js
15
+ * nativine.toast('Item added to cart!');
16
+ * nativine.toast('Processing payment...', 'long');
17
+ * ```
18
+ */
19
+ export declare function showToast(message: string, duration?: ToastDuration): void;
@@ -0,0 +1,109 @@
1
+ /**
2
+ * UI Module
3
+ *
4
+ * Control native UI elements: status bar, navigation bar, splash screen,
5
+ * screen orientation, and native component visibility.
6
+ */
7
+ export interface StatusBarOptions {
8
+ /** Hex color for the status bar background (e.g., "#1a1a2e") */
9
+ color?: string;
10
+ /** Content style: 'light' for white icons, 'dark' for dark icons */
11
+ style?: 'light' | 'dark';
12
+ /** Whether the status bar should be visible */
13
+ visible?: boolean;
14
+ }
15
+ export interface NavigationBarOptions {
16
+ /** Hex color for the navigation bar background (e.g., "#16213e") */
17
+ color?: string;
18
+ /** Icon style: 'light' for white icons, 'dark' for dark icons */
19
+ style?: 'light' | 'dark';
20
+ }
21
+ /**
22
+ * Configure the native status bar appearance.
23
+ *
24
+ * @example
25
+ * ```js
26
+ * nativine.ui.statusBar({ color: '#1a1a2e', style: 'light' });
27
+ * ```
28
+ */
29
+ export declare function statusBar(options: StatusBarOptions): void;
30
+ /**
31
+ * Configure the native navigation bar appearance (Android only).
32
+ *
33
+ * @example
34
+ * ```js
35
+ * nativine.ui.navigationBar({ color: '#16213e' });
36
+ * ```
37
+ */
38
+ export declare function navigationBar(options: NavigationBarOptions): void;
39
+ /**
40
+ * Programmatically hide the splash screen.
41
+ * Useful when your web app needs time to load data before revealing the UI.
42
+ *
43
+ * @example
44
+ * ```js
45
+ * await fetchInitialData();
46
+ * nativine.ui.hideSplashScreen();
47
+ * ```
48
+ */
49
+ export declare function hideSplashScreen(): void;
50
+ /**
51
+ * Lock the screen to a specific orientation.
52
+ *
53
+ * @param mode - 'portrait' | 'landscape' | 'auto'
54
+ *
55
+ * @example
56
+ * ```js
57
+ * // Lock to landscape for a video player
58
+ * nativine.ui.setOrientation('landscape');
59
+ *
60
+ * // Unlock when done
61
+ * nativine.ui.setOrientation('auto');
62
+ * ```
63
+ */
64
+ export declare function setOrientation(mode: 'portrait' | 'landscape' | 'auto'): void;
65
+ /**
66
+ * Show native UI components (header, bottom nav, floating button).
67
+ * Reverses the effect of `hideNativeComponents()`.
68
+ *
69
+ * @example
70
+ * ```js
71
+ * nativine.ui.showNativeComponents();
72
+ * ```
73
+ */
74
+ export declare function showNativeComponents(): void;
75
+ /**
76
+ * Hide all native UI components (header, bottom nav, floating button).
77
+ * Useful for fullscreen content like videos or immersive experiences.
78
+ *
79
+ * @example
80
+ * ```js
81
+ * // Enter fullscreen mode
82
+ * nativine.ui.hideNativeComponents();
83
+ * ```
84
+ */
85
+ export declare function hideNativeComponents(): void;
86
+ /**
87
+ * Toggle pull-to-refresh behavior.
88
+ *
89
+ * @param enabled - Whether pull-to-refresh should be enabled
90
+ *
91
+ * @example
92
+ * ```js
93
+ * // Disable on a page with custom scroll behavior
94
+ * nativine.ui.setPullToRefresh(false);
95
+ * ```
96
+ */
97
+ export declare function setPullToRefresh(enabled: boolean): void;
98
+ /**
99
+ * Toggle pinch-to-zoom behavior.
100
+ *
101
+ * @param enabled - Whether pinch-to-zoom should be enabled
102
+ *
103
+ * @example
104
+ * ```js
105
+ * // Enable for an image gallery
106
+ * nativine.ui.setPinchToZoom(true);
107
+ * ```
108
+ */
109
+ export declare function setPinchToZoom(enabled: boolean): void;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Updates Module
3
+ *
4
+ * Check for and trigger in-app updates (Android only).
5
+ */
6
+ /**
7
+ * Check for available app updates using the Android In-App Update API.
8
+ * If an update is available, a native update UI will be shown.
9
+ *
10
+ * @example
11
+ * ```js
12
+ * nativine.updates.check();
13
+ * ```
14
+ */
15
+ export declare function check(): void;