forked from trent_larson/crowd-funder-for-time-pwa
fix: Add notification channel creation and improve native fetcher configuration
- Add notification channel creation in TimeSafariApplication for Android 8.0+ Required for daily notifications to display properly. Channel ID matches plugin's 'timesafari.daily' channel. - Convert localhost to 10.0.2.2 in CapacitorPlatformService for Android emulators Android emulators cannot reach localhost - they need 10.0.2.2 to access the host machine's API server. - Refresh native fetcher configuration when API server changes in AccountViewView Ensures background notification prefetch uses the updated endpoint when user changes API server URL in settings. - Add directive for fixing notification dismiss cancellation in plugin Documents the fix needed in plugin source to cancel notification from NotificationManager when dismiss button is clicked. These changes ensure daily notifications work correctly on Android, including proper channel setup, emulator network connectivity, and configuration refresh.
This commit is contained in:
@@ -825,6 +825,7 @@ import {
|
||||
import { logger } from "../utils/logger";
|
||||
import { PlatformServiceMixin } from "../utils/PlatformServiceMixin";
|
||||
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
||||
import { PlatformServiceFactory } from "../services/PlatformServiceFactory";
|
||||
import { ACCOUNT_VIEW_CONSTANTS } from "@/constants/accountView";
|
||||
import { showSeedPhraseReminder } from "@/utils/seedPhraseReminder";
|
||||
import {
|
||||
@@ -1547,6 +1548,33 @@ export default class AccountViewView extends Vue {
|
||||
settingsSaved: true,
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
|
||||
// Refresh native fetcher configuration with new API server
|
||||
// This ensures background notification prefetch uses the updated endpoint
|
||||
try {
|
||||
const platformService = PlatformServiceFactory.getInstance();
|
||||
const settings = await this.$accountSettings();
|
||||
const starredPlanHandleIds = settings.starredPlanHandleIds || [];
|
||||
|
||||
await platformService.configureNativeFetcher({
|
||||
apiServer: newApiServer,
|
||||
jwt: "", // Will be generated automatically by configureNativeFetcher
|
||||
starredPlanHandleIds,
|
||||
});
|
||||
|
||||
logger.info(
|
||||
"[AccountViewView] Native fetcher configuration refreshed after API server change",
|
||||
{
|
||||
newApiServer,
|
||||
},
|
||||
);
|
||||
} catch (error) {
|
||||
logger.error(
|
||||
"[AccountViewView] Failed to refresh native fetcher config after API server change:",
|
||||
error,
|
||||
);
|
||||
// Don't throw - API server change should still succeed even if native fetcher refresh fails
|
||||
}
|
||||
}
|
||||
|
||||
async onClickSavePartnerServer(): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user