Browse Source

Update font size & speaker

kevin 5 months ago
parent
commit
40b648d147

+ 2 - 2
AppBuilder/AppBuilder/FourthTabViewController.swift

@@ -672,10 +672,10 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
             
             let fontSize: String = SecureUserDefaults.shared.value(forKey: "font_size") ?? "0"
             var index = 0
-            if fontSize == "2" {
+            if fontSize == "4" {
                 index = 1
             }
-            else if fontSize == "4"{
+            else if fontSize == "6"{
                 index = 2
             }
             fontSizePickerView.selectRow(index, inComponent: 0, animated: false)

+ 1 - 1
NexilisLite/NexilisLite.podspec

@@ -24,7 +24,7 @@ Pod::Spec.new do |spec|
   spec.resource_bundles = { 'NexilisLite' => ['NexilisLite/Resource/**/*']}
   spec.swift_version = '5.5.1'
   spec.dependency 'FMDB', '~> 2.7.12'
-  spec.dependency 'nuSDKService', '~> 4.0.5'
+  spec.dependency 'nuSDKService', '~> 4.0.7'
   spec.dependency 'NotificationBannerSwift'
   spec.dependency 'Alamofire', '~> 5.10.2'
   spec.dependency 'SDWebImage', '~> 5.20.0'

+ 14 - 6
NexilisLite/NexilisLite.xcodeproj/project.pbxproj

@@ -8,8 +8,10 @@
 
 /* Begin PBXBuildFile section */
 		0B4630FFBC4EE87A6634E056 /* Pods_NexilisLite_NexilisLiteTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 10B08C755C0859F1ECA5CEBC /* Pods_NexilisLite_NexilisLiteTests.framework */; };
+		1236B6852D81465800A97809 /* pb_call_in_long.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 1236B6842D81465800A97809 /* pb_call_in_long.mp3 */; };
 		1241AEBC2D017E8C0088175A /* MasterKeyUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1241AEBB2D017E8C0088175A /* MasterKeyUtil.swift */; };
 		1241AEBD2D017E8C0088175A /* FileEncryption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1241AEBA2D017E8C0088175A /* FileEncryption.swift */; };
+		125363982D8031C30006C3D2 /* pb_call_busy.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 125363972D8031C30006C3D2 /* pb_call_busy.mp3 */; };
 		12C36CEB2D0299630095BEC1 /* SecureFolderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 12C36CEA2D02995F0095BEC1 /* SecureFolderView.swift */; };
 		B71100C03F3EE76CC1FFC618 /* Pods_NexilisLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 56F0A46991FE6BE0FDE74132 /* Pods_NexilisLite.framework */; };
 		CD1E6E6D2A0B7C3600BF871F /* NexilisLite.docc in Sources */ = {isa = PBXBuildFile; fileRef = CD1E6E6C2A0B7C3600BF871F /* NexilisLite.docc */; };
