From c5774f8545d7f1e04696b8dadb3e86cec0c77822 Mon Sep 17 00:00:00 2001 From: Redmer Loen Date: Thu, 1 Nov 2018 15:40:33 +0100 Subject: [PATCH] VIALI-3437: Added the option for users to set the audio quality (#60) --- Gemfile.lock | 12 +- Podfile.lock | 12 +- Vialer.xcodeproj/project.pbxproj | 94 +++++++---- .../xcschemes/ANNAbel Screenshots.xcscheme | 2 +- .../xcshareddata/xcschemes/ANNAbel.xcscheme | 2 +- .../xcschemes/Verbonden Screenshots.xcscheme | 2 +- .../xcshareddata/xcschemes/Verbonden.xcscheme | 2 +- .../xcschemes/Vialer Screenshots.xcscheme | 2 +- .../xcschemes/Vialer Staging.xcscheme | 2 +- .../xcshareddata/xcschemes/Vialer.xcscheme | 2 +- .../xcschemes/Voys Screenshots.xcscheme | 2 +- .../xcschemes/Voys Staging.xcscheme | 2 +- .../xcshareddata/xcschemes/Voys.xcscheme | 2 +- Vialer/Api/VoIPGRIDRequestOperationManager.h | 8 + Vialer/Api/VoIPGRIDRequestOperationManager.m | 15 ++ Vialer/AppDelegate.swift | 41 ++++- .../Base.lproj/SettingsStoryboard.storyboard | 77 ++++++++- .../Controllers/DialerViewController.swift | 1 + Vialer/Calling/SIP/Utils/SIPUtils.h | 13 +- Vialer/Calling/SIP/Utils/SIPUtils.m | 88 ++++++---- Vialer/Helpers/EnumHelper.swift | 21 +++ Vialer/Helpers/GradientView.swift | 2 +- Vialer/Helpers/VialerStats.swift | 1 + .../Controllers/VailerRootViewController.m | 12 +- Vialer/Models/SystemUser.h | 27 ++++ Vialer/Models/SystemUser.m | 140 +++++++++++----- .../Controllers/LogInViewController.m | 1 + .../AudioQualityViewController.swift | 151 ++++++++++++++++++ .../Controllers/SettingsViewController.m | 17 +- Vialer/nl.lproj/Localizable.strings | 18 +++ Vialer/nl.lproj/SettingsStoryboard.strings | 4 +- scripts/update_build_number.sh | 32 ++-- scripts/update_version_number.sh | 12 +- 33 files changed, 658 insertions(+), 161 deletions(-) create mode 100644 Vialer/Helpers/EnumHelper.swift create mode 100644 Vialer/Settings/Controllers/AudioQualityViewController.swift diff --git a/Gemfile.lock b/Gemfile.lock index 9607982d..5b03a8eb 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -36,7 +36,7 @@ GEM fuzzy_match (~> 2.0.4) nap (~> 1.0) cocoapods-deintegrate (1.0.2) - cocoapods-downloader (1.2.1) + cocoapods-downloader (1.2.2) cocoapods-plugins (1.0.0) nap cocoapods-search (1.0.0) @@ -66,7 +66,7 @@ GEM faraday_middleware (0.12.2) faraday (>= 0.7.4, < 1.0) fastimage (2.1.4) - fastlane (2.105.1) + fastlane (2.107.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) babosa (>= 1.0.2, < 2.0.0) @@ -151,10 +151,10 @@ GEM uber (< 0.2.0) retriable (3.1.2) rouge (2.0.7) - ruby-macho (1.2.0) + ruby-macho (1.3.1) rubyzip (1.2.2) security (0.1.3) - signet (0.9.2) + signet (0.11.0) addressable (~> 2.3) faraday (~> 0.9) jwt (>= 1.5, < 3.0) @@ -179,7 +179,7 @@ GEM unf_ext (0.0.7.5) unicode-display_width (1.4.0) word_wrap (1.0.0) - xcodeproj (1.6.0) + xcodeproj (1.7.0) CFPropertyList (>= 2.3.3, < 4.0) atomos (~> 0.1.3) claide (>= 1.0.2, < 2.0) @@ -198,4 +198,4 @@ DEPENDENCIES fastlane BUNDLED WITH - 1.16.4 + 1.16.6 diff --git a/Podfile.lock b/Podfile.lock index 70bfa273..ff6b1595 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -53,12 +53,12 @@ PODS: - PBWebViewController (0.5.0) - Reachability (3.2) - SAMKeychain (1.5.3) - - SimulatorStatusMagic (2.2) + - SimulatorStatusMagic (2.3) - SPLumberjackLogFormatter (0.0.1): - CocoaLumberjack - SVProgressHUD (2.2.5) - - Vialer-pjsip-iOS (3.3.7) - - VialerSIPLib (3.3.4): + - Vialer-pjsip-iOS (3.4.1) + - VialerSIPLib (3.4.0): - CocoaLumberjack - Reachability - Vialer-pjsip-iOS @@ -130,11 +130,11 @@ SPEC CHECKSUMS: PBWebViewController: 6537990155ca850fb8d0563efbc12becebc953ef Reachability: 33e18b67625424e47b6cde6d202dce689ad7af96 SAMKeychain: 483e1c9f32984d50ca961e26818a534283b4cd5c - SimulatorStatusMagic: 0389a805fa8bd001e2977c4046730bdbd6642861 + SimulatorStatusMagic: 631fe6e4195a8a8d587ad8744af9015126526cc2 SPLumberjackLogFormatter: a2290c9b880f3166b2d1bace45dc1fc1302b28ab SVProgressHUD: 1428aafac632c1f86f62aa4243ec12008d7a51d6 - Vialer-pjsip-iOS: 3b8bac1bf7e6831379cd0b4763dce1842db0abb4 - VialerSIPLib: 93ffe714270208cb1c5595eb8febca71feb8ff84 + Vialer-pjsip-iOS: 9b8fc1226e9a51150642b9cc81a8c62c9e9c530b + VialerSIPLib: d62821042b97fd6264fd44da07661648dd00fb3f PODFILE CHECKSUM: 8e7a2fdf72deeac99781236e5c990c0e454b5552 diff --git a/Vialer.xcodeproj/project.pbxproj b/Vialer.xcodeproj/project.pbxproj index 8e97b531..55120e6b 100644 --- a/Vialer.xcodeproj/project.pbxproj +++ b/Vialer.xcodeproj/project.pbxproj @@ -101,7 +101,6 @@ C41FD8B71C60A08400BBE6D7 /* dtmf-7.aif in Resources */ = {isa = PBXBuildFile; fileRef = FBB854191A7FE3CE00121366 /* dtmf-7.aif */; }; C41FD8B81C60A08400BBE6D7 /* disconnected.wav in Resources */ = {isa = PBXBuildFile; fileRef = FEE6D6A91B9F12F2001D25B1 /* disconnected.wav */; }; C41FD8B91C60A08400BBE6D7 /* dtmf-8.aif in Resources */ = {isa = PBXBuildFile; fileRef = FBB8541A1A7FE3CE00121366 /* dtmf-8.aif */; }; - C41FD8BA1C60A08400BBE6D7 /* SettingsStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F22362661C22EE6200D6F5FF /* SettingsStoryboard.storyboard */; }; C41FD8BB1C60A08400BBE6D7 /* dtmf-9.aif in Resources */ = {isa = PBXBuildFile; fileRef = FBB8541B1A7FE3CE00121366 /* dtmf-9.aif */; }; C41FD8BD1C60A08400BBE6D7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FB21E03F1A3B48D800AE746B /* Images.xcassets */; }; C41FD8C11C60A08400BBE6D7 /* DialerStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C4EFCF821BF21E210000CC6F /* DialerStoryboard.storyboard */; }; @@ -252,7 +251,6 @@ C490ADD71D0863E3004A8F83 /* SIPIncomingCallStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F9A71EBD1C7F5F360083C8B4 /* SIPIncomingCallStoryboard.storyboard */; }; C490ADD81D0863E3004A8F83 /* disconnected.wav in Resources */ = {isa = PBXBuildFile; fileRef = FEE6D6A91B9F12F2001D25B1 /* disconnected.wav */; }; C490ADD91D0863E3004A8F83 /* dtmf-8.aif in Resources */ = {isa = PBXBuildFile; fileRef = FBB8541A1A7FE3CE00121366 /* dtmf-8.aif */; }; - C490ADDA1D0863E3004A8F83 /* SettingsStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F22362661C22EE6200D6F5FF /* SettingsStoryboard.storyboard */; }; C490ADDB1D0863E3004A8F83 /* dtmf-9.aif in Resources */ = {isa = PBXBuildFile; fileRef = FBB8541B1A7FE3CE00121366 /* dtmf-9.aif */; }; C490ADDD1D0863E3004A8F83 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FB21E03F1A3B48D800AE746B /* Images.xcassets */; }; C490ADE01D0863E3004A8F83 /* DialerStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C4EFCF821BF21E210000CC6F /* DialerStoryboard.storyboard */; }; @@ -530,7 +528,6 @@ EE23189720A0468F00C05EB0 /* SIPCallingStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C4F385931D5B66AC005D8146 /* SIPCallingStoryboard.storyboard */; }; EE23189820A0468F00C05EB0 /* disconnected.wav in Resources */ = {isa = PBXBuildFile; fileRef = FEE6D6A91B9F12F2001D25B1 /* disconnected.wav */; }; EE23189920A0468F00C05EB0 /* dtmf-8.aif in Resources */ = {isa = PBXBuildFile; fileRef = FBB8541A1A7FE3CE00121366 /* dtmf-8.aif */; }; - EE23189A20A0468F00C05EB0 /* SettingsStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F22362661C22EE6200D6F5FF /* SettingsStoryboard.storyboard */; }; EE23189B20A0468F00C05EB0 /* dtmf-9.aif in Resources */ = {isa = PBXBuildFile; fileRef = FBB8541B1A7FE3CE00121366 /* dtmf-9.aif */; }; EE23189C20A0468F00C05EB0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = FB21E03F1A3B48D800AE746B /* Images.xcassets */; }; EE23189D20A0468F00C05EB0 /* DialerStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C4EFCF821BF21E210000CC6F /* DialerStoryboard.storyboard */; }; @@ -726,7 +723,6 @@ EE61F47B1F1DDDE4006E890F /* SIPCallingStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C4F385931D5B66AC005D8146 /* SIPCallingStoryboard.storyboard */; }; EE61F47D1F1DDDE4006E890F /* disconnected.wav in Resources */ = {isa = PBXBuildFile; fileRef = FEE6D6A91B9F12F2001D25B1 /* disconnected.wav */; }; EE61F47E1F1DDDE4006E890F /* dtmf-8.aif in Resources */ = {isa = PBXBuildFile; fileRef = FBB8541A1A7FE3CE00121366 /* dtmf-8.aif */; }; - EE61F47F1F1DDDE4006E890F /* SettingsStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F22362661C22EE6200D6F5FF /* SettingsStoryboard.storyboard */; }; EE61F4801F1DDDE4006E890F /* dtmf-9.aif in Resources */ = {isa = PBXBuildFile; fileRef = FBB8541B1A7FE3CE00121366 /* dtmf-9.aif */; }; EE61F4831F1DDDE4006E890F /* DialerStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C4EFCF821BF21E210000CC6F /* DialerStoryboard.storyboard */; }; EE61F4841F1DDDE4006E890F /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C4DA5C7A1BFB27580043DED7 /* MainStoryboard.storyboard */; }; @@ -736,9 +732,25 @@ EE61F4B81F1DE36C006E890F /* Config.plist in Resources */ = {isa = PBXBuildFile; fileRef = EE61F49B1F1DDF1E006E890F /* Config.plist */; }; EE61F4B91F1DE5E5006E890F /* VoysIntentsExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = C43172371DFE85B3005FF8EA /* VoysIntentsExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; EE65918820AACEAB00305980 /* ANNAbel.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = EE65918720AACEAB00305980 /* ANNAbel.xcassets */; }; - EE65918C20AAD6BC00305980 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = EE65918B20AAD6BB00305980 /* GoogleService-Info.plist */; }; + EE683F8D216254A700D6831B /* AudioQualityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE683F8C216254A700D6831B /* AudioQualityViewController.swift */; }; EE6F2A77214A330500229C75 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = EE6F2A75214A330500229C75 /* InfoPlist.strings */; }; - EE6F2A79214A331100229C75 /* Acceptatie-Voys-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = EE61F4B31F1DE0A8006E890F /* Acceptatie-Voys-Info.plist */; }; + EE733DA22164995900D05CA3 /* AudioQualityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE683F8C216254A700D6831B /* AudioQualityViewController.swift */; }; + EE733DA32164995A00D05CA3 /* AudioQualityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE683F8C216254A700D6831B /* AudioQualityViewController.swift */; }; + EE733DA42164995B00D05CA3 /* AudioQualityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE683F8C216254A700D6831B /* AudioQualityViewController.swift */; }; + EE733DA52164995B00D05CA3 /* AudioQualityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE683F8C216254A700D6831B /* AudioQualityViewController.swift */; }; + EE733DA62164995C00D05CA3 /* AudioQualityViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE683F8C216254A700D6831B /* AudioQualityViewController.swift */; }; + EE733DAA21649C6200D05CA3 /* SettingsStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE733DA821649C6200D05CA3 /* SettingsStoryboard.storyboard */; }; + EE733DAB21649C6200D05CA3 /* SettingsStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE733DA821649C6200D05CA3 /* SettingsStoryboard.storyboard */; }; + EE733DAC21649C6200D05CA3 /* SettingsStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE733DA821649C6200D05CA3 /* SettingsStoryboard.storyboard */; }; + EE733DAD21649C6200D05CA3 /* SettingsStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE733DA821649C6200D05CA3 /* SettingsStoryboard.storyboard */; }; + EE733DAE21649C6200D05CA3 /* SettingsStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE733DA821649C6200D05CA3 /* SettingsStoryboard.storyboard */; }; + EE733DAF21649C6200D05CA3 /* SettingsStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = EE733DA821649C6200D05CA3 /* SettingsStoryboard.storyboard */; }; + EE733DB22164B34600D05CA3 /* EnumHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE733DB12164B34600D05CA3 /* EnumHelper.swift */; }; + EE733DB32164B34600D05CA3 /* EnumHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE733DB12164B34600D05CA3 /* EnumHelper.swift */; }; + EE733DB42164B34600D05CA3 /* EnumHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE733DB12164B34600D05CA3 /* EnumHelper.swift */; }; + EE733DB52164B34600D05CA3 /* EnumHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE733DB12164B34600D05CA3 /* EnumHelper.swift */; }; + EE733DB62164B34600D05CA3 /* EnumHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE733DB12164B34600D05CA3 /* EnumHelper.swift */; }; + EE733DB72164B34600D05CA3 /* EnumHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE733DB12164B34600D05CA3 /* EnumHelper.swift */; }; EE8C5EA62147AF2B008A430F /* UIColorExtenstions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE8C5EA52147AF2B008A430F /* UIColorExtenstions.swift */; }; EE8C5EA72147B053008A430F /* UIColorExtenstions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE8C5EA52147AF2B008A430F /* UIColorExtenstions.swift */; }; EE8C5EA82147B054008A430F /* UIColorExtenstions.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE8C5EA52147AF2B008A430F /* UIColorExtenstions.swift */; }; @@ -880,7 +892,6 @@ F20851561D26935600A17E71 /* SIPIncomingCallStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F9A71EBD1C7F5F360083C8B4 /* SIPIncomingCallStoryboard.storyboard */; }; F20851571D26935600A17E71 /* disconnected.wav in Resources */ = {isa = PBXBuildFile; fileRef = FEE6D6A91B9F12F2001D25B1 /* disconnected.wav */; }; F20851581D26935600A17E71 /* dtmf-8.aif in Resources */ = {isa = PBXBuildFile; fileRef = FBB8541A1A7FE3CE00121366 /* dtmf-8.aif */; }; - F20851591D26935600A17E71 /* SettingsStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F22362661C22EE6200D6F5FF /* SettingsStoryboard.storyboard */; }; F208515A1D26935600A17E71 /* dtmf-9.aif in Resources */ = {isa = PBXBuildFile; fileRef = FBB8541B1A7FE3CE00121366 /* dtmf-9.aif */; }; F208515F1D26935600A17E71 /* DialerStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C4EFCF821BF21E210000CC6F /* DialerStoryboard.storyboard */; }; F20851601D26935600A17E71 /* MainStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C4DA5C7A1BFB27580043DED7 /* MainStoryboard.storyboard */; }; @@ -888,7 +899,6 @@ F20851841D269DD300A17E71 /* Config.plist in Resources */ = {isa = PBXBuildFile; fileRef = F20851801D269DD300A17E71 /* Config.plist */; }; F20851851D269DD300A17E71 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = F20851811D269DD300A17E71 /* GoogleService-Info.plist */; }; F2153E9C1C91C496009A5FD7 /* APNSHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = F275FDAE1C5FA253006AEEA2 /* APNSHandler.m */; }; - F22362641C22EE6200D6F5FF /* SettingsStoryboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F22362661C22EE6200D6F5FF /* SettingsStoryboard.storyboard */; }; F22DE0A51CC90D41001468B3 /* SnapshotHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = F2B43F161C3BEB880089A387 /* SnapshotHelper.swift */; }; F22FF28B1D0ABF3800761C9A /* Configuration.m in Sources */ = {isa = PBXBuildFile; fileRef = F22FF2881D0ABF3800761C9A /* Configuration.m */; }; F22FF28C1D0ABF3800761C9A /* Configuration.m in Sources */ = {isa = PBXBuildFile; fileRef = F22FF2881D0ABF3800761C9A /* Configuration.m */; }; @@ -1383,7 +1393,6 @@ EE5C22241F46EDA300AFB9E2 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/ContactsStoryboard.strings; sourceTree = ""; }; EE5C22261F46EDA300AFB9E2 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/ReachabilityBarStoryboard.strings; sourceTree = ""; }; EE5C22271F46EDA400AFB9E2 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/RecentsStoryboard.strings; sourceTree = ""; }; - EE5C22281F46EDA400AFB9E2 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/SettingsStoryboard.strings; sourceTree = ""; }; EE5C22291F46EDA400AFB9E2 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/SideMenuStoryboard.strings; sourceTree = ""; }; EE5EC3AA213D08670000EE4D /* UrlsConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UrlsConfiguration.swift; sourceTree = ""; }; EE5EC3B1213FD8390000EE4D /* LogEntriesConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogEntriesConfiguration.swift; sourceTree = ""; }; @@ -1399,9 +1408,12 @@ EE61F49C1F1DDF1E006E890F /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = ""; }; EE61F4B31F1DE0A8006E890F /* Acceptatie-Voys-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Acceptatie-Voys-Info.plist"; sourceTree = ""; }; EE65918720AACEAB00305980 /* ANNAbel.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = ANNAbel.xcassets; sourceTree = ""; }; - EE65918B20AAD6BB00305980 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "Branding/Vialer/GoogleService-Info.plist"; sourceTree = SOURCE_ROOT; }; + EE683F8C216254A700D6831B /* AudioQualityViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AudioQualityViewController.swift; path = Settings/Controllers/AudioQualityViewController.swift; sourceTree = ""; }; EE6F2A76214A330500229C75 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; EE6F2A78214A331000229C75 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/InfoPlist.strings; sourceTree = ""; }; + EE733DA921649C6200D05CA3 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/SettingsStoryboard.storyboard; sourceTree = ""; }; + EE733DB021649C7200D05CA3 /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/SettingsStoryboard.strings; sourceTree = ""; }; + EE733DB12164B34600D05CA3 /* EnumHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = EnumHelper.swift; path = Helpers/EnumHelper.swift; sourceTree = ""; }; EE81BB691EF4154300639E31 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; EE8C5EA52147AF2B008A430F /* UIColorExtenstions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColorExtenstions.swift; sourceTree = ""; }; EEA3C2651F908B6700423F96 /* UIDeviceExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIDeviceExtensions.swift; sourceTree = ""; }; @@ -1442,7 +1454,6 @@ F20851821D269DD300A17E71 /* Vialer-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Vialer-Info.plist"; sourceTree = ""; }; F20851881D269E1700A17E71 /* Snapshot-Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Snapshot-Constants.swift"; sourceTree = ""; }; F21ECCE71C47D94000E9B276 /* Snapshot-Constants.EXAMPLE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "Snapshot-Constants.EXAMPLE"; sourceTree = ""; }; - F22362651C22EE6200D6F5FF /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/SettingsStoryboard.storyboard; sourceTree = ""; }; F22DE0AD1CC90D41001468B3 /* VialerSnapshotUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = VialerSnapshotUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; F22FF2871D0ABF3800761C9A /* Configuration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Configuration.h; sourceTree = ""; }; F22FF2881D0ABF3800761C9A /* Configuration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Configuration.m; sourceTree = ""; }; @@ -2051,6 +2062,7 @@ F2CD45F41B330ADA00CE9B1D /* SettingsViewController.m */, C46F10061C7C6FEA007F30A6 /* UserProfileWebViewController.h */, C46F10071C7C6FEA007F30A6 /* UserProfileWebViewController.m */, + EE683F8C216254A700D6831B /* AudioQualityViewController.swift */, ); name = Controllers; sourceTree = ""; @@ -2636,7 +2648,7 @@ F2E811BF1B37E2EB00EA640F /* Settings */ = { isa = PBXGroup; children = ( - F22362661C22EE6200D6F5FF /* SettingsStoryboard.storyboard */, + EE733DA821649C6200D05CA3 /* SettingsStoryboard.storyboard */, C4675FFE1C46E656008820C8 /* Controllers */, ); name = Settings; @@ -2924,6 +2936,7 @@ EEF06BA420970400000CF109 /* TokenFromPasteBoard.swift */, EE02B3F420D7870F006B10FD /* VialerStats.swift */, EE5EC3C6214008860000EE4D /* GradientView.swift */, + EE733DB12164B34600D05CA3 /* EnumHelper.swift */, ); name = Helpers; sourceTree = ""; @@ -3256,7 +3269,7 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0820; - LastUpgradeCheck = 0940; + LastUpgradeCheck = 1010; ORGANIZATIONNAME = VoIPGRID; TargetAttributes = { C41FD8551C60A08400BBE6D7 = { @@ -3410,11 +3423,11 @@ C41FD8B31C60A08400BBE6D7 /* dtmf-4.aif in Resources */, C41FD8B51C60A08400BBE6D7 /* dtmf-5.aif in Resources */, C49B0EEA1E6D9D4C00DD226B /* LogInViewController.xib in Resources */, + EE733DAC21649C6200D05CA3 /* SettingsStoryboard.storyboard in Resources */, C41FD8B61C60A08400BBE6D7 /* dtmf-6.aif in Resources */, C41FD8B71C60A08400BBE6D7 /* dtmf-7.aif in Resources */, C41FD8B81C60A08400BBE6D7 /* disconnected.wav in Resources */, C41FD8B91C60A08400BBE6D7 /* dtmf-8.aif in Resources */, - C41FD8BA1C60A08400BBE6D7 /* SettingsStoryboard.storyboard in Resources */, C4F385961D5B66AC005D8146 /* SIPCallingStoryboard.storyboard in Resources */, C41FD8BB1C60A08400BBE6D7 /* dtmf-9.aif in Resources */, C41FD8BD1C60A08400BBE6D7 /* Images.xcassets in Resources */, @@ -3471,12 +3484,12 @@ C49B0EEB1E6D9D4C00DD226B /* LogInViewController.xib in Resources */, C490ADD51D0863E3004A8F83 /* dtmf-6.aif in Resources */, C490ADD61D0863E3004A8F83 /* dtmf-7.aif in Resources */, + EE733DAE21649C6200D05CA3 /* SettingsStoryboard.storyboard in Resources */, C490ADF91D086458004A8F83 /* Verbonden.xcassets in Resources */, C490ADD71D0863E3004A8F83 /* SIPIncomingCallStoryboard.storyboard in Resources */, C490ADD81D0863E3004A8F83 /* disconnected.wav in Resources */, C4F385971D5B66AC005D8146 /* SIPCallingStoryboard.storyboard in Resources */, C490ADD91D0863E3004A8F83 /* dtmf-8.aif in Resources */, - C490ADDA1D0863E3004A8F83 /* SettingsStoryboard.storyboard in Resources */, C490ADDB1D0863E3004A8F83 /* dtmf-9.aif in Resources */, C490ADDD1D0863E3004A8F83 /* Images.xcassets in Resources */, C490ADF51D086458004A8F83 /* Config.plist in Resources */, @@ -3518,6 +3531,7 @@ EE23188B20A0468F00C05EB0 /* RecentsStoryboard.storyboard in Resources */, EE23188C20A0468F00C05EB0 /* Localizable.strings in Resources */, EE23188E20A0468F00C05EB0 /* ringtone.wav in Resources */, + EE733DAF21649C6200D05CA3 /* SettingsStoryboard.storyboard in Resources */, EE23188F20A0468F00C05EB0 /* dtmf-3.aif in Resources */, EE23189020A0468F00C05EB0 /* dtmf-4.aif in Resources */, EE23189120A0468F00C05EB0 /* dtmf-5.aif in Resources */, @@ -3528,7 +3542,6 @@ EE23189720A0468F00C05EB0 /* SIPCallingStoryboard.storyboard in Resources */, EE23189820A0468F00C05EB0 /* disconnected.wav in Resources */, EE23189920A0468F00C05EB0 /* dtmf-8.aif in Resources */, - EE23189A20A0468F00C05EB0 /* SettingsStoryboard.storyboard in Resources */, 83129869215D033A00CFE01D /* GoogleService-Info.plist in Resources */, EE23189B20A0468F00C05EB0 /* dtmf-9.aif in Resources */, EE2318D120A052EA00C05EB0 /* Config.plist in Resources */, @@ -3578,15 +3591,14 @@ EE61F4741F1DDDE4006E890F /* Images.xcassets in Resources */, EE61F4751F1DDDE4006E890F /* LogInViewController.xib in Resources */, EE61F4761F1DDDE4006E890F /* dtmf-4.aif in Resources */, - EE6F2A79214A331100229C75 /* Acceptatie-Voys-Info.plist in Resources */, EE61F4771F1DDDE4006E890F /* dtmf-5.aif in Resources */, EE61F4781F1DDDE4006E890F /* dtmf-6.aif in Resources */, + EE733DAD21649C6200D05CA3 /* SettingsStoryboard.storyboard in Resources */, EE61F4791F1DDDE4006E890F /* dtmf-7.aif in Resources */, EE61F47A1F1DDDE4006E890F /* SIPIncomingCallStoryboard.storyboard in Resources */, EE61F47B1F1DDDE4006E890F /* SIPCallingStoryboard.storyboard in Resources */, EE61F47D1F1DDDE4006E890F /* disconnected.wav in Resources */, EE61F47E1F1DDDE4006E890F /* dtmf-8.aif in Resources */, - EE61F47F1F1DDDE4006E890F /* SettingsStoryboard.storyboard in Resources */, EE61F4801F1DDDE4006E890F /* dtmf-9.aif in Resources */, EE61F4831F1DDDE4006E890F /* DialerStoryboard.storyboard in Resources */, EE61F4841F1DDDE4006E890F /* MainStoryboard.storyboard in Resources */, @@ -3619,12 +3631,12 @@ F20851541D26935600A17E71 /* dtmf-6.aif in Resources */, F20851551D26935600A17E71 /* dtmf-7.aif in Resources */, F20851561D26935600A17E71 /* SIPIncomingCallStoryboard.storyboard in Resources */, + EE733DAB21649C6200D05CA3 /* SettingsStoryboard.storyboard in Resources */, C4F385981D5B66AC005D8146 /* SIPCallingStoryboard.storyboard in Resources */, F20851571D26935600A17E71 /* disconnected.wav in Resources */, F20851581D26935600A17E71 /* dtmf-8.aif in Resources */, EE61F4A41F1DDF31006E890F /* GoogleService-Info.plist in Resources */, EE61F4A31F1DDF31006E890F /* Config.plist in Resources */, - F20851591D26935600A17E71 /* SettingsStoryboard.storyboard in Resources */, F208515A1D26935600A17E71 /* dtmf-9.aif in Resources */, F208515F1D26935600A17E71 /* DialerStoryboard.storyboard in Resources */, F20851601D26935600A17E71 /* MainStoryboard.storyboard in Resources */, @@ -3663,6 +3675,7 @@ C49A46AC1E6829DD0097E808 /* dtmf-*.aif in Resources */, C46183731BFA23AB0075709B /* RecentsStoryboard.storyboard in Resources */, EEEF160F1F470C8200AEFA83 /* Localizable.strings in Resources */, + EE733DAA21649C6200D05CA3 /* SettingsStoryboard.storyboard in Resources */, EEA9ADB4200DEDD5007727EB /* Vialer.xcassets in Resources */, FBB8542D1A7FF15300121366 /* ringtone.wav in Resources */, FBB854211A7FE67300121366 /* dtmf-3.aif in Resources */, @@ -3676,7 +3689,6 @@ C4F385951D5B66AC005D8146 /* SIPCallingStoryboard.storyboard in Resources */, FEE6D6AA1B9F12F2001D25B1 /* disconnected.wav in Resources */, FBB854261A7FE67300121366 /* dtmf-8.aif in Resources */, - F22362641C22EE6200D6F5FF /* SettingsStoryboard.storyboard in Resources */, FBB854271A7FE67300121366 /* dtmf-9.aif in Resources */, FB21E0401A3B48D800AE746B /* Images.xcassets in Resources */, C4EFCF801BF21E210000CC6F /* DialerStoryboard.storyboard in Resources */, @@ -4005,7 +4017,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/scripts/update_version_number.sh\""; + shellScript = "\"${SRCROOT}/scripts/update_version_number.sh\"\n"; }; C41FD8C61C60A08400BBE6D7 /* Update Build number */ = { isa = PBXShellScriptBuildPhase; @@ -4019,7 +4031,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/scripts/update_build_number.sh\""; + shellScript = "\"${SRCROOT}/scripts/update_build_number.sh\"\n"; showEnvVarsInLog = 0; }; C490ADE31D0863E3004A8F83 /* Update Version number */ = { @@ -4119,7 +4131,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/scripts/update_version_number.sh\""; + shellScript = "\"${SRCROOT}/scripts/update_version_number.sh\"\n"; }; C4E97AD31E700D73006ECDE3 /* Update Build number */ = { isa = PBXShellScriptBuildPhase; @@ -4133,7 +4145,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/scripts/update_build_number.sh\""; + shellScript = "\"${SRCROOT}/scripts/update_build_number.sh\"\n"; showEnvVarsInLog = 0; }; CE8435747F7E1442943DE4AE /* [CP] Check Pods Manifest.lock */ = { @@ -4358,7 +4370,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/scripts/update_build_number.sh\""; + shellScript = "\"${SRCROOT}/scripts/update_build_number.sh\"\n"; showEnvVarsInLog = 0; }; F298A9741B5E28D100467E31 /* Update Version number */ = { @@ -4373,7 +4385,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\"${SRCROOT}/scripts/update_version_number.sh\""; + shellScript = "\"${SRCROOT}/scripts/update_version_number.sh\"\n"; }; F8C27C5CA78E4CB93851A5ED /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; @@ -4419,6 +4431,7 @@ F9EEC9531CA288AA008FB612 /* PhoneNumberModel.m in Sources */, C47BB0C61E72DE9400A1E509 /* NSManagedObjectContext.swift in Sources */, EE1C7B971F87779300708D96 /* SecondCallViewController.swift in Sources */, + EE733DA32164995A00D05CA3 /* AudioQualityViewController.swift in Sources */, EE1C7B981F87779300708D96 /* SetupCallTransferViewController.swift in Sources */, EE5EC3BB213FDC680000EE4D /* GAConfiguration.swift in Sources */, C41FD8601C60A08400BBE6D7 /* SideMenuViewController.m in Sources */, @@ -4432,6 +4445,7 @@ EEDCC3BC20C520E0003480F6 /* NumberPadButton.m in Sources */, C46F10051C7C668D007F30A6 /* ActivateSIPAccountViewController.m in Sources */, EE02B3F720D7870F006B10FD /* VialerStats.swift in Sources */, + EE733DB42164B34600D05CA3 /* EnumHelper.swift in Sources */, EE5A1F1B1F94CFD800F07536 /* CoreDataStackHelper.swift in Sources */, C41FD86B1C60A08400BBE6D7 /* VIAScene.m in Sources */, C41FD86D1C60A08400BBE6D7 /* AvailabilityViewController.m in Sources */, @@ -4553,6 +4567,7 @@ C490AD701D0863E3004A8F83 /* ForgotPasswordView.m in Sources */, C490AD711D0863E3004A8F83 /* NSString+SubString.m in Sources */, EE2317FB20A030CB00C05EB0 /* ColoredCircle.m in Sources */, + EE733DA52164995B00D05CA3 /* AudioQualityViewController.swift in Sources */, C47BB0C71E72DE9400A1E509 /* NSManagedObjectContext.swift in Sources */, EE5EC3BD213FDC680000EE4D /* GAConfiguration.swift in Sources */, EE1C7B931F87779200708D96 /* SecondCallViewController.swift in Sources */, @@ -4566,6 +4581,7 @@ F22FF2901D0ABF3800761C9A /* SystemUser.m in Sources */, EEDCC3BE20C520E0003480F6 /* NumberPadButton.m in Sources */, EE02B3F920D7870F006B10FD /* VialerStats.swift in Sources */, + EE733DB62164B34600D05CA3 /* EnumHelper.swift in Sources */, C490AD7F1D0863E3004A8F83 /* VIAScene.m in Sources */, EE5A1F1D1F94CFD800F07536 /* CoreDataStackHelper.swift in Sources */, C490AD851D0863E3004A8F83 /* AvailabilityViewController.m in Sources */, @@ -4696,6 +4712,7 @@ EE23181B20A0468F00C05EB0 /* NSString+SubString.m in Sources */, EE23181C20A0468F00C05EB0 /* PhoneNumberModel.m in Sources */, EE23181D20A0468F00C05EB0 /* NSManagedObjectContext.swift in Sources */, + EE733DA62164995C00D05CA3 /* AudioQualityViewController.swift in Sources */, EE23181E20A0468F00C05EB0 /* SecondCallViewController.swift in Sources */, EE5EC3BE213FDC680000EE4D /* GAConfiguration.swift in Sources */, EE23181F20A0468F00C05EB0 /* SetupCallTransferViewController.swift in Sources */, @@ -4709,6 +4726,7 @@ EEDCC3BF20C520E0003480F6 /* NumberPadButton.m in Sources */, EE23182920A0468F00C05EB0 /* VIAScene.m in Sources */, EE02B3FA20D7870F006B10FD /* VialerStats.swift in Sources */, + EE733DB72164B34600D05CA3 /* EnumHelper.swift in Sources */, EE23182A20A0468F00C05EB0 /* CoreDataStackHelper.swift in Sources */, EE23182B20A0468F00C05EB0 /* AvailabilityViewController.m in Sources */, EE23182C20A0468F00C05EB0 /* LogInViewController.m in Sources */, @@ -4821,6 +4839,7 @@ EE61F4021F1DDDE4006E890F /* ForgotPasswordView.m in Sources */, EE2317FA20A030C600C05EB0 /* ColoredCircle.m in Sources */, EE61F4031F1DDDE4006E890F /* NSString+SubString.m in Sources */, + EE733DA42164995B00D05CA3 /* AudioQualityViewController.swift in Sources */, EE61F4041F1DDDE4006E890F /* NSManagedObjectContext.swift in Sources */, EE5EC3BC213FDC680000EE4D /* GAConfiguration.swift in Sources */, EE1C7B951F87779200708D96 /* SecondCallViewController.swift in Sources */, @@ -4835,6 +4854,7 @@ EEDCC3BD20C520E0003480F6 /* NumberPadButton.m in Sources */, EE61F4101F1DDDE4006E890F /* SystemUser.m in Sources */, EE02B3F820D7870F006B10FD /* VialerStats.swift in Sources */, + EE733DB52164B34600D05CA3 /* EnumHelper.swift in Sources */, EE5A1F1C1F94CFD800F07536 /* CoreDataStackHelper.swift in Sources */, EE61F4121F1DDDE4006E890F /* VIAScene.m in Sources */, EE61F4151F1DDDE4006E890F /* AvailabilityViewController.m in Sources */, @@ -4927,6 +4947,7 @@ C43FD69C1E76F4C6002593DD /* NotificationToken.swift in Sources */, F20850ED1D26935600A17E71 /* ForgotPasswordView.m in Sources */, F20850EE1D26935600A17E71 /* NSString+SubString.m in Sources */, + EE733DA22164995900D05CA3 /* AudioQualityViewController.swift in Sources */, C47BB0C51E72DE9400A1E509 /* NSManagedObjectContext.swift in Sources */, EE5EC3BA213FDC680000EE4D /* GAConfiguration.swift in Sources */, EE1C7B991F87779300708D96 /* SecondCallViewController.swift in Sources */, @@ -4941,6 +4962,7 @@ EEDCC3BB20C520E0003480F6 /* NumberPadButton.m in Sources */, F20850FB1D26935600A17E71 /* SystemUser.m in Sources */, EE02B3F620D7870F006B10FD /* VialerStats.swift in Sources */, + EE733DB32164B34600D05CA3 /* EnumHelper.swift in Sources */, EE5A1F1A1F94CFD800F07536 /* CoreDataStackHelper.swift in Sources */, F20850FD1D26935600A17E71 /* VIAScene.m in Sources */, F20851031D26935600A17E71 /* AvailabilityViewController.m in Sources */, @@ -5066,6 +5088,7 @@ 3D44303F1AEF8E1B0034156F /* VIAScene.m in Sources */, EE02B3F520D7870F006B10FD /* VialerStats.swift in Sources */, EE5A1F191F94CFD800F07536 /* CoreDataStackHelper.swift in Sources */, + EE733DB22164B34600D05CA3 /* EnumHelper.swift in Sources */, F9D0A53E1BB57BBE0036843A /* AvailabilityViewController.m in Sources */, FBAD7F05182A8D4C002FC8FC /* LogInViewController.m in Sources */, EE3C47B02080DBD500CC80E5 /* TwoStepCallingViewController.m in Sources */, @@ -5126,6 +5149,7 @@ EE8C5EA62147AF2B008A430F /* UIColorExtenstions.swift in Sources */, C4AD4E631E729F780067FE40 /* Vialer.xcdatamodeld in Sources */, C49A46A71E6829CE0097E808 /* RecentsViewController.swift in Sources */, + EE683F8D216254A700D6831B /* AudioQualityViewController.swift in Sources */, C43B6E261E2E524400942F9B /* VialerLogger.swift in Sources */, C48B78141DE309B000B17BCF /* ContactModel.swift in Sources */, C4AD4E681E729F940067FE40 /* CoreDataStack.swift in Sources */, @@ -5286,6 +5310,15 @@ name = InfoPlist.strings; sourceTree = ""; }; + EE733DA821649C6200D05CA3 /* SettingsStoryboard.storyboard */ = { + isa = PBXVariantGroup; + children = ( + EE733DA921649C6200D05CA3 /* Base */, + EE733DB021649C7200D05CA3 /* nl */, + ); + name = SettingsStoryboard.storyboard; + sourceTree = ""; + }; EEEF15FF1F470C1500AEFA83 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( @@ -5321,15 +5354,6 @@ name = Localizable.strings; sourceTree = ""; }; - F22362661C22EE6200D6F5FF /* SettingsStoryboard.storyboard */ = { - isa = PBXVariantGroup; - children = ( - F22362651C22EE6200D6F5FF /* Base */, - EE5C22281F46EDA400AFB9E2 /* nl */, - ); - name = SettingsStoryboard.storyboard; - sourceTree = ""; - }; F2DE21861CB69E7F007B5B4D /* ReachabilityBarStoryboard.storyboard */ = { isa = PBXVariantGroup; children = ( diff --git a/Vialer.xcodeproj/xcshareddata/xcschemes/ANNAbel Screenshots.xcscheme b/Vialer.xcodeproj/xcshareddata/xcschemes/ANNAbel Screenshots.xcscheme index b40c7efb..2b737e81 100644 --- a/Vialer.xcodeproj/xcshareddata/xcschemes/ANNAbel Screenshots.xcscheme +++ b/Vialer.xcodeproj/xcshareddata/xcschemes/ANNAbel Screenshots.xcscheme @@ -1,6 +1,6 @@ - + - - + @@ -128,6 +127,7 @@ + @@ -298,7 +298,74 @@ At this moment there is no VoIP account linked to your user. - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -316,7 +383,7 @@ At this moment there is no VoIP account linked to your user. - + diff --git a/Vialer/Calling/Dialer/Controllers/DialerViewController.swift b/Vialer/Calling/Dialer/Controllers/DialerViewController.swift index ccb2ac0a..20a9987b 100644 --- a/Vialer/Calling/Dialer/Controllers/DialerViewController.swift +++ b/Vialer/Calling/Dialer/Controllers/DialerViewController.swift @@ -4,6 +4,7 @@ // import UIKit +import AVFoundation class DialerViewController: UIViewController, SegueHandler { diff --git a/Vialer/Calling/SIP/Utils/SIPUtils.h b/Vialer/Calling/SIP/Utils/SIPUtils.h index 529adf58..112d9843 100644 --- a/Vialer/Calling/SIP/Utils/SIPUtils.h +++ b/Vialer/Calling/SIP/Utils/SIPUtils.h @@ -5,7 +5,6 @@ #import #import "VialerSIPLib/VialerSIPLib.h" -#import "VialerSIPLib/VSLRingtone.h" @interface SIPUtils : NSObject @@ -21,6 +20,11 @@ */ + (void)removeSIPEndpoint; +/** + * Only update the codecs on the SIP endpoint. + */ ++ (BOOL)updateCodecs; + /** * Add the sipAccount of the current SystemUser to the endpoint. * @@ -59,4 +63,11 @@ * @return A VSLCall instance or nil. */ + (VSLCall * _Nullable)getFirstActiveCall; + +/** + * The codec configuration that is going to be used. + * + * @return a VSLCodecConfiguration instance. + */ ++ (VSLCodecConfiguration * _Nonnull)codecConfiguration; @end diff --git a/Vialer/Calling/SIP/Utils/SIPUtils.m b/Vialer/Calling/SIP/Utils/SIPUtils.m index 1c788272..582d90ad 100644 --- a/Vialer/Calling/SIP/Utils/SIPUtils.m +++ b/Vialer/Calling/SIP/Utils/SIPUtils.m @@ -15,28 +15,31 @@ @implementation SIPUtils + (BOOL)setupSIPEndpoint { VialerLogDebug(@"Setup the endpoint for VoIP"); if (![SystemUser currentUser].sipEnabled) { + VialerLogWarning(@"Not setting up sip endpoint because sip disabled"); return NO; } - VialerLogInfo(@"Endpoint Available: %@, Use encryption: %@, TLS enabled: %@, SIP endpoint TLS: %@", - [VialerSIPLib sharedInstance].endpointAvailable ? @"YES" : @"NO", - [SystemUser currentUser].sipUseEncryption ? @"YES": @"NO", - [SystemUser currentUser].useTLS ? @"YES" : @"NO", - [VialerSIPLib sharedInstance].hasTLSTransport ? @"YES" : @"NO"); + VialerLogInfo(@"SIP endpoint available: %@", [VialerSIPLib sharedInstance].endpointAvailable ? @"YES" : @"NO"); + if ([VialerSIPLib sharedInstance].endpointAvailable) { + BOOL shouldRemoveEndpoint = NO; + if ((![VialerSIPLib sharedInstance].hasTLSTransport && [SystemUser currentUser].sipUseEncryption && [SystemUser currentUser].useTLS) || + ([VialerSIPLib sharedInstance].hasTLSTransport && ![SystemUser currentUser].sipUseEncryption && ![SystemUser currentUser].useTLS)) { + VialerLogDebug(@"Endpoint or User is not TLS ready so remove the endoint so a fresh one can be setup"); + shouldRemoveEndpoint = YES; + } - if ((![VialerSIPLib sharedInstance].hasTLSTransport && [SystemUser currentUser].sipUseEncryption && [SystemUser currentUser].useTLS) || - ([VialerSIPLib sharedInstance].hasTLSTransport && ![SystemUser currentUser].sipUseEncryption && ![SystemUser currentUser].useTLS)) { - VialerLogDebug(@"Endpoint or User is not TLS ready so remove the endoint so a fresh one can be setup"); - [SIPUtils removeSIPEndpoint]; - } + // User has STUN enbaled but the enpoint is not configured to use STUN. + if ([SystemUser currentUser].useStunServers && ![VialerSIPLib sharedInstance].hasSTUNEnabled) { + VialerLogDebug(@"User has STUN ENABLED but the enpoint is not configured to use STUN. Setup a new endpoint with STUN"); + shouldRemoveEndpoint = YES; + } else if (![SystemUser currentUser].useStunServers && [VialerSIPLib sharedInstance].hasSTUNEnabled) { + VialerLogDebug(@"User has STUN DISABLED but the endpoint is configured to use STUN. Setup a new endpoint without STUN"); + shouldRemoveEndpoint = YES; + } - // User has STUN enbaled but the enpoint is not configured to use STUN. - if ([SystemUser currentUser].useStunServers && ![VialerSIPLib sharedInstance].hasSTUNEnabled) { - VialerLogDebug(@"User has STUN ENABLED but the enpoint is not configured to use STUN. Setup a new endpoint with STUN"); - [SIPUtils removeSIPEndpoint]; - } else if (![SystemUser currentUser].useStunServers && [VialerSIPLib sharedInstance].hasSTUNEnabled) { - VialerLogDebug(@"User has STUN DISABLED but the endpoint is configured to use STUN. Setup a new endpoint without STUN"); - [SIPUtils removeSIPEndpoint]; + if (shouldRemoveEndpoint) { + [SIPUtils removeSIPEndpoint]; + } } VSLEndpointConfiguration *endpointConfiguration = [[VSLEndpointConfiguration alloc] init]; @@ -67,11 +70,7 @@ + (BOOL)setupSIPEndpoint { [VSLTransportConfiguration configurationWithTransportType:VSLTransportTypeUDP]]; } - VSLCodecConfiguration *codecConfiguration = [[VSLCodecConfiguration alloc] init]; - codecConfiguration.audioCodecs = @[ - [[VSLAudioCodecs alloc] initWithAudioCodec:VSLAudioCodecILBC andPriority:210] - ]; - endpointConfiguration.codecConfiguration = codecConfiguration; + endpointConfiguration.codecConfiguration = [SIPUtils codecConfiguration]; NSError *error; BOOL success = [[VialerSIPLib sharedInstance] configureLibraryWithEndPointConfiguration:endpointConfiguration error:&error]; @@ -79,11 +78,12 @@ + (BOOL)setupSIPEndpoint { VialerLogError(@"Failed to startup VialerSIPLib: %@", error); } - VialerLogInfo(@"Endpoint Available: %@, Use encryption: %@, TLS enabled: %@, SIP endpoint TLS: %@", - [VialerSIPLib sharedInstance].endpointAvailable ? @"YES" : @"NO", - [SystemUser currentUser].sipUseEncryption ? @"YES": @"NO", - [SystemUser currentUser].useTLS ? @"YES" : @"NO", - [VialerSIPLib sharedInstance].hasTLSTransport ? @"YES" : @"NO"); + VialerLogInfo(@"TLS status: endpoint: %@, user setting: %@", + [VialerSIPLib sharedInstance].hasTLSTransport ? @"YES" : @"NO", + ([SystemUser currentUser].sipUseEncryption && [SystemUser currentUser].useTLS) ? @"YES" : @"NO"); + VialerLogInfo(@"STUN status: endpoint: %@, user setting: %@", + [VialerSIPLib sharedInstance].hasSTUNEnabled ? @"YES": @"NO", + [SystemUser currentUser].useStunServers ? @"YES" : @"NO"); return success; } @@ -92,6 +92,19 @@ + (void)removeSIPEndpoint { [[VialerSIPLib sharedInstance] removeEndpoint]; } ++ (BOOL)updateCodecs { + VialerLogDebug(@"Updating the codec which is being used"); + VSLCodecConfiguration *codecConfiguration = [SIPUtils codecConfiguration]; + VSLAudioCodecs *codec = codecConfiguration.audioCodecs.firstObject; + VialerLogDebug(@"Swithcing to codec: %@", [VSLAudioCodecs codecString: codec.codec]); + if (![[VialerSIPLib sharedInstance] updateCodecConfiguration:codecConfiguration]) { + [SIPUtils removeSIPEndpoint]; + [SIPUtils setupSIPEndpoint]; + } + + return YES; +} + + (VSLAccount *)addSIPAccountToEndpoint { if (![VialerSIPLib sharedInstance].endpointAvailable) { [SIPUtils setupSIPEndpoint]; @@ -140,4 +153,25 @@ + (VSLCall *)getFirstActiveCall { VSLCall *call = [account firstActiveCall]; return call; } + ++ (VSLCodecConfiguration *)codecConfiguration { + VSLCodecConfiguration *codecConfiguration = [[VSLCodecConfiguration alloc] init]; + + if ([SystemUser currentUser].currentAudioQuality > 0) { + codecConfiguration.audioCodecs = @[ + [[VSLAudioCodecs alloc] initWithAudioCodec:VSLAudioCodecOpus andPriority:210] + ]; + VSLOpusConfiguration *opusConfiguration = [[VSLOpusConfiguration alloc] init]; + opusConfiguration.sampleRate = VSLOpusConfigurationSampleRateWideBand; + opusConfiguration.frameDuration = VSLOpusConfigurationFrameDurationTwenty; + + codecConfiguration.opusConfiguration = opusConfiguration; + } else { + codecConfiguration.audioCodecs = @[ + [[VSLAudioCodecs alloc] initWithAudioCodec:VSLAudioCodecILBC andPriority:210] + ]; + } + + return codecConfiguration; +} @end diff --git a/Vialer/Helpers/EnumHelper.swift b/Vialer/Helpers/EnumHelper.swift new file mode 100644 index 00000000..ca01c713 --- /dev/null +++ b/Vialer/Helpers/EnumHelper.swift @@ -0,0 +1,21 @@ +// +// EnumHelper.swift +// Copyright © 2018 VoIPGRID. All rights reserved. +// + +import Foundation + +protocol EnumHelper { + static var count: Int { get } + var descriprtion: String { get } +} + +extension EnumHelper where Self: RawRepresentable, Self.RawValue == Int { + internal static var count: Int { + var count = 0 + while let _ = Self(rawValue: count) { + count += 1 + } + return count + } +} diff --git a/Vialer/Helpers/GradientView.swift b/Vialer/Helpers/GradientView.swift index 9188f6b0..d6fd32f2 100644 --- a/Vialer/Helpers/GradientView.swift +++ b/Vialer/Helpers/GradientView.swift @@ -15,7 +15,7 @@ import UIKit override func layoutSubviews() { let startColor = ColorsConfiguration.shared.gradientColors(.start) let endColor = ColorsConfiguration.shared.gradientColors(.end) - self.gradientLayer = self.layer as! CAGradientLayer + self.gradientLayer = (self.layer as! CAGradientLayer) self.gradientLayer.colors = [startColor.cgColor, endColor.cgColor] self.gradientLayer.startPoint = createStartPoint() self.gradientLayer.endPoint = createEndPoint() diff --git a/Vialer/Helpers/VialerStats.swift b/Vialer/Helpers/VialerStats.swift index 6695bfa1..4459c1bf 100644 --- a/Vialer/Helpers/VialerStats.swift +++ b/Vialer/Helpers/VialerStats.swift @@ -4,6 +4,7 @@ // import Foundation +import AVFoundation @objc class VialerStats : NSObject { diff --git a/Vialer/Main/Controllers/VailerRootViewController.m b/Vialer/Main/Controllers/VailerRootViewController.m index 43fef065..844f5d80 100644 --- a/Vialer/Main/Controllers/VailerRootViewController.m +++ b/Vialer/Main/Controllers/VailerRootViewController.m @@ -246,13 +246,13 @@ - (void)showSipCallingViewOrIncomingCallNotification:(NSNotification *)notificat [self dismissViewControllerAnimated:NO completion:^{ [self performSegueWithIdentifier:VialerRootViewControllerShowSIPCallingViewSegue sender:self]; }]; - } else { + } else if (notification.name == AppDelegateIncomingCallNotification) { + [self dismissViewControllerAnimated:NO completion:^{ + [self performSegueWithIdentifier:VialerRootViewControllerShowSIPIncomingCallViewSegue sender:self]; + }]; + } else if (notification.name == AppDelegateIncomingBackgroundCallAcceptedNotification) { [self dismissViewControllerAnimated:NO completion:^{ - if (notification.name == AppDelegateIncomingCallNotification) { - [self performSegueWithIdentifier:VialerRootViewControllerShowSIPIncomingCallViewSegue sender:self]; - } else if (notification.name == AppDelegateIncomingBackgroundCallAcceptedNotification) { - [self performSegueWithIdentifier:VialerRootViewControllerShowSIPCallingViewSegue sender:self]; - } + [self performSegueWithIdentifier:VialerRootViewControllerShowSIPCallingViewSegue sender:self]; }]; } } diff --git a/Vialer/Models/SystemUser.h b/Vialer/Models/SystemUser.h index 59d754e4..e92da0a3 100644 --- a/Vialer/Models/SystemUser.h +++ b/Vialer/Models/SystemUser.h @@ -47,6 +47,10 @@ typedef NS_ENUM(NSInteger, SystemUserErrors) { * When the encryption setting couldn't be stored remotely. */ SystemUserFailedToSaveEncryptionToRemote, + /** + * When the use of opus couldn't be stored remotely. + */ + SystemUserFailedToSaveOpusToRemote, /** * The user is unauthorized. */ @@ -86,6 +90,16 @@ extern NSString * const SystemUserLogoutNotificationErrorKey; */ extern NSString * const SystemUserSIPCredentialsChangedNotification; +/** + * Notification that can be listened to when the user has changed the use of STUN. + */ +extern NSString * const SystemUserStunUsageChangedNotification; + +/** + * Notification that can be listened to when the user has changed the use of encryption. + */ +extern NSString * const SystemUserEncryptionUsageChangedNotification; + /** * Notification that can be listened to when the user has disabled SIP. */ @@ -243,6 +257,11 @@ extern NSString * const SystemUserTwoFactorAuthenticationTokenNotification; */ @property (strong, nonatomic) NSDictionary* currentAvailability; +/** + * The users current audio quality for VoIP calls. + */ +@property (nonatomic) NSInteger currentAudioQuality; + /** * Singleton instance of the current user. * @@ -285,6 +304,14 @@ extern NSString * const SystemUserTwoFactorAuthenticationTokenNotification; */ - (void)updateMobileNumber:(NSString *)mobileNumber withCompletion:(void(^)(BOOL success, NSError *error))completion; +/** + * Update the setting to user Opus. This will update the codec setting on remote also. + * + * @param codec Which codec will be used. + * @param completion A will be called after the update. BOOL success will tell if the update was successful, NSError will return an error if there was one set. + */ +- (void)updateUseOpus:(NSInteger)codec withCompletion:(void(^)(BOOL success, NSError *error))completion; + /** * This will fetch the up to date information from the VoIPGRID platform and on succes enables SIP. * diff --git a/Vialer/Models/SystemUser.m b/Vialer/Models/SystemUser.m index e9e36d2c..d85c1c54 100644 --- a/Vialer/Models/SystemUser.m +++ b/Vialer/Models/SystemUser.m @@ -8,6 +8,7 @@ #import "Configuration.h" #import "NSString+SubString.h" #import "SAMKeychain.h" +#import "SIPUtils.h" #import "VoIPGRIDRequestOperationManager.h" #import "Vialer-Swift.h" @@ -19,7 +20,10 @@ NSString * const SystemUserLogoutNotificationDisplayNameKey = @"SystemUserLogoutNotificationDisplayNameKey"; NSString * const SystemUserLogoutNotificationErrorKey = @"SystemUserLogoutNotificationErrorKey"; -NSString * const SystemUserSIPCredentialsChangedNotification = @"SystemUserSIPCredentialsChangedNotification"; +NSString * const SystemUserSIPCredentialsChangedNotification = @"SystemUserSIPCredentialsChangedNotification"; +NSString * const SystemUserStunUsageChangedNotification = @"SystemUserStunUsageChangedNotification"; +NSString * const SystemUserEncryptionUsageChangedNotification = @"SystemUserEncryptionUsageChangedNotification"; + NSString * const SystemUserSIPDisabledNotification = @"SystemUserSIPDisabledNotification"; NSString * const SystemUserOutgoingNumberUpdatedNotification = @"SystemUserOutgoingNumberUpdatedNotification"; @@ -45,6 +49,7 @@ static NSString * const SystemUserApiKeySIPPassword = @"appaccount_password"; static NSString * const SystemUserApiKeyUseEncryption = @"appaccount_use_encryption"; static NSString * const SystemUserApiKeyCountry = @"appaccount_country"; +static NSString * const SystemUserApiKeyOpusEnabled = @"appaccount_use_opus"; static NSString * const SystemUserApiKeyAPIToken = @"api_token"; // Constant for "suppressed" key as supplied by api for outgoingNumber @@ -74,6 +79,7 @@ static NSString * const SystemUserSUDAPIToken = @"APIToken"; static NSString * const SystemUserSUDCountry = @"Country"; static NSString * const SystemUserCurrentAvailabilitySUDKey = @"AvailabilityModelSUDKey"; +static NSString * const SystemUserAudioQualitySUDKey = @"SystemUserAudioQualitySUDKey"; @interface SystemUser () @@ -327,6 +333,9 @@ - (void)setMobileNumber:(NSString *)mobileNumber { - (void)setSipUseEncryption:(BOOL)sipUseEncryption { [[NSUserDefaults standardUserDefaults] setBool:sipUseEncryption forKey:SystemUserSUDSIPUseEncryption]; + if (self.sipEnabled && self.loggedIn) { + [[NSNotificationCenter defaultCenter] postNotificationName:SystemUserEncryptionUsageChangedNotification object:self]; + } } - (void)setOutgoingNumber:(NSString *)outgoingNumber { @@ -375,13 +384,20 @@ - (void)setCurrentAvailability:(NSDictionary *)currentAvailability { [[NSUserDefaults standardUserDefaults] setObject:currentAvailability forKey:SystemUserCurrentAvailabilitySUDKey]; } +- (NSInteger)currentAudioQuality { + return [[NSUserDefaults standardUserDefaults] integerForKey:SystemUserAudioQualitySUDKey]; +} + +- (void)setCurrentAudioQuality: (NSInteger)currentAudioQuality { + [[NSUserDefaults standardUserDefaults] setInteger:currentAudioQuality forKey:SystemUserAudioQualitySUDKey]; +} + - (void)setShowWiFiNotification:(BOOL)showWiFiNotification { showWiFiNotification = showWiFiNotification; [[NSUserDefaults standardUserDefaults] setBool:showWiFiNotification forKey:SystemUserSUDShowWiFiNotification]; } - (void)setUse3GPlus:(BOOL)use3GPlus { - use3GPlus = use3GPlus; [[NSUserDefaults standardUserDefaults] setBool:use3GPlus forKey:SystemUserSUDUse3GPlus]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ @@ -390,7 +406,6 @@ - (void)setUse3GPlus:(BOOL)use3GPlus { } - (void)setUseTLS:(BOOL)useTLS { - useTLS = useTLS; [[NSUserDefaults standardUserDefaults] setBool:useTLS forKey:SystemUserSUDUseTLS]; [self updateUseEncryptionWithCompletion:^(BOOL success, NSError *error) { @@ -401,19 +416,26 @@ - (void)setUseTLS:(BOOL)useTLS { } dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ - VialerLogDebug(@"post from setUseTLS"); - [[NSNotificationCenter defaultCenter] postNotificationName:SystemUserSIPCredentialsChangedNotification object:self]; + if (self.loggedIn && self.sipEnabled) { + VialerLogDebug(@"post from setUseTLS"); + [[NSNotificationCenter defaultCenter] postNotificationName:SystemUserEncryptionUsageChangedNotification object:self]; + } else { + VialerLogDebug(@"Nothing to do here sip has not been enabled"); + } }); }]; } - (void)setUseStunServers:(BOOL)useStunServers { - useStunServers = useStunServers; [[NSUserDefaults standardUserDefaults] setBool:useStunServers forKey:SystemuserSUDUseStunServers]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ - VialerLogDebug(@"Post from setUseStunServers"); - [[NSNotificationCenter defaultCenter] postNotificationName:SystemUserSIPCredentialsChangedNotification object:self]; + if (self.loggedIn && self.sipEnabled) { + VialerLogDebug(@"Post from setUseStunServers"); + [[NSNotificationCenter defaultCenter] postNotificationName:SystemUserStunUsageChangedNotification object:self]; + } else { + VialerLogDebug(@"Nothing to do here sip has not been enabled"); + } }); } @@ -469,8 +491,6 @@ - (void)loginToCheckTwoFactorWithUserName:(NSString *)username password:(NSStrin completion(NO, YES, error); } }]; - - } }]; } @@ -532,7 +552,6 @@ - (void)logoutWithUserInfo:(NSDictionary *)userInfo { - (void)removeCurrentUser { [SAMKeychain deletePasswordForService:self.serviceName account:self.username]; - self.loggedIn = NO; self.username = nil; self.outgoingNumber = nil; self.mobileNumber = nil; @@ -551,6 +570,8 @@ - (void)removeCurrentUser { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults removePersistentDomainForName:appDomain]; [defaults synchronize]; + + self.loggedIn = NO; } - (void)removeSIPCredentials { @@ -558,10 +579,14 @@ - (void)removeSIPCredentials { self.sipEnabled = NO; self.sipAccount = nil; self.sipUseEncryption = NO; + self.useTLS = NO; + self.useStunServers = NO; [[NSUserDefaults standardUserDefaults] removeObjectForKey:SystemUserSUDSIPAccount]; [[NSUserDefaults standardUserDefaults] removeObjectForKey:SystemUserSUDSIPEnabled]; [[NSUserDefaults standardUserDefaults] removeObjectForKey:SystemUserSUDSIPUseEncryption]; + [[NSUserDefaults standardUserDefaults] removeObjectForKey:SystemUserSUDUseTLS]; + [[NSUserDefaults standardUserDefaults] removeObjectForKey:SystemuserSUDUseStunServers]; } - (void)setOwnPropertiesFromUserDict:(NSDictionary *)userDict withUsername:(NSString *)username andPassword:(NSString *)password { @@ -610,6 +635,23 @@ - (void)setMobileProfileFromUserDict:(NSDictionary *)profileDict { self.outgoingNumber = profileDict[SystemUserApiKeyOutgoingNumber]; self.country = profileDict[SystemUserApiKeyCountry]; + BOOL opusEnabled = NO; + if (![profileDict[SystemUserApiKeyOpusEnabled] isKindOfClass:[NSNull class]]) { + opusEnabled = [profileDict[SystemUserApiKeyOpusEnabled] boolValue]; + } + + if (self.currentAudioQuality == 0 && opusEnabled) { + self.currentAudioQuality = 1; + if (self.sipEnabled) { + [SIPUtils updateCodecs]; + } + } else if (self.currentAudioQuality > 0 && !opusEnabled) { + self.currentAudioQuality = 0; + if (self.sipEnabled) { + [SIPUtils updateCodecs]; + } + } + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if ([profileDict[SystemUserApiKeyOutgoingNumber] isKindOfClass:[NSNull class]]) { self.outgoingNumber = @""; @@ -617,6 +659,7 @@ - (void)setMobileProfileFromUserDict:(NSDictionary *)profileDict { self.outgoingNumber = profileDict[SystemUserApiKeyOutgoingNumber]; } [defaults setObject:self.outgoingNumber forKey:SystemUserSUDOutgoingNumber]; + if (![self.country isKindOfClass:[NSNull class]]) { [defaults setObject:self.country forKey:SystemUserSUDCountry]; } @@ -688,6 +731,24 @@ - (void)updateUseEncryptionWithCompletion:(void(^)(BOOL success, NSError *error) }]; } +-(void)updateUseOpus:(NSInteger)codec withCompletion:(void (^)(BOOL, NSError *))completion { + BOOL enable = NO; + if (codec > 0) { + enable =YES; + } + + [self.operationsManager pushUseOpus:enable withCompletion:^(BOOL success, NSError *error) { + if (success) { + completion(YES, nil); + } else { + NSDictionary *userInfo = @{NSUnderlyingErrorKey: error, + NSLocalizedDescriptionKey: NSLocalizedString(@"Unable to save the use of opus.", nil) + }; + completion(NO, [NSError errorWithDomain:SystemUserErrorDomain code:SystemUserFailedToSaveOpusToRemote userInfo:userInfo]); + } + }]; +} + #pragma mark - SIP Handling - (void)getAndActivateSIPAccountWithCompletion:(void (^)(BOOL success, NSError *error))completion { @@ -710,9 +771,7 @@ - (void)getAndActivateSIPAccountWithCompletion:(void (^)(BOOL success, NSError * - (void)fetchMobileProfileFromRemoteWithCompletion:(void(^)(BOOL success, NSError *error))completion { [self.operationsManager getMobileProfileWithCompletion:^(AFHTTPRequestOperation *operation, NSDictionary *responseData, NSError *error) { if (!error) { - - [self setMobileProfileFromUserDict:responseData]; - + id sipAccount = responseData[SystemUserApiKeySIPAccount]; id sipPassword = responseData[SystemUserApiKeySIPPassword]; id useEncryption = responseData[SystemUserApiKeyUseEncryption]; @@ -738,37 +797,38 @@ - (void)fetchMobileProfileFromRemoteWithCompletion:(void(^)(BOOL success, NSErro if (![self.sipAccount isEqualToString:[sipAccount stringValue]] || ![self.sipPassword isEqualToString:sipPassword]) { self.sipAccount = [sipAccount stringValue]; [SAMKeychain setPassword:sipPassword forService:self.serviceName account:self.sipAccount]; - [[NSNotificationCenter defaultCenter] postNotificationName:SystemUserSIPCredentialsChangedNotification object:self]; - } - // Encryption is turned off for this account. Make an api call and enable it. - if (self.useTLS && ([useEncryption isEqualToNumber:@0] || !self.sipUseEncryption)) { - [self updateUseEncryptionWithCompletion:^(BOOL success, NSError *error) { - if (success) { - [[NSNotificationCenter defaultCenter] postNotificationName:SystemUserSIPCredentialsChangedNotification object:self]; - self.sipUseEncryption = YES; - } else { - if (completion) { - completion(NO, error); + // Encryption is turned off for this account. Make an api call and enable it. + if (self.useTLS && ([useEncryption isEqualToNumber:@0] || !self.sipUseEncryption)) { + [self updateUseEncryptionWithCompletion:^(BOOL success, NSError *error) { + if (success) { + self.sipUseEncryption = YES; + } else { + if (completion) { + completion(NO, error); + } + return; } - return; - } - }]; - } else if (!self.useTLS && self.sipUseEncryption){ - VialerLogDebug(@"Turn TLS Off"); - [self updateUseEncryptionWithCompletion:^(BOOL success, NSError *error) { - if (success) { - [[NSNotificationCenter defaultCenter] postNotificationName:SystemUserSIPCredentialsChangedNotification object:self]; - self.sipUseEncryption = NO; - } else { - if (completion) { - completion(NO, error); + }]; + } else if (!self.useTLS && self.sipUseEncryption){ + VialerLogDebug(@"Turn TLS Off"); + [self updateUseEncryptionWithCompletion:^(BOOL success, NSError *error) { + if (success) { + self.sipUseEncryption = NO; + } else { + if (completion) { + completion(NO, error); + } + return; } - return; - } - }]; + }]; + } else { + [[NSNotificationCenter defaultCenter] postNotificationName:SystemUserSIPCredentialsChangedNotification object:self]; + } } + [self setMobileProfileFromUserDict:responseData]; + if (completion) completion(YES, nil); } else { if (completion) completion(NO, error); diff --git a/Vialer/Onboarding/Controllers/LogInViewController.m b/Vialer/Onboarding/Controllers/LogInViewController.m index fe70f90c..d39a3570 100644 --- a/Vialer/Onboarding/Controllers/LogInViewController.m +++ b/Vialer/Onboarding/Controllers/LogInViewController.m @@ -6,6 +6,7 @@ #import "LogInViewController.h" #import "AnimatedImageView.h" +#import #import "PBWebViewController.h" #import #import "SettingsViewController.h" diff --git a/Vialer/Settings/Controllers/AudioQualityViewController.swift b/Vialer/Settings/Controllers/AudioQualityViewController.swift new file mode 100644 index 00000000..a6606ceb --- /dev/null +++ b/Vialer/Settings/Controllers/AudioQualityViewController.swift @@ -0,0 +1,151 @@ +// +// AudioQualityViewController.swift +// Copyright © 2018 VoIPGRID. All rights reserved. +// + +import UIKit + +@objc public enum AudioQuality: Int, EnumHelper { + case low = 0, high + + var descriprtion: String { + switch self { + case .low: + return NSLocalizedString("Standard audio", comment: "Standard audio") + case .high: + return NSLocalizedString("Higher quality audio", comment: "Higher quality audio") + } + } + + var explanation: String { + switch self { + case .low: + return NSLocalizedString("Low bandwidth", comment: "Low bandwidth") + case .high: + return NSLocalizedString("Clearer audio - possible higher bandwidth", comment: "Clearer audio - possible higher bandwidth") + } + } +} + +class AudioQualityViewController: UIViewController, TableViewHandler { + + enum CellIdentifier: String { + case audioQuality = "AudioQualityCell" + } + + @IBOutlet weak var tableView: UITableView! { + didSet { + tableView.delegate = self + tableView.dataSource = self + } + } + + @IBAction func backButtonPressed(_ sender: UIBarButtonItem) { + sender.isEnabled = false + + let audioQualityToStore = selectedIndexPath?.row ?? 0 + let audioQuality = SystemUser.current()?.currentAudioQuality + + if audioQualityToStore == audioQuality { + self.navigationController?.popViewController(animated: true) + return + } + + DispatchQueue.global(qos: .background).async { + SystemUser.current()?.updateUseOpus(audioQualityToStore, withCompletion: { (success, error) in + if success { + SystemUser.current()?.currentAudioQuality = audioQualityToStore + let updateSuccess = SIPUtils.updateCodecs() + if updateSuccess { + self.navigationController?.popViewController(animated: true) + } else { + let alertController = UIAlertController(title: NSLocalizedString("Could not save audio settings", comment: "Could not save audio settings"), + message: NSLocalizedString("An error occured when saving your changes. Please try again.", comment: "An error occured when saving your changes. Please try again."), + preferredStyle: .alert) + + let okButton = UIAlertAction(title: "OK", style: .default, handler: { (action) in + let oldCell = self.tableView.cellForRow(at: self.selectedIndexPath!) + oldCell?.accessoryType = .none + self.tableView.reloadData() + }) + + alertController.addAction(okButton) + + self.present(alertController, animated: true, completion: nil) + } + } else { + let alertController = UIAlertController(title: NSLocalizedString("Could not save audio settings", comment: "Could not save audio settings"), + message: NSLocalizedString("An error occured when saving your changes. Please try again.", comment: "An error occured when saving your changes. Please try again."), + preferredStyle: .alert) + + + let okButton = UIAlertAction(title: "OK", style: .default, handler: { (action) in + let oldCell = self.tableView.cellForRow(at: self.selectedIndexPath!) + oldCell?.accessoryType = .none + self.tableView.reloadData() + }) + + alertController.addAction(okButton) + + self.present(alertController, animated: true, completion: nil) + } + sender.isEnabled = true + }) + } + } + + private var selectedIndexPath: IndexPath? + private var previousSelectedIndexPath: IndexPath? + + override func viewDidLoad() { + super.viewDidLoad() + } +} + +extension AudioQualityViewController: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return AudioQuality.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = dequeueReusableCell(cellIdentifier: .audioQuality, for: indexPath) + let audioQuality = AudioQuality.init(rawValue: SystemUser.current()?.currentAudioQuality ?? 0)! + + if indexPath.row == AudioQuality.low.rawValue { + cell.textLabel?.text = AudioQuality.low.descriprtion + cell.detailTextLabel?.text = AudioQuality.low.explanation + + if audioQuality == AudioQuality.low { + cell.accessoryType = .checkmark + selectedIndexPath = indexPath + } + } else if indexPath.row == AudioQuality.high.rawValue { + cell.textLabel?.text = AudioQuality.high.descriprtion + cell.detailTextLabel?.text = AudioQuality.high.explanation + if audioQuality == AudioQuality.high { + selectedIndexPath = indexPath + cell.accessoryType = .checkmark + } + } + return cell + } +} + +extension AudioQualityViewController: UITableViewDelegate { + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + tableView.deselectRow(at: indexPath, animated: true) + + if indexPath == selectedIndexPath { + return + } + + let oldCell = tableView.cellForRow(at: selectedIndexPath!) + oldCell?.accessoryType = .none + + let newCell = tableView.cellForRow(at: indexPath) + newCell?.accessoryType = .checkmark + + selectedIndexPath = indexPath + + } +} diff --git a/Vialer/Settings/Controllers/SettingsViewController.m b/Vialer/Settings/Controllers/SettingsViewController.m index 18bd5a08..824fc479 100644 --- a/Vialer/Settings/Controllers/SettingsViewController.m +++ b/Vialer/Settings/Controllers/SettingsViewController.m @@ -17,7 +17,8 @@ static int const SettingsViewControllerSipEnabledRow = 0; static int const SettingsViewControllerWifiNotificationRow = 1; static int const SettingsViewController3GPlusRow = 2; -static int const SettingsViewControllerSipAccountRow = 3; +static int const SettingsViewControllerAudioQualityRow = 3; +static int const SettingsViewControllerSipAccountRow = 4; static int const SettingsViewControllerNumbersSection = 1; static int const SettingsViewControllerMyNumberRow = 0; @@ -44,6 +45,7 @@ static NSString * const SettingsViewControllerShowEditNumberSegue = @"ShowEditNumberSegue"; static NSString * const SettingsViewControllerShowActivateSIPAccount = @"ShowActivateSIPAccount"; +static NSString * const SettingsViewControllerShowAudioQualitySegue = @"ShowAudioQualitySegue"; @interface SettingsViewController() @property (weak, nonatomic) SystemUser *currentUser; @@ -102,8 +104,9 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger // The VoIP Switch // WiFi notification // 3G+ + // Audio Quality // account ID - return 4; + return 5; } else { // Only show VoIP Switch return 1; @@ -174,6 +177,14 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N withTitle:NSLocalizedString(@"Use 3G+ for calls", @"Use 3G+ for calls") withTag:SettingsViewControllerSwitch3GPlus defaultVal:self.currentUser.use3GPlus]; + } else if (indexPath.row == SettingsViewControllerAudioQualityRow) { + cell = [self.tableView dequeueReusableCellWithIdentifier:tableViewSettingsWithAccessoryCell]; + cell.textLabel.text = NSLocalizedString(@"Audio quality", nil); + if (self.currentUser.currentAudioQuality == AudioQualityLow) { + cell.detailTextLabel.text = NSLocalizedString(@"Standard audio", @"Standard audio"); + } else if (self.currentUser.currentAudioQuality == AudioQualityHigh) { + cell.detailTextLabel.text = NSLocalizedString(@"Higher quality audio", @"Higher quality audio"); + } } else if (indexPath.row == SettingsViewControllerSipAccountRow) { cell = [self.tableView dequeueReusableCellWithIdentifier:tableViewSettingsCell]; cell.textLabel.text = NSLocalizedString(@"VoIP account ID", nil); @@ -251,6 +262,8 @@ - (void)unwindToSettingsViewController:(UIStoryboardSegue *)sender {} - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.section == SettingsViewControllerNumbersSection && indexPath.row == SettingsViewControllerMyNumberRow) { [self performSegueWithIdentifier:SettingsViewControllerShowEditNumberSegue sender:self]; + } else if (indexPath.section == SettingsViewControllerVoIPAccountSection && indexPath.row == SettingsViewControllerAudioQualityRow) { + [self performSegueWithIdentifier:SettingsViewControllerShowAudioQualitySegue sender:self]; } } diff --git a/Vialer/nl.lproj/Localizable.strings b/Vialer/nl.lproj/Localizable.strings index 423f575e..b62b1110 100644 --- a/Vialer/nl.lproj/Localizable.strings +++ b/Vialer/nl.lproj/Localizable.strings @@ -458,3 +458,21 @@ /* Calls are not encrypted */ "Calls are not encrypted" = "Gesprekken zijn niet versleuteld"; + +/* Standard audio */ +"Standard audio" = "Standaard audio"; + +/* Higher quality audio */ +"Higher quality audio" = "Hogere audio kwaliteit"; + +/* Low bandwidth */ +"Low bandwidth" = "Lagere bandbreedte"; + +/* Clearer audio - possible higher bandwidth */ +"Clearer audio - possible higher bandwidth" = "Heldere audio - gebruikt mogelijk meer bandbreedte"; + +/* Could not save audio settings */ +"Could not save audio settings" = "Kon de audio instellingen niet opslaan"; + +/* An error occured when saving your changes. Please try again. */ +"An error occured when saving your changes. Please try again." = "Fout opgetreden tijdens het opslaan van de wijzigingen. Probeer het nog eens."; diff --git a/Vialer/nl.lproj/SettingsStoryboard.strings b/Vialer/nl.lproj/SettingsStoryboard.strings index cdcf9724..db99b385 100644 --- a/Vialer/nl.lproj/SettingsStoryboard.strings +++ b/Vialer/nl.lproj/SettingsStoryboard.strings @@ -47,8 +47,8 @@ /* Class = "UINavigationItem"; title = "VoIP account missing"; ObjectID = "ud5-WK-eg1"; */ "ud5-WK-eg1.title" = "VoIP-account ontbreekt"; -/* Class = "UILabel"; text = "Title"; ObjectID = "2ah-51-Icj"; */ -"2ah-51-Icj.text" = ""; +/* Class = "UIBarButtonItem"; title = "Back"; ObjectID = "nqE-VI-Hnq"; */ +"nqE-VI-Hnq.title" = "Terug"; /* Class = "UIBarButtonItem"; title = "Back"; ObjectID = "6ws-XF-rad"; */ "6ws-XF-rad.title" = "Terug"; diff --git a/scripts/update_build_number.sh b/scripts/update_build_number.sh index 7370455a..c634f610 100755 --- a/scripts/update_build_number.sh +++ b/scripts/update_build_number.sh @@ -1,5 +1,5 @@ #!/bin/bash - + # update_build_number.sh # Usage: `update_build_number.sha [branch]` # Run this script after the 'Copy Bundle Resources' build phase @@ -8,8 +8,8 @@ # http://blog.jaredsinclair.com/post/97193356620/the-best-of-all-possible-xcode-automated-build # http://www.egeek.me/2013/02/09/xcode-insert-git-build-info-into-ios-app/ -# Consider using https://github.com/Autorevision/autorevision for both Verion and Build number - +# Consider using https://github.com/Autorevision/autorevision for both Verion and Build number + GIT=`sh /etc/profile; which git` PLISTBUDDY=/usr/libexec/PlistBuddy @@ -17,11 +17,11 @@ PLISTBUDDY=/usr/libexec/PlistBuddy BRANCH=${1:-`${GIT} rev-parse --abbrev-ref HEAD`} echo "Using branch '${BRANCH}' for counting" -# git rev-list ${BRANCH} --count is used to get the number of commits on ${BRANCH}, -# BUT it subtracts out the number of commits that you are currently behind said branch -# (with git rev-list HEAD..${BRANCH} --count). -# This is done so that if you aren’t at the tip of the branch (e.g. you’re checked out -# a few commits behind to find a problem), the build number will still be accurate to +# git rev-list ${BRANCH} --count is used to get the number of commits on ${BRANCH}, +# BUT it subtracts out the number of commits that you are currently behind said branch +# (with git rev-list HEAD..${BRANCH} --count). +# This is done so that if you aren’t at the tip of the branch (e.g. you’re checked out +# a few commits behind to find a problem), the build number will still be accurate to # what you’re currently running. BUILDNUMBER=$(expr $(${GIT} rev-list ${BRANCH} --count) - $(${GIT} rev-list HEAD..${BRANCH} --count)) echo "Updating build number to ${BUILDNUMBER} using branch '${BRANCH}'." @@ -29,10 +29,14 @@ echo "Updating build number to ${BUILDNUMBER} using branch '${BRANCH}'." COMMIT_SHORT_HASH=$(${GIT} rev-list ${BRANCH} --abbrev-commit | tail -n ${BUILDNUMBER} | head -n 1) echo "Commit short hash:${COMMIT_SHORT_HASH}" -# Instead of updating the info.plist file in the source directory, the script modifies -# the info.plist in the target build directory. This way, you don’t have to check-in a +plist="${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}" + +# Instead of updating the info.plist file in the source directory, the script modifies +# the info.plist in the target build directory. This way, you don’t have to check-in a # constantly-modifying info.plist. -${PLISTBUDDY} -c "Set :CFBundleVersion ${BUILDNUMBER}" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" -#Also update dSYM file -${PLISTBUDDY} -c "Set :CFBundleVersion ${BUILDNUMBER}" "${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Info.plist" -${PLISTBUDDY} -c "Set :Commit_Short_Hash ${COMMIT_SHORT_HASH}" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" +${PLISTBUDDY} -c "Set :CFBundleVersion ${BUILDNUMBER}" "${plist}" +if [ -f "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}.dSYM/Contents/Info.plist" ]; then + ${PLISTBUDDY} -c "Set :CFBundleVersion ${BUILDNUMBER}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}.dSYM/Contents/Info.plist" +fi + +${PLISTBUDDY} -c "Set :Commit_Short_Hash ${COMMIT_SHORT_HASH}" "${plist}" \ No newline at end of file diff --git a/scripts/update_version_number.sh b/scripts/update_version_number.sh index a882c290..f4ba13be 100755 --- a/scripts/update_version_number.sh +++ b/scripts/update_version_number.sh @@ -34,8 +34,12 @@ else echo "Additional Version String: ${POSSIBLE_REST}" fi -${PLISTBUDDY} -c "Set :CFBundleShortVersionString ${VERSION_NUMBER}" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" -#Also update dSYM file -${PLISTBUDDY} -c "Set :CFBundleShortVersionString ${VERSION_NUMBER}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}.dSYM/Contents/Info.plist" +plist="${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}" + +${PLISTBUDDY} -c "Set :CFBundleShortVersionString ${VERSION_NUMBER}" "${plist}" +if [ -f "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}.dSYM/Contents/Info.plist" ]; then + ${PLISTBUDDY} -c "Set :CFBundleShortVersionString ${VERSION_NUMBER}" "${BUILT_PRODUCTS_DIR}/${WRAPPER_NAME}.dSYM/Contents/Info.plist" +fi + #Store the possible string found behind the "clean" version string -${PLISTBUDDY} -c "Set :Additional_Version_String ${POSSIBLE_REST}" "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}" +# ${PLISTBUDDY} -c "Set :Additional_Version_String ${POSSIBLE_REST}" "${plist}" \ No newline at end of file