Browse Source

chat removed

pull/1/head
Amrit 4 years ago
parent
commit
1327d7b615
  1. 4
      GME Remit.xcodeproj/project.pbxproj
  2. 11
      GME Remit/AppDelegate.swift
  3. 19
      GME Remit/Modules/Home/User Interface/View/HomeViewController.swift
  4. 4
      GME Remit/Modules/ManageAgreement/User Interface/View/ManageAgreementViewController.swift
  5. 4
      GME Remit/Modules/RegisterModules/UserAuthentication/NewRegister/User Interface/View/NewRegisterViewController.swift
  6. 1
      GME Remit/Modules/RemittanceModules/DomesticModules/DomesticRemit/User Interface/View/DomesticRemitViewController.swift
  7. 2
      GME Remit/Modules/SplashScreen/User Interface/View/SplashScreen.storyboard
  8. 15
      GME Remit/Modules/SplashScreen/User Interface/View/SplashScreenViewController.swift
  9. 255
      GME Remit/Utilities/CSManagement.swift

4
GME Remit.xcodeproj/project.pbxproj

@ -476,7 +476,6 @@
73BA8CD0237E3E5600F3E579 /* AccountCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BA8CCF237E3E5600F3E579 /* AccountCell.swift */; }; 73BA8CD0237E3E5600F3E579 /* AccountCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BA8CCF237E3E5600F3E579 /* AccountCell.swift */; };
73BA8CD2237E427D00F3E579 /* TotalAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BA8CD1237E427D00F3E579 /* TotalAccount.swift */; }; 73BA8CD2237E427D00F3E579 /* TotalAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BA8CD1237E427D00F3E579 /* TotalAccount.swift */; };
73BE702C22D33E6800E87DD2 /* GMENumberTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BE702B22D33E6800E87DD2 /* GMENumberTextField.swift */; }; 73BE702C22D33E6800E87DD2 /* GMENumberTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73BE702B22D33E6800E87DD2 /* GMENumberTextField.swift */; };
73CD98DC23C5B80A00C1A458 /* CSManagement.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73CD98DB23C5B80A00C1A458 /* CSManagement.swift */; };
73D1683B2398D49900E3E01E /* NewRegisterStep3Service.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73D1682D2398D49900E3E01E /* NewRegisterStep3Service.swift */; }; 73D1683B2398D49900E3E01E /* NewRegisterStep3Service.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73D1682D2398D49900E3E01E /* NewRegisterStep3Service.swift */; };
73D1683C2398D49900E3E01E /* NewRegisterStep3ServiceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73D1682E2398D49900E3E01E /* NewRegisterStep3ServiceType.swift */; }; 73D1683C2398D49900E3E01E /* NewRegisterStep3ServiceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73D1682E2398D49900E3E01E /* NewRegisterStep3ServiceType.swift */; };
73D1683D2398D49900E3E01E /* NewRegisterStep3InteractorIO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73D168302398D49900E3E01E /* NewRegisterStep3InteractorIO.swift */; }; 73D1683D2398D49900E3E01E /* NewRegisterStep3InteractorIO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73D168302398D49900E3E01E /* NewRegisterStep3InteractorIO.swift */; };
@ -2969,7 +2968,6 @@
73BA8CCF237E3E5600F3E579 /* AccountCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountCell.swift; sourceTree = "<group>"; }; 73BA8CCF237E3E5600F3E579 /* AccountCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccountCell.swift; sourceTree = "<group>"; };
73BA8CD1237E427D00F3E579 /* TotalAccount.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TotalAccount.swift; sourceTree = "<group>"; }; 73BA8CD1237E427D00F3E579 /* TotalAccount.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TotalAccount.swift; sourceTree = "<group>"; };
73BE702B22D33E6800E87DD2 /* GMENumberTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GMENumberTextField.swift; sourceTree = "<group>"; }; 73BE702B22D33E6800E87DD2 /* GMENumberTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GMENumberTextField.swift; sourceTree = "<group>"; };
73CD98DB23C5B80A00C1A458 /* CSManagement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CSManagement.swift; sourceTree = "<group>"; };
73D1682D2398D49900E3E01E /* NewRegisterStep3Service.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NewRegisterStep3Service.swift; sourceTree = "<group>"; }; 73D1682D2398D49900E3E01E /* NewRegisterStep3Service.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NewRegisterStep3Service.swift; sourceTree = "<group>"; };
73D1682E2398D49900E3E01E /* NewRegisterStep3ServiceType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NewRegisterStep3ServiceType.swift; sourceTree = "<group>"; }; 73D1682E2398D49900E3E01E /* NewRegisterStep3ServiceType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NewRegisterStep3ServiceType.swift; sourceTree = "<group>"; };
73D168302398D49900E3E01E /* NewRegisterStep3InteractorIO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NewRegisterStep3InteractorIO.swift; sourceTree = "<group>"; }; 73D168302398D49900E3E01E /* NewRegisterStep3InteractorIO.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NewRegisterStep3InteractorIO.swift; sourceTree = "<group>"; };
@ -13506,7 +13504,6 @@
730D7896227A94F2007E517E /* SearchAddress */, 730D7896227A94F2007E517E /* SearchAddress */,
73895FF522C2F208003FEA90 /* TablePresenter */, 73895FF522C2F208003FEA90 /* TablePresenter */,
D95B7044213FB5F00053CC3D /* WebLinks */, D95B7044213FB5F00053CC3D /* WebLinks */,
73CD98DB23C5B80A00C1A458 /* CSManagement.swift */,
); );
path = Utilities; path = Utilities;
sourceTree = "<group>"; sourceTree = "<group>";
@ -16818,7 +16815,6 @@
FF6E7D9821BF951D00A003B9 /* AppUpdateWireframeInput.swift in Sources */, FF6E7D9821BF951D00A003B9 /* AppUpdateWireframeInput.swift in Sources */,
D96A4FDE21460B4A00CFD507 /* SplashScreenViewController.swift in Sources */, D96A4FDE21460B4A00CFD507 /* SplashScreenViewController.swift in Sources */,
D9DC107921639078008F3C51 /* MessageComposeServiceType.swift in Sources */, D9DC107921639078008F3C51 /* MessageComposeServiceType.swift in Sources */,
73CD98DC23C5B80A00C1A458 /* CSManagement.swift in Sources */,
73911179237AA3C300697D27 /* InboundPennyTestSubmitService.swift in Sources */, 73911179237AA3C300697D27 /* InboundPennyTestSubmitService.swift in Sources */,
D92B80252140C3CB00A25B26 /* MainModuleInterface.swift in Sources */, D92B80252140C3CB00A25B26 /* MainModuleInterface.swift in Sources */,
D946719521426DFB003924DB /* LoginModuleInterface.swift in Sources */, D946719521426DFB003924DB /* LoginModuleInterface.swift in Sources */,

