@ -100,14 +100,14 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
* /
* /
async updateSettings ( settings : NotificationSettings ) : Promise < void > {
async updateSettings ( settings : NotificationSettings ) : Promise < void > {
this . settings = { . . . this . settings , . . . settings } ;
this . settings = { . . . this . settings , . . . settings } ;
console . log ( 'Web notification s ettings updated:' , this . settings ) ;
console . log ( 'S ettings updated:' , this . settings ) ;
}
}
/ * *
/ * *
* Get battery status ( mock implementation )
* Get battery status ( mock implementation for web )
* /
* /
async getBatteryStatus ( ) : Promise < BatteryStatus > {
async getBatteryStatus ( ) : Promise < BatteryStatus > {
// Mock battery status for web
// Mock implementation for web
return {
return {
level : 100 ,
level : 100 ,
isCharging : false ,
isCharging : false ,
@ -117,21 +117,21 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
}
}
/ * *
/ * *
* Request battery optimization exemption ( web not applicable )
* Request battery optimization exemption ( mock for web )
* /
* /
async requestBatteryOptimizationExemption ( ) : Promise < void > {
async requestBatteryOptimizationExemption ( ) : Promise < void > {
console . log ( 'Battery optimization exemption not applicable on web ' ) ;
console . log ( 'Battery optimization exemption requested (web mock) ' ) ;
}
}
/ * *
/ * *
* Set adaptive scheduling ( web not applicable )
* Set adaptive scheduling ( mock for web )
* /
* /
async setAdaptiveScheduling ( options : { enabled : boolean } ) : Promise < void > {
async setAdaptiveScheduling ( options : { enabled : boolean } ) : Promise < void > {
console . log ( 'Adaptive scheduling not applicable on web :' , options ) ;
console . log ( 'Adaptive scheduling set :' , options . enabled ) ;
}
}
/ * *
/ * *
* Get power state ( mock implementation )
* Get power state ( mock for web )
* /
* /
async getPowerState ( ) : Promise < PowerState > {
async getPowerState ( ) : Promise < PowerState > {
return {
return {
@ -141,13 +141,11 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
}
}
/ * *
/ * *
* Check permissions
* Check permissions ( web implementation )
* /
* /
async checkPermissions ( ) : Promise < PermissionStatus > {
async checkPermissions ( ) : Promise < PermissionStatus > {
if ( ! ( 'Notification' in window ) ) {
if ( ! ( 'Notification' in window ) ) {
return {
return {
status : 'denied' ,
granted : false ,
notifications : 'denied' ,
notifications : 'denied' ,
alert : false ,
alert : false ,
badge : false ,
badge : false ,
@ -161,7 +159,8 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
return {
return {
status : permission ,
status : permission ,
granted : permission === 'granted' ,
granted : permission === 'granted' ,
notifications : permission as any ,
notifications : permission === 'granted' ? 'granted' :
permission === 'denied' ? 'denied' : 'prompt' ,
alert : permission === 'granted' ,
alert : permission === 'granted' ,
badge : permission === 'granted' ,
badge : permission === 'granted' ,
sound : permission === 'granted' ,
sound : permission === 'granted' ,
@ -171,29 +170,139 @@ export class DailyNotificationWeb implements DailyNotificationPlugin {
}
}
/ * *
/ * *
* Request permissions
* Request permissions ( web implementation )
* /
* /
async requestPermissions ( ) : Promise < PermissionStatus > {
async requestPermissions ( ) : Promise < PermissionStatus > {
if ( ! ( 'Notification' in window ) ) {
if ( ! ( 'Notification' in window ) ) {
throw new Error ( 'Notifications not supported in this browser' ) ;
throw new Error ( 'Notifications not supported in this browser' ) ;
}
}
try {
await Notification . requestPermission ( ) ;
const permission = await Notification . requestPermission ( ) ;
return this . checkPermissions ( ) ;
return {
}
status : permission ,
granted : permission === 'granted' ,
// Dual Scheduling Methods Implementation
notifications : permission as any ,
alert : permission === 'granted' ,
/ * *
badge : permission === 'granted' ,
* Schedule content fetch ( web implementation )
sound : permission === 'granted' ,
* /
lockScreen : permission === 'granted' ,
async scheduleContentFetch ( config : any ) : Promise < void > {
carPlay : false
console . log ( 'Content fetch scheduled (web mock):' , config ) ;
} ;
// Mock implementation - in real app would use Service Worker
} catch ( error ) {
}
console . error ( 'Error requesting notification permissions:' , error ) ;
throw error ;
/ * *
}
* Schedule user notification ( web implementation )
* /
async scheduleUserNotification ( config : any ) : Promise < void > {
console . log ( 'User notification scheduled (web mock):' , config ) ;
// Mock implementation - in real app would use browser notifications
}
/ * *
* Schedule dual notification ( web implementation )
* /
async scheduleDualNotification ( config : any ) : Promise < void > {
console . log ( 'Dual notification scheduled (web mock):' , config ) ;
// Mock implementation combining content fetch and user notification
}
/ * *
* Get dual schedule status ( web implementation )
* /
async getDualScheduleStatus ( ) : Promise < any > {
return {
contentFetch : {
isEnabled : false ,
isScheduled : false ,
pendingFetches : 0
} ,
userNotification : {
isEnabled : false ,
isScheduled : false ,
pendingNotifications : 0
} ,
relationship : {
isLinked : false ,
contentAvailable : false
} ,
overall : {
isActive : false ,
lastActivity : Date.now ( ) ,
errorCount : 0 ,
successRate : 1.0
}
} ;
}
/ * *
* Update dual schedule configuration ( web implementation )
* /
async updateDualScheduleConfig ( config : any ) : Promise < void > {
console . log ( 'Dual schedule config updated (web mock):' , config ) ;
}
/ * *
* Cancel dual schedule ( web implementation )
* /
async cancelDualSchedule ( ) : Promise < void > {
console . log ( 'Dual schedule cancelled (web mock)' ) ;
}
/ * *
* Pause dual schedule ( web implementation )
* /
async pauseDualSchedule ( ) : Promise < void > {
console . log ( 'Dual schedule paused (web mock)' ) ;
}
/ * *
* Resume dual schedule ( web implementation )
* /
async resumeDualSchedule ( ) : Promise < void > {
console . log ( 'Dual schedule resumed (web mock)' ) ;
}
/ * *
* Get content cache ( web implementation )
* /
async getContentCache ( ) : Promise < Record < string , any > > {
return { } ; // Mock empty cache
}
/ * *
* Clear content cache ( web implementation )
* /
async clearContentCache ( ) : Promise < void > {
console . log ( 'Content cache cleared (web mock)' ) ;
}
/ * *
* Get content history ( web implementation )
* /
async getContentHistory ( ) : Promise < any [ ] > {
return [ ] ; // Mock empty history
}
/ * *
* Register callback ( web implementation )
* /
async registerCallback ( name : string , _callback : Function ) : Promise < void > {
console . log ( 'Callback registered (web mock):' , name ) ;
}
/ * *
* Unregister callback ( web implementation )
* /
async unregisterCallback ( name : string ) : Promise < void > {
console . log ( 'Callback unregistered (web mock):' , name ) ;
}
/ * *
* Get registered callbacks ( web implementation )
* /
async getRegisteredCallbacks ( ) : Promise < string [ ] > {
return [ ] ; // Mock empty callback list
}
}
/ * *
/ * *