diff --git a/CHANGES.rst b/CHANGES.rst index d7d597adf6..e61921a3ad 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -20,6 +20,7 @@ Changes to be released in next version 🧱 Build * build.sh: Add xcframework argument to build a universal MatrixSDK.xcframework * MatrixSDKTests-macOS: Remove tests from macOS profile and archive builds to match iOS. + * Support adding DISABLE_CALLKIT preprocessor macro to disable compilation of CallKit. Others * diff --git a/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.h b/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.h index 4c3ab7a686..523bc2a1b4 100644 --- a/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.h +++ b/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.h @@ -14,6 +14,7 @@ limitations under the License. */ +#ifndef DISABLE_CALLKIT #if TARGET_OS_IPHONE @import Foundation; @@ -64,3 +65,4 @@ API_AVAILABLE(ios(10.0)) NS_ASSUME_NONNULL_END #endif +#endif diff --git a/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.m b/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.m index 8c3fc29d7d..9371778c97 100644 --- a/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.m +++ b/MatrixSDK/VoIP/CallKit/MXCallKitAdapter.m @@ -14,6 +14,7 @@ limitations under the License. */ +#ifndef DISABLE_CALLKIT #if TARGET_OS_IPHONE #import "MXCallKitAdapter.h" @@ -370,3 +371,4 @@ - (void)contactIdentifierForCall:(MXCall *)call onComplete:(void (^)(NSString *c @end #endif +#endif diff --git a/MatrixSDK/VoIP/CallKit/MXCallKitConfiguration.h b/MatrixSDK/VoIP/CallKit/MXCallKitConfiguration.h index e0f93ab37b..85d02b9b12 100644 --- a/MatrixSDK/VoIP/CallKit/MXCallKitConfiguration.h +++ b/MatrixSDK/VoIP/CallKit/MXCallKitConfiguration.h @@ -14,6 +14,8 @@ limitations under the License. */ +#ifndef DISABLE_CALLKIT + @import Foundation; NS_ASSUME_NONNULL_BEGIN @@ -60,3 +62,5 @@ NS_ASSUME_NONNULL_BEGIN @end NS_ASSUME_NONNULL_END + +#endif diff --git a/MatrixSDK/VoIP/CallKit/MXCallKitConfiguration.m b/MatrixSDK/VoIP/CallKit/MXCallKitConfiguration.m index e059c49481..db80d8e6bb 100644 --- a/MatrixSDK/VoIP/CallKit/MXCallKitConfiguration.m +++ b/MatrixSDK/VoIP/CallKit/MXCallKitConfiguration.m @@ -14,6 +14,8 @@ limitations under the License. */ +#ifndef DISABLE_CALLKIT + #import "MXCallKitConfiguration.h" @implementation MXCallKitConfiguration @@ -44,3 +46,5 @@ - (instancetype)initWithName:(NSString *)name } @end + +#endif diff --git a/MatrixSDK/VoIP/MXCallManager.h b/MatrixSDK/VoIP/MXCallManager.h index bf83f897bd..8f65bee08a 100644 --- a/MatrixSDK/VoIP/MXCallManager.h +++ b/MatrixSDK/VoIP/MXCallManager.h @@ -20,7 +20,10 @@ NS_ASSUME_NONNULL_BEGIN @class MXCall; +#ifndef DISABLE_CALLKIT @class MXCallKitAdapter; +#endif + @class MXRoom, MXRoomState; @class MXRoomMember; @class MXSession; @@ -137,9 +140,11 @@ extern NSString *const kMXCallManagerPSTNSupportUpdated; The CallKit adapter. Provide it if you want to add CallKit support. */ +#ifndef DISABLE_CALLKIT #if TARGET_OS_IPHONE @property (nonatomic, nullable) MXCallKitAdapter *callKitAdapter; #endif +#endif /** The time in milliseconds that an incoming or outgoing call invite is valid for. diff --git a/MatrixSDK/VoIP/MXCallManager.m b/MatrixSDK/VoIP/MXCallManager.m index 3ea9ca4c17..171ebce109 100644 --- a/MatrixSDK/VoIP/MXCallManager.m +++ b/MatrixSDK/VoIP/MXCallManager.m @@ -564,6 +564,7 @@ - (void)handleCallRejectReplacement:(MXEvent *)event - (void)handleCallStateDidChangeNotification:(NSNotification *)notification { +#ifndef DISABLE_CALLKIT #if TARGET_OS_IPHONE MXCall *call = notification.object; @@ -590,15 +591,18 @@ - (void)handleCallStateDidChangeNotification:(NSNotification *)notification break; } #endif +#endif } - (void)handleCallSupportHoldingStatusDidChange:(NSNotification *)notification { +#ifndef DISABLE_CALLKIT #if TARGET_OS_IPHONE MXCall *call = notification.object; [self.callKitAdapter updateSupportsHoldingForCall:call]; #endif +#endif } - (void)unregisterFromNotifications