Browse Source
- Update package.json with modern build tooling and dependencies - Streamline and enhance TypeScript definitions for better type safety - Reorganize plugin structure for better maintainability - Add comprehensive interface definitions for notification features - Implement proper build configuration with rollup - Update tsconfig.json for stricter type checking and ES2020 modules Breaking Changes: - Changed module structure to use ES modules - Updated interface definitions with stricter typing - Removed redundant notification options - Simplified API surface while maintaining core functionality Dependencies: - Upgrade @capacitor dependencies to v5.7.8 - Add rollup and typescript build tools - Update test framework configurationmaster
133 changed files with 918 additions and 4250 deletions
@ -0,0 +1,19 @@ |
|||
{ |
|||
"root": true, |
|||
"parser": "@typescript-eslint/parser", |
|||
"plugins": ["@typescript-eslint"], |
|||
"extends": [ |
|||
"eslint:recommended", |
|||
"plugin:@typescript-eslint/recommended" |
|||
], |
|||
"env": { |
|||
"node": true, |
|||
"jest": true |
|||
}, |
|||
"rules": { |
|||
"@typescript-eslint/explicit-function-return-type": "warn", |
|||
"@typescript-eslint/no-explicit-any": "warn", |
|||
"@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }], |
|||
"no-console": ["warn", { "allow": ["warn", "error"] }] |
|||
} |
|||
} |
@ -1,15 +1,61 @@ |
|||
dist/ |
|||
# Dependencies |
|||
node_modules/ |
|||
.DS_Store |
|||
Pods/ |
|||
*.iml |
|||
npm-debug.log |
|||
yarn-debug.log |
|||
yarn-error.log |
|||
|
|||
# Build output |
|||
dist/ |
|||
build/ |
|||
*.tsbuildinfo |
|||
|
|||
# IDE |
|||
.idea/ |
|||
.vscode/ |
|||
build/ |
|||
*.tgz |
|||
*.swp |
|||
*.swo |
|||
|
|||
# OS |
|||
.DS_Store |
|||
Thumbs.db |
|||
|
|||
# Android |
|||
android/app/build/ |
|||
android/build/ |
|||
android/gradle/ |
|||
android/gradlew |
|||
android/gradlew.bat |
|||
android/.gradle/ |
|||
android/local.properties |
|||
android/.idea/ |
|||
android/*.iml |
|||
|
|||
# iOS |
|||
ios/Pods/ |
|||
ios/build/ |
|||
ios/Podfile.lock |
|||
ios/.xcode.env.local |
|||
ios/DerivedData/ |
|||
ios/*.xcworkspace/ |
|||
ios/*.xcodeproj/* |
|||
!ios/*.xcodeproj/project.pbxproj |
|||
!ios/*.xcodeproj/xcshareddata/ |
|||
!ios/*.xcworkspace/contents.xcworkspacedata |
|||
|
|||
# Testing |
|||
coverage/ |
|||
.nyc_output/ |
|||
|
|||
# Logs |
|||
logs/ |
|||
*.log |
|||
|
|||
# Ignore Gradle project-specific cache directory |
|||
.gradle |
|||
# Environment |
|||
.env |
|||
.env.local |
|||
.env.*.local |
|||
|
|||
# Ignore Gradle build output directory |
|||
build |
|||
# Temporary files |
|||
*.tmp |
|||
*.temp |
|||
.cache/ |
|||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,2 @@ |
|||
#Fri Mar 28 09:01:29 UTC 2025 |
|||
gradle.version=8.13 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@ |
|||
_{€ż=lLgÍ’Ĺđßw�xD=‚ŚHç–ÎăzâQbK6ňEĂ+Il/b‹‡zjîíĺěB4Ł˝Čí`Süć8�Oo}]ř�yä~Űuĺ\”tŁÄžqT€DVEq·Gů5Úb´*r¨üD® ›L¤Ę-dąCüŇ1ä„'°ćK«±‘%úeţżA'pîâűž9Ö]jPor�zŻT×Ţb_�OĹ«xŮ™WÝ6-˘‘V“i¤yŐ?ęŘ�AB'±Âz'�š¨˙P:ŻB÷�ëcŚÝď\Q¤*Á2Ş˛[µ»+ pTvmoä¬ŮżÝAJş±Ś×yGłŘ’ďď•˝P@fŤkâ—…™`%w �§Whé\Ó»n?±ŞDâŹďíŃł˂ý±¶őŤŮĽDžr]‚î9ë<lšXÍ7ó4o��€�q?Îľ®e-â˛J¦ť?·ő* |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@ |
|||
6c6d7154-1c12-44da-bab9-788cea5132bå |
@ -0,0 +1 @@ |
|||
TºlXå�†^)~cÇÈüúŒD |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@ |
|||
^«ę©«±ev—a†r“»ĎÝ+×˝ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@ |
|||
96e7369f-9457-47f1-8304-05bf876b89fæ |
@ -0,0 +1 @@ |
|||
102cc785-1d0d-4dbb-a688-2153e21cdbf¹ |
@ -0,0 +1 @@ |
|||
-
�f0���Jj�R&�Ν+��� |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@ |
|||
5dbbc9a7-8a29-4ae7-b3f0-33b5a5e5203± |
@ -0,0 +1 @@ |
|||
f93c619e-5608-44c0-ae77-793c324d124å |
@ -0,0 +1 @@ |
|||
0809f6f5-185b-4807-b8df-47cb0fd7076オ |
@ -0,0 +1,3 @@ |
|||
M�4�YG�4#���� |
|||
1z� |
|||
|
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@ |
|||
�U2 C��'���?��s��9� |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@ |
|||
6277d4cb-02d2-4a97-aa8b-c333720dfd7á |
Binary file not shown.
@ -0,0 +1 @@ |
|||
da5353e4-2da1-4b2a-8d76-9f7a80dfac3ä |
@ -0,0 +1 @@ |
|||
ΐ��η«6‰Τ©&U��τ,²bj¤Λa\…Ό‹JLneγϋΒkhυ?滉bΕ
άεΨ?UFζΓnά�υβ^ |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,4 @@ |
|||
E[Ď$—ĄqQíëŐĆ>b�Ô‚ŢX›^CÄRKýĘ ˛ŐUöpY˘ćhΖµ•pŠĚüĚ*»Rze�ć@dVµe_WKy=T$ŐĆ_Wf§ŐnŔš¤!|ŢR©Ş_– ĄÉ�7§ëíŚ2¶w‰4|–\Ýň:€}ţH�-�´ßßy@2QŠ©KŤČ�‡B@YTŹ |
|||
yhůGŤlŃÓsÚe, |
|||
p¨Öěeĺ.‹Î�ëő<ŁĘb�» |
|||
Tń�“`”ż¨Ż˙‡.@íŽ";�6źÇ<ĹäíŞďHÜżÔz M1P}¨Řř9s?č…ו,Ń'tGöşWĎÜ:wś©†|ÉŞř‚‰îÉÝ�ť’äŮ=eí2¤|žŮ74�]ôC…ľŰđ]ńňdT)Bh§ĽˇUfaÜâŚ�5Ęü řR)rŔň)Š�ËKR˘‡FČ�‡ÇcCâ.h(Úą˙Aé�× |
@ -0,0 +1 @@ |
|||
f64db575-a480-4fdc-82c4-6fc81d961b4ã |
@ -0,0 +1 @@ |
|||
Úßù¶R¿P<-Op2¥0ÞX«| |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1 @@ |
|||
o£Ÿ…mäc-½Œ¬¸ u1¡G |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,10 @@ |
|||
{ |
|||
"semi": true, |
|||
"trailingComma": "es5", |
|||
"singleQuote": true, |
|||
"printWidth": 80, |
|||
"tabWidth": 2, |
|||
"useTabs": false, |
|||
"bracketSpacing": true, |
|||
"arrowParens": "avoid" |
|||
} |
@ -1,143 +1,146 @@ |
|||
# Daily Notification Plugin for Capacitor |
|||
# Daily Notification Plugin |
|||
|
|||
A Capacitor plugin for scheduling and managing daily notifications with advanced features and robust error handling. |
|||
A Capacitor plugin for scheduling and managing daily notifications on Android devices. |
|||
|
|||
## Features |
|||
|
|||
- Schedule daily notifications with custom time and content |
|||
- Support for different priority levels |
|||
- Timezone-aware scheduling |
|||
- Offline support with caching |
|||
- Comprehensive permission handling |
|||
- Automatic retry logic |
|||
- Detailed notification status tracking |
|||
- Configurable settings management |
|||
- 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 |
|||
|
|||
```bash |
|||
npm install daily-notification-plugin |
|||
npx cap sync |
|||
npm install @timesafari/daily-notification-plugin |
|||
``` |
|||
|
|||
## iOS Setup |
|||
|
|||
No additional setup required for iOS. The plugin automatically handles all necessary configurations. |
|||
|
|||
## Usage |
|||
|
|||
### Basic Usage |
|||
|
|||
```typescript |
|||
import { DailyNotification } from 'daily-notification-plugin'; |
|||
import { DailyNotification } from '@timesafari/daily-notification-plugin'; |
|||
|
|||
// Initialize the plugin |
|||
const dailyNotification = new DailyNotification(); |
|||
|
|||
// Schedule a daily notification |
|||
await DailyNotification.scheduleDailyNotification({ |
|||
url: 'https://api.example.com/updates', |
|||
time: '09:00', |
|||
title: 'Daily Update', |
|||
body: 'Your daily update is ready' |
|||
await dailyNotification.scheduleDailyNotification({ |
|||
sound: true, |
|||
priority: 'default', |
|||
timezone: 'UTC' |
|||
}); |
|||
``` |
|||
|
|||
### Advanced Features |
|||
// Get notification status |
|||
const status = await dailyNotification.getNotificationStatus(); |
|||
|
|||
#### Custom Priority |
|||
|
|||
```typescript |
|||
await DailyNotification.scheduleDailyNotification({ |
|||
url: 'https://api.example.com/updates', |
|||
time: '09:00', |
|||
// Update settings |
|||
await dailyNotification.updateSettings({ |
|||
sound: false, |
|||
priority: 'high' |
|||
}); |
|||
``` |
|||
|
|||
#### Timezone Support |
|||
// Cancel all notifications |
|||
await dailyNotification.cancelAllNotifications(); |
|||
|
|||
```typescript |
|||
await DailyNotification.scheduleDailyNotification({ |
|||
url: 'https://api.example.com/updates', |
|||
time: '09:00', |
|||
timezone: 'America/New_York' |
|||
}); |
|||
// Get battery status |
|||
const batteryStatus = await dailyNotification.getBatteryStatus(); |
|||
|
|||
// Request battery optimization exemption |
|||
await dailyNotification.requestBatteryOptimizationExemption(); |
|||
``` |
|||
|
|||
#### Check Notification Status |
|||
## Configuration |
|||
|
|||
```typescript |
|||
const status = await DailyNotification.getNotificationStatus(); |
|||
console.log('Notification status:', status); |
|||
``` |
|||
### Android |
|||
|
|||
#### Update Settings |
|||
Add the following permissions to your `AndroidManifest.xml`: |
|||
|
|||
```typescript |
|||
await DailyNotification.updateSettings({ |
|||
sound: true, |
|||
priority: 'high', |
|||
timezone: 'America/Los_Angeles' |
|||
}); |
|||
```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" /> |
|||
``` |
|||
|
|||
## API Documentation |
|||
## Development |
|||
|
|||
### Methods |
|||
### Prerequisites |
|||
|
|||
#### scheduleDailyNotification(options: ScheduleOptions) |
|||
Schedule a new daily notification. |
|||
- Node.js 14 or later |
|||
- Android Studio |
|||
- Android SDK |
|||
- Gradle |
|||
|
|||
#### getLastNotification() |
|||
Get information about the last delivered notification. |
|||
### Building |
|||
|
|||
#### cancelAllNotifications() |
|||
Cancel all pending notifications. |
|||
```bash |
|||
# Install dependencies |
|||
npm install |
|||
|
|||
#### getNotificationStatus() |
|||
Get current notification status and settings. |
|||
# Build the plugin |
|||
npm run build |
|||
|
|||
#### updateSettings(settings: NotificationSettings) |
|||
Update notification settings. |
|||
# Run tests |
|||
npm test |
|||
``` |
|||
|
|||
#### checkPermissions() |
|||
Check current notification permissions. |
|||
### Project Structure |
|||
|
|||
#### requestPermissions() |
|||
Request notification permissions. |
|||
``` |
|||
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 |
|||
``` |
|||
|
|||
### Types |
|||
## Contributing |
|||
|
|||
```typescript |
|||
interface ScheduleOptions { |
|||
url: string; |
|||
time: string; |
|||
title?: string; |
|||
body?: string; |
|||
sound?: boolean; |
|||
priority?: 'high' | 'default' | 'low'; |
|||
timezone?: string; |
|||
} |
|||
|
|||
interface NotificationSettings { |
|||
sound?: boolean; |
|||
priority?: string; |
|||
timezone?: string; |
|||
} |
|||
``` |
|||
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 |
|||
|
|||
## Error Handling |
|||
## License |
|||
|
|||
The plugin provides detailed error messages for various scenarios: |
|||
- Invalid parameters |
|||
- Permission issues |
|||
- Scheduling failures |
|||
- Invalid time formats |
|||
- Invalid timezone identifiers |
|||
- Invalid priority values |
|||
This project is licensed under the MIT License - see the LICENSE file for details. |
|||
|
|||
## Contributing |
|||
## Author |
|||
|
|||
Contributions are welcome! Please read our contributing guidelines and submit pull requests to our GitHub repository. |
|||
Matthew Raymer |
|||
|
|||
## License |
|||
## 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 |
|||
|
|||
MIT License - see LICENSE file for details |
|||
### 1.0.0 |
|||
- Initial release |
|||
- Basic notification scheduling |
|||
- System state handling |
|||
- Battery optimization support |
|||
- Background task management |
|||
- Rich logging system |
|||
|
@ -1 +0,0 @@ |
|||
/home/matthew/projects/timesafari/daily-notification-plugin/android/app/src/androidTest/java/com/timesafari/dailynotification/DailyNotificationPluginTest.java |
@ -1,104 +0,0 @@ |
|||
/** |
|||
* DailyNotificationConfigTest.java |
|||
* Daily Notification Plugin for Capacitor |
|||
* |
|||
* Tests for the DailyNotificationConfig |
|||
* |
|||
* Features: |
|||
* - Unit tests |
|||
* - Singleton pattern |
|||
* - Configuration management |
|||
* - Default values |
|||
* |
|||
* @author Matthew Raymer |
|||
*/ |
|||
|
|||
package com.timesafari.dailynotification; |
|||
|
|||
import org.junit.Before; |
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.mockito.junit.MockitoJUnitRunner; |
|||
|
|||
import java.util.TimeZone; |
|||
|
|||
import static org.junit.Assert.*; |
|||
|
|||
@RunWith(MockitoJUnitRunner.class) |
|||
public class DailyNotificationConfigTest { |
|||
private DailyNotificationConfig config; |
|||
|
|||
@Before |
|||
public void setUp() { |
|||
config = DailyNotificationConfig.getInstance(); |
|||
} |
|||
|
|||
@Test |
|||
public void testSingletonPattern() { |
|||
DailyNotificationConfig config2 = DailyNotificationConfig.getInstance(); |
|||
assertSame("Config instances should be the same", config, config2); |
|||
} |
|||
|
|||
@Test |
|||
public void testDefaultValues() { |
|||
assertEquals("Default max notifications should be 10", 10, |
|||
config.getMaxNotificationsPerDay()); |
|||
assertEquals("Default timezone should be system default", |
|||
TimeZone.getDefault(), config.getDefaultTimeZone()); |
|||
assertTrue("Default logging should be enabled", config.isLoggingEnabled()); |
|||
assertEquals("Default retention days should be 7", 7, |
|||
config.getRetentionDays()); |
|||
} |
|||
|
|||
@Test |
|||
public void testMaxNotificationsPerDay() { |
|||
config.setMaxNotificationsPerDay(5); |
|||
assertEquals("Max notifications should be 5", 5, |
|||
config.getMaxNotificationsPerDay()); |
|||
} |
|||
|
|||
@Test |
|||
public void testDefaultTimeZone() { |
|||
TimeZone newTimeZone = TimeZone.getTimeZone("America/New_York"); |
|||
config.setDefaultTimeZone(newTimeZone); |
|||
assertEquals("Default timezone should be America/New_York", |
|||
newTimeZone, config.getDefaultTimeZone()); |
|||
} |
|||
|
|||
@Test |
|||
public void testLoggingEnabled() { |
|||
config.setLoggingEnabled(false); |
|||
assertFalse("Logging should be disabled", config.isLoggingEnabled()); |
|||
|
|||
config.setLoggingEnabled(true); |
|||
assertTrue("Logging should be enabled", config.isLoggingEnabled()); |
|||
} |
|||
|
|||
@Test |
|||
public void testRetentionDays() { |
|||
config.setRetentionDays(14); |
|||
assertEquals("Retention days should be 14", 14, |
|||
config.getRetentionDays()); |
|||
} |
|||
|
|||
@Test |
|||
public void testResetToDefaults() { |
|||
// Change values
|
|||
config.setMaxNotificationsPerDay(5); |
|||
config.setDefaultTimeZone(TimeZone.getTimeZone("America/New_York")); |
|||
config.setLoggingEnabled(false); |
|||
config.setRetentionDays(14); |
|||
|
|||
// Reset to defaults
|
|||
config.resetToDefaults(); |
|||
|
|||
// Verify defaults
|
|||
assertEquals("Max notifications should be reset to 10", 10, |
|||
config.getMaxNotificationsPerDay()); |
|||
assertEquals("Default timezone should be reset to system default", |
|||
TimeZone.getDefault(), config.getDefaultTimeZone()); |
|||
assertTrue("Logging should be reset to enabled", config.isLoggingEnabled()); |
|||
assertEquals("Retention days should be reset to 7", 7, |
|||
config.getRetentionDays()); |
|||
} |
|||
} |
@ -1,126 +0,0 @@ |
|||
/** |
|||
* DailyNotificationConstantsTest.java |
|||
* Daily Notification Plugin for Capacitor |
|||
* |
|||
* Tests for the DailyNotificationConstants |
|||
* |
|||
* Features: |
|||
* - Unit tests |
|||
* - Constant validation |
|||
* - Default values |
|||
* - Error messages |
|||
* |
|||
* @author Matthew Raymer |
|||
*/ |
|||
|
|||
package com.timesafari.dailynotification; |
|||
|
|||
import org.junit.Test; |
|||
import org.junit.runner.RunWith; |
|||
import org.mockito.junit.MockitoJUnitRunner; |
|||
|
|||
import static org.junit.Assert.*; |
|||
|
|||
@RunWith(MockitoJUnitRunner.class) |
|||
public class DailyNotificationConstantsTest { |
|||
|
|||
@Test |
|||
public void testDefaultValues() { |
|||
assertEquals("Default title should be 'Daily Notification'", |
|||
"Daily Notification", DailyNotificationConstants.DEFAULT_TITLE); |
|||
assertEquals("Default body should be 'Your daily update is ready'", |
|||
"Your daily update is ready", DailyNotificationConstants.DEFAULT_BODY); |
|||
} |
|||
|
|||
@Test |
|||
public void testNotificationIdentifiers() { |
|||
assertTrue("Notification ID prefix should start with 'daily-notification-'", |
|||
DailyNotificationConstants.NOTIFICATION_ID_PREFIX.startsWith("daily-notification-")); |
|||
assertEquals("Event name should be 'notification'", |
|||
"notification", DailyNotificationConstants.EVENT_NAME); |
|||
} |
|||
|
|||
@Test |
|||
public void testSettingsKeys() { |
|||
assertEquals("Sound setting key should be 'sound'", |
|||
"sound", DailyNotificationConstants.Settings.SOUND); |
|||
assertEquals("Priority setting key should be 'priority'", |
|||
"priority", DailyNotificationConstants.Settings.PRIORITY); |
|||
assertEquals("Timezone setting key should be 'timezone'", |
|||
"timezone", DailyNotificationConstants.Settings.TIMEZONE); |
|||
assertEquals("Retry count setting key should be 'retryCount'", |
|||
"retryCount", DailyNotificationConstants.Settings.RETRY_COUNT); |
|||
assertEquals("Retry interval setting key should be 'retryInterval'", |
|||
"retryInterval", DailyNotificationConstants.Settings.RETRY_INTERVAL); |
|||
} |
|||
|
|||
@Test |
|||
public void testSettingsDefaultValues() { |
|||
assertTrue("Default sound should be true", |
|||
DailyNotificationConstants.Settings.DEFAULT_SOUND); |
|||
assertEquals("Default priority should be 'default'", |
|||
"default", DailyNotificationConstants.Settings.DEFAULT_PRIORITY); |
|||
assertEquals("Default retry count should be 3", |
|||
3, DailyNotificationConstants.Settings.DEFAULT_RETRY_COUNT); |
|||
assertEquals("Default retry interval should be 1000", |
|||
1000, DailyNotificationConstants.Settings.DEFAULT_RETRY_INTERVAL); |
|||
} |
|||
|
|||
@Test |
|||
public void testPluginMethodKeys() { |
|||
assertEquals("URL key should be 'url'", |
|||
"url", DailyNotificationConstants.Keys.URL); |
|||
assertEquals("Time key should be 'time'", |
|||
"time", DailyNotificationConstants.Keys.TIME); |
|||
assertEquals("Title key should be 'title'", |
|||
"title", DailyNotificationConstants.Keys.TITLE); |
|||
assertEquals("Body key should be 'body'", |
|||
"body", DailyNotificationConstants.Keys.BODY); |
|||
assertEquals("Sound key should be 'sound'", |
|||
"sound", DailyNotificationConstants.Keys.SOUND); |
|||
assertEquals("Priority key should be 'priority'", |
|||
"priority", DailyNotificationConstants.Keys.PRIORITY); |
|||
assertEquals("Timezone key should be 'timezone'", |
|||
"timezone", DailyNotificationConstants.Keys.TIMEZONE); |
|||
} |
|||
|
|||
@Test |
|||
public void testChannelSettings() { |
|||
assertEquals("Channel ID should be 'daily_notification_channel'", |
|||
"daily_notification_channel", DailyNotificationConstants.Channel.ID); |
|||
assertEquals("Channel name should be 'Daily Notifications'", |
|||
"Daily Notifications", DailyNotificationConstants.Channel.NAME); |
|||
assertEquals("Channel description should be 'Daily notification updates'", |
|||
"Daily notification updates", DailyNotificationConstants.Channel.DESCRIPTION); |
|||
assertTrue("Channel should enable vibration", |
|||
DailyNotificationConstants.Channel.ENABLE_VIBRATION); |
|||
assertTrue("Channel should enable lights", |
|||
DailyNotificationConstants.Channel.ENABLE_LIGHTS); |
|||
} |
|||
|
|||
@Test |
|||
public void testTimeConstants() { |
|||
assertEquals("Milliseconds per day should be 86400000", |
|||
86400000, DailyNotificationConstants.Time.MILLIS_PER_DAY); |
|||
assertEquals("Maximum hours should be 24", |
|||
24, DailyNotificationConstants.Time.MAX_HOURS); |
|||
assertEquals("Maximum minutes should be 60", |
|||
60, DailyNotificationConstants.Time.MAX_MINUTES); |
|||
} |
|||
|
|||
@Test |
|||
public void testErrorMessages() { |
|||
assertEquals("Missing parameters error message should be correct", |
|||
"Missing required parameters", DailyNotificationConstants.Errors.MISSING_PARAMS); |
|||
assertEquals("Invalid time error message should be correct", |
|||
"Invalid time format", DailyNotificationConstants.Errors.INVALID_TIME); |
|||
assertEquals("Invalid timezone error message should be correct", |
|||
"Invalid timezone", DailyNotificationConstants.Errors.INVALID_TIMEZONE); |
|||
assertEquals("Invalid priority error message should be correct", |
|||
"Invalid priority value", DailyNotificationConstants.Errors.INVALID_PRIORITY); |
|||
assertEquals("Scheduling failed error message should be correct", |
|||
"Failed to schedule notification", DailyNotificationConstants.Errors.SCHEDULING_FAILED); |
|||
assertEquals("Permission denied error message should be correct", |
|||
"Notification permission denied", DailyNotificationConstants.Errors.PERMISSION_DENIED); |
|||
} |
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue