From 9218e5d4ca59e7c2153554ee2af52d73fa574c61 Mon Sep 17 00:00:00 2001 From: Ivan Sein Date: Thu, 15 Mar 2018 15:39:37 +0100 Subject: [PATCH] Initialize a video settings model in setting contoller. Signed-off-by: Ivan Sein --- VideoCalls.xcodeproj/project.pbxproj | 4 ++++ VideoCalls/CallViewController.m | 5 +---- VideoCalls/NCSettingsController.h | 2 ++ VideoCalls/NCSettingsController.m | 1 + VideoCalls/VideoSettingsViewController.m | 5 ++--- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/VideoCalls.xcodeproj/project.pbxproj b/VideoCalls.xcodeproj/project.pbxproj index 50dad084..7c446b44 100644 --- a/VideoCalls.xcodeproj/project.pbxproj +++ b/VideoCalls.xcodeproj/project.pbxproj @@ -14,6 +14,8 @@ 2C0574A51EDDA2E300D9E7F2 /* LoginViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2C0574A31EDDA2E300D9E7F2 /* LoginViewController.xib */; }; 2C06330F2046CC8B0043481A /* NCUserInterfaceController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C06330E2046CC8B0043481A /* NCUserInterfaceController.m */; }; 2C063313205A85850043481A /* VideoSettingsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C063312205A85850043481A /* VideoSettingsViewController.m */; }; + 2C063314205AB8B90043481A /* ARDSettingsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D7D651F2F7DBC00FF4A0D /* ARDSettingsModel.m */; }; + 2C063315205AB8C40043481A /* ARDSettingsStore.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C4D7D681F2F7DBC00FF4A0D /* ARDSettingsStore.m */; }; 2C2E64251F3462AF00D39CE8 /* NCSignalingMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C2E64241F3462AF00D39CE8 /* NCSignalingMessage.m */; }; 2C3F6AA81FBB1ACD00E2705C /* NotificationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 2C3F6AA71FBB1ACD00E2705C /* NotificationService.m */; }; 2C3F6AAC1FBB1ACD00E2705C /* NotificationServiceExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 2C3F6AA41FBB1ACC00E2705C /* NotificationServiceExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; @@ -974,9 +976,11 @@ files = ( 2C3F6AB61FBB47B800E2705C /* NCAPIController.m in Sources */, 2C3F6AB91FBB4C9D00E2705C /* NCUser.m in Sources */, + 2C063314205AB8B90043481A /* ARDSettingsModel.m in Sources */, 2CBF82BA1FD5A1E500636459 /* CCCertificate.m in Sources */, 2CBF82B71FD0939600636459 /* NCAPISessionManager.m in Sources */, 2CBF82C21FD5AE3F00636459 /* NCPushProxySessionManager.m in Sources */, + 2C063315205AB8C40043481A /* ARDSettingsStore.m in Sources */, 2CBF82AF1FC888FC00636459 /* NCPushNotification.m in Sources */, 2CBF82BE1FD5AE0A00636459 /* NCImageSessionManager.m in Sources */, 2C3F6AA81FBB1ACD00E2705C /* NotificationService.m in Sources */, diff --git a/VideoCalls/CallViewController.m b/VideoCalls/CallViewController.m index d9621ac9..2c201a18 100644 --- a/VideoCalls/CallViewController.m +++ b/VideoCalls/CallViewController.m @@ -12,7 +12,6 @@ #import #import #import -#import "ARDSettingsModel.h" #import "ARDCaptureController.h" #import "CallParticipantViewCell.h" #import "NBMPeersFlowLayout.h" @@ -385,9 +384,7 @@ typedef NS_ENUM(NSInteger, CallState) { - (void)callController:(NCCallController *)callController didCreateLocalVideoCapturer:(RTCCameraVideoCapturer *)videoCapturer { _localVideoView.captureSession = videoCapturer.captureSession; - - ARDSettingsModel *settingsModel = [[ARDSettingsModel alloc] init]; - _captureController = [[ARDCaptureController alloc] initWithCapturer:videoCapturer settings:settingsModel]; + _captureController = [[ARDCaptureController alloc] initWithCapturer:videoCapturer settings:[[NCSettingsController sharedInstance] videoSettingsModel]]; [_captureController startCapture]; } - (void)callController:(NCCallController *)callController didAddLocalStream:(RTCMediaStream *)localStream diff --git a/VideoCalls/NCSettingsController.h b/VideoCalls/NCSettingsController.h index 424dcc38..a5c36acd 100644 --- a/VideoCalls/NCSettingsController.h +++ b/VideoCalls/NCSettingsController.h @@ -8,6 +8,7 @@ #import +#import "ARDSettingsModel.h" #import "UICKeyChainStore.h" @@ -44,6 +45,7 @@ extern NSString * const NCServerCapabilitiesReceivedNotification; @property (nonatomic, copy) NSString *ncDeviceSignature; @property (nonatomic, copy) NSString *ncUserPublicKey; @property (nonatomic, copy) NSDictionary *ncTalkCapabilities; +@property (nonatomic, copy) ARDSettingsModel *videoSettingsModel; + (instancetype)sharedInstance; - (void)cleanUserAndServerStoredValues; diff --git a/VideoCalls/NCSettingsController.m b/VideoCalls/NCSettingsController.m index 26087d07..52fca2c4 100644 --- a/VideoCalls/NCSettingsController.m +++ b/VideoCalls/NCSettingsController.m @@ -55,6 +55,7 @@ NSString * const NCServerCapabilitiesReceivedNotification = @"NCServerCapabiliti { self = [super init]; if (self) { + _videoSettingsModel = [[ARDSettingsModel alloc] init]; _keychain = [UICKeyChainStore keyChainStoreWithService:@"com.nextcloud.Talk" accessGroup:@"group.com.nextcloud.Talk"]; [self readValuesFromKeyChain]; diff --git a/VideoCalls/VideoSettingsViewController.m b/VideoCalls/VideoSettingsViewController.m index 52ac45e9..212c3b62 100644 --- a/VideoCalls/VideoSettingsViewController.m +++ b/VideoCalls/VideoSettingsViewController.m @@ -8,7 +8,7 @@ #import "VideoSettingsViewController.h" -#import "ARDSettingsModel.h" +#import "NCSettingsController.h" typedef enum VideoSettingsSection { kVideoSettingsSectionResolution = 0, @@ -77,8 +77,7 @@ typedef enum VideoSettingsSection { } cell.textLabel.text = @"Video resolution"; - ARDSettingsModel *settingsModel = [[ARDSettingsModel alloc] init]; - cell.detailTextLabel.text = [settingsModel currentVideoResolutionSettingFromStore]; + cell.detailTextLabel.text = [[[NCSettingsController sharedInstance] videoSettingsModel] currentVideoResolutionSettingFromStore]; } break; case kVideoSettingsSectionDefaultVideo: