|
|
@ -481,12 +481,12 @@ export class DailyNotificationWeb implements DailyNotificationPlugin { |
|
|
|
// Phase 1: ActiveDid Management Methods Implementation
|
|
|
|
async setActiveDidFromHost(activeDid: string): Promise<void> { |
|
|
|
try { |
|
|
|
console.log('DNP-WEB-INDEX: Setting activeDid from host:', activeDid, 'stored:', this.activeDid); |
|
|
|
// Setting activeDid from host
|
|
|
|
|
|
|
|
// Store activeDid for future use
|
|
|
|
this.activeDid = activeDid; |
|
|
|
|
|
|
|
console.log('DNP-WEB-INDEX: ActiveDid set successfully'); |
|
|
|
// ActiveDid set successfully
|
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
console.error('DNP-WEB-INDEX: Error setting activeDid from host:', error); |
|
|
@ -496,14 +496,14 @@ export class DailyNotificationWeb implements DailyNotificationPlugin { |
|
|
|
|
|
|
|
onActiveDidChange(callback: (newActiveDid: string) => Promise<void>): void { |
|
|
|
try { |
|
|
|
console.log('DNP-WEB-INDEX: Setting up activeDid change listener'); |
|
|
|
// Setting up activeDid change listener
|
|
|
|
|
|
|
|
// Set up event listener for activeDidChanged events
|
|
|
|
document.addEventListener('activeDidChanged', async (event: Event) => { |
|
|
|
try { |
|
|
|
const eventDetail = (event as CustomEvent).detail; |
|
|
|
if (eventDetail && eventDetail.activeDid) { |
|
|
|
console.log('DNP-WEB-INDEX: ActiveDid changed to:', eventDetail.activeDid); |
|
|
|
// ActiveDid changed to new value
|
|
|
|
|
|
|
|
// Clear current cached content
|
|
|
|
await this.clearCacheForNewIdentity(); |
|
|
@ -514,14 +514,14 @@ export class DailyNotificationWeb implements DailyNotificationPlugin { |
|
|
|
// Call the provided callback
|
|
|
|
await callback(eventDetail.activeDid); |
|
|
|
|
|
|
|
console.log('DNP-WEB-INDEX: ActiveDid changed processed'); |
|
|
|
// ActiveDid changed processed
|
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|
console.error('DNP-WEB-INDEX: Error processing activeDid change:', error); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
console.log('DNP-WEB-INDEX: ActiveDid change listener configured'); |
|
|
|
// ActiveDid change listener configured
|
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
console.error('DNP-WEB-INDEX: Error setting up activeDid change listener:', error); |
|
|
@ -531,12 +531,12 @@ export class DailyNotificationWeb implements DailyNotificationPlugin { |
|
|
|
|
|
|
|
async refreshAuthenticationForNewIdentity(activeDid: string): Promise<void> { |
|
|
|
try { |
|
|
|
console.log('DNP-WEB-INDEX: Refreshing authentication for activeDid:', activeDid); |
|
|
|
// Refreshing authentication for activeDid
|
|
|
|
|
|
|
|
// Update current activeDid
|
|
|
|
this.activeDid = activeDid; |
|
|
|
|
|
|
|
console.log('DNP-WEB-INDEX: Authentication refreshed successfully'); |
|
|
|
// Authentication refreshed successfully
|
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
console.error('DNP-WEB-INDEX: Error refreshing authentication:', error); |
|
|
@ -546,12 +546,12 @@ export class DailyNotificationWeb implements DailyNotificationPlugin { |
|
|
|
|
|
|
|
async clearCacheForNewIdentity(): Promise<void> { |
|
|
|
try { |
|
|
|
console.log('DNP-WEB-INDEX: Clearing cache for new identity'); |
|
|
|
// Clearing cache for new identity
|
|
|
|
|
|
|
|
// Clear content cache
|
|
|
|
await this.clearContentCache(); |
|
|
|
|
|
|
|
console.log('DNP-WEB-INDEX: Cache cleared successfully'); |
|
|
|
// Cache cleared successfully
|
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
console.error('DNP-WEB-INDEX: Error clearing cache for new identity:', error); |
|
|
@ -561,12 +561,12 @@ export class DailyNotificationWeb implements DailyNotificationPlugin { |
|
|
|
|
|
|
|
async updateBackgroundTaskIdentity(activeDid: string): Promise<void> { |
|
|
|
try { |
|
|
|
console.log('DNP-WEB-INDEX: Updating background task identity:', activeDid); |
|
|
|
// Updating background task identity
|
|
|
|
|
|
|
|
// Update current activeDid
|
|
|
|
this.activeDid = activeDid; |
|
|
|
|
|
|
|
console.log('DNP-WEB-INDEX: Background task identity updated successfully'); |
|
|
|
// Background task identity updated successfully
|
|
|
|
|
|
|
|
} catch (error) { |
|
|
|
console.error('DNP-WEB-INDEX: Error updating background task identity:', error); |
|
|
|