From 3c832b207d35ae39500e5c0e219bcd04e74f07d7 Mon Sep 17 00:00:00 2001 From: saeedrooyekhat Date: Wed, 12 Sep 2018 15:51:17 +0430 Subject: [PATCH] Cherry Pick To - Improvement - Show Main Avatar '5c6029e071395548e1166963ece0eba01c4ac14d' --- .../IGNavigationItem.swift | 2 +- .../View Controllers/Call/IGCall.swift | 2 + .../View Controllers/Call/IGCallQuality.swift | 4 + ...gesAndVideosCollectionViewController.swift | 5 +- .../IGChannelInfoTableViewController.swift | 3 +- .../IGGroupInfoTableViewController.swift | 6 +- ...RegistredUserInfoTableViewController.swift | 4 +- .../IGFinancialServiceBill.swift | 262 ++++++++++++ .../IGFinancialServiceBillingInquiry.swift | 365 ++++++++++++++++ .../IGFinancialServiceCharge.swift | 398 ++++++++++++++++++ .../View Controllers/Map/IGMap.swift | 2 + .../IGContactTableViewCell.swift | 2 + ...GCreateNewChannelTableViewController.swift | 2 +- .../IGSettingContactTableViewCell.swift | 3 +- ...IGSettingContactsTableViewController.swift | 21 +- .../IGSettingTableViewController.swift | 2 +- ...rificationOptionsTableViewController.swift | 2 + ...ionVerifyPasswordTableViewController.swift | 3 + ...epVerificationVerifyUnconfirmedEmail.swift | 2 + ...gistrationStepPasswordViewController.swift | 15 +- ...GRegistrationStepPhoneViewController.swift | 4 + ...trationStepProfileInfoViewController.swift | 13 +- ...onStepVerificationCodeViewController.swift | 17 +- .../IGSplashScreenViewController.swift | 3 + .../IGChannelsTableViewController.swift | 24 +- .../IGChatsTableViewController.swift | 23 +- .../IGGroupsTableViewController.swift | 24 +- .../IGRecentsTableViewController.swift | 50 ++- iGap/General/IGGlobal.swift | 56 ++- .../Controller/IGMessageViewController.swift | 19 +- .../IGMessageGeneralCollectionViewCell.swift | 2 +- iGap/Model/AppDelegate/AppDelegate.swift | 39 +- iGap/Model/Managers/IGAppManager.swift | 11 +- iGap/SupportingFiles/Info.plist | 4 +- iGap/VIew/.DS_Store | Bin 0 -> 6148 bytes iGap/VIew/Assets.xcassets/.DS_Store | Bin 0 -> 8196 bytes iGap/VIew/Base.lproj/Main.storyboard | 6 + iGap/VIew/CreateRoom.storyboard | 5 +- ...achmentCurrentLocationViewController.swift | 2 + iGap/VIew/IGSettingStoryboard.storyboard | 8 +- iGap/VIew/Register.storyboard | 3 +- iGap/VIew/ReusableViews/IGAvatarView.swift | 12 +- iGap/VIew/profile.storyboard | 17 +- 43 files changed, 1328 insertions(+), 119 deletions(-) create mode 100644 iGap/Controller/View Controllers/Financial Services/IGFinancialServiceBill.swift create mode 100644 iGap/Controller/View Controllers/Financial Services/IGFinancialServiceBillingInquiry.swift create mode 100644 iGap/Controller/View Controllers/Financial Services/IGFinancialServiceCharge.swift create mode 100644 iGap/VIew/.DS_Store create mode 100644 iGap/VIew/Assets.xcassets/.DS_Store diff --git a/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationItem.swift b/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationItem.swift index 605dd3c..f64cdd5 100644 --- a/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationItem.swift +++ b/iGap/Controller/Custom Master Controllers/NavigationController/IGNavigationItem.swift @@ -385,7 +385,7 @@ class IGNavigationItem: UINavigationItem { let avatarViewFrame = CGRect(x: 0, y: 0, width: 40, height:40) let avatarView = IGAvatarView(frame: avatarViewFrame) - avatarView.setRoom(room) + avatarView.setRoom(room, showMainAvatar: true) rightViewContainer!.addSubview(avatarView) DispatchQueue.main.asyncAfter(deadline: .now() + 10.0) { diff --git a/iGap/Controller/View Controllers/Call/IGCall.swift b/iGap/Controller/View Controllers/Call/IGCall.swift index aa45e10..43bb2a6 100644 --- a/iGap/Controller/View Controllers/Call/IGCall.swift +++ b/iGap/Controller/View Controllers/Call/IGCall.swift @@ -169,6 +169,8 @@ class IGCall: UIViewController, CallStateObserver, ReturnToCallObserver { } private func buttonViewCustomize(button: UIButton, color: UIColor, imgName: String = ""){ + + button.removeUnderline() button.backgroundColor = color button.layer.shadowColor = UIColor.darkGray.cgColor diff --git a/iGap/Controller/View Controllers/Call/IGCallQuality.swift b/iGap/Controller/View Controllers/Call/IGCallQuality.swift index c974e97..e3dbd85 100644 --- a/iGap/Controller/View Controllers/Call/IGCallQuality.swift +++ b/iGap/Controller/View Controllers/Call/IGCallQuality.swift @@ -20,6 +20,7 @@ class IGCallQuality: UIViewController, UITextFieldDelegate { @IBOutlet weak var userActionView: UIView! @IBOutlet weak var edtReason: UITextField! @IBOutlet weak var btnSubmit: UIButton! + @IBOutlet weak var btnCancel: UIButton! var ratingView: CosmosView! var rateId: Int64! @@ -43,6 +44,9 @@ class IGCallQuality: UIViewController, UITextFieldDelegate { override func viewDidLoad() { super.viewDidLoad() + btnSubmit.removeUnderline() + btnCancel.removeUnderline() + edtReason.delegate = self edtReason.isHidden = true diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelAndGroupSharedMediaImagesAndVideosCollectionViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelAndGroupSharedMediaImagesAndVideosCollectionViewController.swift index 1ecc5e1..d55fd37 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelAndGroupSharedMediaImagesAndVideosCollectionViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelAndGroupSharedMediaImagesAndVideosCollectionViewController.swift @@ -145,7 +145,10 @@ class IGChannelAndGroupSharedMediaImagesAndVideosCollectionViewController: UICol galleryPreview.referenceViewForPhotoWhenDismissingHandler = { [weak self] photo in if let index = photos.index(where: {$0 === photo}) { let indexPath = IndexPath(row: index, section: 0) - return collectionView.cellForItem(at: indexPath) as! IGChannelAndGroupInfoSharedMediaImagesAndVideosCollectionViewCell + if let cell = collectionView.cellForItem(at: indexPath) { + return cell as! IGChannelAndGroupInfoSharedMediaImagesAndVideosCollectionViewCell + } + return nil } return nil } diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoTableViewController.swift index c807ca9..64bfa85 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGChannelInfoTableViewController.swift @@ -73,6 +73,7 @@ class IGChannelInfoTableViewController: UITableViewController , UIGestureRecogni tableView.rowHeight = UITableViewAutomaticDimension signMessageIndexPath = IndexPath(row: 2, section: 1) myRole = room?.channelRoom?.role + cameraButton.removeUnderline() switch myRole! { case .member: channelSignMessageCell.isHidden = true @@ -711,7 +712,7 @@ class IGChannelInfoTableViewController: UITableViewController , UIGestureRecogni channelNameLabel.text = room?.title ChannelDescriptionLabel.text = room?.channelRoom?.roomDescription if let channelRoom = room { - channelImage.setRoom(channelRoom) + channelImage.setRoom(channelRoom, showMainAvatar: true) } if let channelType = room?.channelRoom?.type { switch channelType { diff --git a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoTableViewController.swift b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoTableViewController.swift index d18061a..377f5fb 100644 --- a/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoTableViewController.swift +++ b/iGap/Controller/View Controllers/Channel and Group Info/IGGroupInfoTableViewController.swift @@ -80,6 +80,7 @@ class IGGroupInfoTableViewController: UITableViewController , UIGestureRecognize let tap = UITapGestureRecognizer.init(target: self, action: #selector(self.handleTap(recognizer:))) groupAvatarView.avatarImageView?.addGestureRecognizer(tap) + cameraButton.removeUnderline() switch myRole! { case .admin: cameraButton.isHidden = false @@ -152,9 +153,6 @@ class IGGroupInfoTableViewController: UITableViewController , UIGestureRecognize } override func viewWillAppear(_ animated: Bool) { self.tableView.isUserInteractionEnabled = true - - } - @IBAction func didTapOnCameraBtn(_ sender: UIButton) { } @IBAction func didTapOnCameraButton(_ sender: UIButton) { @@ -591,7 +589,7 @@ class IGGroupInfoTableViewController: UITableViewController , UIGestureRecognize groupNameLabel.text = room?.title groupDescriptionLabel.text = room?.groupRoom?.roomDescription if let groupRoom = room { - groupAvatarView.setRoom(groupRoom) + groupAvatarView.setRoom(groupRoom, showMainAvatar: true) } if let groupType = room?.groupRoom?.type { switch groupType { diff --git a/iGap/Controller/View Controllers/Chat and User Info/IGRegistredUserInfoTableViewController.swift b/iGap/Controller/View Controllers/Chat and User Info/IGRegistredUserInfoTableViewController.swift index 946ec70..274874b 100644 --- a/iGap/Controller/View Controllers/Chat and User Info/IGRegistredUserInfoTableViewController.swift +++ b/iGap/Controller/View Controllers/Chat and User Info/IGRegistredUserInfoTableViewController.swift @@ -42,7 +42,7 @@ class IGRegistredUserInfoTableViewController: UITableViewController , UIGestureR super.viewDidLoad() if user != nil { requestToGetAvatarList() - self.avatarView.setUser(user!) + self.avatarView.setUser(user!, showMainAvatar: true) self.displayNameLabel.text = user!.displayName if let phone = user?.phone { if phone == 0 { @@ -299,7 +299,7 @@ class IGRegistredUserInfoTableViewController: UITableViewController , UIGestureR func handleTap(recognizer:UITapGestureRecognizer) { if recognizer.state == .ended { if let userAvatar = user?.avatar { - showAvatar( avatar: userAvatar) + showAvatar(avatar: userAvatar) } } } diff --git a/iGap/Controller/View Controllers/Financial Services/IGFinancialServiceBill.swift b/iGap/Controller/View Controllers/Financial Services/IGFinancialServiceBill.swift new file mode 100644 index 0000000..7a21059 --- /dev/null +++ b/iGap/Controller/View Controllers/Financial Services/IGFinancialServiceBill.swift @@ -0,0 +1,262 @@ +/* + * This is the source code of iGap for iOS + * It is licensed under GNU AGPL v3.0 + * You should have received a copy of the license in this archive (see LICENSE). + * Copyright © 2017 , iGap - www.iGap.net + * iGap Messenger | Free, Fast and Secure instant messaging application + * The idea of the RooyeKhat Media Company - www.RooyeKhat.co + * All rights reserved. + */ + +import UIKit +import IGProtoBuff +import PecPayment +import SnapKit + +class IGFinancialServiceBill: UIViewController, UIGestureRecognizerDelegate, UITextFieldDelegate , BillMerchantResultObserver { + + @IBOutlet weak var btnPayment: UIButton! + @IBOutlet weak var edtBillingID: UITextField! + @IBOutlet weak var edtPaymentCode: UITextField! + @IBOutlet weak var txtAmount: UILabel! + @IBOutlet weak var imgCompany: UIImageView! + + var billId: String! = "" + var payId: String! = "" + + internal static var isTrafficOffenses = false + internal static var BillInfo: String? + + override func viewDidLoad() { + super.viewDidLoad() + + edtBillingID.delegate = self + edtPaymentCode.delegate = self + + initNavigationBar() + manageButtonsView(buttons: [btnPayment]) + manageEditTextsView(editTexts: [edtBillingID,edtPaymentCode]) + manageTextsView(labels: [txtAmount]) + //manageImageViews(images: [imgCompany]) + + if IGFinancialServiceBill.isTrafficOffenses { + imgCompany.image = UIImage(named: "bill_jarime_pec") + } + } + + override func viewDidAppear(_ animated: Bool) { + super.viewDidAppear(animated) + + if let billInfo = IGFinancialServiceBill.BillInfo { + fetchBillInfo(billInfo: billInfo) + } + } + + func initNavigationBar(){ + + var title = "Pay Bills" + if IGFinancialServiceBill.isTrafficOffenses { + title = "Pay Traffic Tickets" + } + let navigationItem = self.navigationItem as! IGNavigationItem + navigationItem.addNavigationViewItems(rightItemText: nil, title: title, width: 200) + navigationItem.navigationController = self.navigationController as? IGNavigationController + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + + if IGFinancialServiceBill.isTrafficOffenses { + txtAmount.isHidden = true + + btnPayment.snp.makeConstraints { (make) in + make.top.equalTo(edtPaymentCode.snp.bottom).offset(20) + } + + } else { + navigationItem.addModalViewRightItem(title: "", iGapFont: true, fontSize: 25.0, xPosition: 5.0) + navigationItem.rightViewContainer?.addAction { + self.performSegue(withIdentifier: "showFinancialServiceBillQrScanner", sender: self) + } + } + } + + private func manageButtonsView(buttons: [UIButton]){ + for btn in buttons { + btn.removeUnderline() + btn.layer.cornerRadius = 5 + btn.layer.borderWidth = 1 + btn.layer.borderColor = UIColor.iGapColor().cgColor + } + } + + private func manageEditTextsView(editTexts: [UITextField]){ + for edt in editTexts { + edt.layer.cornerRadius = 5 + edt.layer.borderWidth = 1 + edt.layer.borderColor = UIColor.iGapColor().cgColor + } + } + + private func manageTextsView(labels: [UILabel]){ + for txt in labels { + txt.layer.cornerRadius = 5 + txt.layer.borderWidth = 1 + txt.layer.borderColor = UIColor.iGapColor().cgColor + } + } + + private func manageImageViews(images: [UIImageView]){ + for img in images { + img.layer.cornerRadius = 5 + img.layer.borderWidth = 1 + img.layer.borderColor = UIColor.iGapColor().cgColor + } + } + + private func fetchBillInfo(billInfo: String, setText: Bool = true){ + + if IGFinancialServiceBill.isTrafficOffenses { + return + } + + billId = billInfo[0..<13] + payId = billInfo[13..<30] + let companyType = billInfo[11..<12] + let price = billInfo[13..<21] + + if setText { + edtBillingID.text = billId + edtPaymentCode.text = payId + } + if !price.isEmpty { + txtAmount.text = "\(Int(price)! * 1000) Rials" + } + + if !IGFinancialServiceBill.isTrafficOffenses { + switch Int(companyType) { + case 1: + imgCompany.image = UIImage(named: "bill_water_pec") + break + + case 2: + imgCompany.image = UIImage(named: "bill_elc_pec") + break + + case 3: + imgCompany.image = UIImage(named: "bill_gaz_pec") + break + + case 4: + imgCompany.image = UIImage(named: "bill_telecom_pec") + break + + case 5: + imgCompany.image = UIImage(named: "bill_mci_pec") + break + + case 6: + imgCompany.image = UIImage(named: "bill_shahrdari_pec") + break + + default: + imgCompany.image = nil + break + } + } + } + + private func showErrorAlertView(title: String, message: String?, dismiss: Bool = false){ + let option = UIAlertController(title: title, message: message, preferredStyle: .alert) + let ok = UIAlertAction(title: "Ok", style: .cancel, handler: { (action) in + if dismiss { + self.navigationController?.popViewController(animated: true) + } + }) + option.addAction(ok) + self.present(option, animated: true, completion: {}) + } + + private func initBillPaymanet(token: String){ + let initpayment = InitPayment() + initpayment.registerBill(merchant: self) + initpayment.initBillPayment(Token: token, MerchantVCArg: self, TSPEnabled: 0) + } + + /********************************************/ + /*************** User Actions ***************/ + /********************************************/ + + @IBAction func edtBillingID(_ sender: UITextField) { + if let billId = edtBillingID.text , let payId = edtPaymentCode.text { + if billId.characters.count > 3 && payId.characters.count > 3 { + self.billId = billId + self.payId = payId + fetchBillInfo(billInfo: "\(billId)\(payId)" , setText: false) + } + } + } + + @IBAction func edtPaymentCode(_ sender: UITextField) { + if let billId = edtBillingID.text, let payId = edtPaymentCode.text { + if billId.characters.count > 3 && payId.characters.count > 3 { + self.billId = billId + self.payId = payId + fetchBillInfo(billInfo: "\(billId)\(payId)", setText: false) + } + } + } + + @IBAction func btnPayment(_ sender: UIButton) { + + if billId == nil || !billId.isNumber || payId == nil || !payId.isNumber{ + return + } + + IGGlobal.prgShow(self.view) + IGMplGetBillToken.Generator.generate(billId: Int64(billId)!, payId: Int64(payId)!).success({ (protoResponse) in + IGGlobal.prgHide() + if let mplGetBillTokenResponse = protoResponse as? IGPMplGetBillTokenResponse { + if mplGetBillTokenResponse.igpStatus == 0 { //success + self.initBillPaymanet(token: mplGetBillTokenResponse.igpToken) + } else { + self.showErrorAlertView(title: "خطا", message: mplGetBillTokenResponse.igpMessage) + } + } + + }).error ({ (errorCode, waitTime) in + IGGlobal.prgHide() + switch errorCode { + case .timeout: + DispatchQueue.main.async { + let alert = UIAlertController(title: "Timeout", message: "Please try again later!", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.present(alert, animated: true, completion: nil) + } + break + default: + break + } + }).send() + } + + /*********************************************************/ + /*************** Overrided Payment Mehtods ***************/ + /*********************************************************/ + + func BillMerchantUpdate(encData: String, message: String, status: Int) { + self.navigationController?.popViewController(animated: true) + } + + func BillMerchantError(errorType: Int) { + showErrorAlertView(title: "Bill Payment Error", message: "Bill payment error occurred!", dismiss: true) + } + + /********************************************/ + /************* Overrided Methods ************/ + /********************************************/ + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + self.view.endEditing(true) + return false + } +} diff --git a/iGap/Controller/View Controllers/Financial Services/IGFinancialServiceBillingInquiry.swift b/iGap/Controller/View Controllers/Financial Services/IGFinancialServiceBillingInquiry.swift new file mode 100644 index 0000000..f2816fd --- /dev/null +++ b/iGap/Controller/View Controllers/Financial Services/IGFinancialServiceBillingInquiry.swift @@ -0,0 +1,365 @@ +/* + * This is the source code of iGap for iOS + * It is licensed under GNU AGPL v3.0 + * You should have received a copy of the license in this archive (see LICENSE). + * Copyright © 2017 , iGap - www.iGap.net + * iGap Messenger | Free, Fast and Secure instant messaging application + * The idea of the RooyeKhat Media Company - www.RooyeKhat.co + * All rights reserved. + */ + +import UIKit +import IGProtoBuff +import PecPayment +import SnapKit + +class IGFinancialServiceBillingInquiry: UIViewController, UIGestureRecognizerDelegate, UITextFieldDelegate, BillMerchantResultObserver { + + @IBOutlet weak var edtPhoneNumber: UITextField! + @IBOutlet weak var edtProvisionCode: UITextField! + @IBOutlet weak var btnInquiry: UIButton! + + @IBOutlet weak var viewOne: UIView! + @IBOutlet weak var txtLastTerm: UILabel! + @IBOutlet weak var txtBillingID: UILabel! + @IBOutlet weak var txtPaymentCode: UILabel! + @IBOutlet weak var txtAmount: UILabel! + @IBOutlet weak var btnPayment: UIButton! + + @IBOutlet weak var viewTwo: UIView! + @IBOutlet weak var txtMidTerm: UILabel! + @IBOutlet weak var txtBillingIDMid: UILabel! + @IBOutlet weak var txtPaymentCodeMid: UILabel! + @IBOutlet weak var txtAmountMid: UILabel! + @IBOutlet weak var btnPaymentMid: UIButton! + + var billingId: String! + var paymentCode: String! + var billingIdMid: String! + var paymentCodeMid: String! + + internal static var isMobile = false + + override func viewDidLoad() { + super.viewDidLoad() + + edtPhoneNumber.delegate = self + if IGFinancialServiceBillingInquiry.isMobile { + edtPhoneNumber.snp.makeConstraints { (make) in + make.leading.equalTo(self.view.snp.leading).offset(12) + } + edtProvisionCode.isHidden = true + } else { + edtPhoneNumber.placeholder = "Telephone Number, xxxxxxx" + } + + initNavigationBar() + manageEditTextsView(editTexts: [edtPhoneNumber, edtProvisionCode]) + manageViews(views: [viewOne,viewTwo], enable: false) + manageButtonsView(buttons: [btnInquiry]) + manageButtonsView(buttons: [btnPayment,btnPaymentMid], enable: false) + manageTextsView(labels: [txtLastTerm,txtMidTerm], grayLine: true) + manageTextsView(labels: [txtBillingID,txtPaymentCode,txtAmount,txtBillingIDMid,txtPaymentCodeMid,txtAmountMid]) + } + + func initNavigationBar(){ + var title = "Phone Bills Inquiry" + if IGFinancialServiceBillingInquiry.isMobile { + title = "Mobile Bills Inquiry" + } + let navigationItem = self.navigationItem as! IGNavigationItem + navigationItem.addNavigationViewItems(rightItemText: nil, title: title, width: 200) + navigationItem.navigationController = self.navigationController as? IGNavigationController + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + } + + + private func manageButtonsView(buttons: [UIButton], enable: Bool = true){ + if enable { + for btn in buttons { + btn.removeUnderline() + btn.layer.cornerRadius = 5 + btn.layer.borderWidth = 1 + btn.layer.borderColor = UIColor.iGapColor().cgColor + btn.layer.backgroundColor = UIColor.organizationalColor().cgColor + btn.isEnabled = true + } + } else { + for btn in buttons { + btn.removeUnderline() + btn.layer.cornerRadius = 5 + btn.layer.borderWidth = 1 + btn.layer.borderColor = UIColor.gray.cgColor + btn.layer.backgroundColor = UIColor.lightGray.cgColor + btn.isEnabled = false + } + } + } + + private func manageEditTextsView(editTexts: [UITextField]){ + for edt in editTexts { + edt.layer.cornerRadius = 5 + edt.layer.borderWidth = 1 + edt.layer.borderColor = UIColor.iGapColor().cgColor + } + } + + private func manageTextsView(labels: [UILabel], grayLine: Bool = false){ + for txt in labels { + txt.layer.cornerRadius = 5 + txt.layer.borderWidth = 1 + if grayLine { + txt.layer.borderColor = UIColor.gray.cgColor + } else { + txt.layer.borderColor = UIColor.iGapColor().cgColor + } + } + } + + private func manageViews(views: [UIView], enable: Bool = true){ + + for view in views { + view.layer.cornerRadius = 5 + view.layer.borderWidth = 1 + view.layer.borderColor = UIColor.gray.cgColor + + if enable { + view.layer.backgroundColor = UIColor.white.cgColor + } else { + view.layer.backgroundColor = UIColor(red: 220.0/255.0, green: 220.0/255.0, blue: 220.0/255.0, alpha: 1.0).cgColor + } + } + } + + private func showErrorAlertView(title: String, message: String?, dismiss: Bool = false){ + let option = UIAlertController(title: title, message: message, preferredStyle: .alert) + let ok = UIAlertAction(title: "Ok", style: .cancel, handler: { (action) in + if dismiss { + self.navigationController?.popViewController(animated: true) + } + }) + option.addAction(ok) + self.present(option, animated: true, completion: {}) + } + + private func fetchPaymentToken(billId: String, payId: String){ + IGMplGetBillToken.Generator.generate(billId: Int64(billId)!, payId: Int64(payId)!).success({ (protoResponse) in + + if let mplGetBillTokenResponse = protoResponse as? IGPMplGetBillTokenResponse { + if mplGetBillTokenResponse.igpStatus == 0 { //success + self.initBillPaymanet(token: mplGetBillTokenResponse.igpToken) + } else { + self.showErrorAlertView(title: "خطا", message: mplGetBillTokenResponse.igpMessage) + } + } + + }).error ({ (errorCode, waitTime) in + switch errorCode { + case .timeout: + DispatchQueue.main.async { + let alert = UIAlertController(title: "Timeout", message: "Please try again later!", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.present(alert, animated: true, completion: nil) + } + default: + break + } + + }).send() + } + + private func initBillPaymanet(token: String){ + let initpayment = InitPayment() + initpayment.registerBill(merchant: self) + initpayment.initBillPayment(Token: token, MerchantVCArg: self, TSPEnabled: 0) + } + + private func manageInquiryMci(lastTerm: IGPBillInquiryMciResponse.IGPBillInfo, midTerm: IGPBillInquiryMciResponse.IGPBillInfo){ + DispatchQueue.main.async { + self.billingId = "\(lastTerm.igpBillID)" + self.paymentCode = "\(lastTerm.igpPayID)" + self.txtBillingID.text = "\(lastTerm.igpBillID)" + self.txtPaymentCode.text = "\(lastTerm.igpPayID)" + self.txtAmount.text = "\(lastTerm.igpAmount) Rials" + + if lastTerm.igpAmount != 0 { + self.manageButtonsView(buttons: [self.btnPayment]) + self.manageViews(views: [self.viewOne]) + self.btnPayment.setTitle("Pay", for: UIControlState.normal) + } else { + self.manageButtonsView(buttons: [self.btnPayment],enable: false) + self.manageViews(views: [self.viewOne], enable: false) + self.btnPayment.setTitle("Pay", for: UIControlState.normal) + } + + self.billingIdMid = "\(midTerm.igpBillID)" + self.paymentCodeMid = "\(midTerm.igpPayID)" + self.txtBillingIDMid.text = "\(midTerm.igpBillID)" + self.txtPaymentCodeMid.text = "\(midTerm.igpPayID)" + self.txtAmountMid.text = "\(midTerm.igpAmount) Rials" + + if midTerm.igpAmount != 0 { + self.manageButtonsView(buttons: [self.btnPaymentMid]) + self.manageViews(views: [self.viewTwo]) + self.btnPaymentMid.setTitle("Pay", for: UIControlState.normal) + } else { + self.manageButtonsView(buttons: [self.btnPaymentMid],enable: false) + self.manageViews(views: [self.viewTwo], enable: false) + self.btnPaymentMid.setTitle("Pay", for: UIControlState.normal) + } + } + } + + private func manageInquiryTelecom(lastTerm: IGPBillInquiryTelecomResponse.IGPBillInfo, midTerm: IGPBillInquiryTelecomResponse.IGPBillInfo){ + DispatchQueue.main.async { + self.billingId = "\(lastTerm.igpBillID)" + self.paymentCode = "\(lastTerm.igpPayID)" + self.txtBillingID.text = "\(lastTerm.igpBillID)" + self.txtPaymentCode.text = "\(lastTerm.igpPayID)" + self.txtAmount.text = "\(lastTerm.igpAmount) Rials" + + if lastTerm.igpAmount != 0 { + self.manageButtonsView(buttons: [self.btnPayment]) + self.manageViews(views: [self.viewOne]) + self.btnPayment.setTitle("Pay", for: UIControlState.normal) + } else { + self.manageButtonsView(buttons: [self.btnPayment],enable: false) + self.manageViews(views: [self.viewOne], enable: false) + self.btnPayment.setTitle("Pay", for: UIControlState.normal) + } + + self.billingIdMid = "\(midTerm.igpBillID)" + self.paymentCodeMid = "\(midTerm.igpPayID)" + self.txtBillingIDMid.text = "\(midTerm.igpBillID)" + self.txtPaymentCodeMid.text = "\(midTerm.igpPayID)" + self.txtAmountMid.text = "\(midTerm.igpAmount) Rials" + + if midTerm.igpAmount != 0 { + self.manageButtonsView(buttons: [self.btnPaymentMid]) + self.manageViews(views: [self.viewTwo]) + self.btnPaymentMid.setTitle("Pay", for: UIControlState.normal) + } else { + self.manageButtonsView(buttons: [self.btnPaymentMid],enable: false) + self.manageViews(views: [self.viewTwo], enable: false) + self.btnPaymentMid.setTitle("Pay", for: UIControlState.normal) + } + } + } + + /*********************************************************/ + /********************* User Actions **********************/ + /*********************************************************/ + + + @IBAction func btnInquiry(_ sender: UIButton) { + + self.view.endEditing(true) + + if IGFinancialServiceBillingInquiry.isMobile { + + guard let phoneNumber: String! = edtPhoneNumber.text else { + return + } + + if (phoneNumber.characters.count != 11 || !phoneNumber.isNumber) { + showErrorAlertView(title: "Error", message: "phone number is wrong!") + return + } + + IGGlobal.prgShow(self.view) + IGBillInquiryMci.Generator.generate(mobileNumber: Int64(phoneNumber)!).success({ (protoResponse) in + IGGlobal.prgHide() + if let billInquiryMciResponse = protoResponse as? IGPBillInquiryMciResponse { + self.manageInquiryMci(lastTerm: billInquiryMciResponse.igpLastTerm, midTerm: billInquiryMciResponse.igpMidTerm) + } + }).error ({ (errorCode, waitTime) in + IGGlobal.prgHide() + switch errorCode { + case .timeout: + DispatchQueue.main.async { + let alert = UIAlertController(title: "Timeout", message: "Please try again later!", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.present(alert, animated: true, completion: nil) + } + default: + break + } + + }).send() + } else { + + guard let phoneNumber: String! = edtPhoneNumber.text else { + return + } + + if (phoneNumber.characters.count < 5 || !phoneNumber.isNumber) { + showErrorAlertView(title: "Error", message: "phone number is wrong!") + return + } + + + guard let provisionCode: String! = edtProvisionCode.text else { + return + } + + if (provisionCode.characters.count < 1 || !provisionCode.isNumber) { + showErrorAlertView(title: "Error", message: "phone number is wrong!") + return + } + + IGGlobal.prgShow(self.view) + IGBillInquiryTelecom.Generator.generate(provinceCode: Int32(provisionCode)!, telephoneNumber: Int64(phoneNumber)!).success({ (protoResponse) in + IGGlobal.prgHide() + if let billInquiryMciResponse = protoResponse as? IGPBillInquiryTelecomResponse { + self.manageInquiryTelecom(lastTerm: billInquiryMciResponse.igpLastTerm, midTerm: billInquiryMciResponse.igpMidTerm) + } + }).error ({ (errorCode, waitTime) in + IGGlobal.prgHide() + switch errorCode { + case .timeout: + DispatchQueue.main.async { + let alert = UIAlertController(title: "Timeout", message: "Please try again later!", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.present(alert, animated: true, completion: nil) + } + default: + break + } + + }).send() + } + } + + @IBAction func btnPayment(_ sender: UIButton) { + fetchPaymentToken(billId: billingId, payId: paymentCode) + } + + @IBAction func btnPaymentMid(_ sender: UIButton) { + fetchPaymentToken(billId: billingIdMid, payId: paymentCodeMid) + } + + /*********************************************************/ + /*************** Overrided Payment Mehtods ***************/ + /*********************************************************/ + + func BillMerchantUpdate(encData: String, message: String, status: Int) { + self.navigationController?.popViewController(animated: true) + } + + func BillMerchantError(errorType: Int) { + showErrorAlertView(title: "Bill Payment Error", message: "Bill payment error occurred!", dismiss: true) + } + + /*********************************************************/ + /******************* Overrided Method ********************/ + /*********************************************************/ + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + self.view.endEditing(true) + return false + } +} diff --git a/iGap/Controller/View Controllers/Financial Services/IGFinancialServiceCharge.swift b/iGap/Controller/View Controllers/Financial Services/IGFinancialServiceCharge.swift new file mode 100644 index 0000000..cb5e455 --- /dev/null +++ b/iGap/Controller/View Controllers/Financial Services/IGFinancialServiceCharge.swift @@ -0,0 +1,398 @@ +/* + * This is the source code of iGap for iOS + * It is licensed under GNU AGPL v3.0 + * You should have received a copy of the license in this archive (see LICENSE). + * Copyright © 2017 , iGap - www.iGap.net + * iGap Messenger | Free, Fast and Secure instant messaging application + * The idea of the RooyeKhat Media Company - www.RooyeKhat.co + * All rights reserved. + */ + +import UIKit +import IGProtoBuff +import PecPayment + +protocol AlertClouser { + func onActionClick(title: String) +} + +class IGFinancialServiceCharge: UIViewController, UIGestureRecognizerDelegate, UITextFieldDelegate, MerchantResultObserver, TopupMerchantResultObserver { + + @IBOutlet weak var edtPhoneNubmer: UITextField! + @IBOutlet weak var txtOperatorTransport: UILabel! + @IBOutlet weak var btnOperator: UIButton! + @IBOutlet weak var btnChargeType: UIButton! + @IBOutlet weak var btnPrice: UIButton! + @IBOutlet weak var btnBuy: UIButton! + + let PHONE_LENGTH = 11 + var latestPhoneNumber = "" + + let operatorIrancell = "Irancell" + let operatorMCI = "MCI" + let operatorRightel = "Rightel" + let operatorNotDetect = "Not Detect Operator" + + let normalCharge = "Normal" + let amazingCharge = "Amazing" + let wimaxCharge = "Wimax" + let permanently = "Permanently SIM Card" + + let P1000: Int64 = 10000 + let P2000: Int64 = 20000 + let P5000: Int64 = 50000 + let P10000: Int64 = 100000 + let P20000: Int64 = 200000 + let rials = "Rials" + + var operatorDictionary: [String:IGOperator] = + ["0910":IGOperator.mci, + "0911":IGOperator.mci, + "0912":IGOperator.mci, + "0913":IGOperator.mci, + "0914":IGOperator.mci, + "0915":IGOperator.mci, + "0916":IGOperator.mci, + "0917":IGOperator.mci, + "0918":IGOperator.mci, + "0919":IGOperator.mci, + "0990":IGOperator.mci, + "0991":IGOperator.mci, + + "0901":IGOperator.irancell, + "0902":IGOperator.irancell, + "0903":IGOperator.irancell, + "0930":IGOperator.irancell, + "0933":IGOperator.irancell, + "0935":IGOperator.irancell, + "0936":IGOperator.irancell, + "0937":IGOperator.irancell, + "0938":IGOperator.irancell, + "0939":IGOperator.irancell, + + "0920":IGOperator.rightel, + "0921":IGOperator.rightel, + "0922":IGOperator.rightel] + + var operatorType: IGOperator! + var operatorTypeBackup: IGOperator! + var operatorChargeType: IGPMplGetTopupToken.IGPType! + var chargeAmount: Int64! + var operatorTransport: Bool = false + + override func viewDidLoad() { + super.viewDidLoad() + + edtPhoneNubmer.delegate = self + + initNavigationBar() + manageButtonsView(buttons: [btnOperator,btnChargeType,btnPrice,btnBuy]) + ButtonViewActivate(button: btnOperator ,isEnable: false) + } + + func initNavigationBar(){ + let navigationItem = self.navigationItem as! IGNavigationItem + navigationItem.addNavigationViewItems(rightItemText: nil, title: "Top Up SIM Card") + navigationItem.navigationController = self.navigationController as? IGNavigationController + let navigationController = self.navigationController as! IGNavigationController + navigationController.interactivePopGestureRecognizer?.delegate = self + } + + private func manageButtonsView(buttons: [UIButton]){ + for btn in buttons { + btn.removeUnderline() + btn.layer.cornerRadius = 5 + btn.layer.borderWidth = 1 + btn.layer.borderColor = UIColor.iGapColor().cgColor + } + } + + private func ButtonViewActivate(button: UIButton, isEnable: Bool){ + + if isEnable { + button.layer.borderColor = UIColor.iGapColor().cgColor + button.layer.backgroundColor = UIColor.white.cgColor + } else { + button.layer.borderColor = UIColor.gray.cgColor + button.layer.backgroundColor = UIColor.lightGray.cgColor + } + } + + private func setOperator(){ + + if operatorType == nil { + btnOperator.setTitle(operatorNotDetect, for: UIControlState.normal) + return + } + + switch operatorType { + case .irancell: + btnOperator.setTitle(operatorIrancell, for: UIControlState.normal) + break + + case .mci: + btnOperator.setTitle(operatorMCI, for: UIControlState.normal) + break + + case .rightel: + btnOperator.setTitle(operatorRightel, for: UIControlState.normal) + break + + default: + break + } + + operatorChargeType = nil + self.btnChargeType.setTitle("Choose Charge Type", for: UIControlState.normal) + } + + private func showAlertView(title: String, message: String?, subtitles: [String], alertClouser: @escaping ((_ title :String) -> Void), hasCancel: Bool = true){ + let option = UIAlertController(title: title, message: message, preferredStyle: IGGlobal.detectAlertStyle()) + + for subtitle in subtitles { + let action = UIAlertAction(title: subtitle, style: .default, handler: { (action) in + alertClouser(action.title!) + }) + option.addAction(action) + } + + let cancel = UIAlertAction(title: "Cancel", style: .cancel, handler: nil) + + option.addAction(cancel) + + self.present(option, animated: true, completion: {}) + } + + private func showErrorAlertView(title: String, message: String?, dismiss: Bool = false){ + let option = UIAlertController(title: title, message: message, preferredStyle: .alert) + let ok = UIAlertAction(title: "Ok", style: .cancel, handler: { (action) in + if dismiss { + self.navigationController?.popViewController(animated: true) + } + }) + option.addAction(ok) + self.present(option, animated: true, completion: {}) + } + + private func registerTopup(token: String){ + let initpayment = InitPayment() + initpayment.registerTopup(merchant: self) + initpayment.initTopupPayment(Token: token, MerchantVCArg: self, TSPEnabled: 0) + } + + /*********************************************************/ + /********************* User Actions **********************/ + /*********************************************************/ + + @IBAction func switchToggle(_ sender: UISwitch) { + if sender.isOn { + operatorTransport = true + txtOperatorTransport.text = "Ported Subscriber Enable" + txtOperatorTransport.textColor = UIColor.iGapColor() + } else { + operatorTransport = false + txtOperatorTransport.text = "Ported Subscriber Disable" + txtOperatorTransport.textColor = UIColor.gray + + if operatorTypeBackup != nil { + operatorType = operatorTypeBackup + setOperator() + } + } + btnOperator.isEnabled = sender.isOn + ButtonViewActivate(button: btnOperator, isEnable: sender.isOn) + } + + @IBAction func btnChooseOperator(_ sender: UIButton) { + showAlertView(title: "Choose Operator", message: nil, subtitles: [operatorIrancell,operatorMCI,operatorRightel], alertClouser: { (title) -> Void in + + switch title { + case self.operatorIrancell: + self.operatorType = IGOperator.irancell + self.setOperator() + break + case self.operatorMCI: + self.operatorType = IGOperator.mci + self.setOperator() + break + case self.operatorRightel: + self.operatorType = IGOperator.rightel + self.setOperator() + break + default: + break + } + self.view.endEditing(true) + }) + } + + @IBAction func btnChooseChargeType(_ sender: UIButton) { + + var chargeType: [String] = [normalCharge] + if operatorType == IGOperator.irancell { + chargeType = [normalCharge,amazingCharge,wimaxCharge,permanently] + } + + showAlertView(title: "Charge Type", message: nil, subtitles: chargeType, alertClouser: { (title) -> Void in + + switch title { + case self.normalCharge: + if self.operatorType == IGOperator.irancell { + self.operatorChargeType = IGPMplGetTopupToken.IGPType.irancellPrepaid + } else if self.operatorType == IGOperator.mci { + self.operatorChargeType = IGPMplGetTopupToken.IGPType.mci + } else if self.operatorType == IGOperator.rightel { + self.operatorChargeType = IGPMplGetTopupToken.IGPType.rightel + } + self.btnChargeType.setTitle(self.normalCharge, for: UIControlState.normal) + break + + case self.amazingCharge: + self.operatorChargeType = IGPMplGetTopupToken.IGPType.irancellWow + self.btnChargeType.setTitle(self.amazingCharge, for: UIControlState.normal) + break + + case self.wimaxCharge: + self.operatorChargeType = IGPMplGetTopupToken.IGPType.irancellWimax + self.btnChargeType.setTitle(self.wimaxCharge, for: UIControlState.normal) + break + + case self.permanently: + self.operatorChargeType = IGPMplGetTopupToken.IGPType.irancellPostpaid + self.btnChargeType.setTitle(self.permanently, for: UIControlState.normal) + break + + default: + break + } + self.view.endEditing(true) + }) + } + + @IBAction func btnChoosePrice(_ sender: UIButton) { + + let chargePrice = ["\(P1000) \(rials)" , "\(P2000) \(rials)" , "\(P5000) \(rials)", "\(P10000) \(rials)", "\(P20000) \(rials)"] + + showAlertView(title: "Charge Price", message: nil, subtitles: chargePrice, alertClouser: { (title) -> Void in + switch title { + case "\(self.P1000) \(self.rials)": + self.chargeAmount = self.P1000 + break + case "\(self.P2000) \(self.rials)": + self.chargeAmount = self.P2000 + break + case "\(self.P5000) \(self.rials)": + self.chargeAmount = self.P5000 + break + case "\(self.P10000) \(self.rials)": + self.chargeAmount = self.P10000 + break + case "\(self.P20000) \(self.rials)": + self.chargeAmount = self.P20000 + break + default: + break + } + self.btnPrice.setTitle(title, for: UIControlState.normal) + self.view.endEditing(true) + }) + } + + @IBAction func btnBuy(_ sender: UIButton) { + + guard let phoneNumber: String! = edtPhoneNubmer.text else { + return + } + + if (phoneNumber.characters.count) < 11 || !phoneNumber.isNumber || (operatorDictionary[(phoneNumber!.substring(offset: 4))] == nil) { + showErrorAlertView(title: "Error", message: "phone number is wrong!") + return + } + + if operatorChargeType == nil || chargeAmount == nil { + showErrorAlertView(title: "Error", message: "Please complete all options!") + return + } + + IGGlobal.prgShow(self.view) + IGMplGetTopupToken.Generator.generate(number: Int64(phoneNumber!)!, amount: chargeAmount, type: operatorChargeType).success({ (protoResponse) in + IGGlobal.prgHide() + if let getTokenResponse = protoResponse as? IGPMplGetTopupTokenResponse { + if getTokenResponse.igpStatus == 0 { //success + self.registerTopup(token: getTokenResponse.igpToken) + } else { + self.showErrorAlertView(title: "خطا", message: getTokenResponse.igpMessage) + } + } + }).error ({ (errorCode, waitTime) in + IGGlobal.prgHide() + switch errorCode { + case .timeout: + DispatchQueue.main.async { + let alert = UIAlertController(title: "Timeout", message: "Please try again later!", preferredStyle: .alert) + let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) + alert.addAction(okAction) + self.present(alert, animated: true, completion: nil) + } + default: + break + } + + }).send() + } + + + /*********************************************************/ + /*************** Overrided Payment Mehtods ***************/ + /*********************************************************/ + + func TopupMerchantUpdate(encData: String, message: String, status: Int) { + self.navigationController?.popViewController(animated: true) + } + + func TopupMerchantError(errorType: Int) { + showErrorAlertView(title: "Payment Error", message: "Payment error occurred!", dismiss: true) + } + + + + func update(encData: String, message: String, status: Int) { + self.navigationController?.popViewController(animated: true) + } + + func error(errorType: Int, orderID: Int) { + self.navigationController?.popViewController(animated: true) + } + + /*********************************************************/ + /******************* Overrided Method ********************/ + /*********************************************************/ + + func textFieldShouldReturn(_ textField: UITextField) -> Bool { + self.view.endEditing(true) + return false + } + + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { + + if let text = edtPhoneNubmer.text { + let newLength = text.characters.count + string.characters.count - range.length + if (newLength == PHONE_LENGTH) { + operatorTypeBackup = operatorDictionary[text.substring(offset: 4)] + if !operatorTransport { + operatorType = operatorTypeBackup + } + setOperator() + latestPhoneNumber = text + DispatchQueue.main.asyncAfter(wallDeadline: .now() + 0.5){ + self.view.endEditing(true) + } + } else if (newLength > PHONE_LENGTH) { + edtPhoneNubmer.text = latestPhoneNumber + } else { + latestPhoneNumber = text + } + } + return true + } +} diff --git a/iGap/Controller/View Controllers/Map/IGMap.swift b/iGap/Controller/View Controllers/Map/IGMap.swift index c77f13b..14c3858 100644 --- a/iGap/Controller/View Controllers/Map/IGMap.swift +++ b/iGap/Controller/View Controllers/Map/IGMap.swift @@ -89,6 +89,8 @@ class IGMap: UIViewController, CLLocationManagerDelegate, UIGestureRecognizerDel override func viewDidLoad() { super.viewDidLoad() + btnComment.removeUnderline() + btnCurrentLocation.removeUnderline() edtComment.delegate = self initNavigationBar() diff --git a/iGap/Controller/View Controllers/New Conversation/IGContactTableViewCell.swift b/iGap/Controller/View Controllers/New Conversation/IGContactTableViewCell.swift index 6f2358a..70abed9 100644 --- a/iGap/Controller/View Controllers/New Conversation/IGContactTableViewCell.swift +++ b/iGap/Controller/View Controllers/New Conversation/IGContactTableViewCell.swift @@ -16,6 +16,7 @@ class IGContactTableViewCell: UITableViewCell { @IBOutlet weak var userAvatarView: IGAvatarView! @IBOutlet weak var contactNameLable: UILabel! + @IBOutlet weak var btnCall: UIButton! override func awakeFromNib() { super.awakeFromNib() @@ -26,6 +27,7 @@ class IGContactTableViewCell: UITableViewCell { } func setUser(_ user: IGRegisteredUser) { + btnCall.removeUnderline() contactNameLable.text = user.displayName userAvatarView.setUser(user) self.userRegister = user diff --git a/iGap/Controller/View Controllers/New Conversation/IGCreateNewChannelTableViewController.swift b/iGap/Controller/View Controllers/New Conversation/IGCreateNewChannelTableViewController.swift index 0dae9ce..82286a8 100644 --- a/iGap/Controller/View Controllers/New Conversation/IGCreateNewChannelTableViewController.swift +++ b/iGap/Controller/View Controllers/New Conversation/IGCreateNewChannelTableViewController.swift @@ -40,7 +40,7 @@ class IGCreateNewChannelTableViewController: UITableViewController { } navigationItem.rightViewContainer?.addAction { if self.channelnameTextField.text?.isEmpty == true { - let alert = UIAlertController(title: "Alert", message: "Please fill in the Channel name field. ", preferredStyle: UIAlertControllerStyle.alert) + let alert = UIAlertController(title: "Hint", message: "Please write your channel name !", preferredStyle: UIAlertControllerStyle.alert) alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil)) alert.view.tintColor = UIColor.organizationalColor() self.present(alert, animated: true, completion: nil) diff --git a/iGap/Controller/View Controllers/Setting/IGSettingContactTableViewCell.swift b/iGap/Controller/View Controllers/Setting/IGSettingContactTableViewCell.swift index ac98aaa..542ea63 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingContactTableViewCell.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingContactTableViewCell.swift @@ -16,6 +16,7 @@ class IGSettingContactTableViewCell: MGSwipeTableCell { @IBOutlet weak var userAvatarView: IGAvatarView! @IBOutlet weak var contactNameLable: UILabel! @IBOutlet weak var lastSeenStatusLabel: UILabel! + @IBOutlet weak var btnCall: UIButton! var registeredUser: IGRegisteredUser! @@ -41,7 +42,7 @@ class IGSettingContactTableViewCell: MGSwipeTableCell { } func setUser(_ user: IGRegisteredUser) { - + btnCall.removeUnderline() self.registeredUser = user contactNameLable.text = user.displayName diff --git a/iGap/Controller/View Controllers/Setting/IGSettingContactsTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingContactsTableViewController.swift index 3565912..28a7d6c 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingContactsTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingContactsTableViewController.swift @@ -328,17 +328,18 @@ class IGSettingContactsTableViewController: UITableViewController,UISearchResult contactsCell.setUser(user.registredUser) // } - contactsCell.rightButtons = [MGSwipeButton(title: "Delete", backgroundColor: UIColor.swipeRed(), callback: { (sender: MGSwipeTableCell!) -> Bool in - + let delete = MGSwipeButton(title: "Delete", backgroundColor: UIColor.swipeRed(), callback: { (sender: MGSwipeTableCell!) -> Bool in self.deleteContactAlert(phone: user.registredUser.phone) return true - - }),MGSwipeButton(title: "Edit", backgroundColor: UIColor.swipeBlueGray(), callback: { (sender: MGSwipeTableCell!) -> Bool in - + }) + + let edit = MGSwipeButton(title: "Edit", backgroundColor: UIColor.swipeBlueGray(), callback: { (sender: MGSwipeTableCell!) -> Bool in self.contactEditAlert(phone: user.registredUser.phone, firstname: user.registredUser.firstName, lastname: user.registredUser.lastName) return true - - })] + }) + + contactsCell.rightButtons = [delete, edit] + removeButtonsUnderline(buttons: [delete, edit]) contactsCell.rightSwipeSettings.transition = MGSwipeTransition.border contactsCell.rightExpansion.buttonIndex = 0 contactsCell.rightExpansion.fillOnTrigger = true @@ -354,6 +355,12 @@ class IGSettingContactsTableViewController: UITableViewController,UISearchResult return cell } + private func removeButtonsUnderline(buttons: [UIButton]){ + for btn in buttons { + btn.removeUnderline() + } + } + override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String { if section == 0 { return " " diff --git a/iGap/Controller/View Controllers/Setting/IGSettingTableViewController.swift b/iGap/Controller/View Controllers/Setting/IGSettingTableViewController.swift index 5c7bc2c..3a7bd42 100644 --- a/iGap/Controller/View Controllers/Setting/IGSettingTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/IGSettingTableViewController.swift @@ -50,7 +50,7 @@ class IGSettingTableViewController: UITableViewController , NVActivityIndicatorV let realm = try! Realm() let predicate = NSPredicate(format: "id = %lld", currentUserId!) if let userInDb = realm.objects(IGRegisteredUser.self).filter(predicate).first { - userAvatarView.setUser(userInDb) + userAvatarView.setUser(userInDb, showMainAvatar: true) usernameLabel.text = userInDb.displayName user = userInDb userAvatarView.avatarImageView?.isUserInteractionEnabled = true diff --git a/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController.swift b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController.swift index 78289a7..ba537e4 100644 --- a/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController.swift @@ -34,6 +34,8 @@ class IGSettingPrivacyAndSecurityTwoStepVerificationOptionsTableViewController: override func viewDidLoad() { super.viewDidLoad() + btnOutletVerify.removeUnderline() + let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self diff --git a/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController.swift b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController.swift index ef1fc60..6afa548 100644 --- a/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController.swift +++ b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController.swift @@ -16,12 +16,15 @@ import MBProgressHUD class IGSettingPrivacyAndSecurityTwoStepVerificationVerifyPasswordTableViewController: UITableViewController, UIGestureRecognizerDelegate { @IBOutlet weak var passwordTextField: UITextField! + @IBOutlet weak var btnForgetPassword: UIButton! var twoStepVerification: IGTwoStepVerification? override func viewDidLoad() { super.viewDidLoad() + btnForgetPassword.removeUnderline() + let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self diff --git a/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationVerifyUnconfirmedEmail.swift b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationVerifyUnconfirmedEmail.swift index f4b30dc..dbe5266 100644 --- a/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationVerifyUnconfirmedEmail.swift +++ b/iGap/Controller/View Controllers/Setting/TwoStep Verification/IGSettingPrivacyAndSecurityTwoStepVerificationVerifyUnconfirmedEmail.swift @@ -31,6 +31,8 @@ class IGSettingPrivacyAndSecurityTwoStepVerificationVerifyUnconfirmedEmail: UITa override func viewDidLoad() { super.viewDidLoad() + btnOutletResendCode.removeUnderline() + let navigationController = self.navigationController as! IGNavigationController navigationController.interactivePopGestureRecognizer?.delegate = self let navigationItem = self.navigationItem as! IGNavigationItem diff --git a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPasswordViewController.swift b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPasswordViewController.swift index ed50e64..adc23b8 100644 --- a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPasswordViewController.swift +++ b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPasswordViewController.swift @@ -138,7 +138,7 @@ class IGRegistrationStepPasswordViewController: UIViewController, UIGestureRecog switch protoResponse { case _ as IGPUserLoginResponse: IGUserLoginRequest.Handler.intrepret(response: (protoResponse as? IGPUserLoginResponse)!) - IGAppManager.sharedManager.setUserLoginSuccessful() + IGAppManager.sharedManager.isUserLoggedIn.value = true IGUserInfoRequest.Generator.generate(userID: IGAppManager.sharedManager.userID()!).success({ (protoResponse) in DispatchQueue.main.async { @@ -151,8 +151,9 @@ class IGRegistrationStepPasswordViewController: UIViewController, UIGestureRecog break } self.hud.hide(animated: true) - IGAppManager.sharedManager.setUserLoginSuccessful() - self.dismiss(animated: true, completion: nil) + self.dismiss(animated: true, completion: { + IGAppManager.sharedManager.setUserLoginSuccessful() + }) } }).error({ (errorCode, waitTime) in DispatchQueue.main.async { @@ -169,7 +170,13 @@ class IGRegistrationStepPasswordViewController: UIViewController, UIGestureRecog } } }).error({ (errorCode, waitTime) in - + DispatchQueue.main.async { + self.hud.hide(animated: true) + let alertVC = UIAlertController(title: "Error", message: "There was an error logging you in. Try again please.", preferredStyle: .alert) + let ok = UIAlertAction(title: "OK", style: .default, handler: nil) + alertVC.addAction(ok) + self.present(alertVC, animated: true, completion: nil) + } }).send() } diff --git a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPhoneViewController.swift b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPhoneViewController.swift index 9a17fcf..4b923d7 100644 --- a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPhoneViewController.swift +++ b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepPhoneViewController.swift @@ -25,6 +25,7 @@ class IGRegistrationStepPhoneViewController: UIViewController { @IBOutlet weak var termLabel: UILabel! @IBOutlet weak var countryNameLabel: UILabel! @IBOutlet weak var countryCodeLabel: UILabel! + @IBOutlet weak var btnLoginQrCode: UIButton! internal static var allowGetCountry:Bool = true var phone: String? @@ -68,6 +69,9 @@ class IGRegistrationStepPhoneViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() + + btnLoginQrCode.removeUnderline() + IGAppManager.sharedManager.connectionStatus.asObservable().subscribe(onNext: { (connectionStatus) in DispatchQueue.main.async { self.updateNavigationBarBasedOnNetworkStatus(connectionStatus) diff --git a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepProfileInfoViewController.swift b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepProfileInfoViewController.swift index f7ae06e..f21f91f 100644 --- a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepProfileInfoViewController.swift +++ b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepProfileInfoViewController.swift @@ -61,6 +61,7 @@ class IGRegistrationStepProfileInfoViewController: UITableViewController { func didTapOnDone() { if let nickname = nicknameTextField.text { + IGGlobal.prgShow(self.view) IGUserProfileSetNicknameRequest.Generator.generate(nickname: nickname).success({ (responseProto) in DispatchQueue.main.async { switch responseProto { @@ -77,14 +78,14 @@ class IGRegistrationStepProfileInfoViewController: UITableViewController { default: break } -// self.hud.hide(animated: true) - IGAppManager.sharedManager.setUserLoginSuccessful() - self.dismiss(animated: true, completion: nil) - + IGGlobal.prgHide() + self.dismiss(animated: true, completion: { + IGAppManager.sharedManager.setUserLoginSuccessful() + }) } }).error({ (errorCode, waitTime) in DispatchQueue.main.async { -// self.hud.hide(animated: true) + IGGlobal.prgHide() let alertVC = UIAlertController(title: "Error", message: "There was an error logging you in. Try again please.", preferredStyle: .alert) let ok = UIAlertAction(title: "OK", style: .default, handler: nil) alertVC.addAction(ok) @@ -99,7 +100,7 @@ class IGRegistrationStepProfileInfoViewController: UITableViewController { } }).error({ (errorCode, waitTime) in DispatchQueue.main.async { -// self.hud.hide(animated: true) + IGGlobal.prgHide() let alertVC = UIAlertController(title: "Error", message: "There was an error setting your nickname. Try again please.", preferredStyle: .alert) let ok = UIAlertAction(title: "OK", style: .default, handler: nil) alertVC.addAction(ok) diff --git a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepVerificationCodeViewController.swift b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepVerificationCodeViewController.swift index fab0ccf..4e6bafc 100644 --- a/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepVerificationCodeViewController.swift +++ b/iGap/Controller/View Controllers/Splash and Register/IGRegistrationStepVerificationCodeViewController.swift @@ -189,7 +189,6 @@ class IGRegistrationStepVerificationCodeViewController: UIViewController, UIGest if let code = Int32(codeTextField.text!){ IGUserVerifyRequest.Generator.generate(usename: self.username!, code: code).success({ (responseProto) in DispatchQueue.main.async { - self.hud.hide(animated: false) switch responseProto { case let userVerifyReponse as IGPUserVerifyResponse: let interpretedResponse = IGUserVerifyRequest.Handler.intrepret(response: userVerifyReponse) @@ -277,7 +276,7 @@ class IGRegistrationStepVerificationCodeViewController: UIViewController, UIGest switch protoResponse { case _ as IGPUserLoginResponse: IGUserLoginRequest.Handler.intrepret(response: (protoResponse as? IGPUserLoginResponse)!) - IGAppManager.sharedManager.setUserLoginSuccessful() + IGAppManager.sharedManager.isUserLoggedIn.value = true if self.isUserNew! { self.hud.hide(animated: true) self.performSegue(withIdentifier: "showYourProfile", sender: self) @@ -293,8 +292,10 @@ class IGRegistrationStepVerificationCodeViewController: UIViewController, UIGest break } self.hud.hide(animated: true) - IGAppManager.sharedManager.setUserLoginSuccessful() - self.dismiss(animated: true, completion: nil) + + self.dismiss(animated: true, completion: { + IGAppManager.sharedManager.setUserLoginSuccessful() + }) } }).error({ (errorCode, waitTime) in DispatchQueue.main.async { @@ -312,7 +313,13 @@ class IGRegistrationStepVerificationCodeViewController: UIViewController, UIGest } } }).error({ (errorCode, waitTime) in - + DispatchQueue.main.async { + self.hud.hide(animated: true) + let alertVC = UIAlertController(title: "Error", message: "There was an error logging you in. Try again please.", preferredStyle: .alert) + let ok = UIAlertAction(title: "OK", style: .default, handler: nil) + alertVC.addAction(ok) + self.present(alertVC, animated: true, completion: nil) + } }).send() } } diff --git a/iGap/Controller/View Controllers/Splash and Register/IGSplashScreenViewController.swift b/iGap/Controller/View Controllers/Splash and Register/IGSplashScreenViewController.swift index ca75845..e9af022 100644 --- a/iGap/Controller/View Controllers/Splash and Register/IGSplashScreenViewController.swift +++ b/iGap/Controller/View Controllers/Splash and Register/IGSplashScreenViewController.swift @@ -35,6 +35,9 @@ class IGSplashScreenViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() + skipButton.removeUnderline() + startButton.removeUnderline() + IGContactManager.importedContact = false // Do any additional setup after loading the view. diff --git a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChannelsTableViewController.swift b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChannelsTableViewController.swift index 44e2e75..be3ab4b 100644 --- a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChannelsTableViewController.swift +++ b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChannelsTableViewController.swift @@ -148,7 +148,7 @@ class IGChannelsTableViewController: UITableViewController { pinTitle = "UnPin" } - cell.rightButtons = [MGSwipeButton(title: muteTitle, backgroundColor: UIColor(red: 90.0/255.0, green: 90.0/255.0, blue: 90.0/255.0, alpha: 1), callback: { (sender: MGSwipeTableCell!) -> Bool in + let btnMuteSwipeCell = MGSwipeButton(title: muteTitle, backgroundColor: UIColor.swipeGray(), callback: { (sender: MGSwipeTableCell!) -> Bool in if self.connectionStatus == .waitingForNetwork || self.connectionStatus == .connecting { let alert = UIAlertController(title: "Error", message: "No Network Connection", preferredStyle: .alert) let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) @@ -159,7 +159,9 @@ class IGChannelsTableViewController: UITableViewController { self.muteRoom(room: room) } return true - }),MGSwipeButton(title: pinTitle, backgroundColor: UIColor(red: 50.0/255.0, green: 100.0/255.0, blue: 122.0/255.0, alpha: 1), callback: { (sender: MGSwipeTableCell!) -> Bool in + }) + + let btnPinSwipeCell = MGSwipeButton(title: pinTitle, backgroundColor: UIColor.swipeBlueGray(), callback: { (sender: MGSwipeTableCell!) -> Bool in if self.connectionStatus == .waitingForNetwork || self.connectionStatus == .connecting { let alert = UIAlertController(title: "Error", message: "No Network Connection", preferredStyle: .alert) let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) @@ -170,8 +172,9 @@ class IGChannelsTableViewController: UITableViewController { self.pinRoom(room: room) } return true - - }),MGSwipeButton(title: "More...", backgroundColor: UIColor(red: 26.0/255.0, green: 67.0/255.0, blue: 90.0/255.0, alpha: 1), callback: { (sender: MGSwipeTableCell!) -> Bool in + }) + + let btnMoreSwipeCell = MGSwipeButton(title: "More...", backgroundColor: UIColor(red: 26.0/255.0, green: 67.0/255.0, blue: 90.0/255.0, alpha: 1), callback: { (sender: MGSwipeTableCell!) -> Bool in let title = room.title != nil ? room.title! : "Delete" let alertC = UIAlertController(title: title, message: "What do you want to do?", preferredStyle: IGGlobal.detectAlertStyle()) let clear = UIAlertAction(title: "Clear History", style: .default, handler: { (action) in @@ -358,7 +361,12 @@ class IGChannelsTableViewController: UITableViewController { }) return true - })] + }) + + let buttons = [btnMuteSwipeCell, btnPinSwipeCell, btnMoreSwipeCell] + cell.rightButtons = buttons + removeButtonsUnderline(buttons: buttons) + cell.rightSwipeSettings.transition = MGSwipeTransition.border cell.rightExpansion.buttonIndex = 0 cell.rightExpansion.fillOnTrigger = true @@ -374,6 +382,12 @@ class IGChannelsTableViewController: UITableViewController { return cell } + private func removeButtonsUnderline(buttons: [UIButton]){ + for btn in buttons { + btn.removeUnderline() + } + } + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { selectedRoomForSegue = rooms![indexPath.row] self.tableView.isUserInteractionEnabled = false diff --git a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChatsTableViewController.swift b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChatsTableViewController.swift index 0707e93..9e6d494 100644 --- a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChatsTableViewController.swift +++ b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGChatsTableViewController.swift @@ -139,7 +139,7 @@ class IGChatsTableViewController: UITableViewController { pinTitle = "UnPin" } - cell.rightButtons = [MGSwipeButton(title: muteTitle, backgroundColor: UIColor(red: 90.0/255.0, green: 90.0/255.0, blue: 90.0/255.0, alpha: 1), callback: { (sender: MGSwipeTableCell!) -> Bool in + let btnMuteSwipeCell = MGSwipeButton(title: muteTitle, backgroundColor: UIColor.swipeGray(), callback: { (sender: MGSwipeTableCell!) -> Bool in if self.connectionStatus == .waitingForNetwork || self.connectionStatus == .connecting { let alert = UIAlertController(title: "Error", message: "No Network Connection", preferredStyle: .alert) let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) @@ -150,7 +150,9 @@ class IGChatsTableViewController: UITableViewController { self.muteRoom(room: room) } return true - }),MGSwipeButton(title: pinTitle, backgroundColor: UIColor(red: 50.0/255.0, green: 100.0/255.0, blue: 122.0/255.0, alpha: 1), callback: { (sender: MGSwipeTableCell!) -> Bool in + }) + + let btnPinSwipeCell = MGSwipeButton(title: pinTitle, backgroundColor: UIColor.swipeBlueGray(), callback: { (sender: MGSwipeTableCell!) -> Bool in if self.connectionStatus == .waitingForNetwork || self.connectionStatus == .connecting { let alert = UIAlertController(title: "Error", message: "No Network Connection", preferredStyle: .alert) let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) @@ -162,7 +164,9 @@ class IGChatsTableViewController: UITableViewController { } return true - }),MGSwipeButton(title: "More...", backgroundColor: UIColor(red: 26.0/255.0, green: 67.0/255.0, blue: 90.0/255.0, alpha: 1), callback: { (sender: MGSwipeTableCell!) -> Bool in + }) + + let btnMoreSwipeCell = MGSwipeButton(title: "More...", backgroundColor: UIColor(red: 26.0/255.0, green: 67.0/255.0, blue: 90.0/255.0, alpha: 1), callback: { (sender: MGSwipeTableCell!) -> Bool in let title = room.title != nil ? room.title! : "Delete" let alertC = UIAlertController(title: title, message: "What do you want to do?", preferredStyle: IGGlobal.detectAlertStyle()) let clear = UIAlertAction(title: "Clear History", style: .default, handler: { (action) in @@ -336,7 +340,12 @@ class IGChatsTableViewController: UITableViewController { }) return true - })] + }) + + let buttons = [btnMuteSwipeCell, btnPinSwipeCell, btnMoreSwipeCell] + cell.rightButtons = buttons + removeButtonsUnderline(buttons: buttons) + cell.rightSwipeSettings.transition = MGSwipeTransition.border cell.rightExpansion.buttonIndex = 0 cell.rightExpansion.fillOnTrigger = true @@ -352,6 +361,12 @@ class IGChatsTableViewController: UITableViewController { return cell } + private func removeButtonsUnderline(buttons: [UIButton]){ + for btn in buttons { + btn.removeUnderline() + } + } + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { selectedRoomForSegue = rooms![indexPath.row] self.tableView.isUserInteractionEnabled = false diff --git a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGGroupsTableViewController.swift b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGGroupsTableViewController.swift index 88859ad..b80fdcb 100644 --- a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGGroupsTableViewController.swift +++ b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGGroupsTableViewController.swift @@ -138,7 +138,7 @@ class IGGroupsTableViewController: UITableViewController { pinTitle = "UnPin" } - cell.rightButtons = [MGSwipeButton(title: muteTitle, backgroundColor: UIColor(red: 90.0/255.0, green: 90.0/255.0, blue: 90.0/255.0, alpha: 1), callback: { (sender: MGSwipeTableCell!) -> Bool in + let btnMuteSwipeCell = MGSwipeButton(title: muteTitle, backgroundColor: UIColor.swipeGray(), callback: { (sender: MGSwipeTableCell!) -> Bool in if self.connectionStatus == .waitingForNetwork || self.connectionStatus == .connecting { let alert = UIAlertController(title: "Error", message: "No Network Connection", preferredStyle: .alert) let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) @@ -149,7 +149,9 @@ class IGGroupsTableViewController: UITableViewController { self.muteRoom(room: room) } return true - }),MGSwipeButton(title: pinTitle, backgroundColor: UIColor(red: 50.0/255.0, green: 100.0/255.0, blue: 122.0/255.0, alpha: 1), callback: { (sender: MGSwipeTableCell!) -> Bool in + }) + + let btnPinSwipeCell = MGSwipeButton(title: pinTitle, backgroundColor: UIColor.swipeBlueGray(), callback: { (sender: MGSwipeTableCell!) -> Bool in if self.connectionStatus == .waitingForNetwork || self.connectionStatus == .connecting { let alert = UIAlertController(title: "Error", message: "No Network Connection", preferredStyle: .alert) let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) @@ -160,8 +162,9 @@ class IGGroupsTableViewController: UITableViewController { self.pinRoom(room: room) } return true - - }),MGSwipeButton(title: "More...", backgroundColor: UIColor(red: 26.0/255.0, green: 67.0/255.0, blue: 90.0/255.0, alpha: 1), callback: { (sender: MGSwipeTableCell!) -> Bool in + }) + + let btnMoreSwipeCell = MGSwipeButton(title: "More...", backgroundColor: UIColor(red: 26.0/255.0, green: 67.0/255.0, blue: 90.0/255.0, alpha: 1), callback: { (sender: MGSwipeTableCell!) -> Bool in let title = room.title != nil ? room.title! : "Delete" let alertC = UIAlertController(title: title, message: "What do you want to do?", preferredStyle: IGGlobal.detectAlertStyle()) let clear = UIAlertAction(title: "Clear History", style: .default, handler: { (action) in @@ -335,7 +338,12 @@ class IGGroupsTableViewController: UITableViewController { }) return true - })] + }) + + let buttons = [btnMuteSwipeCell, btnPinSwipeCell, btnMoreSwipeCell] + cell.rightButtons = buttons + removeButtonsUnderline(buttons: buttons) + cell.rightSwipeSettings.transition = MGSwipeTransition.border cell.rightExpansion.buttonIndex = 0 cell.rightExpansion.fillOnTrigger = true @@ -351,6 +359,12 @@ class IGGroupsTableViewController: UITableViewController { return cell } + private func removeButtonsUnderline(buttons: [UIButton]){ + for btn in buttons { + btn.removeUnderline() + } + } + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { selectedRoomForSegue = rooms![indexPath.row] self.tableView.isUserInteractionEnabled = false diff --git a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGRecentsTableViewController.swift b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGRecentsTableViewController.swift index c2d12bf..3fffa0e 100644 --- a/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGRecentsTableViewController.swift +++ b/iGap/Controller/View Controllers/Tabbar Sub Controllers/IGRecentsTableViewController.swift @@ -17,8 +17,10 @@ import RxCocoa import IGProtoBuff import MGSwipeTableCell import MBProgressHUD +import UserNotifications +import Contacts -class IGRecentsTableViewController: UITableViewController, MessageReceiveObserver { +class IGRecentsTableViewController: UITableViewController, MessageReceiveObserver, UNUserNotificationCenterDelegate { static var messageReceiveDelegat: MessageReceiveObserver! static var visibleChat: [Int64 : Bool] = [:] @@ -263,12 +265,33 @@ class IGRecentsTableViewController: UITableViewController, MessageReceiveObserve //MARK: Room List actions @objc private func userDidLogin() { + self.checkPermission() self.addRoomChangeNotificationBlock() self.fetchRoomList() self.saveAndSendContacts() self.requestToGetUserPrivacy() } + private func checkPermission() { + + /********** Contact Permission **********/ + CNContactStore().requestAccess(for: CNEntityType.contacts, completionHandler: { (granted, error) -> Void in + IGContactManager.sharedManager.manageContact() + + /********** Microphon Permission **********/ + AVAudioSession.sharedInstance().requestRecordPermission { (granted) in + + /********** Receive Notification Permission **********/ + if #available(iOS 10.0, *) { + // For iOS 10 display notification (sent via APNS) + UNUserNotificationCenter.current().delegate = self + let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound, .carPlay] + UNUserNotificationCenter.current().requestAuthorization(options: authOptions,completionHandler: {_, _ in }) + } + } + }) + } + private func addRoomChangeNotificationBlock() { self.notificationToken?.invalidate() self.notificationToken = rooms!.observe { (changes: RealmCollectionChange) in @@ -309,7 +332,6 @@ class IGRecentsTableViewController: UITableViewController, MessageReceiveObserve IGClientGetRoomListRequest.Generator.generate(offset: 0, limit: 40).success { (responseProtoMessage) in self.isLoadingMoreRooms = false DispatchQueue.main.async { - AVAudioSession.sharedInstance().requestRecordPermission { (granted) in } switch responseProtoMessage { case let response as IGPClientGetRoomListResponse: self.sendClientCondition(clientCondition: clientCondition) @@ -411,7 +433,7 @@ class IGRecentsTableViewController: UITableViewController, MessageReceiveObserve pinTitle = "UnPin" } - cell.rightButtons = [MGSwipeButton(title: muteTitle, backgroundColor: UIColor.swipeGray(), callback: { (sender: MGSwipeTableCell!) -> Bool in + let btnMuteSwipeCell = MGSwipeButton(title: muteTitle, backgroundColor: UIColor.swipeGray(), callback: { (sender: MGSwipeTableCell!) -> Bool in if self.connectionStatus == .waitingForNetwork || self.connectionStatus == .connecting { let alert = UIAlertController(title: "Error", message: "No Network Connection", preferredStyle: .alert) let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) @@ -422,7 +444,9 @@ class IGRecentsTableViewController: UITableViewController, MessageReceiveObserve self.muteRoom(room: room) } return true - }),MGSwipeButton(title: pinTitle, backgroundColor: UIColor.swipeBlueGray(), callback: { (sender: MGSwipeTableCell!) -> Bool in + }) + + let btnPinSwipeCell = MGSwipeButton(title: pinTitle, backgroundColor: UIColor.swipeBlueGray(), callback: { (sender: MGSwipeTableCell!) -> Bool in if self.connectionStatus == .waitingForNetwork || self.connectionStatus == .connecting { let alert = UIAlertController(title: "Error", message: "No Network Connection", preferredStyle: .alert) let okAction = UIAlertAction(title: "OK", style: .default, handler: nil) @@ -433,8 +457,9 @@ class IGRecentsTableViewController: UITableViewController, MessageReceiveObserve self.pinRoom(room: room) } return true - - }),MGSwipeButton(title: "More...", backgroundColor: UIColor.swipeDarkBlue(), callback: { (sender: MGSwipeTableCell!) -> Bool in + }) + + let btnMoreSwipeCell = MGSwipeButton(title: "More...", backgroundColor: UIColor.swipeDarkBlue(), callback: { (sender: MGSwipeTableCell!) -> Bool in let title = room.title != nil ? room.title! : "Delete" let alertC = UIAlertController(title: title, message: "What do you want to do?", preferredStyle: IGGlobal.detectAlertStyle()) @@ -602,8 +627,11 @@ class IGRecentsTableViewController: UITableViewController, MessageReceiveObserve self.present(alertC, animated: true, completion: nil) return true - - })] + }) + + let buttons = [btnMuteSwipeCell, btnPinSwipeCell, btnMoreSwipeCell] + cell.rightButtons = buttons + removeButtonsUnderline(buttons: buttons) cell.rightSwipeSettings.transition = MGSwipeTransition.border cell.rightExpansion.buttonIndex = 0 @@ -620,6 +648,12 @@ class IGRecentsTableViewController: UITableViewController, MessageReceiveObserve return cell } + private func removeButtonsUnderline(buttons: [UIButton]){ + for btn in buttons { + btn.removeUnderline() + } + } + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { selectedRoomForSegue = rooms![indexPath.row] self.tableView.isUserInteractionEnabled = false diff --git a/iGap/General/IGGlobal.swift b/iGap/General/IGGlobal.swift index 13a4319..97935e6 100644 --- a/iGap/General/IGGlobal.swift +++ b/iGap/General/IGGlobal.swift @@ -564,28 +564,53 @@ extension UIImageView { } } - func setImage(avatar: IGAvatar) { - if let smallThumbnail = avatar.file?.smallThumbnail { + func setImage(avatar: IGAvatar, showMain: Bool = false) { + + var file : IGFile! + var previewType : IGFile.PreviewType! + + if showMain { + + file = avatar.file + previewType = IGFile.PreviewType.originalFile + + } else { + + if let largeThumbnail = avatar.file?.largeThumbnail { + file = largeThumbnail + previewType = IGFile.PreviewType.largeThumbnail + } else { + file = avatar.file?.smallThumbnail + previewType = IGFile.PreviewType.smallThumbnail + } + } + + if file != nil { do { - if smallThumbnail.attachedImage != nil { - self.image = smallThumbnail.attachedImage + if file.attachedImage != nil { + self.image = file.attachedImage } else { + var image: UIImage? - let path = smallThumbnail.path() - if FileManager.default.fileExists(atPath: path!.path) { + + let path = file.path() + if IGGlobal.isFileExist(path: path) { image = UIImage(contentsOfFile: path!.path) } if image != nil { self.image = image } else { + if showMain { + setImage(avatar: avatar) // call this method again for load thumbnail before load main image + } throw NSError(domain: "asa", code: 1234, userInfo: nil) } } } catch { - IGDownloadManager.sharedManager.download(file: smallThumbnail, previewType:.smallThumbnail, completion: { (attachment) -> Void in + IGDownloadManager.sharedManager.download(file: file, previewType: previewType, completion: { (attachment) -> Void in DispatchQueue.main.async { - let path = smallThumbnail.path() + let path = file.path() if let data = try? Data(contentsOf: path!) { if let image = UIImage(data: data) { self.image = image @@ -597,9 +622,7 @@ extension UIImageView { }) } } - } - } //MARK: - @@ -752,3 +775,16 @@ extension Array { } } } + +extension UIButton { + + func removeUnderline(){ + if let text = self.titleLabel?.text { + let attrs = [ NSFontAttributeName : self.titleLabel?.font as Any, + NSForegroundColorAttributeName : self.titleLabel?.textColor as Any, + NSUnderlineStyleAttributeName : NSUnderlineStyle.styleNone.rawValue ] as [String : Any] + + self.setAttributedTitle(NSMutableAttributedString(string: text, attributes: attrs), for: self.state) + } + } +} diff --git a/iGap/Libraries/Chat Screen/Controller/IGMessageViewController.swift b/iGap/Libraries/Chat Screen/Controller/IGMessageViewController.swift index c4576f6..98cbf8a 100644 --- a/iGap/Libraries/Chat Screen/Controller/IGMessageViewController.swift +++ b/iGap/Libraries/Chat Screen/Controller/IGMessageViewController.swift @@ -56,7 +56,6 @@ class IGMessageViewController: UIViewController, DidSelectLocationDelegate, UIGe @IBOutlet weak var txtPinnedMessage: UILabel! @IBOutlet weak var collectionView: IGMessageCollectionView! @IBOutlet weak var inputBarContainerView: UIView! - @IBOutlet weak var joinButton: UIButton! @IBOutlet weak var inputTextView: GrowingTextView! @IBOutlet weak var inputTextViewHeightConstraint: NSLayoutConstraint! @IBOutlet weak var inputBarHeightContainerConstraint: NSLayoutConstraint! @@ -66,8 +65,14 @@ class IGMessageViewController: UIViewController, DidSelectLocationDelegate, UIGe @IBOutlet weak var inputBarLeftView: UIView! @IBOutlet weak var inputBarRightiew: UIView! @IBOutlet weak var inputBarViewBottomConstraint: NSLayoutConstraint! + @IBOutlet weak var joinButton: UIButton! @IBOutlet weak var inputBarRecordButton: UIButton! + @IBOutlet weak var btnScrollToBottom: UIButton! @IBOutlet weak var inputBarSendButton: UIButton! + @IBOutlet weak var btnCancelReplyOrForward: UIButton! + @IBOutlet weak var btnDeleteSelectedAttachment: UIButton! + @IBOutlet weak var btnClosePin: UIButton! + @IBOutlet weak var btnAttachment: UIButton! @IBOutlet weak var inputBarRecordTimeLabel: UILabel! @IBOutlet weak var inputBarRecordView: UIView! @IBOutlet weak var inputBarRecodingBlinkingView: UIView! @@ -152,6 +157,10 @@ class IGMessageViewController: UIViewController, DidSelectLocationDelegate, UIGe override func viewDidLoad() { super.viewDidLoad() + removeButtonsUnderline(buttons: [joinButton, inputBarRecordButton, btnScrollToBottom, + inputBarSendButton, btnCancelReplyOrForward, + btnDeleteSelectedAttachment, btnClosePin, btnAttachment]) + IGAppManager.sharedManager.connectionStatus.asObservable().subscribe(onNext: { (connectionStatus) in DispatchQueue.main.async { self.updateConnectionStatus(connectionStatus) @@ -331,6 +340,12 @@ class IGMessageViewController: UIViewController, DidSelectLocationDelegate, UIGe } } + private func removeButtonsUnderline(buttons: [UIButton]){ + for btn in buttons { + btn.removeUnderline() + } + } + func openUserProfile(){ let profile = IGRegistredUserInfoTableViewController.instantiateFromAppStroryboard(appStoryboard: .Profile) profile.user = self.selectedUserToSeeTheirInfo @@ -2507,7 +2522,7 @@ extension IGMessageViewController: IGMessageGeneralCollectionViewCellDelegate { return self } - func didTapOnAttachment(cellMessage: IGRoomMessage, cell: IGMessageGeneralCollectionViewCell, imageView: IGImageView) { + func didTapOnAttachment(cellMessage: IGRoomMessage, cell: IGMessageGeneralCollectionViewCell, imageView: IGImageView?) { var finalMessage = cellMessage var roomMessageLists = self.messagesWithMedia diff --git a/iGap/Libraries/Chat Screen/View/IGMessageGeneralCollectionViewCell.swift b/iGap/Libraries/Chat Screen/View/IGMessageGeneralCollectionViewCell.swift index ce3278a..e00eb37 100644 --- a/iGap/Libraries/Chat Screen/View/IGMessageGeneralCollectionViewCell.swift +++ b/iGap/Libraries/Chat Screen/View/IGMessageGeneralCollectionViewCell.swift @@ -13,7 +13,7 @@ import UIKit protocol IGMessageGeneralCollectionViewCellDelegate { func didTapAndHoldOnMessage(cellMessage: IGRoomMessage, cell: IGMessageGeneralCollectionViewCell) - func didTapOnAttachment(cellMessage: IGRoomMessage, cell: IGMessageGeneralCollectionViewCell, imageView: IGImageView) + func didTapOnAttachment(cellMessage: IGRoomMessage, cell: IGMessageGeneralCollectionViewCell, imageView: IGImageView?) func didTapOnForwardedAttachment(cellMessage: IGRoomMessage, cell: IGMessageGeneralCollectionViewCell) func didTapOnOriginalMessageWhenReply(cellMessage: IGRoomMessage, cell: IGMessageGeneralCollectionViewCell) func didTapOnSenderAvatar(cellMessage: IGRoomMessage, cell: IGMessageGeneralCollectionViewCell) diff --git a/iGap/Model/AppDelegate/AppDelegate.swift b/iGap/Model/AppDelegate/AppDelegate.swift index 0002415..30133d1 100644 --- a/iGap/Model/AppDelegate/AppDelegate.swift +++ b/iGap/Model/AppDelegate/AppDelegate.swift @@ -132,18 +132,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD Messaging.messaging().delegate = self Messaging.messaging().shouldEstablishDirectChannel = true - if #available(iOS 10.0, *) { - // For iOS 10 display notification (sent via APNS) - UNUserNotificationCenter.current().delegate = self - let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound, .carPlay] - UNUserNotificationCenter.current().requestAuthorization( - options: authOptions, - completionHandler: {_, _ in }) + if #available(iOS 10.0, *) { // For iOS 10 display notification (sent via APNS) + /** + * execute following code in "IGRecentsTableViewController" and don't execute here, + * for avoid from show permission alert in start of app when user not registered yet + **/ + //UNUserNotificationCenter.current().delegate = self + //let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound, .carPlay] + //UNUserNotificationCenter.current().requestAuthorization(options: authOptions,completionHandler: {_, _ in }) } else { let settings: UIUserNotificationSettings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil) application.registerUserNotificationSettings(settings) } - + application.registerForRemoteNotifications() } /******************* Notificaton End *******************/ @@ -153,10 +154,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD IGAppManager.sharedManager.clearDataOnLogout() let storyboard : UIStoryboard = UIStoryboard(name: "Register", bundle: nil) let vc = storyboard.instantiateViewController(withIdentifier: "IGSplashNavigationController") - self.window?.rootViewController?.present(vc, animated: true, completion: { - print("showed") - }) + self.window?.rootViewController?.present(vc, animated: true, completion: nil) } + func showRegistrationSetpProfileInfo() { let storyboard : UIStoryboard = UIStoryboard(name: "Register", bundle: nil) let setNicknameVC = storyboard.instantiateViewController(withIdentifier: "RegistrationStepProfileInfo") @@ -182,16 +182,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } func showLoginFaieldAlert() { - //DispatchQueue.main.sync(execute: { - let badLoginAC = UIAlertController(title: "Login Failed", message: "There was a problem logging you in. Please login again", preferredStyle: .alert) - let ok = UIAlertAction(title: "OK", style: .default, handler: { (action) in - self.logoutAndShowRegisterViewController() - }) - badLoginAC.addAction(ok) - self.window?.rootViewController?.present(badLoginAC, animated: true, completion: { - print("showed") - }) - //}) + let badLoginAC = UIAlertController(title: "Login Failed", message: "There was a problem logging you in. Please login again", preferredStyle: .alert) + let ok = UIAlertAction(title: "OK", style: .default, handler: { (action) in + self.logoutAndShowRegisterViewController() + }) + badLoginAC.addAction(ok) + self.window?.rootViewController?.present(badLoginAC, animated: true, completion: nil) } @@ -205,6 +201,5 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD NotificationCenter.default.post(IGNotificationStatusBarTapped) } } - } diff --git a/iGap/Model/Managers/IGAppManager.swift b/iGap/Model/Managers/IGAppManager.swift index 35d7e34..a6e69a8 100644 --- a/iGap/Model/Managers/IGAppManager.swift +++ b/iGap/Model/Managers/IGAppManager.swift @@ -299,7 +299,6 @@ class IGAppManager: NSObject { switch responseProto { case _ as IGPUserLoginResponse: IGUserLoginRequest.Handler.intrepret(response: (responseProto as? IGPUserLoginResponse)!) - IGContactManager.sharedManager.manageContact() self.setUserLoginSuccessful() self.setUserUpdateStatus(status: .online) self.getSignalingConfiguration(force: true) @@ -322,10 +321,12 @@ class IGAppManager: NSObject { } }).send() } else { - // no token or no author hash - self.isTryingToLoginUser = false - let appDelegate = UIApplication.shared.delegate as! AppDelegate - appDelegate.showLoginFaieldAlert() + DispatchQueue.main.async { + // no token or no author hash + self.isTryingToLoginUser = false + let appDelegate = UIApplication.shared.delegate as! AppDelegate + appDelegate.showLoginFaieldAlert() + } } } diff --git a/iGap/SupportingFiles/Info.plist b/iGap/SupportingFiles/Info.plist index 3e78a92..3b8e8a7 100644 --- a/iGap/SupportingFiles/Info.plist +++ b/iGap/SupportingFiles/Info.plist @@ -15,9 +15,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.6.4 + 0.6.5 CFBundleVersion - 471 + 472 Fabric APIKey diff --git a/iGap/VIew/.DS_Store b/iGap/VIew/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..4d94a45f64577e2961dd93d8560aabb1628dfc82 GIT binary patch literal 6148 zcmeH~Jx&8b427Q|LXjv)NjWD#;s!$$PLK=YL>&|WbRWZTisABPG`JD zI;^K^6af(!6FAQ4!u$U<{lNWyT%?%@h`_%hV6)YFwd5;RZ=JlH_u59kp?@25Bb`IE kVrsNvPP`SL@8mUq=6Ww3Qlp&lD5vU=fOCusu}^7l5m@pDL=qKYRPjwc+*%PsZ}>dn7Z0e3+iPA_c7I(~85o*PEX%fGU* z@rf5+ypqf3bNNF4p|vl1R%Az=uxtnSUfr165PoF4J`WVw zZE}b__{{a2qE{9jzZoh$mL5=s>c-;n@#^Z@lDYEM`pJ@cy#Ds;lDWRNd~%Y{ExfUE zyYlGZ@aXuJ2b7IPuuS=>b%?N#?G^!2G0L(7^m)Eot!FMn>J=nujT5Y@G`mLRaKZz{&h}VtTA<-?~ z{QRt|cG!l@+*yZG_kO^+uk>y1?S(wrN$|UMV>)aE!t<&kbR$>zyAMJvNhRV36@O2_ zVi!xW*_K1$HV;D35zNl69R#-D;^o7Kp6zgN(=UrC5(hhOL-=~;(@HHKs{xlPi+BFi zAug6a956REV^C2uM8(ppn#~!k<_n+ai>0dW$>Tt|g%|r{+NQ^JMBmU4^pt+2pXoRH zgZ^Syn899Wx7ZrH&F-)d*r#lZ)z~h(#~NC}*kHw98(7nnH9;@5Wx7`2d%|x)Uh0~l z4P1lAa``3XtN^7ecnBI1?86XbhA;N#qoe9pL0A z$fPO|HXQ;Pq%AV(Q4)8JK7nKxxE5#xD*ZF5jHe;2^oivXJ{iDr>OopZr7P{JxyO3a zw(&Nl@l&(~L@Qpg;LLs+Cw)!X&5;FMq-N^_KfKoPF(qGsd|O2%#Cu}m>74ae9zIEU zI7Kzg%E2F^0p#F=KV(sPmc-?-hh!{V+C$~ke1=C!c`Qm+E`J2Z^%NIn{{Pmidn`O7AGo@eL3d{h5h + @@ -923,6 +924,11 @@ + + + + + diff --git a/iGap/VIew/CreateRoom.storyboard b/iGap/VIew/CreateRoom.storyboard index 3815a64..80a892d 100644 --- a/iGap/VIew/CreateRoom.storyboard +++ b/iGap/VIew/CreateRoom.storyboard @@ -1,11 +1,11 @@ - + - + @@ -476,6 +476,7 @@ Cg + diff --git a/iGap/VIew/IGMessageAttachmentCurrentLocationViewController.swift b/iGap/VIew/IGMessageAttachmentCurrentLocationViewController.swift index a4cf4fb..e1407a0 100644 --- a/iGap/VIew/IGMessageAttachmentCurrentLocationViewController.swift +++ b/iGap/VIew/IGMessageAttachmentCurrentLocationViewController.swift @@ -86,6 +86,8 @@ class IGMessageAttachmentCurrentLocationViewController: UIViewController , UIGes } func buttonViewCustomize(){ + btnCurrentLocation.removeUnderline() + btnCurrentLocation.layer.shadowColor = UIColor.darkGray.cgColor btnCurrentLocation.layer.shadowOffset = CGSize(width: 0.0, height: 2.0) btnCurrentLocation.layer.shadowRadius = 0.1 diff --git a/iGap/VIew/IGSettingStoryboard.storyboard b/iGap/VIew/IGSettingStoryboard.storyboard index 87f6363..fe8d8f4 100644 --- a/iGap/VIew/IGSettingStoryboard.storyboard +++ b/iGap/VIew/IGSettingStoryboard.storyboard @@ -1446,6 +1446,7 @@ To proceed, confirm that your new number can recieve SMS or calls and tap Next t + @@ -4674,6 +4675,7 @@ Please wait 0:59 + @@ -5776,9 +5778,9 @@ Afg - - - + + + diff --git a/iGap/VIew/Register.storyboard b/iGap/VIew/Register.storyboard index f16e01c..002be16 100644 --- a/iGap/VIew/Register.storyboard +++ b/iGap/VIew/Register.storyboard @@ -1,5 +1,5 @@ - + @@ -172,6 +172,7 @@ + diff --git a/iGap/VIew/ReusableViews/IGAvatarView.swift b/iGap/VIew/ReusableViews/IGAvatarView.swift index 7e530c1..85d67a1 100644 --- a/iGap/VIew/ReusableViews/IGAvatarView.swift +++ b/iGap/VIew/ReusableViews/IGAvatarView.swift @@ -71,7 +71,7 @@ class IGAvatarView: UIView { self.initialLettersLabel!.text = "" } - func setUser(_ user: IGRegisteredUser) { + func setUser(_ user: IGRegisteredUser, showMainAvatar: Bool = false) { self.avatarImageView!.image = nil self.initialLettersLabel!.text = user.initials @@ -79,7 +79,7 @@ class IGAvatarView: UIView { self.initialLettersView!.backgroundColor = color if let avatar = user.avatar { - self.avatarImageView!.setImage(avatar: avatar) + self.avatarImageView!.setImage(avatar: avatar, showMain: showMainAvatar) } if self.frame.size.width < 40 { @@ -92,7 +92,7 @@ class IGAvatarView: UIView { } - func setRoom(_ room: IGRoom) { + func setRoom(_ room: IGRoom, showMainAvatar: Bool = false) { if room.isInvalidated { return @@ -107,16 +107,16 @@ class IGAvatarView: UIView { switch room.type { case .chat: if let avatar = room.chatRoom?.peer?.avatar { - self.avatarImageView!.setImage(avatar: avatar) + self.avatarImageView!.setImage(avatar: avatar, showMain: showMainAvatar) } case .group: if let avatar = room.groupRoom?.avatar { - self.avatarImageView!.setImage(avatar: avatar) + self.avatarImageView!.setImage(avatar: avatar, showMain: showMainAvatar) } case .channel: if let avatar = room.channelRoom?.avatar { - self.avatarImageView!.setImage(avatar: avatar) + self.avatarImageView!.setImage(avatar: avatar, showMain: showMainAvatar) } } diff --git a/iGap/VIew/profile.storyboard b/iGap/VIew/profile.storyboard index db9ec63..1794c20 100644 --- a/iGap/VIew/profile.storyboard +++ b/iGap/VIew/profile.storyboard @@ -357,7 +357,7 @@ - + @@ -365,7 +365,7 @@ - + @@ -764,7 +764,7 @@ - + @@ -772,19 +772,18 @@