Selaa lähdekoodia

Add friend from QR Code

kevin 7 kuukautta sitten
vanhempi
commit
09c21b4f24

+ 60 - 14
NexilisLite/NexilisLite/Resource/Palio.storyboard

@@ -619,6 +619,21 @@
             </objects>
             <point key="canvasLocation" x="9367" y="861"/>
         </scene>
+        <!--QR Profile-->
+        <scene sceneID="hql-fv-Wmp">
+            <objects>
+                <viewController storyboardIdentifier="qrProfile" title="QR Profile" useStoryboardIdentifierAsRestorationIdentifier="YES" id="N4a-cq-tHG" customClass="QRProfileController" customModule="NexilisLite" customModuleProvider="target" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="e03-Gu-At7">
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <viewLayoutGuide key="safeArea" id="dkw-82-M1P"/>
+                        <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+                    </view>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="sEw-9C-wWO" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="10594" y="879"/>
+        </scene>
         <!--Change Name Table View Controller-->
         <scene sceneID="cBS-F8-cFW">
             <objects>
@@ -697,7 +712,7 @@
                                                     <rect key="frame" x="286" y="154.5" width="68" height="24.5"/>
                                                     <subviews>
                                                         <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_internal" translatesAutoresizingMaskIntoConstraints="NO" id="yKV-8p-D06">
-                                                            <rect key="frame" x="5" y="-51.5" width="10" height="128"/>
+                                                            <rect key="frame" x="5" y="-51.5" width="10" height="127.5"/>
                                                             <constraints>
                                                                 <constraint firstAttribute="width" constant="10" id="Vh5-7K-sQv"/>
                                                             </constraints>
@@ -715,6 +730,7 @@
                                                         <constraint firstItem="evL-sf-Uad" firstAttribute="centerY" secondItem="40M-iH-oyA" secondAttribute="centerY" id="Dha-zc-uGG"/>
                                                         <constraint firstItem="evL-sf-Uad" firstAttribute="leading" secondItem="yKV-8p-D06" secondAttribute="trailing" constant="5" id="Lyl-gk-lIi"/>
                                                         <constraint firstItem="evL-sf-Uad" firstAttribute="top" secondItem="40M-iH-oyA" secondAttribute="top" constant="5" id="e6Y-0s-mBS"/>
+                                                        <constraint firstItem="yKV-8p-D06" firstAttribute="top" secondItem="40M-iH-oyA" secondAttribute="top" constant="-51.5" id="fdZ-Og-eiV"/>
                                                         <constraint firstAttribute="height" relation="greaterThanOrEqual" constant="20" id="i0Q-fH-ts0"/>
                                                         <constraint firstAttribute="bottom" secondItem="evL-sf-Uad" secondAttribute="bottom" constant="5" id="lgM-7n-GLu"/>
                                                         <constraint firstItem="yKV-8p-D06" firstAttribute="leading" secondItem="40M-iH-oyA" secondAttribute="leading" constant="5" id="rfS-v4-lis"/>
@@ -742,6 +758,9 @@
                                                         <constraint firstAttribute="trailing" secondItem="yNx-gJ-gXq" secondAttribute="trailing" constant="5" id="lhT-7H-PB4"/>
                                                     </constraints>
                                                 </view>
+                                                <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="qrcode" catalog="system" translatesAutoresizingMaskIntoConstraints="NO" id="DO0-Q1-buB">
+                                                    <rect key="frame" x="266" y="51" width="88" height="83.5"/>
+                                                </imageView>
                                             </subviews>
                                             <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                             <constraints>
@@ -749,10 +768,15 @@
                                                 <constraint firstAttribute="bottom" secondItem="0K5-VL-Mqq" secondAttribute="bottom" id="7fF-SI-jIM"/>
                                                 <constraint firstItem="4Od-Bu-62G" firstAttribute="top" secondItem="Al4-Bd-c6i" secondAttribute="bottom" constant="8" symbolic="YES" id="A2c-If-gTE"/>
                                                 <constraint firstItem="0K5-VL-Mqq" firstAttribute="top" secondItem="lop-Ow-tJu" secondAttribute="top" id="KSw-ew-NOs"/>
