Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
浙江兰德纵横网络技术股份有限公司
o2oa-ios
提交
e2680a56
o2oa-ios
项目概览
浙江兰德纵横网络技术股份有限公司
/
o2oa-ios
通知
5
Star
5
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
o2oa-ios
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
e2680a56
编写于
6月 08, 2023
作者:
F
fancy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
多身份 多个顶层组织的问题修复
im 消息支持会话删除试试退出的等功能
上级
c956262d
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
118 addition
and
32 deletion
+118
-32
O2Platform/App/IM-聊天/IMChatViewController.swift
O2Platform/App/IM-聊天/IMChatViewController.swift
+26
-0
O2Platform/App/IM-聊天/IMConversationListViewController.swift
O2Platform/App/IM-聊天/IMConversationListViewController.swift
+16
-0
O2Platform/App/IM-聊天/Model/IMConversationInfo.swift
O2Platform/App/IM-聊天/Model/IMConversationInfo.swift
+10
-1
O2Platform/App/O2MainController.swift
O2Platform/App/O2MainController.swift
+12
-2
O2Platform/App/contacts/c/ContactHomeViewController.swift
O2Platform/App/contacts/c/ContactHomeViewController.swift
+48
-29
O2Platform/Extension/Notification+Extension.swift
O2Platform/Extension/Notification+Extension.swift
+4
-0
O2Platform/config/O2.swift
O2Platform/config/O2.swift
+2
-0
未找到文件。
O2Platform/App/IM-聊天/IMChatViewController.swift
浏览文件 @
e2680a56
...
...
@@ -158,6 +158,8 @@ class IMChatViewController: UIViewController {
// websocket 消息监听
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
receiveMessageFromWs(notice:)
)
,
name
:
OONotification
.
imCreate
.
notificationName
,
object
:
nil
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
receiveRevokeMsgFromWs(notice:)
)
,
name
:
OONotification
.
imRevoke
.
notificationName
,
object
:
nil
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
receiveImConvUpdateFromWs(notice:)
)
,
name
:
OONotification
.
imConvUpdate
.
notificationName
,
object
:
nil
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
receiveImConvDeleteFromWs(notice:)
)
,
name
:
OONotification
.
imConvDelete
.
notificationName
,
object
:
nil
)
// 监听 键盘打开
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
openKeyboard(notification:)
)
,
name
:
UIResponder
.
keyboardWillShowNotification
,
object
:
nil
)
// 监听 键盘大小变化
...
...
@@ -217,6 +219,30 @@ class IMChatViewController: UIViewController {
}
}
}
@objc
private
func
receiveImConvUpdateFromWs
(
notice
:
Notification
)
{
DDLogDebug
(
"接收到websocket 更新会话 消息"
)
if
let
message
=
notice
.
object
as?
IMConversationInfo
{
if
message
.
id
==
self
.
conversation
?
.
id
{
let
personList
=
message
.
personList
??
[]
let
currentDn
=
O2AuthSDK
.
shared
.
myInfo
()?
.
distinguishedName
??
""
if
personList
.
contains
(
currentDn
)
{
self
.
conversation
=
message
self
.
title
=
self
.
conversation
?
.
title
}
else
{
DDLogInfo
(
"成员被删除"
)
self
.
popVC
()
}
}
}
}
@objc
private
func
receiveImConvDeleteFromWs
(
notice
:
Notification
)
{
DDLogDebug
(
"接收到websocket 删除会话 消息"
)
if
let
message
=
notice
.
object
as?
IMConversationInfo
{
if
message
.
id
==
self
.
conversation
?
.
id
{
self
.
popVC
()
}
}
}
@objc
private
func
clickUpdate
()
{
var
arr
=
[
...
...
O2Platform/App/IM-聊天/IMConversationListViewController.swift
浏览文件 @
e2680a56
...
...
@@ -51,6 +51,9 @@ class IMConversationListViewController: UIViewController {
view
.
addSubview
(
emptyView
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
receiveMessageFromWs(notice:)
)
,
name
:
OONotification
.
imCreate
.
notificationName
,
object
:
nil
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
receiveImConvUpdateFromWs(notice:)
)
,
name
:
OONotification
.
imConvUpdate
.
notificationName
,
object
:
nil
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
receiveImConvDeleteFromWs(notice:)
)
,
name
:
OONotification
.
imConvDelete
.
notificationName
,
object
:
nil
)
imConfig
.
enableClearMsg
=
false
viewModel
.
loadImConfig
()
.
then
{
imConfig
in
...
...
@@ -103,6 +106,19 @@ class IMConversationListViewController: UIViewController {
}
}
}
@objc
private
func
receiveImConvUpdateFromWs
(
notice
:
Notification
)
{
DDLogDebug
(
"接收到websocket 更新会话 消息"
)
if
let
_
=
notice
.
object
as?
IMConversationInfo
{
self
.
getConversationList
()
}
}
@objc
private
func
receiveImConvDeleteFromWs
(
notice
:
Notification
)
{
DDLogDebug
(
"接收到websocket 删除会话 消息"
)
if
let
_
=
notice
.
object
as?
IMConversationInfo
{
self
.
getConversationList
()
}
}
//接收websocket消息
@objc
private
func
receiveMessageFromWs
(
notice
:
Notification
)
{
...
...
O2Platform/App/IM-聊天/Model/IMConversationInfo.swift
浏览文件 @
e2680a56
...
...
@@ -119,7 +119,7 @@ class IMUploadBackModel: NSObject, DataModel {
}
//websocket 消息对象
class
WsMessage
:
NSObject
,
DataModel
{
class
Ws
Im
Message
:
NSObject
,
DataModel
{
@objc
var
type
:
String
?
//im_create
@objc
var
body
:
IMMessageInfo
?
//这个对象只有 type=im_create的时候才是这个对象
required
override
init
()
{
}
...
...
@@ -128,6 +128,15 @@ class WsMessage: NSObject, DataModel {
}
}
class
WsImConvMessage
:
NSObject
,
DataModel
{
@objc
var
type
:
String
?
//
@objc
var
body
:
IMConversationInfo
?
//
required
override
init
()
{
}
func
mapping
(
mapper
:
HelpingMapper
)
{
}
}
//其他消息
class
InstantMessage
:
NSObject
,
DataModel
{
...
...
O2Platform/App/O2MainController.swift
浏览文件 @
e2680a56
...
...
@@ -374,17 +374,27 @@ extension O2MainController: WebSocketDelegate {
return
}
if
type
==
O2
.
O2_MESSAGE_TYPE_IM_CREATE
{
if
let
messageInfo
=
WsMessage
.
deserialize
(
from
:
text
)
{
if
let
messageInfo
=
Ws
Im
Message
.
deserialize
(
from
:
text
)
{
DDLogDebug
(
"接收到im消息 发送通知。。"
)
NotificationCenter
.
post
(
customeNotification
:
OONotification
.
imCreate
,
object
:
messageInfo
.
body
)
}
self
.
addUnreadNumber
()
AudioServicesPlaySystemSound
(
kSystemSoundID_Vibrate
)
}
else
if
type
==
O2
.
O2_MESSAGE_TYPE_IM_REVOKE
{
if
let
messageInfo
=
WsMessage
.
deserialize
(
from
:
text
)
{
if
let
messageInfo
=
Ws
Im
Message
.
deserialize
(
from
:
text
)
{
DDLogDebug
(
"接收到im消息 撤回消息"
)
NotificationCenter
.
post
(
customeNotification
:
OONotification
.
imRevoke
,
object
:
messageInfo
.
body
)
}
}
else
if
type
==
O2
.
O2_MESSAGE_TYPE_IM_CONVERSATION_UPDATE
{
if
let
messageInfo
=
WsImConvMessage
.
deserialize
(
from
:
text
)
{
DDLogDebug
(
"接收到im消息 更新会话消息"
)
NotificationCenter
.
post
(
customeNotification
:
OONotification
.
imConvUpdate
,
object
:
messageInfo
.
body
)
}
}
else
if
type
==
O2
.
O2_MESSAGE_TYPE_IM_CONVERSATION_DELETE
{
if
let
messageInfo
=
WsImConvMessage
.
deserialize
(
from
:
text
)
{
DDLogDebug
(
"接收到im消息 删除消息"
)
NotificationCenter
.
post
(
customeNotification
:
OONotification
.
imConvDelete
,
object
:
messageInfo
.
body
)
}
}
}
}
catch
{
}
...
...
O2Platform/App/contacts/c/ContactHomeViewController.swift
浏览文件 @
e2680a56
...
...
@@ -19,6 +19,7 @@ import CocoaLumberjack
class
ContactHomeViewController
:
UITableViewController
{
var
contacts
:[
Int
:[
CellViewModel
]]
=
[
0
:[],
1
:[],
2
:[]]
let
group
=
DispatchGroup
()
var
myDepartmentURL
:
String
?
{
let
acc
=
O2AuthSDK
.
shared
.
myInfo
()
!
...
...
@@ -354,38 +355,14 @@ class ContactHomeViewController: UITableViewController {
case
.
success
(
let
val
):
let
objects
=
JSON
(
val
)[
"data"
]
print
(
objects
.
description
)
var
identity
=
""
var
identity
s
:[
IdentityV2
]
=
[]
if
let
person
=
Mapper
<
PersonV2
>
()
.
map
(
JSONString
:
objects
.
description
)
{
if
let
identities
=
person
.
woIdentityList
,
identities
.
count
>
0
{
identity
=
identities
[
0
]
.
distinguishedName
??
""
identity
s
=
identities
}
}
if
!
identity
.
isEmpty
{
AF
.
request
(
self
.
topUnitByIdentityURL
!
,
method
:
.
post
,
parameters
:
[
"identity"
:
identity
as
AnyObject
,
"level"
:
1
as
AnyObject
],
encoding
:
JSONEncoding
.
default
,
headers
:
nil
)
.
responseJSON
(
completionHandler
:
{
(
res
)
in
switch
res
.
result
{
case
.
success
(
let
val
):
let
objects
=
JSON
(
val
)[
"data"
]
print
(
objects
.
description
)
self
.
contacts
[
order
]?
.
removeAll
()
if
let
unit
=
Mapper
<
OrgUnit
>
()
.
map
(
JSONString
:
objects
.
description
)
{
unit
.
subDirectUnitCount
=
1
//这个接口查询出来的组织没有下级组织的数量,假设是有下级组织的
let
tile
=
HeadTitle
(
name
:
L10n
.
Contacts
.
orgStructre
,
icon
:
O2ThemeManager
.
string
(
for
:
"Icon.icon_bumen"
)
!
)
let
vmt
=
CellViewModel
(
name
:
tile
.
name
,
sourceObject
:
tile
)
self
.
contacts
[
order
]?
.
append
(
vmt
)
// 顶级组织
let
vm
=
CellViewModel
(
name
:
unit
.
name
,
sourceObject
:
unit
)
self
.
contacts
[
order
]?
.
append
(
vm
)
}
break
case
.
failure
(
let
err
):
DDLogError
(
err
.
localizedDescription
)
}
self
.
hideLoading
()
if
self
.
tableView
.
mj_header
.
isRefreshing
()
==
true
{
self
.
tableView
.
mj_header
.
endRefreshing
()
}
self
.
tableView
.
reloadData
()
})
if
!
identitys
.
isEmpty
{
self
.
loadAllTopUnitByIdentity
(
order
:
order
,
identitys
:
identitys
)
}
else
{
self
.
hideLoading
()
if
self
.
tableView
.
mj_header
.
isRefreshing
()
==
true
{
...
...
@@ -393,7 +370,6 @@ class ContactHomeViewController: UITableViewController {
}
self
.
tableView
.
reloadData
()
}
case
.
failure
(
let
err
):
DDLogError
(
err
.
localizedDescription
)
self
.
hideLoading
()
...
...
@@ -407,6 +383,49 @@ class ContactHomeViewController: UITableViewController {
}
}
private
func
loadAllTopUnitByIdentity
(
order
:
Int
,
identitys
:
[
IdentityV2
])
{
self
.
contacts
[
order
]?
.
removeAll
()
for
identity
in
identitys
{
self
.
group
.
enter
()
// 异步处理请求
DispatchQueue
.
main
.
async
(
group
:
self
.
group
,
execute
:
DispatchWorkItem
(
block
:
{
AF
.
request
(
self
.
topUnitByIdentityURL
!
,
method
:
.
post
,
parameters
:
[
"identity"
:
identity
.
distinguishedName
as
AnyObject
,
"level"
:
1
as
AnyObject
],
encoding
:
JSONEncoding
.
default
,
headers
:
nil
)
.
responseJSON
(
completionHandler
:
{
(
res
)
in
switch
res
.
result
{
case
.
success
(
let
val
):
let
objects
=
JSON
(
val
)[
"data"
]
if
let
unit
=
Mapper
<
OrgUnit
>
()
.
map
(
JSONString
:
objects
.
description
)
{
unit
.
subDirectUnitCount
=
1
//这个接口查询出来的组织没有下级组织的数量,假设是有下级组织的
if
(
self
.
contacts
[
order
]?
.
isEmpty
==
true
)
{
// 第一次 添加头部
let
tile
=
HeadTitle
(
name
:
L10n
.
Contacts
.
orgStructre
,
icon
:
O2ThemeManager
.
string
(
for
:
"Icon.icon_bumen"
)
!
)
let
vmt
=
CellViewModel
(
name
:
tile
.
name
,
sourceObject
:
tile
)
self
.
contacts
[
order
]?
.
append
(
vmt
)
}
// 顶级组织
let
vm
=
CellViewModel
(
name
:
unit
.
name
,
sourceObject
:
unit
)
self
.
contacts
[
order
]?
.
append
(
vm
)
}
self
.
group
.
leave
()
break
case
.
failure
(
let
err
):
DDLogError
(
err
.
localizedDescription
)
self
.
group
.
leave
()
break
}
})
}))
}
self
.
group
.
notify
(
queue
:
DispatchQueue
.
main
)
{
// 处理结果
self
.
hideLoading
()
if
self
.
tableView
.
mj_header
.
isRefreshing
()
==
true
{
self
.
tableView
.
mj_header
.
endRefreshing
()
}
self
.
tableView
.
reloadData
()
}
}
}
extension
ContactHomeViewController
:
UISearchControllerDelegate
{
...
...
O2Platform/Extension/Notification+Extension.swift
浏览文件 @
e2680a56
...
...
@@ -29,6 +29,10 @@ enum OONotification:String {
case
imCreate
// im消息撤回
case
imRevoke
// 会话更新
case
imConvUpdate
// 会话删除
case
imConvDelete
//日程管理Main中使用
case
calendarIds
...
...
O2Platform/config/O2.swift
浏览文件 @
e2680a56
...
...
@@ -21,6 +21,8 @@ struct O2 {
public
static
let
O2_MESSAGE_TYPE_IM_CREATE
=
"im_create"
public
static
let
O2_MESSAGE_TYPE_IM_REVOKE
=
"im_revoke"
public
static
let
O2_MESSAGE_TYPE_IM_CONVERSATION_UPDATE
=
"im_conv_update"
public
static
let
O2_MESSAGE_TYPE_IM_CONVERSATION_DELETE
=
"im_conv_delete"
// 通讯录权限查询视图key
public
static
let
CUSTOM_STYLE_CONTACT_PERMISSION_PREF_KEY
=
"customStyleContactPermissionViewKey"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录