@opexa/portal-components 0.0.713 → 0.0.714

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,9 @@ export const AndroidRoutingHandler = () => {
14
14
  App.exitApp(); // Exit app on Android when at root
15
15
  }
16
16
  });
17
+ return () => {
18
+ App.removeAllListeners();
19
+ };
17
20
  }, [router, pathname]);
18
21
  return null;
19
22
  };
@@ -1,4 +1,5 @@
1
1
  'use client';
2
+ import { App } from '@capacitor/app';
2
3
  import { Capacitor } from '@capacitor/core';
3
4
  import { PushNotifications } from '@capacitor/push-notifications';
4
5
  import { useEffect } from 'react';
@@ -11,14 +12,21 @@ export const PushNotification = () => {
11
12
  const platform = Capacitor.getPlatform();
12
13
  if (platform === 'web')
13
14
  return;
14
- PushNotifications.requestPermissions().then((permission) => {
15
- if (permission.receive === 'granted') {
16
- PushNotifications.register();
17
- console.info('✅ Push permission granted');
18
- }
19
- else {
20
- console.warn('⚠️ Push permission denied');
21
- }
15
+ const checkAndRegister = async () => {
16
+ PushNotifications.requestPermissions().then((permission) => {
17
+ if (permission.receive === 'granted') {
18
+ PushNotifications.register();
19
+ console.info('✅ Push permission granted');
20
+ }
21
+ else {
22
+ console.warn('⚠️ Push permission denied');
23
+ }
24
+ });
25
+ };
26
+ checkAndRegister();
27
+ App.addListener('resume', () => {
28
+ checkAndRegister();
29
+ console.log('App resumed - checking push notification permissions');
22
30
  });
23
31
  PushNotifications.addListener('registration', async ({ value }) => {
24
32
  console.info('✅ Push registration success');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opexa/portal-components",
3
- "version": "0.0.713",
3
+ "version": "0.0.714",
4
4
  "exports": {
5
5
  "./ui/*": {
6
6
  "types": "./dist/ui/*/index.d.ts",