refactor: improve build configuration and code organization
- Add build scripts for Android and iOS platforms - Remove duplicate web implementation (src/web.ts) - Add proper TypeScript configuration - Add module documentation to index.ts - Clean up package.json scripts This commit improves the project structure and build process by: 1. Adding dedicated build scripts for native platforms 2. Removing redundant web implementation 3. Adding proper TypeScript configuration with strict mode 4. Improving code documentation 5. Organizing package.json scripts The changes maintain backward compatibility while improving the development experience and code quality.
This commit is contained in:
@@ -1,19 +1,98 @@
|
||||
/**
|
||||
* Interface definitions for the Daily Notification plugin
|
||||
*/
|
||||
|
||||
export interface NotificationOptions {
|
||||
url: string;
|
||||
time: string;
|
||||
title?: string;
|
||||
body?: string;
|
||||
sound?: boolean;
|
||||
vibrate?: boolean;
|
||||
priority?: 'low' | 'normal' | 'high';
|
||||
retryCount?: number;
|
||||
retryInterval?: number;
|
||||
cacheDuration?: number;
|
||||
headers?: Record<string, string>;
|
||||
offlineFallback?: boolean;
|
||||
timezone?: string;
|
||||
contentHandler?: (response: Response) => Promise<{
|
||||
title: string;
|
||||
body: string;
|
||||
data?: any;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface NotificationStatus {
|
||||
isScheduled: boolean;
|
||||
nextNotificationTime?: string;
|
||||
lastNotificationTime?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export interface NotificationResponse {
|
||||
title: string;
|
||||
body: string;
|
||||
data?: any;
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
export interface NotificationSettings {
|
||||
time?: string;
|
||||
sound?: boolean;
|
||||
vibrate?: boolean;
|
||||
priority?: 'low' | 'normal' | 'high';
|
||||
timezone?: string;
|
||||
}
|
||||
|
||||
export interface NotificationEvent extends Event {
|
||||
detail: {
|
||||
id: string;
|
||||
action: string;
|
||||
data?: any;
|
||||
};
|
||||
}
|
||||
|
||||
export interface DailyNotificationPlugin {
|
||||
initialize(options: DailyNotificationOptions): Promise<void>;
|
||||
checkPermissions(): Promise<PermissionStatus>;
|
||||
requestPermissions(): Promise<PermissionStatus>;
|
||||
}
|
||||
|
||||
export interface DailyNotificationOptions {
|
||||
url: string;
|
||||
notificationTime: string; // "HH:mm" format
|
||||
title?: string;
|
||||
body?: string;
|
||||
}
|
||||
|
||||
export interface PermissionStatus {
|
||||
notifications: PermissionState;
|
||||
backgroundRefresh?: PermissionState; // iOS only
|
||||
}
|
||||
|
||||
export type PermissionState = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';
|
||||
/**
|
||||
* Schedule a daily notification with the specified options
|
||||
*/
|
||||
scheduleDailyNotification(options: NotificationOptions): Promise<void>;
|
||||
|
||||
/**
|
||||
* Get the last notification that was delivered
|
||||
*/
|
||||
getLastNotification(): Promise<NotificationResponse | null>;
|
||||
|
||||
/**
|
||||
* Cancel all scheduled notifications
|
||||
*/
|
||||
cancelAllNotifications(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Get the current status of notifications
|
||||
*/
|
||||
getNotificationStatus(): Promise<NotificationStatus>;
|
||||
|
||||
/**
|
||||
* Update notification settings
|
||||
*/
|
||||
updateSettings(settings: NotificationSettings): Promise<void>;
|
||||
|
||||
/**
|
||||
* Check notification permissions
|
||||
*/
|
||||
checkPermissions(): Promise<PermissionStatus>;
|
||||
|
||||
/**
|
||||
* Request notification permissions
|
||||
*/
|
||||
requestPermissions(): Promise<PermissionStatus>;
|
||||
}
|
||||
|
||||
export interface PermissionStatus {
|
||||
notifications: PermissionState;
|
||||
backgroundRefresh?: PermissionState; // iOS only
|
||||
}
|
||||
|
||||
export type PermissionState = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';
|
||||
Reference in New Issue
Block a user