+                                                <constraint firstItem="DO0-Q1-buB" firstAttribute="top" secondItem="Al4-Bd-c6i" secondAttribute="top" id="MbT-5H-j0z"/>
                                                 <constraint firstItem="Al4-Bd-c6i" firstAttribute="centerX" secondItem="lop-Ow-tJu" secondAttribute="centerX" id="RCV-tS-V7i"/>
                                                 <constraint firstItem="4Od-Bu-62G" firstAttribute="centerX" secondItem="lop-Ow-tJu" secondAttribute="centerX" id="WaS-Yt-ldB"/>
+                                                <constraint firstItem="DO0-Q1-buB" firstAttribute="leading" secondItem="Al4-Bd-c6i" secondAttribute="trailing" constant="29" id="bXi-AA-C5d"/>
                                                 <constraint firstItem="0K5-VL-Mqq" firstAttribute="leading" secondItem="lop-Ow-tJu" secondAttribute="leading" id="dG1-3T-Dc8"/>
                                                 <constraint firstAttribute="trailing" secondItem="0K5-VL-Mqq" secondAttribute="trailing" id="dvH-ey-GNH"/>
+                                                <constraint firstItem="DO0-Q1-buB" firstAttribute="trailing" secondItem="40M-iH-oyA" secondAttribute="trailing" id="eHh-wJ-Db2"/>
+                                                <constraint firstItem="40M-iH-oyA" firstAttribute="top" secondItem="DO0-Q1-buB" secondAttribute="bottom" constant="18.5" id="ieu-4A-kkQ"/>
+                                                <constraint firstItem="40M-iH-oyA" firstAttribute="top" secondItem="lop-Ow-tJu" secondAttribute="top" constant="154.5" id="kg9-pl-3mh"/>
                                                 <constraint firstItem="Al4-Bd-c6i" firstAttribute="centerY" secondItem="lop-Ow-tJu" secondAttribute="centerY" id="meT-ah-cdH"/>
                                                 <constraint firstAttribute="bottomMargin" secondItem="40M-iH-oyA" secondAttribute="bottom" constant="10" id="r1W-TW-sUP"/>
                                             </constraints>
@@ -775,6 +799,9 @@
                                                     <subviews>
                                                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Private Account Mode" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Nvg-uC-lAp">
                                                             <rect key="frame" x="8" y="10" width="151" height="18"/>
+                                                            <constraints>
+                                                                <constraint firstAttribute="height" constant="18" id="Jn1-al-TPl"/>
+                                                            </constraints>
                                                             <fontDescription key="fontDescription" type="system" pointSize="15"/>
                                                             <nil key="textColor"/>
                                                             <nil key="highlightedColor"/>
@@ -787,6 +814,9 @@
                                                         </label>
                                                         <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Accept Call" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OlC-4h-ULU">
                                                             <rect key="frame" x="8" y="86" width="78" height="18"/>
+                                                            <constraints>
+                                                                <constraint firstAttribute="height" constant="18" id="GCl-H2-MeB"/>
+                                                            </constraints>
                                                             <fontDescription key="fontDescription" type="system" pointSize="15"/>
                                                             <nil key="textColor"/>
                                                             <nil key="highlightedColor"/>
@@ -797,12 +827,18 @@
                                                             <state key="normal" title="Button"/>
                                                             <buttonConfiguration key="configuration" style="filled" title="Contact Center History"/>
                                                         </button>
+                                                        <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9ck-VQ-0zT">
+                                                            <rect key="frame" x="8" y="178.5" width="358" height="34.5"/>
+                                                            <color key="tintColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                                            <state key="normal" title="Button"/>
+                                                            <buttonConfiguration key="configuration" style="filled" title="Contact Center History"/>
+                                                        </button>
                                                         <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="oaQ-vC-3bV">
-                                                            <rect key="frame" x="315" y="4" width="51" height="31"/>
+                                                            <rect key="frame" x="315" y="4" width="51" height="30"/>
                                                             <color key="onTintColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                                         </switch>
                                                         <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ndh-T2-T4k">
-                                                            <rect key="frame" x="334" y="46" width="30" height="22"/>
+                                                            <rect key="frame" x="334" y="45" width="30" height="24"/>
                                                             <constraints>
                                                                 <constraint firstAttribute="width" constant="30" id="gGC-QS-Ghx"/>
                                                             </constraints>
