UNPKG

@sendbird/uikit-react-native

Version:

Sendbird UIKit for React Native: A feature-rich and customizable chat UI kit with messaging, channel management, and user authentication.

37 lines (36 loc) 1.56 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; const createExpoNotificationService = messagingModule => { const authorizedStatus = [messagingModule.IosAuthorizationStatus.AUTHORIZED, messagingModule.IosAuthorizationStatus.PROVISIONAL]; return { async getAPNSToken() { const response = await messagingModule.getDevicePushTokenAsync(); return response.data; }, async getFCMToken() { const response = await messagingModule.getDevicePushTokenAsync(); return response.data; }, async hasPushPermission() { var _status$ios; const status = await messagingModule.getPermissionsAsync(); return Boolean(status.granted || ((_status$ios = status.ios) === null || _status$ios === void 0 ? void 0 : _status$ios.status) && authorizedStatus.includes(status.ios.status)); }, async requestPushPermission() { var _status$ios2; const status = await messagingModule.requestPermissionsAsync(); return Boolean(status.granted || ((_status$ios2 = status.ios) === null || _status$ios2 === void 0 ? void 0 : _status$ios2.status) && authorizedStatus.includes(status.ios.status)); }, onTokenRefresh(handler) { const subscription = messagingModule.addPushTokenListener(({ data }) => handler(data)); return () => messagingModule.removePushTokenSubscription(subscription); } }; }; var _default = exports.default = createExpoNotificationService; //# sourceMappingURL=createNotificationService.expo.js.map