11
GME Remit/AppDelegate.swift

@ -18,7 +18,6 @@ import Crashlytics
import AlamofireNetworkActivityLogger import AlamofireNetworkActivityLogger
import IQKeyboardManagerSwift import IQKeyboardManagerSwift
import Localize_Swift import Localize_Swift
import ChannelIO
import LGSideMenuController import LGSideMenuController
#if DEBUG #if DEBUG
@ -94,8 +93,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
destination = extractDestination(userInfo: useInfo) destination = extractDestination(userInfo: useInfo)
self.window?.rootViewController = LauncherScreenWireframe().getMainView() self.window?.rootViewController = LauncherScreenWireframe().getMainView()
ChannelIO.initialize()
GMEDB GMEDB
.shared .shared
.app .app
@ -116,9 +113,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
didReceiveRemoteNotification userInfo: [AnyHashable: Any], didReceiveRemoteNotification userInfo: [AnyHashable: Any],
fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void
) { ) {
ChannelIO.handlePushNotification(userInfo) {
completionHandler(.noData)
}
} }
func application( func application(
@ -135,7 +129,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
Messaging.messaging().apnsToken = deviceToken Messaging.messaging().apnsToken = deviceToken
ChannelIO.initPushToken(deviceToken: deviceToken)
} }
func applicationDidEnterBackground(_ application: UIApplication) { func applicationDidEnterBackground(_ application: UIApplication) {
@ -206,10 +199,6 @@ extension AppDelegate: UNUserNotificationCenterDelegate {
let userInfo = response.notification.request.content.userInfo let userInfo = response.notification.request.content.userInfo
print("Message ID: \(userInfo["gcm_message_id"] ?? "nil")") print("Message ID: \(userInfo["gcm_message_id"] ?? "nil")")
if ChannelIO.isChannelPushNotification(userInfo) {
ChannelIO.handlePushNotification(userInfo)
}
// open push notification's destination // open push notification's destination
guard guard
window?.rootViewController is LGSideMenuController, window?.rootViewController is LGSideMenuController,

19
GME Remit/Modules/Home/User Interface/View/HomeViewController.swift

@ -9,7 +9,6 @@
import UIKit import UIKit
import Crashlytics import Crashlytics
import Localize_Swift import Localize_Swift
//import ChannelIO
import LGSideMenuController import LGSideMenuController
#if DEBUG #if DEBUG
@ -82,7 +81,6 @@ class HomeViewController: UIViewController {
var refreshControl: UIRefreshControl? var refreshControl: UIRefreshControl?
var presenter: HomeModuleInterface? var presenter: HomeModuleInterface?
private var csManager: CSManagement?
var user: User? { var user: User? {
didSet { didSet {
@ -206,10 +204,6 @@ class HomeViewController: UIViewController {
setupDelegates() setupDelegates()
setupNotifications() setupNotifications()
addRefreshControlTableView() addRefreshControlTableView()
// addRightCSButton(delegate: self)
csManager = CSManagement(self)
csManager?.setNavigationRightBarbutton(type: .original)
} }
private func update() { private func update() {
@ -722,19 +716,6 @@ extension HomeViewController {
} }
} }
// MARK: - ChannelPluginDelegate
//extension HomeViewController: ChannelPluginDelegate {
// func onChangeBadge(count: Int) {
// setMessageCount(with: count)
// }
//
// func onReceivePush(event: PushEvent) {
// //configure your view with push event data
// //and display
// print("event: \(event)")
// }
//}
// MARK: - HomeCollectionDelegate // MARK: - HomeCollectionDelegate
extension HomeViewController: HomeCollectionDelegate { extension HomeViewController: HomeCollectionDelegate {
func didSelect( func didSelect(

4
GME Remit/Modules/ManageAgreement/User Interface/View/ManageAgreementViewController.swift

@ -19,7 +19,6 @@ class ManageAgreementViewController: UIViewController {
private var isFirst = true private var isFirst = true
private var documents: [AgreePDFDocument]? private var documents: [AgreePDFDocument]?
private var titleLabels: [UILabel]? private var titleLabels: [UILabel]?
private var csManager: CSManagement?
// MARK: Computed Properties // MARK: Computed Properties
// MARK: IBOutlets // MARK: IBOutlets
@ -137,9 +136,6 @@ extension ManageAgreementViewController {
documentTitleLabel4, documentTitleLabel5, documentTitleLabel6 documentTitleLabel4, documentTitleLabel5, documentTitleLabel6
] ]
csManager = CSManagement(self)
csManager?.setNavigationRightBarbutton(type: .call)
setMultiLanguages() setMultiLanguages()
} }

4
GME Remit/Modules/RegisterModules/UserAuthentication/NewRegister/User Interface/View/NewRegisterViewController.swift

@ -32,7 +32,6 @@ class NewRegisterViewController: UIViewController {
private let disposeBag = DisposeBag() private let disposeBag = DisposeBag()
private var stepButtons = [UIButton]() private var stepButtons = [UIButton]()
private var csManager: CSManagement?
// MARK: Computed Properties // MARK: Computed Properties
// MARK: IBOutlets // MARK: IBOutlets
@ -115,9 +114,6 @@ extension NewRegisterViewController {
step3Button step3Button
] ]
csManager = CSManagement(self)
csManager?.setNavigationRightBarbutton(type: .call)
setMultilanguages() setMultilanguages()
} }

1
GME Remit/Modules/RemittanceModules/DomesticModules/DomesticRemit/User Interface/View/DomesticRemitViewController.swift

@ -9,7 +9,6 @@
import UIKit import UIKit
import RxSwift import RxSwift
import RxCocoa import RxCocoa
import ChannelIO
class DomesticRemitViewController: UIViewController { class DomesticRemitViewController: UIViewController {

2
GME Remit/Modules/SplashScreen/User Interface/View/SplashScreen.storyboard

@ -477,7 +477,7 @@
<constraint firstItem="xXT-1Y-c8Y" firstAttribute="height" secondItem="G73-dq-xvs" secondAttribute="height" id="84F-ZN-feM"/> <constraint firstItem="xXT-1Y-c8Y" firstAttribute="height" secondItem="G73-dq-xvs" secondAttribute="height" id="84F-ZN-feM"/>
</constraints> </constraints>
</stackView> </stackView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="P8b-PV-4MD">
<button hidden="YES" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="P8b-PV-4MD">
<rect key="frame" x="255" y="498" width="45" height="45"/> <rect key="frame" x="255" y="498" width="45" height="45"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints> <constraints>

15
GME Remit/Modules/SplashScreen/User Interface/View/SplashScreenViewController.swift

@ -60,7 +60,6 @@ class SplashScreenViewController: UIViewController {
lazy private var selectedPaymentModeIndex = 0 lazy private var selectedPaymentModeIndex = 0
lazy private var calcBy = "" lazy private var calcBy = ""
private var csManager: CSManagement?
private var selectedLanguage: SendMoneyCountryViewModel? { private var selectedLanguage: SendMoneyCountryViewModel? {
didSet { didSet {
@ -211,19 +210,6 @@ class SplashScreenViewController: UIViewController {
} }
} }
@IBAction func touchInAppChat(_ sender: UIButton) { @IBAction func touchInAppChat(_ sender: UIButton) {
self.alertWithOkCancel(
message: "check_start_chat_text".localized(),
title: "check_start_chat_title_text".localized(),
okTitle: "yes_text".localized(),
cancelTitle: "no_text".localized(),
okAction: { [weak self] in
if !(self?.csManager?.chatIsBooted ?? false) {
self?.csManager?.setChannelIO()
} else {
self?.csManager?.openChat(animated: true)
}
}
)
} }
@IBAction private func login(_ sender: UIButton) { @IBAction private func login(_ sender: UIButton) {
@ -269,7 +255,6 @@ class SplashScreenViewController: UIViewController {
buttonLogin.titleLabel?.numberOfLines = 2 buttonLogin.titleLabel?.numberOfLines = 2
oneUnitExchangeRateView.layer.cornerRadius = 5 oneUnitExchangeRateView.layer.cornerRadius = 5
csManager = CSManagement(self, badgeTarget: inAppChatButton)
} }
private func setExchangeRateUI() { private func setExchangeRateUI() {

255
GME Remit/Utilities/CSManagement.swift

@ -1,255 +0,0 @@
//
// CSManagement.swift
// GME Remit
//
// Created by InKwon James Kim on 2020/01/08.
// Copyright © 2020 Gobal Money Express Co. Ltd. All rights reserved.
//
import ChannelIO
#if DEBUG
import FLEX
#endif
class CSManagement {
enum IconType {
case original
case call
}
private let target: UIViewController
private var csButton: UIBarButtonItem?
private var badgeTarget: UIView?
var messageCount = 0 {
didSet {
var appearance = BadgeAppearance()
let message = messageCount != 0 ? "\(messageCount)" : nil
appearance.backgroundColor = .themeWhiteRed
appearance.textColor = .themeRedWhite
csButton?.badge(text: message, appearance: appearance)
badgeTarget?.badge(text: message, appearance: appearance)
}
}
var chatIsBooted: Bool {
return ChannelIO.isBooted
}
init(_ target: UIViewController, badgeTarget: UIView? = nil) {
self.target = target
self.badgeTarget = badgeTarget
}
func getCSButton(with type: IconType) -> UIBarButtonItem? {
switch type {
case .original:
let supportImage = UIImage(named: "ic_support")?.withRenderingMode(.alwaysOriginal)
csButton = UIBarButtonItem(
image: supportImage,
style: .plain,
target: self,
action: #selector(touch(_:))
)
return csButton
case .call:
let supportImage = UIImage(named: "call")?.withRenderingMode(.alwaysTemplate)
csButton = UIBarButtonItem(
image: supportImage,
style: .plain,
target: self,
action: #selector(touch(_:))
)
csButton?.tintColor = .red
return csButton
}
}
func setNavigationRightBarbutton(type: IconType) {
target.navigationItem.rightBarButtonItem = getCSButton(with: type)
}
func setChannelIO() {
let settings = ChannelPluginSettings()
settings.pluginKey = "24dc2dfd-3ed1-4953-b395-a2255ed41dae"
settings.userId = GMEDB.shared.user.string(.userId)
let profile = Profile()
let username = GMEDB.shared.user.string(.fullName)
let email = GMEDB.shared.user.string(.email)
profile
.set(name: username ?? "")
.set(email: email ?? "")
ChannelIO.delegate = self
ChannelIO.boot(with:settings, profile: profile) {[weak self] (completion, _) in
var message = "channelIO_error_message_text".localized()
switch completion {
case .success:
ChannelIO.open(animated: true)
return
case .notInitialized: message += "(1)"
case .networkTimeout: message += "(2)"
case .notAvailableVersion: message += "(3)"
case .serviceUnderConstruction: message += "(4)"
case .requirePayment: message += "(5)"
case .accessDenied: message += "(6)"
case .unknown: message += "(7)"
@unknown default: message += "(8)"
}
self?.target.alert(type: .error, message: message)
}
}
func openChat(animated: Bool) {
ChannelIO.open(animated: animated)
}
@objc func touch(_ sender: UIBarButtonItem) {
let hotLines = HotLineService().staticHotLines
let nativeCountry = GMEDB.shared.user.string(.countryCode)?.lowercased()
let userHotLine = hotLines?.filter { $0.countryCode == nativeCountry }.first
let alert = UIAlertController(
title: nil,
message: "help_you_text".localized(),
preferredStyle: .actionSheet
)
let liveChat = UIAlertAction(
title: "live_chat_text".localized(),
style: .default
) {[weak self] _ in
self?.target.alertWithOkCancel(
message: "check_start_chat_text".localized(),
title: "check_start_chat_title_text".localized(),
okTitle: "yes_text".localized(),
cancelTitle: "no_text".localized(),
okAction: {
self?.setChannelIO()
}
)
}
#if DEBUG
let debug = UIAlertAction(
title: "Debug",
style: .default
) { _ in
FLEXManager.shared()?.showExplorer()
}
let changeServer = UIAlertAction(
title: "Change Server (\(server.rawValue))",
style: .destructive
) { _ in
MainWireframe.shared?.window?.rootViewController = LauncherScreenWireframe().getMainView()
}
let requestHeader = UIAlertAction(
title: "Show Header",
style: .default
) { _ in
ShowAPIWireframe().open(on: self.target)
}
#endif
let contactNumber = UIAlertAction(
title: userHotLine?.remitPhoneNumber ?? "1588 6864",
style: .default
) { _ in
self.startCall(contactNumber: userHotLine?.remitPhoneNumber ?? "1588 6864")
}
let facebook = UIAlertAction(
title: "Facebook",
style: .default
) { _ in
UIApplication.tryURL(
url: userHotLine?.remitFacebookURL ?? "https://www.facebook.com/gmenepal/"
)
}
liveChat.setValue(UIImage(named:"chat")?.withRenderingMode(.alwaysOriginal),forKey:"image")
contactNumber.setValue(UIImage(named:"ic_call")?.withRenderingMode(.alwaysOriginal),forKey:"image")
facebook.setValue(UIImage(named:"settingsFacebook")?.withRenderingMode(.alwaysOriginal),forKey:"image")
#if DEBUG
alert.addAction(changeServer)
alert.addAction(debug)
alert.addAction(requestHeader)
#endif
alert.addAction(facebook)
alert.addAction(liveChat)
alert.addAction(contactNumber)
alert.addAction(UIAlertAction(
title: "cancel_text".localized(),
style: UIAlertAction.Style.cancel,
handler: nil
)
)
alert.view.tintColor = .themeText
if UIDevice.current.userInterfaceIdiom == .pad {
if let popoverController = alert.popoverPresentationController {
popoverController.sourceView = target.view
popoverController.sourceRect = CGRect(
x: target.view.bounds.midX,
y: target.view.bounds.midY,
width: 0,
height: 0
)
popoverController.permittedArrowDirections = []
target.present(alert, animated: true, completion: nil)
}
} else {
target.present(alert, animated: true, completion: nil)
}
guard
let label = (liveChat.value(forKey: "__representer")as? NSObject)?.value(forKey: "label") as? UILabel
else { return }
var appearance = BadgeAppearance()
appearance.distanceFromCenterX = (label.intrinsicContentSize.width / 2) + 10
appearance.distanceFromCenterY = -(label.intrinsicContentSize.height / 2)
let message = messageCount != 0 ? "\(messageCount)" : nil
label.badge(text: message, appearance: appearance)
}
private func startCall(contactNumber: String) {
if let url = URL(string: "tel://\(contactNumber.removeWhitespacesInBetween())"),
UIApplication.shared.canOpenURL(url) {
UIApplication.shared.open(url)
}
}
}
// MARK: ChannelPluginDelegate
extension CSManagement: ChannelPluginDelegate {
func onChangeBadge(count: Int) {
messageCount = count
}
func onReceivePush(event: PushEvent) {
//configure your view with push event data
//and display
print("event: \(event)")
}
}
Loading…
Cancel
Save