@@ -811,25 +847,33 @@
                                                             <state key="normal" image="pencil" catalog="system"/>
                                                         </button>
                                                         <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="imY-6r-cWB">
-                                                            <rect key="frame" x="315" y="80" width="51" height="31"/>
+                                                            <rect key="frame" x="315" y="81" width="51" height="28"/>
                                                             <color key="onTintColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                                         </switch>
                                                     </subviews>
                                                     <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
                                                     <constraints>
+                                                        <constraint firstAttribute="trailing" secondItem="9ck-VQ-0zT" secondAttribute="trailing" constant="8" id="3qz-IZ-OXh"/>
                                                         <constraint firstItem="UZm-64-k1t" firstAttribute="leading" secondItem="VAe-OS-2Uz" secondAttribute="leading" constant="8" id="4n3-85-Ctg"/>
+                                                        <constraint firstItem="NYg-hJ-SNM" firstAttribute="leading" secondItem="9ck-VQ-0zT" secondAttribute="leading" id="7ce-4Q-obd"/>
+                                                        <constraint firstItem="9ck-VQ-0zT" firstAttribute="leading" secondItem="VAe-OS-2Uz" secondAttribute="leading" constant="8" id="8aj-Af-5I0"/>
+                                                        <constraint firstItem="Nvg-uC-lAp" firstAttribute="centerY" secondItem="oaQ-vC-3bV" secondAttribute="centerY" id="H4C-Gj-Rf3"/>
                                                         <constraint firstAttribute="trailing" secondItem="NYg-hJ-SNM" secondAttribute="trailing" constant="8" id="LnI-x9-osh"/>
                                                         <constraint firstItem="OlC-4h-ULU" firstAttribute="top" secondItem="UZm-64-k1t" secondAttribute="bottom" constant="20" id="MSs-KT-Nbb"/>
                                                         <constraint firstItem="NYg-hJ-SNM" firstAttribute="leading" secondItem="VAe-OS-2Uz" secondAttribute="leading" constant="8" id="Nwb-nO-veO"/>
+                                                        <constraint firstItem="NYg-hJ-SNM" firstAttribute="trailing" secondItem="9ck-VQ-0zT" secondAttribute="trailing" id="OTx-pJ-KGk"/>
                                                         <constraint firstItem="oaQ-vC-3bV" firstAttribute="top" secondItem="VAe-OS-2Uz" secondAttribute="top" constant="4" id="PdZ-sO-FkE"/>
+                                                        <constraint firstItem="UZm-64-k1t" firstAttribute="centerY" secondItem="ndh-T2-T4k" secondAttribute="centerY" id="Vqx-zA-7Ll"/>
                                                         <constraint firstItem="Nvg-uC-lAp" firstAttribute="leading" secondItem="VAe-OS-2Uz" secondAttribute="leading" constant="8" id="aPf-gw-zHh"/>
                                                         <constraint firstItem="Nvg-uC-lAp" firstAttribute="top" secondItem="VAe-OS-2Uz" secondAttribute="top" constant="10" id="dL5-hu-okT"/>
                                                         <constraint firstAttribute="trailing" secondItem="ndh-T2-T4k" secondAttribute="trailing" constant="10" id="gYT-v9-fMl"/>
+                                                        <constraint firstItem="9ck-VQ-0zT" firstAttribute="top" secondItem="NYg-hJ-SNM" secondAttribute="bottom" constant="20" id="hd8-cb-3cf"/>
                                                         <constraint firstItem="ndh-T2-T4k" firstAttribute="top" secondItem="oaQ-vC-3bV" secondAttribute="bottom" constant="11" id="hjp-T9-vfG"/>
                                                         <constraint firstItem="OlC-4h-ULU" firstAttribute="leading" secondItem="VAe-OS-2Uz" secondAttribute="leading" constant="8" id="jyO-T1-gct"/>
                                                         <constraint firstItem="UZm-64-k1t" firstAttribute="top" secondItem="Nvg-uC-lAp" secondAttribute="bottom" constant="20" id="m0i-iW-ewF"/>
                                                         <constraint firstAttribute="trailing" secondItem="oaQ-vC-3bV" secondAttribute="trailing" constant="10" id="mOt-ZV-H73"/>
                                                         <constraint firstItem="imY-6r-cWB" firstAttribute="top" secondItem="ndh-T2-T4k" secondAttribute="bottom" constant="12" id="ou6-U8-wKO"/>
