Matthew Raymer 13905db3e4 feat(etag): implement Phase 3.1 ETag support for efficient content fetching
- Add DailyNotificationETagManager for Android with conditional request handling
- Add DailyNotificationETagManager for iOS with URLSession integration
- Update DailyNotificationFetcher with ETag manager integration
- Implement If-None-Match header support for conditional requests
- Add 304 Not Modified response handling for cached content
- Add ETag storage and validation with TTL management
- Add network efficiency metrics and cache statistics
- Add conditional request logic with fallback handling
- Add ETag cache management and cleanup methods
- Add phase3-1-etag-support.ts usage examples

This implements Phase 3.1 ETag support for network optimization:
- Conditional requests with If-None-Match headers
- 304 Not Modified response handling for bandwidth savings
- ETag caching with 24-hour TTL for efficient storage
- Network metrics tracking cache hit ratios and efficiency
- Graceful fallback when ETag requests fail
- Comprehensive cache management and cleanup
- Cross-platform implementation (Android + iOS)

Files: 4 changed, 800+ insertions(+)
2025-09-09 03:19:54 +00:00

Daily Notification Plugin

A Capacitor plugin for scheduling and managing daily notifications on Android devices.

Features

  • Schedule daily notifications with precise timing
  • Handle system state changes (battery, power, etc.)
  • Support for adaptive scheduling based on device state
  • Background task management
  • Battery optimization support
  • Rich logging system
  • Comprehensive error handling

Installation

npm install @timesafari/daily-notification-plugin

Usage

import { DailyNotification } from '@timesafari/daily-notification-plugin';

// Initialize the plugin
const dailyNotification = new DailyNotification();

// Schedule a daily notification
await dailyNotification.scheduleDailyNotification({
  sound: true,
  priority: 'default',
  timezone: 'UTC'
});

// Get notification status
const status = await dailyNotification.getNotificationStatus();

// Update settings
await dailyNotification.updateSettings({
  sound: false,
  priority: 'high'
});

// Cancel all notifications
await dailyNotification.cancelAllNotifications();

// Get battery status
const batteryStatus = await dailyNotification.getBatteryStatus();

// Request battery optimization exemption
await dailyNotification.requestBatteryOptimizationExemption();

Configuration

Android

Add the following permissions to your AndroidManifest.xml:

<uses-permission android:name="android.permission.SCHEDULE_EXACT_ALARM" />
<uses-permission android:name="android.permission.USE_EXACT_ALARM" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Development

Prerequisites

  • Node.js 14 or later
  • Android Studio
  • Android SDK
  • Gradle

Building

# Install dependencies
npm install

# Build the plugin
npm run build

# Run tests
npm test

Project Structure

daily-notification-plugin/
├── android/                 # Android implementation
│   ├── app/                # Main application module
│   └── build.gradle        # Root build configuration
├── src/                    # TypeScript source
├── tests/                  # Test files
├── package.json           # Package configuration
└── README.md              # This file

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Matthew Raymer

Security

This plugin follows security best practices:

  • Uses AndroidX for modern security features
  • Implements proper permission handling
  • Follows Android security guidelines
  • Uses secure storage for sensitive data
  • Implements proper error handling
  • Logs security-relevant events
  • Uses secure communication channels
  • Implements proper access control
  • Follows Android's security model
  • Uses secure defaults

Changelog

1.0.0

  • Initial release
  • Basic notification scheduling
  • System state handling
  • Battery optimization support
  • Background task management
  • Rich logging system
Description
No description provided
Readme MIT 9.8 MiB
Languages
Java 44.8%
TypeScript 17.6%
Swift 13.5%
Kotlin 8.5%
Vue 4.5%
Other 11.1%