Add new setting for CallKit
MODIFY
MatrixKit/Models/MXKAppSettings.h
MatrixKit/Models/MXKAppSettings.h
*/
@property (nonatomic) UIColor *presenceColorForOfflineUser;
+#pragma mark - Calls
+
+/**
+ Return YES if the user enable CallKit support.
+
+ This boolean value is defined in shared settings object with the key: `enableCallKit`.
+ Return YES if no value is defined.
+ */
+@property (nonatomic, getter=isCallKitEnabled) BOOL enableCallKit;
#pragma mark - Class methods

MODIFY
MatrixKit/Models/MXKAppSettings.m
MatrixKit/Models/MXKAppSettings.m
@@ -31,6 +31,7 @@ static MXKAppSettings *standardAppSettings = nil;
@synthesize showLeftMembersInRoomMemberList, sortRoomMembersUsingLastSeenTime;
@synthesize syncLocalContacts, syncLocalContactsPermissionRequested, phonebookCountryCode;
@synthesize presenceColorForOnlineUser, presenceColorForUnavailableUser, presenceColorForOfflineUser;
+@synthesize enableCallKit;
+ (MXKAppSettings *)standardAppSettings
{
@@ -64,6 +65,8 @@ static MXKAppSettings *standardAppSettings = nil;
httpLinkScheme = @"http";
httpsLinkScheme = @"https";
+
+ enableCallKit = YES;
}
return self;
}
@@ -95,6 +98,8 @@ static MXKAppSettings *standardAppSettings = nil;
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"httpLinkScheme"];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"httpsLinkScheme"];
+ [[NSUserDefaults standardUserDefaults] removeObjectForKey:@"enableCallKit"];
+
[[NSUserDefaults standardUserDefaults] synchronize];
}
else
@@ -116,6 +121,8 @@ static MXKAppSettings *standardAppSettings = nil;
httpLinkScheme = @"http";
httpsLinkScheme = @"https";
+
+ enableCallKit = YES;
}
}
@@ -576,4 +583,38 @@ static MXKAppSettings *standardAppSettings = nil;
}
}
+#pragma mark - Calls
+
+- (BOOL)isCallKitEnabled
+{
+ if (self == [MXKAppSettings standardAppSettings])
+ {
+ id storedValue = [[NSUserDefaults standardUserDefaults] objectForKey:@"enableCallKit"];
+ if (storedValue)
+ {
+ return [(NSNumber *)storedValue boolValue];
+ }
+ else
+ {
+ return YES;
+ }
+ }
+ else
+ {
+ return enableCallKit;
+ }
+}
+
+- (void)setEnableCallKit:(BOOL)enable
+{
+ if (self == [MXKAppSettings standardAppSettings])
+ {
+ [[NSUserDefaults standardUserDefaults] setBool:enable forKey:@"enableCallKit"];
+ }
+ else
+ {
+ enableCallKit = enable;
+ }
+}
+
@end

Add new setting for CallKit