+                                                        <constraint firstItem="OlC-4h-ULU" firstAttribute="centerY" secondItem="imY-6r-cWB" secondAttribute="centerY" id="pYl-dW-VUg"/>
                                                         <constraint firstItem="NYg-hJ-SNM" firstAttribute="top" secondItem="OlC-4h-ULU" secondAttribute="bottom" constant="20" id="vRo-9J-ngF"/>
                                                         <constraint firstAttribute="trailing" secondItem="imY-6r-cWB" secondAttribute="trailing" constant="10" id="zBO-83-eUD"/>
                                                     </constraints>
@@ -893,6 +937,7 @@
                         <outlet property="message" destination="Sti-Yk-M8o" id="y6C-te-gGV"/>
                         <outlet property="myViewGroup" destination="VAe-OS-2Uz" id="kTG-Mv-YKl"/>
                         <outlet property="profile" destination="Al4-Bd-c6i" id="skq-v9-LHa"/>
+                        <outlet property="qrImage" destination="DO0-Q1-buB" id="V7M-Ge-e41"/>
                         <outlet property="switchAcceptCall" destination="imY-6r-cWB" id="Klz-Le-70y"/>
                         <outlet property="switchPrivateAccount" destination="oaQ-vC-3bV" id="bTI-fM-xc6"/>
                         <outlet property="video" destination="Opk-qK-mSQ" id="DkR-nl-nae"/>
@@ -3281,6 +3326,7 @@
         <image name="phone.down.fill" catalog="system" width="128" height="53"/>
         <image name="phone.fill" catalog="system" width="128" height="114"/>
         <image name="plus" catalog="system" width="128" height="113"/>
+        <image name="qrcode" catalog="system" width="128" height="114"/>
         <image name="speaker.slash.fill" catalog="system" width="115" height="128"/>
         <image name="speaker.wave.3.fill" catalog="system" width="128" height="84"/>
         <image name="trash.circle.fill" catalog="system" width="128" height="123"/>
@@ -3291,37 +3337,37 @@
             <color white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
         </systemColor>
         <systemColor name="secondarySystemBackgroundColor">
-            <color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <color red="0.94901960780000005" green="0.94901960780000005" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </systemColor>
         <systemColor name="systemBackgroundColor">
             <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
         </systemColor>
         <systemColor name="systemBlueColor">
-            <color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <color red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </systemColor>
         <systemColor name="systemGray2Color">
-            <color red="0.68235294117647061" green="0.68235294117647061" blue="0.69803921568627447" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <color red="0.68235294120000001" green="0.68235294120000001" blue="0.69803921570000005" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </systemColor>
         <systemColor name="systemGray3Color">
-            <color red="0.7803921568627451" green="0.7803921568627451" blue="0.80000000000000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <color red="0.78039215689999997" green="0.78039215689999997" blue="0.80000000000000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </systemColor>
         <systemColor name="systemGray4Color">
-            <color red="0.81960784313725488" green="0.81960784313725488" blue="0.83921568627450982" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <color red="0.81960784310000001" green="0.81960784310000001" blue="0.83921568629999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </systemColor>
         <systemColor name="systemGrayColor">
-            <color red="0.55686274509803924" green="0.55686274509803924" blue="0.57647058823529407" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <color red="0.5568627451" green="0.5568627451" blue="0.57647058819999997" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </systemColor>
         <systemColor name="systemGreenColor">
-            <color red="0.20392156862745098" green="0.7803921568627451" blue="0.34901960784313724" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <color red="0.20392156859999999" green="0.78039215689999997" blue="0.34901960780000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </systemColor>
         <systemColor name="systemIndigoColor">
-            <color red="0.34509803921568627" green="0.33725490196078434" blue="0.83921568627450982" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <color red="0.34509803919999998" green="0.33725490200000002" blue="0.83921568629999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </systemColor>
         <systemColor name="systemRedColor">
-            <color red="1" green="0.23137254901960785" blue="0.18823529411764706" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <color red="1" green="0.23137254900000001" blue="0.18823529410000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </systemColor>
         <systemColor name="tintColor">