@@ -274,8 +276,10 @@
 
 /* Begin PBXFileReference section */
 		10B08C755C0859F1ECA5CEBC /* Pods_NexilisLite_NexilisLiteTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NexilisLite_NexilisLiteTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+		1236B6842D81465800A97809 /* pb_call_in_long.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = pb_call_in_long.mp3; sourceTree = "<group>"; };
 		1241AEBA2D017E8C0088175A /* FileEncryption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileEncryption.swift; sourceTree = "<group>"; };
 		1241AEBB2D017E8C0088175A /* MasterKeyUtil.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MasterKeyUtil.swift; sourceTree = "<group>"; };
+		125363972D8031C30006C3D2 /* pb_call_busy.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = pb_call_busy.mp3; sourceTree = "<group>"; };
 		12C36CEA2D02995F0095BEC1 /* SecureFolderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecureFolderView.swift; sourceTree = "<group>"; };
 		56F0A46991FE6BE0FDE74132 /* Pods_NexilisLite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NexilisLite.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		5AFDB202A2CA7FE864B0B1C2 /* Pods-NexilisLite-NexilisLiteTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NexilisLite-NexilisLiteTests.debug.xcconfig"; path = "Target Support Files/Pods-NexilisLite-NexilisLiteTests/Pods-NexilisLite-NexilisLiteTests.debug.xcconfig"; sourceTree = "<group>"; };
@@ -945,6 +949,8 @@
 		CDE3BED82C86E3A000B0BF36 /* Sound */ = {
 			isa = PBXGroup;
 			children = (
+				1236B6842D81465800A97809 /* pb_call_in_long.mp3 */,
+				125363972D8031C30006C3D2 /* pb_call_busy.mp3 */,
 				CD2585B72D59DA60002AB416 /* Dutifully.mp3 */,
 				CD2585B82D59DA60002AB416 /* Elegant.mp3 */,
 				CD2585B92D59DA60002AB416 /* Eventually.mp3 */,
@@ -1117,6 +1123,7 @@
 				CD2585CA2D59DA60002AB416 /* Relax.mp3 in Resources */,
 				CD2585CB2D59DA60002AB416 /* Eventually.mp3 in Resources */,
 				CD2585CC2D59DA60002AB416 /* Upset.mp3 in Resources */,
+				125363982D8031C30006C3D2 /* pb_call_busy.mp3 in Resources */,
 				CD2585CD2D59DA60002AB416 /* Elegant.mp3 in Resources */,
 				CD2585CE2D59DA60002AB416 /* Strong_Minded.mp3 in Resources */,
 				CD2585CF2D59DA60002AB416 /* Magic.mp3 in Resources */,
@@ -1207,6 +1214,7 @@
 				CD46A0B12A0CE320009E4C87 /* sticker_20000000_1.png in Resources */,
 				CD46A0B22A0CE320009E4C87 /* sticker_20000000_12.png in Resources */,
 				CD46A0B32A0CE320009E4C87 /* sticker_30000000_20.png in Resources */,
+				1236B6852D81465800A97809 /* pb_call_in_long.mp3 in Resources */,
 				CD9551602A664BDB00AF6476 /* Poppins-ExtraBoldItalic.otf in Resources */,
 				CD46A0B42A0CE320009E4C87 /* sticker_30000000_34.png in Resources */,
 				CDB21B2E2BA9998400EC5280 /* pb_def_icon_mode2.gif in Resources */,
@@ -1611,7 +1619,7 @@
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1;
 				DEFINES_MODULE = YES;
-				DEVELOPMENT_TEAM = FR2C2CZUYZ;
+				DEVELOPMENT_TEAM = 4R36B4D29V;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
 				DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -1651,7 +1659,7 @@
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1;
 				DEFINES_MODULE = YES;
-				DEVELOPMENT_TEAM = FR2C2CZUYZ;
+				DEVELOPMENT_TEAM = 4R36B4D29V;
 				DYLIB_COMPATIBILITY_VERSION = 1;
 				DYLIB_CURRENT_VERSION = 1;
 				DYLIB_INSTALL_NAME_BASE = "@rpath";
@@ -1690,7 +1698,7 @@
 				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1;
-				DEVELOPMENT_TEAM = FR2C2CZUYZ;
+				DEVELOPMENT_TEAM = 4R36B4D29V;
 				GENERATE_INFOPLIST_FILE = YES;
 				MARKETING_VERSION = 1.0;
 				PRODUCT_BUNDLE_IDENTIFIER = io.nexilis.NexilisLiteTests;
@@ -1708,7 +1716,7 @@
 				ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = "$(inherited)";
 				CODE_SIGN_STYLE = Automatic;
 				CURRENT_PROJECT_VERSION = 1;
-				DEVELOPMENT_TEAM = FR2C2CZUYZ;
+				DEVELOPMENT_TEAM = 4R36B4D29V;
 				GENERATE_INFOPLIST_FILE = YES;
 				MARKETING_VERSION = 1.0;
 				PRODUCT_BUNDLE_IDENTIFIER = io.nexilis.NexilisLiteTests;
@@ -1725,7 +1733,7 @@
 				CODE_SIGN_STYLE = Automatic;
 				COMBINE_HIDPI_IMAGES = YES;
 				CURRENT_PROJECT_VERSION = 1;
-				DEVELOPMENT_TEAM = FR2C2CZUYZ;
+				DEVELOPMENT_TEAM = 4R36B4D29V;
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_KEY_NSHumanReadableCopyright = "";
 				INFOPLIST_KEY_NSPrincipalClass = "";
@@ -1747,7 +1755,7 @@
 				CODE_SIGN_STYLE = Automatic;
 				COMBINE_HIDPI_IMAGES = YES;
 				CURRENT_PROJECT_VERSION = 1;
-				DEVELOPMENT_TEAM = FR2C2CZUYZ;
+				DEVELOPMENT_TEAM = 4R36B4D29V;
 				GENERATE_INFOPLIST_FILE = YES;
 				INFOPLIST_KEY_NSHumanReadableCopyright = "";
 				INFOPLIST_KEY_NSPrincipalClass = "";

BIN
NexilisLite/NexilisLite/Resource/Sound/pb_call_in_long.mp3


+ 9 - 4
NexilisLite/NexilisLite/Source/Extension.swift

@@ -725,6 +725,11 @@ extension String {
         return String(self[startIndex ..< endIndex])
     }
     
+    static public func offset() -> CGFloat{
+        guard let fontSize = Int(SecureUserDefaults.shared.value(forKey: "font_size") ?? "0") else { return 0 }
+        return CGFloat(fontSize)
+    }
+    
     public func richText(
         isEditing: Bool = false,
         isSearching: Bool = false,
@@ -733,10 +738,10 @@ extension String {
         listMentionInTextField: [User] = []
     ) -> NSMutableAttributedString {
         
-        let font = UIFont.systemFont(ofSize: 12)
-        let boldFont = UIFont.boldSystemFont(ofSize: 12)
-        let italicFont = UIFont.italicSystemFont(ofSize: 12)
-        let boldItalicFont = UIFont.systemFont(ofSize: 12, weight: .semibold)
+        let font = UIFont.systemFont(ofSize: 12 + String.offset())
+        let boldFont = UIFont.boldSystemFont(ofSize: 12 + String.offset())
+        let italicFont = UIFont.italicSystemFont(ofSize: 12 + String.offset())
+        let boldItalicFont = UIFont.systemFont(ofSize: 12 + String.offset(), weight: .semibold)
         
         let textUTF8 = self
         let finalText = NSMutableAttributedString(string: textUTF8, attributes: [.font: font])

+ 20 - 2
NexilisLite/NexilisLite/Source/Nexilis.swift

@@ -305,9 +305,9 @@ public class Nexilis: NSObject {
     }
     
     public static func playRingtoneCall() {
-        var ringtonePath = Bundle.resourceBundle(for: Nexilis.self).url(forResource: "pb_call_in", withExtension: "mp3")
+        var ringtonePath = Bundle.resourceBundle(for: Nexilis.self).url(forResource: "pb_call_in_long", withExtension: "mp3")
         if ringtonePath == nil {
-            ringtonePath = Bundle.resourcesMediaBundle(for: Nexilis.self).url(forResource: "pb_call_in", withExtension: "mp3")
+            ringtonePath = Bundle.resourcesMediaBundle(for: Nexilis.self).url(forResource: "pb_call_in_long", withExtension: "mp3")
         }
         do {
             ringtonePlayer = try AVAudioPlayer(contentsOf:ringtonePath!)
@@ -1095,6 +1095,24 @@ public class Nexilis: NSObject {
             //print(error)
         }
     }
+    
+    public static func setSpeakerphoneOn(_ isOn: Bool){
+        let audioSession = AVAudioSession.sharedInstance()
+        
+        do {
+            try audioSession.setCategory(.playAndRecord, mode: .default, options: [])
+            
+            try audioSession.setActive(true)
+            
+            if isOn {
+                try audioSession.overrideOutputAudioPort(.speaker)
+            } else {
+                try audioSession.overrideOutputAudioPort(.none)
+            }
+        } catch {
+            print("Error setting up audio session: \(error.localizedDescription)")
+        }
+    }
 
     public static func buttonClicked(index: Int, id: String = "") {
         //print("BTNCLICK \(index) \(id)")

+ 21 - 7
NexilisLite/NexilisLite/Source/View/Call/QmeraAudioViewController.swift

@@ -9,9 +9,14 @@ import UIKit
 import AVFoundation
 import nuSDKService
 import NotificationBannerSwift
+import MediaPlayer
 
 class QmeraAudioViewController: UIViewController {
     
+    static private var volumeView: MPVolumeView!
+    static private var bSpeakerPhone: Bool! = false
+    static private var lastVolume: Float! = AVAudioSession.sharedInstance().outputVolume
+    
     let stackViewToolbar2 = UIStackView()
     var onScreenConstraintWB = [NSLayoutConstraint]()
     let buttonWB = UIButton()
@@ -23,6 +28,7 @@ class QmeraAudioViewController: UIViewController {
     var callFCM = true
     var autoAcceptAPN = false
     
+    
     let buttonSize: CGFloat = 70
     
     lazy var data: String = "" {
@@ -75,7 +81,7 @@ class QmeraAudioViewController: UIViewController {
     
     private var firstCall: Bool = true
     
-    private var isSpeaker: Bool = false
+    private var isSpeaker: Bool = true
     
     private var isMuted: Bool = false
     
@@ -252,6 +258,17 @@ class QmeraAudioViewController: UIViewController {
         return button
     }()
     
+    static func turnSpeakerOn(bSpeakerOn: Bool!) {
+        bSpeakerPhone = bSpeakerOn
+        var volume:Float! = 0
+        if (bSpeakerPhone) {
+            volume = 50
+        } else {
+            volume = 3
+        }
+        API.adjustVolume(fValue: volume)
+    }
+    
     override func viewWillDisappear(_ animated: Bool) {
         UIDevice.current.isProximityMonitoringEnabled = false
         NotificationCenter.default.removeObserver(self)
@@ -408,6 +425,7 @@ class QmeraAudioViewController: UIViewController {
     }
     
     private func outgoingView() {
+//        Nexilis.setSpeakerphoneOn(isSpeaker)
         Nexilis.playRingbacktoneCall()
         status.text = "Connecting..."
         view.addSubview(end)
@@ -417,6 +435,7 @@ class QmeraAudioViewController: UIViewController {
     }
     
     private func incomingView() {
+//        Nexilis.setSpeakerphoneOn(isSpeaker)
         Nexilis.playRingtoneCall()
         status.text = "Incoming..."
         
@@ -621,12 +640,7 @@ class QmeraAudioViewController: UIViewController {
     @objc func didSpeaker(sender: Any?) {
         isSpeaker = !isSpeaker
         speaker.isSelected = isSpeaker
-        if isSpeaker {
-            UIDevice.current.isProximityMonitoringEnabled = false
-        } else {
-            UIDevice.current.isProximityMonitoringEnabled = true
-        }
-        Nexilis.setSpeaker(isSpeaker)
+        QmeraAudioViewController.turnSpeakerOn(bSpeakerOn: isSpeaker)
     }
     
     @objc func didMute(sender: Any?) {

+ 19 - 1
NexilisLite/NexilisLite/Source/View/Call/QmeraVideoViewController.swift

@@ -14,8 +14,15 @@ import UIKit
 import nuSDKService
 import AVFoundation
 import NotificationBannerSwift
+import MediaPlayer
 
 class QmeraVideoViewController: UIViewController {
+    
+    static private var volumeView: MPVolumeView!
+    static private var bSpeakerPhone: Bool! = false
+    static private var lastVolume: Float! = AVAudioSession.sharedInstance().outputVolume
+    
+    
     var dataPerson: [[String: String?]] = []
     var fPin = ""
     var wbRoomId = ""
@@ -131,6 +138,17 @@ class QmeraVideoViewController: UIViewController {
         return button
     }()
     
+    static func turnSpeakerOn(bSpeakerOn: Bool!) {
+        bSpeakerPhone = bSpeakerOn
+        var volume:Float! = 0
+        if (bSpeakerPhone) {
+            volume = 50
+        } else {
+            volume = 3
+        }
+        API.adjustVolume(fValue: volume)
+    }
+    
     deinit {
         navigationController?.changeAppearance(clear: false)
         let textAttributes = [NSAttributedString.Key.foregroundColor:UIColor.white]
@@ -966,7 +984,7 @@ class QmeraVideoViewController: UIViewController {
     }
     
     func setSpeaker(isSpeaker: Bool) {
-        Nexilis.setSpeaker(isSpeaker, isVideo: true)
+        QmeraVideoViewController.turnSpeakerOn(bSpeakerOn: isSpeaker)
         DispatchQueue.main.async {
             if (isSpeaker) {
                 self.buttonSpeaker.backgroundColor = .lightGray

+ 3 - 3
NexilisLite/NexilisLite/Source/View/Control/SettingTableViewController.swift

@@ -13,7 +13,7 @@ import Photos
 public class SettingTableViewController: UITableViewController, UIGestureRecognizerDelegate {
     
     var language: [[String: String]] = [["Indonesia": "id"],["English": "en"]]
-    var fontSizeSelection: [[String: String]] = [["Small": "0"],["Medium": "2"],["Large": "4"]]
+    var fontSizeSelection: [[String: String]] = [["Small": "0"],["Medium": "4"],["Large": "6"]]
     var alert: UIAlertController?
     var textFields = [UITextField]()
     var languagePickerView = UIPickerView()
@@ -519,10 +519,10 @@ public class SettingTableViewController: UITableViewController, UIGestureRecogni
             
             let fontSize: String = SecureUserDefaults.shared.value(forKey: "font_size") ?? "0"
             var index = 0
-            if fontSize == "2" {
+            if fontSize == "4" {
                 index = 1
             }
-            else if fontSize == "4"{
+            else if fontSize == "6"{
                 index = 2
             }
             fontSizePickerView.selectRow(index, inComponent: 0, animated: false)