PS: уведомление Firebase работает нормально для обоих Android и ios
Вот соответствующая часть моего кода:
AppDelegate.m:
Код: Выделить всё
#import "AppDelegate.h"
#import "Adjust.h"
#import "Firebase.h"
#import
#import
#import "FirebaseCore.h"
#import
#import
#import "RNCallKeep.h"
#import
#import
#import "RNVoipPushNotificationManager.h"
#import
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[FIRApp configure];
[RNCallKeep setup:@{@"appName": @"DocMoonlight", @"maximumCallGroups": @3, @"maximumCallsPerCallGroup": @1, @"supportsVideo": @YES}];
[RNVoipPushNotificationManager voipRegistration];
// other initialization code
}
- (void)pushRegistry:(PKPushRegistry *)registry didReceiveIncomingPushWithPayload:(PKPushPayload *)payload forType:(PKPushType)type withCompletionHandler:(void (^)(void))completion {
[RNVoipPushNotificationManager didReceiveIncomingPushWithPayload:payload forType:(NSString *)type];
NSString *uuid = [[[NSUUID UUID] UUIDString] lowercaseString];
[RNCallKeep reportNewIncomingCall:uuid handle:@"unknown" handleType:@"generic" hasVideo:NO localizedCallerName:@"Unknown" supportsHolding:YES supportsDTMF:YES supportsGrouping:YES supportsUngrouping:YES fromPushKit:YES payload:nil withCompletionHandler:completion];
}
Код: Выделить всё
const options = {
ios: {
appName: 'DocMoonlight',
},
android: {
alertTitle: 'Permissions required',
alertDescription: 'This application needs to access your phone accounts',
cancelButton: 'Cancel',
okButton: 'ok',
imageName: '',
additionalPermissions: [],
foregroundService: {
channelId: 'com.docmoonlight',
channelName: 'Foreground service for my app',
notificationTitle: 'My app is running on background',
notificationIcon: 'ic_notification',
},
},
};
CallKeep.setup(options).then(() => {});
CallKeep.setAvailable(true);
Код: Выделить всё
async function onMessageReceived(remoteMessage) {
if (remoteMessage.data?.type === 'video_call') {
const callUUID = uuidv4();
CallKeep.displayIncomingCall(
callUUID,
remoteMessage.data?.location,
'Docmoonlight',
'generic',
true,
);
// Listen to the CallKeep events
CallKeep.addEventListener('answerCall', async ({callUUID}) => {
bringAppToForeground();
CallKeep.endCall(callUUID);
setTimeout(async () => {
if (remoteMessage.data) {
const zoomLink = remoteMessage.data;
try {
const jwtToken = generateSignature(zoomLink.meetingNumber);
await ZoomUs.initialize({
jwtToken,
})
.then(result => {
console.log(result);
try {
ZoomUs.joinMeeting({
userName: zoomLink.name,
meetingNumber: zoomLink.meetingNumber,
password: zoomLink.password,
});
} catch (error) {
console.error('Failed to join the meeting', error);
}
})
.catch(error => console.log('Failed to initialize', error));
} catch (error) {
console.log(error);
}
}
}, 1000);
});
CallKeep.addEventListener('endCall', ({callUUID}) => {
console.log('Call ended:', callUUID);
CallKeep.endCall(callUUID);
});
} else {
onDisplayNotification(
remoteMessage.notification?.title,
remoteMessage.notification?.body,
remoteMessage.messageId,
);
}
}
Код: Выделить всё
require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
platform :ios, min_ios_version_supported
prepare_react_native_project!
source 'https://github.com/CocoaPods/Specs.git'
# Disable Flipper temporarily
flipper_config = FlipperConfiguration.disabled
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
target 'DocMoonlight' do
config = use_native_modules!
pod 'Firebase', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true
pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
permissions_path = '../node_modules/react-native-permissions/ios'
pod 'FirebaseInstallations', :modular_headers => true
pod 'FirebaseCoreExtension', :modular_headers => true
pod 'GoogleDataTransport', :modular_headers => true
pod 'nanopb', :modular_headers => true
pod 'RNCallKeep', :path => '../node_modules/react-native-callkeep'
# Flags change depending on the env values.
flags = get_default_flags()
use_react_native!(
:path => config[:reactNativePath],
:hermes_enabled => flags[:hermes_enabled],
:fabric_enabled => flags[:fabric_enabled],
:flipper_configuration => flipper_config,
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'DocMoonlightTests' do
inherit! :complete
end
post_install do |installer|
react_native_post_install(
installer,
:mac_catalyst_enabled => false
)
end
end
Код: Выделить всё
BGTaskSchedulerPermittedIdentifiers
com.docmoonlight.app.fetch-updates
CFBundleDevelopmentRegion
en
CFBundleDisplayName
Docmoonlight
CFBundleExecutable
$(EXECUTABLE_NAME)
CFBundleIdentifier
$(PRODUCT_BUNDLE_IDENTIFIER)
CFBundleInfoDictionaryVersion
6.0
CFBundleName
$(PRODUCT_NAME)
CFBundlePackageType
APPL
CFBundleShortVersionString
$(MARKETING_VERSION)
CFBundleSignature
????
CFBundleVersion
$(CURRENT_PROJECT_VERSION)
LSRequiresIPhoneOS
NSAppTransportSecurity
NSExceptionDomains
localhost
NSExceptionAllowsInsecureHTTPLoads
NSBluetoothPeripheralUsageDescription
We will use your Bluetooth to access your Bluetooth headphones.
NSCameraUsageDescription
For people to see you during meetings, we need access to your camera.
NSDocumentsFolderUsageDescription
Docmoonlight's app requires access to your Documents Folder to allow you to upload necessary documents and files, such as proof of medical licensing or certifications, during the registration process
NSLocationWhenInUseUsageDescription
Docmoonlight's app requires access to your location while in use to provide accurate clock-in and clock-out times for payment purposes.
NSMicrophoneUsageDescription
For people to hear you during meetings, we need access to your microphone.
NSPhotoLibraryUsageDescription
Docmoonlight's app requires access to your Photo Library and file storage to allow you to upload necessary documents and files, such as proof of medical licensing or certifications, during the registration process
UIAppFonts
Poppins-Medium.ttf
Poppins-Regular.ttf
Poppins-SemiBold.ttf
AntDesign.ttf
Entypo.ttf
EvilIcons.ttf
Feather.ttf
FontAwesome.ttf
FontAwesome5_Brands.ttf
FontAwesome5_Regular.ttf
FontAwesome5_Solid.ttf
Foundation.ttf
Ionicons.ttf
MaterialIcons.ttf
MaterialCommunityIcons.ttf
SimpleLineIcons.ttf
Octicons.ttf
Zocial.ttf
FontAwesome6_Regular.ttf
FontAwesome6_Solid.ttf
FontAwesome6_Brands.ttf
UIBackgroundModes
audio
fetch
remote-notification
voip
UILaunchStoryboardName
LaunchScreen
UIRequiredDeviceCapabilities
armv7
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
UISupportedInterfaceOrientations~ipad
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
UIInterfaceOrientationPortrait
UIViewControllerBasedStatusBarAppearance
Подробнее здесь: https://stackoverflow.com/questions/786 ... ate-on-ios