-            <color red="0.0" green="0.47843137254901963" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+            <color red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
         </systemColor>
     </resources>
 </document>

+ 44 - 0
NexilisLite/NexilisLite/Source/View/Control/AddFriendTableViewController.swift

@@ -57,6 +57,7 @@ class AddFriendTableViewController: UITableViewController {
         navigationController?.navigationBar.scrollEdgeAppearance = navBarAppearance
         
         navigationItem.leftBarButtonItem = UIBarButtonItem(title: "Cancel".localized(), style: .plain, target: self, action: #selector(cancel(sender:)))
+        navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Scan QR".localized(), style: .plain, target: self, action: #selector(scanQR(sender:)))
         
         searchController = UISearchController(searchResultsController: nil)
         searchController.delegate = self
@@ -93,6 +94,49 @@ class AddFriendTableViewController: UITableViewController {
         navigationController?.dismiss(animated: true, completion: nil)
     }
     
+    @objc func scanQR(sender: Any) {
+        let scannerVC = QRScannerController()
+        scannerVC.onQRCodeDetected = { qrCode in
+            print("Detected QR Code: \(qrCode)")
+            
+            let users = self.data.filter{ $0.pin == qrCode }
+            if users.count > 0 {
+                let user = users[0]
+                let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "profileView") as! ProfileViewController
+                controller.flag = .invite
+                controller.data = user.pin
+                controller.name = user.fullName
+                controller.picture = user.thumb
+                controller.isDismiss = {
+                    self.data.removeAll(where: {$0.pin == user.pin})
+                    if self.isFilltering {
+                        self.fillteredData.removeAll(where: {$0.pin == user.pin})
+                    }
+                    self.tableView.reloadData()
+        //            self.getData { d in
+        //                self.data = d
+        //                DispatchQueue.main.async {
+        //                    self.tableView.reloadData()
+        //                }
+        //            }
+                }
+                self.navigationController?.show(controller, sender: nil)
+            }
+            else {
+                let alert = UIAlertController(title: "User not found", message: "The QR code may be invalid.", preferredStyle: .alert)
+                alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
+                self.present(alert, animated: true, completion: nil)
+            }
+            
+            
+            // Handle the detected QR code here (e.g., navigate or show an alert)
+//            let alert = UIAlertController(title: "QR Code Detected", message: qrCode, preferredStyle: .alert)
+//            alert.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
+//            self.present(alert, animated: true, completion: nil)
+        }
+        present(scannerVC, animated: true, completion: nil)
+    }
+    
     // MARK: - Data source
     
     func getData(completion: @escaping ([User])->()) {

+ 18 - 0
NexilisLite/NexilisLite/Source/View/Control/ProfileViewController.swift

@@ -18,6 +18,7 @@ public class ProfileViewController: UITableViewController {
     @IBOutlet weak var message: UIButton!
     @IBOutlet weak var viewUserType: UIView!
     @IBOutlet weak var imageUserType: UIImageView!
+    @IBOutlet weak var qrImage: UIImageView!
     @IBOutlet weak var labelUserType: UILabel!
     @IBOutlet weak var buttonGroup: UIStackView!
     @IBOutlet weak var myViewGroup: UIView!
@@ -239,12 +240,20 @@ public class ProfileViewController: UITableViewController {
         labelChangePassword.text = "Change Password".localized()
         labelAcceptCall.text = "Accept Call".localized()
         buttonHistoryCC.setAttributedTitle(NSAttributedString(string: "Call Center History".localized(), attributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 16), NSAttributedString.Key.foregroundColor : self.traitCollection.userInterfaceStyle == .dark ? UIColor.blackDarkMode : UIColor.white]), for: .normal)
+//        buttonQRCode.setAttributedTitle(NSAttributedString(string: "Show QR Code".localized(), attributes: [NSAttributedString.Key.font : UIFont.systemFont(ofSize: 16), NSAttributedString.Key.foregroundColor : self.traitCollection.userInterfaceStyle == .dark ? UIColor.blackDarkMode : UIColor.white]), for: .normal)
         navigationController?.navigationBar.topItem?.backButtonTitle = "Back".localized()
         
         switchPrivateAccount.onTintColor = .mainColor
         switchAcceptCall.onTintColor = .mainColor
         buttonEditpass.tintColor = self.traitCollection.userInterfaceStyle == .dark ? .white : .black
         buttonHistoryCC.tintColor = self.traitCollection.userInterfaceStyle == .dark ? .secondaryColor : .black
+//        buttonQRCode.tintColor = self.traitCollection.userInterfaceStyle == .dark ? .secondaryColor : .black
+        let qrTapGesture = UITapGestureRecognizer(target: self, action: #selector(showQR(sender:)))
+        qrImage.isUserInteractionEnabled = true
+        qrImage.contentMode = .scaleAspectFit
+        qrImage.tintColor = self.traitCollection.userInterfaceStyle == .dark ? .secondaryColor : .black
+        qrImage.translatesAutoresizingMaskIntoConstraints = false
+        qrImage.addGestureRecognizer(qrTapGesture)
         
         if let me = User.getMyPin(), me == data || flag == Flag.me {
             buttonGroup.removeFromSuperview()
@@ -252,6 +261,8 @@ public class ProfileViewController: UITableViewController {
             imageVideoPicker = ImageVideoPicker(presentationController: self, delegate: self)
             buttonEditPass.addTarget(self, action: #selector(editPassword(sender:)), for: .touchUpInside)
             buttonHistoryCC.addTarget(self, action: #selector(historyCC(sender:)), for: .touchUpInside)
+//            buttonQRCode.addTarget(self, action: #selector(showQR(sender:)), for: .touchUpInside)
+            
             if myData?.privacy_flag == "1" {
                 switchPrivateAccount.setOn(true, animated: false)
             }
@@ -400,6 +411,13 @@ public class ProfileViewController: UITableViewController {
         navigationController?.show(controller, sender: nil)
     }
     
+    @objc func showQR(sender: Any){
+        // TODO: Show Controller
+        let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "qrProfile") as! QRProfileController
+        controller.fPin = self.data
+        navigationController?.show(controller, sender: nil)
+    }
+    
     @objc func call(sender: Any) {
         if !Nexilis.checkingAccess(key: "audio_call") {
             showToast(message: "Feature disabled..".localized(), font: UIFont.systemFont(ofSize: 12), controller: self)

+ 84 - 0
NexilisLite/NexilisLite/Source/View/Control/QRProfileController.swift

@@ -0,0 +1,84 @@
+//
+//  QRProfileController.swift
+//  Pods
+//
+//  Created by Maronakins on 17/01/25.
+//
+
+import UIKit
+import CoreImage
+
+class QRProfileController: UIViewController {
+    var qrCodeImage: UIImage?
+
+    var fPin : String?
+    override func viewDidLoad() {
+        super.viewDidLoad()
+
+        view.backgroundColor = .white
+
+        // Generate a QR code
+        let qrCodeString = fPin
+        qrCodeImage = generateQRCode(from: qrCodeString!)
+
+        guard let qrCodeImage = qrCodeImage else { return }
+
+        // Add an image view to display the QR code
+        let imageView = UIImageView(image: qrCodeImage)
+        imageView.contentMode = .scaleAspectFit
+        imageView.translatesAutoresizingMaskIntoConstraints = false
+        view.addSubview(imageView)
+
+        // Add a share button
+        let shareButton = UIButton(type: .system)
+        shareButton.setTitle("Share QR Code", for: .normal)
+        shareButton.titleLabel?.font = UIFont.systemFont(ofSize: 16)
+        shareButton.addTarget(self, action: #selector(shareQRCode), for: .touchUpInside)
+        shareButton.translatesAutoresizingMaskIntoConstraints = false
+        view.addSubview(shareButton)
+
+        // Add constraints
+        NSLayoutConstraint.activate([
+//            label.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 20),
+//            label.centerXAnchor.constraint(equalTo: view.centerXAnchor),
+
+            imageView.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 20),
+            imageView.centerXAnchor.constraint(equalTo: view.centerXAnchor),
+            imageView.widthAnchor.constraint(equalToConstant: 200),
+            imageView.heightAnchor.constraint(equalToConstant: 200),
+
+            shareButton.topAnchor.constraint(equalTo: imageView.bottomAnchor, constant: 20),
+            shareButton.centerXAnchor.constraint(equalTo: view.centerXAnchor)
+        ])
+    }
+
+    @objc func shareQRCode() {
+        guard let qrCodeImage = qrCodeImage else { return }
+
+        // Create the activity view controller
+        let activityViewController = UIActivityViewController(activityItems: [qrCodeImage], applicationActivities: nil)
+
+        // Present the activity view controller
+        present(activityViewController, animated: true, completion: nil)
+    }
+
+    func generateQRCode(from string: String) -> UIImage? {
+        let data = string.data(using: String.Encoding.ascii)
+
+        // Create a QR code filter
+        if let filter = CIFilter(name: "CIQRCodeGenerator") {
+            filter.setValue(data, forKey: "inputMessage")
+            filter.setValue("Q", forKey: "inputCorrectionLevel") // Error correction level: L, M, Q, H
+
+            // Generate the QR code image
+            if let outputImage = filter.outputImage {
+                let transform = CGAffineTransform(scaleX: 10, y: 10) // Scale the image
+                let scaledImage = outputImage.transformed(by: transform)
+
+                // Convert to UIImage
+                return UIImage(ciImage: scaledImage)
+            }
+        }
+        return nil
+    }
+}

+ 101 - 0
NexilisLite/NexilisLite/Source/View/Control/QRScannerController.swift

@@ -0,0 +1,101 @@
+//
+//  QRScannerViewController.swift
+//  Pods
+//
+//  Created by Maronakins on 17/01/25.
+//
+
+import UIKit
+import AVFoundation
+
+class QRScannerController: UIViewController, AVCaptureMetadataOutputObjectsDelegate {
+    var captureSession: AVCaptureSession!
+    var previewLayer: AVCaptureVideoPreviewLayer!
+    var onQRCodeDetected: ((String) -> Void)?
+
+    override func viewDidLoad() {
+        super.viewDidLoad()
+
+        view.backgroundColor = .black
+        captureSession = AVCaptureSession()
+
+        // Configure the camera device
+        guard let videoCaptureDevice = AVCaptureDevice.default(for: .video) else {
+            print("No camera available")
+            return
+        }
+
+        let videoInput: AVCaptureDeviceInput
+        do {
+            videoInput = try AVCaptureDeviceInput(device: videoCaptureDevice)
+        } catch {
+            print("Unable to access camera")
+            return
+        }
+
+        if captureSession.canAddInput(videoInput) {
+            captureSession.addInput(videoInput)
+        } else {
+            print("Unable to add input to session")
+            return
+        }
+
+        let metadataOutput = AVCaptureMetadataOutput()
+
+        if captureSession.canAddOutput(metadataOutput) {
+            captureSession.addOutput(metadataOutput)
+
+            metadataOutput.setMetadataObjectsDelegate(self, queue: DispatchQueue.main)
+            metadataOutput.metadataObjectTypes = [.qr]
+        } else {
+            print("Unable to add output to session")
+            return
+        }
+
+        // Configure the camera preview layer
+        previewLayer = AVCaptureVideoPreviewLayer(session: captureSession)
+        previewLayer.frame = view.layer.bounds
+        previewLayer.videoGravity = .resizeAspectFill
+        view.layer.addSublayer(previewLayer)
+
+        // Start the capture session
+        captureSession.startRunning()
+    }
+
+    override func viewWillDisappear(_ animated: Bool) {
+        super.viewWillDisappear(animated)
+
+        if captureSession.isRunning {
+            captureSession.stopRunning()
+        }
+    }
+
+    // Handle detected metadata objects (QR codes)
+    func metadataOutput(_ output: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) {
+        captureSession.stopRunning()
+
+        if let metadataObject = metadataObjects.first {
+            guard let readableObject = metadataObject as? AVMetadataMachineReadableCodeObject else { return }
+            guard let stringValue = readableObject.stringValue else { return }
+
+            // Send the detected QR code result
+            onQRCodeDetected?(stringValue)
+
+            // Optionally dismiss the scanner view controller
+            dismiss(animated: true, completion: nil)
+        }
+    }
+
+    override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
+        return .portrait
+    }
+
+    override func viewDidAppear(_ animated: Bool) {
+        super.viewDidAppear(animated)
+
+        // Restart the session if needed
+        if !captureSession.isRunning {
+            captureSession.startRunning()
+        }
+    }
+}