Commit 52ca2c3f authored by David黄金龙's avatar David黄金龙

添加 环信 SDK

parent 06a31cdd
...@@ -875,6 +875,7 @@ ...@@ -875,6 +875,7 @@
A567E5B62BD7643D00D5D5A0 /* YHHomeBannerIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E58F2BD7643D00D5D5A0 /* YHHomeBannerIndicatorView.swift */; }; A567E5B62BD7643D00D5D5A0 /* YHHomeBannerIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E58F2BD7643D00D5D5A0 /* YHHomeBannerIndicatorView.swift */; };
A567E5B82BD7643D00D5D5A0 /* YHSearchItemLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5912BD7643D00D5D5A0 /* YHSearchItemLayout.swift */; }; A567E5B82BD7643D00D5D5A0 /* YHSearchItemLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = A567E5912BD7643D00D5D5A0 /* YHSearchItemLayout.swift */; };
A56D2D612B62020C009C83A8 /* YHContractMainItemStatusCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A56D2D602B62020C009C83A8 /* YHContractMainItemStatusCell.swift */; }; A56D2D612B62020C009C83A8 /* YHContractMainItemStatusCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A56D2D602B62020C009C83A8 /* YHContractMainItemStatusCell.swift */; };
A574C8D02CF4A9C900E1E586 /* YHIMTestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A574C8CF2CF4A9C900E1E586 /* YHIMTestViewController.swift */; };
A5765B262C771F86002CD3C1 /* YHRangeDatePickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5765B252C771F86002CD3C1 /* YHRangeDatePickerView.swift */; }; A5765B262C771F86002CD3C1 /* YHRangeDatePickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5765B252C771F86002CD3C1 /* YHRangeDatePickerView.swift */; };
A5765B282C772185002CD3C1 /* YHRangeDatePickerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5765B272C772185002CD3C1 /* YHRangeDatePickerCell.swift */; }; A5765B282C772185002CD3C1 /* YHRangeDatePickerCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5765B272C772185002CD3C1 /* YHRangeDatePickerCell.swift */; };
A5765B2A2C77268C002CD3C1 /* YHRangeDatePickerSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5765B292C77268C002CD3C1 /* YHRangeDatePickerSheetView.swift */; }; A5765B2A2C77268C002CD3C1 /* YHRangeDatePickerSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A5765B292C77268C002CD3C1 /* YHRangeDatePickerSheetView.swift */; };
...@@ -1928,6 +1929,7 @@ ...@@ -1928,6 +1929,7 @@
A567E58F2BD7643D00D5D5A0 /* YHHomeBannerIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHHomeBannerIndicatorView.swift; sourceTree = "<group>"; }; A567E58F2BD7643D00D5D5A0 /* YHHomeBannerIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHHomeBannerIndicatorView.swift; sourceTree = "<group>"; };
A567E5912BD7643D00D5D5A0 /* YHSearchItemLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSearchItemLayout.swift; sourceTree = "<group>"; }; A567E5912BD7643D00D5D5A0 /* YHSearchItemLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = YHSearchItemLayout.swift; sourceTree = "<group>"; };
A56D2D602B62020C009C83A8 /* YHContractMainItemStatusCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHContractMainItemStatusCell.swift; sourceTree = "<group>"; }; A56D2D602B62020C009C83A8 /* YHContractMainItemStatusCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHContractMainItemStatusCell.swift; sourceTree = "<group>"; };
A574C8CF2CF4A9C900E1E586 /* YHIMTestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHIMTestViewController.swift; sourceTree = "<group>"; };
A5765B252C771F86002CD3C1 /* YHRangeDatePickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHRangeDatePickerView.swift; sourceTree = "<group>"; }; A5765B252C771F86002CD3C1 /* YHRangeDatePickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHRangeDatePickerView.swift; sourceTree = "<group>"; };
A5765B272C772185002CD3C1 /* YHRangeDatePickerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHRangeDatePickerCell.swift; sourceTree = "<group>"; }; A5765B272C772185002CD3C1 /* YHRangeDatePickerCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHRangeDatePickerCell.swift; sourceTree = "<group>"; };
A5765B292C77268C002CD3C1 /* YHRangeDatePickerSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHRangeDatePickerSheetView.swift; sourceTree = "<group>"; }; A5765B292C77268C002CD3C1 /* YHRangeDatePickerSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHRangeDatePickerSheetView.swift; sourceTree = "<group>"; };
...@@ -2903,6 +2905,7 @@ ...@@ -2903,6 +2905,7 @@
04564D542CF413A1004456E4 /* IM(环信) */ = { 04564D542CF413A1004456E4 /* IM(环信) */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
A574C8CE2CF4A95900E1E586 /* C */,
); );
path = "IM(环信)"; path = "IM(环信)";
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -4848,6 +4851,14 @@ ...@@ -4848,6 +4851,14 @@
path = V; path = V;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
A574C8CE2CF4A95900E1E586 /* C */ = {
isa = PBXGroup;
children = (
A574C8CF2CF4A9C900E1E586 /* YHIMTestViewController.swift */,
);
path = C;
sourceTree = "<group>";
};
A5765B242C771F51002CD3C1 /* RangeDatePicker */ = { A5765B242C771F51002CD3C1 /* RangeDatePicker */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
...@@ -5747,6 +5758,7 @@ ...@@ -5747,6 +5758,7 @@
04256DE02C72DC0600A37BA4 /* YHCertificateAppointOptionView.swift in Sources */, 04256DE02C72DC0600A37BA4 /* YHCertificateAppointOptionView.swift in Sources */,
04CA2BEE2CB7771000F36DE7 /* YHResignUploadTravelCardFootViewController.swift in Sources */, 04CA2BEE2CB7771000F36DE7 /* YHResignUploadTravelCardFootViewController.swift in Sources */,
044D0C062C22736F00C5CF5E /* YHSetExplainView.swift in Sources */, 044D0C062C22736F00C5CF5E /* YHSetExplainView.swift in Sources */,
A574C8D02CF4A9C900E1E586 /* YHIMTestViewController.swift in Sources */,
04256DF02C733B2D00A37BA4 /* YHGrabNumberInfoView.swift in Sources */, 04256DF02C733B2D00A37BA4 /* YHGrabNumberInfoView.swift in Sources */,
04213B252C48C15400797900 /* YHHomeIdentityViewController.swift in Sources */, 04213B252C48C15400797900 /* YHHomeIdentityViewController.swift in Sources */,
0472E25C2C521E64008EAB6E /* YHHomeIdentityListVC.swift in Sources */, 0472E25C2C521E64008EAB6E /* YHHomeIdentityListVC.swift in Sources */,
......
...@@ -17,6 +17,7 @@ import SensorsAnalyticsSDK ...@@ -17,6 +17,7 @@ import SensorsAnalyticsSDK
import AGConnectCore import AGConnectCore
import AGConnectCredential import AGConnectCredential
import AGConnectAppLinking import AGConnectAppLinking
import HyphenateChat
@main @main
class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
...@@ -75,6 +76,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate { ...@@ -75,6 +76,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
// QiYu SDK初始化 // QiYu SDK初始化
YHButlerServiceManager.shared.setupSDK() YHButlerServiceManager.shared.setupSDK()
//初始化 环信IM SDK
DispatchQueue.main.async {
let options : EMOptions = EMOptions(appkey: "1126241122157016#demo")
EMClient.shared().initializeSDK(with: options)
}
//设置主窗口 //设置主窗口
setupRootVC() setupRootVC()
return true return true
......
//
// YHIMTestViewController.swift
// galaxy
//
// Created by davidhuangA on 2024/11/25.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
import HyphenateChat
class YHIMTestViewController: YHBaseViewController {
override func viewDidLoad() {
super.viewDidLoad()
//1.
gk_navTitle = "IM 测试"
//2
//注册用户
// 异步方法
// [[EMClient sharedClient] registerWithUsername:@"username"
// password:@"your password"
// completion:^(NSString *aUsername, EMError *aError) {
// }];
EMClient.shared().register(withUsername: "davidTest", password: "galaxy-666") { aUsername, error in
if let err = error {
print("注册失败")
print(err.description)
} else {
print("注册成功")
//登录账号
// [[EMClient sharedClient] loginWithUsername:@"username"
// password:@"your password"
// completion:^(NSString *aUsername, EMError *aError) {
//
// }];
EMClient.shared().login(withUsername: "davidTest", password: "galaxy-666") { aUsername, error in
if let err = error {
print("登录失败")
print(err.description)
} else {
print("登录成功")
}
}
}
}
}
}
...@@ -342,87 +342,90 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource { ...@@ -342,87 +342,90 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = YHIMTestViewController()
if (indexPath.row >= items.count) { return }
if !checkLogin() {
return
}
let item: PersonalModuleItem = items[indexPath.row]
switch item.type {
case .myCard://我的名片
if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty {
let vc = YHNameCardViewController()
vc.userId = userId
self.navigationController?.pushViewController(vc)
} else {
YHHUD.show(.progress(message: "加载中..."))
self.loginViewModel.getUserId {
[weak self] uid in
YHHUD.hide()
guard let self = self else { return }
if !uid.isEmpty {
YHLoginManager.shared.userModel?.id = uid
let vc = YHNameCardViewController()
vc.userId = uid
self.navigationController?.pushViewController(vc) self.navigationController?.pushViewController(vc)
} return //for test hjl
}
}
case .myMessage://我的消息
printLog("我的消息")
goToMessagePage()
case .scoreCenter:////积分中心 // if (indexPath.row >= items.count) { return }
printLog("积分中心") //
if let param = YHLoginManager.shared.userModel?.token,param.count>5 { // if !checkLogin() {
printLog(param) // return
var url = YHBaseUrlManager.shared.curH5URL() + "superApp/integral" // }
url = url + "?param=" + YHLoginManager.shared.h5Token //
// let item: PersonalModuleItem = items[indexPath.row]
let vc = YHH5WebViewVC() // switch item.type {
vc.navTitle = "积分中心" // case .myCard://我的名片
vc.url = url // if let userId = YHLoginManager.shared.userModel?.id, !userId.isEmpty {
vc.isFullScreenFlag = false // let vc = YHNameCardViewController()
vc.isSupportWebviewInterBackFlag = true // vc.userId = userId
self.navigationController?.pushViewController(vc) // self.navigationController?.pushViewController(vc)
} // } else {
case .myTestCode://我的测评码 // YHHUD.show(.progress(message: "加载中..."))
printLog("我的测评码") // self.loginViewModel.getUserId {
let vc = YHHomeWebViewController() // [weak self] uid in
vc.vcTitle = "香港身份测评码" // YHHUD.hide()
vc.showSavePicBottomFlag = true // guard let self = self else { return }
vc.url = "https://cdn-public.galaxy-immi.com/app/cepingma.png" // if !uid.isEmpty {
self.navigationController?.pushViewController(vc) // YHLoginManager.shared.userModel?.id = uid
case .appointGalaxyBay://预约银河湾 // let vc = YHNameCardViewController()
printLog("预约银河湾") // vc.userId = uid
let vc = YHListViewController() // self.navigationController?.pushViewController(vc)
self.navigationController?.pushViewController(vc) // }
case .myActivity: // }
printLog("我的活动") // }
let vc = YHActivityListViewController() // case .myMessage://我的消息
vc.type = 1 // printLog("我的消息")
self.navigationController?.pushViewController(vc) // goToMessagePage()
case .aboutUs: //
let vc = YHAboutGalaxyViewController() // case .scoreCenter:////积分中心
self.navigationController?.pushViewController(vc) // printLog("积分中心")
case .myOrder: // if let param = YHLoginManager.shared.userModel?.token,param.count>5 {
// 我的订单 // printLog(param)
if let token = YHLoginManager.shared.userModel?.token,token.count > 5 { // var url = YHBaseUrlManager.shared.curH5URL() + "superApp/integral"
var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/order/my" // url = url + "?param=" + YHLoginManager.shared.h5Token
url = url + "?param=" + YHLoginManager.shared.h5Token //
printLog("URL: \(url)") // let vc = YHH5WebViewVC()
let vc = YHH5WebViewVC() // vc.navTitle = "积分中心"
vc.url = url // vc.url = url
vc.isFullScreenFlag = false // vc.isFullScreenFlag = false
vc.navTitle = "我的订单" // vc.isSupportWebviewInterBackFlag = true
vc.isSupportWebviewInterBackFlag = true // self.navigationController?.pushViewController(vc)
UIViewController.current?.navigationController?.pushViewController(vc) // }
} // case .myTestCode://我的测评码
default: // printLog("我的测评码")
printLog("不需要响应") // let vc = YHHomeWebViewController()
} // vc.vcTitle = "香港身份测评码"
// vc.showSavePicBottomFlag = true
// vc.url = "https://cdn-public.galaxy-immi.com/app/cepingma.png"
// self.navigationController?.pushViewController(vc)
// case .appointGalaxyBay://预约银河湾
// printLog("预约银河湾")
// let vc = YHListViewController()
// self.navigationController?.pushViewController(vc)
// case .myActivity:
// printLog("我的活动")
// let vc = YHActivityListViewController()
// vc.type = 1
// self.navigationController?.pushViewController(vc)
// case .aboutUs:
// let vc = YHAboutGalaxyViewController()
// self.navigationController?.pushViewController(vc)
// case .myOrder:
//// 我的订单
// if let token = YHLoginManager.shared.userModel?.token,token.count > 5 {
// var url = YHBaseUrlManager.shared.curH5URL() + "superAppBridge.html#/order/my"
// url = url + "?param=" + YHLoginManager.shared.h5Token
// printLog("URL: \(url)")
// let vc = YHH5WebViewVC()
// vc.url = url
// vc.isFullScreenFlag = false
// vc.navTitle = "我的订单"
// vc.isSupportWebviewInterBackFlag = true
// UIViewController.current?.navigationController?.pushViewController(vc)
// }
// default:
// printLog("不需要响应")
// }
} }
private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat { private func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> CGFloat {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment