CallKitManager.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /**
  2. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  3. * SPDX-License-Identifier: GPL-3.0-or-later
  4. */
  5. #import <Foundation/Foundation.h>
  6. #import <CallKit/CallKit.h>
  7. extern NSString * const CallKitManagerDidAnswerCallNotification;
  8. extern NSString * const CallKitManagerDidEndCallNotification;
  9. extern NSString * const CallKitManagerDidStartCallNotification;
  10. extern NSString * const CallKitManagerDidChangeAudioMuteNotification;
  11. extern NSString * const CallKitManagerWantsToUpgradeToVideoCallNotification;
  12. extern NSString * const CallKitManagerDidFailRequestingCallTransactionNotification;
  13. @interface CallKitCall : NSObject
  14. @property (nonatomic, strong) NSUUID *uuid;
  15. @property (nonatomic, strong) NSString *token;
  16. @property (nonatomic, strong) NSString *displayName;
  17. @property (nonatomic, strong) NSString *accountId;
  18. @property (nonatomic, strong) CXCallUpdate *update;
  19. @property (nonatomic, assign) BOOL reportedWhileInCall;
  20. @property (nonatomic, assign) BOOL isRinging;
  21. @property (nonatomic, assign) BOOL initiator;
  22. @property (nonatomic, assign) BOOL silentCall;
  23. @property (nonatomic, assign) BOOL recordingConsent;
  24. @end
  25. @class NCPushNotification;
  26. @interface CallKitManager : NSObject
  27. @property (nonatomic, strong) NSMutableDictionary *calls; // uuid -> callKitCall
  28. + (instancetype)sharedInstance;
  29. + (BOOL)isCallKitAvailable;
  30. - (void)setDefaultProviderConfiguration;
  31. - (void)reportIncomingCall:(NSString *)token withDisplayName:(NSString *)displayName forAccountId:(NSString *)accountId;
  32. - (void)reportIncomingCallForNonCallKitDevicesWithPushNotification:(NCPushNotification *)pushNotification;
  33. - (void)reportIncomingCallForOldAccount;
  34. - (void)startCall:(NSString *)token withVideoEnabled:(BOOL)videoEnabled andDisplayName:(NSString *)displayName asInitiator:(BOOL)initiator silently:(BOOL)silently recordingConsent:(BOOL)recordingConsent withAccountId:(NSString *)accountId;
  35. - (void)endCall:(NSString *)token withStatusCode:(NSInteger)statusCode;
  36. - (void)changeAudioMuted:(BOOL)muted forCall:(NSString *)token;
  37. - (void)switchCallFrom:(NSString *)from toCall:(NSString *)to;
  38. @end