Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
GMAILab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMAILab
Commits
3ab0a117
Commit
3ab0a117
authored
4 years ago
by
朱璇
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'zx/faceTest' into 'lym/test'
Zx/face test See merge request
!2
parents
5ee37d65
3f466d85
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
272 additions
and
59 deletions
+272
-59
GMBasicInfoCardView.m
...lasses/ToFace/ToFaceDoctorList/View/GMBasicInfoCardView.m
+3
-2
GMToFacePayPrepareModel.h
...lasses/ToFace/ToFaceOrder/Model/GMToFacePayPrepareModel.h
+1
-1
GMDoctorVideoTelephoneLogin.m
...Face/VideoTelephone/manager/GMDoctorVideoTelephoneLogin.m
+49
-5
GMNimChannelManager.h
...asses/ToFace/VideoTelephone/manager/GMNimChannelManager.h
+7
-0
GMNimChannelManager.m
...asses/ToFace/VideoTelephone/manager/GMNimChannelManager.m
+18
-0
GMTelephoneAudioPlay.h
...sses/ToFace/VideoTelephone/manager/GMTelephoneAudioPlay.h
+6
-0
GMTelephoneAudioPlay.m
...sses/ToFace/VideoTelephone/manager/GMTelephoneAudioPlay.m
+22
-0
GMUserVideoTelephoneLogin.m
...ToFace/VideoTelephone/manager/GMUserVideoTelephoneLogin.m
+42
-11
GMVideoTelephoneModel.h
...asses/ToFace/VideoTelephone/model/GMVideoTelephoneModel.h
+10
-2
GMDoctorVideoTelephoneWindow.m
...Face/VideoTelephone/window/GMDoctorVideoTelephoneWindow.m
+17
-6
GMUserVideoTelephoneWindow.m
...ToFace/VideoTelephone/window/GMUserVideoTelephoneWindow.m
+1
-3
GMNoticeInfoObject.h
GMAILab/Classes/ToFace/Waiting/GMNoticeInfoObject.h
+9
-0
GMVideoWaitingView.m
GMAILab/Classes/ToFace/Waiting/GMVideoWaitingView.m
+59
-17
GMWaitingSuccessView.m
GMAILab/Classes/ToFace/Waiting/GMWaitingSuccessView.m
+27
-9
GMWaitingGrabListCell.m
.../Classes/ToFace/WorkingTable/View/GMWaitingGrabListCell.m
+1
-3
No files found.
GMAILab/Classes/ToFace/ToFaceDoctorList/View/GMBasicInfoCardView.m
View file @
3ab0a117
...
...
@@ -234,8 +234,9 @@
//1v1的付款金额字段
fee
=
weakSelf
.
dict
[
@"service_fee"
];
}
//是否需要付款
if
(
fee
.
floatValue
==
0
)
{
//需要付款
//是否需要付款(逻辑改为和安卓一致)
if
(
!
model
.
needPay
)
{
//金额为0则直接开启面诊
[
self
videoDiagnose
];
}
else
{
...
...
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/ToFaceOrder/Model/GMToFacePayPrepareModel.h
View file @
3ab0a117
...
...
@@ -50,7 +50,7 @@
@property
(
nonatomic
,
assign
)
NSInteger
paymentAmount
;
@property
(
nonatomic
,
copy
)
NSString
*
paymentAmountStr
;
/** */
@property
(
nonatomic
,
assign
)
NSInteger
needPay
;
@property
(
nonatomic
,
assign
)
BOOL
needPay
;
/** 支付方式 */
@property
(
nonatomic
,
strong
)
NSMutableArray
<
GMToFacePayTypeModel
>*
paymentChannels
;
...
...
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/VideoTelephone/manager/GMDoctorVideoTelephoneLogin.m
View file @
3ab0a117
...
...
@@ -15,6 +15,9 @@
#import "GMAppCameraAndMicrophone.h"
#import "GMVideoPhobos.h"
#import <GMBase/GMBaseTool.h>
#import "GMNimChannelManager.h"
#import <GMFoundation/NSString+GM.h>
@import
GMHud
;
@import
GMRouter
;
...
...
@@ -33,6 +36,9 @@ static GMDoctorVideoTelephoneLogin *loginManager = nil;
/// 扩展字段
@property
(
nonatomic
,
strong
)
NSDictionary
*
extensionDict
;
/// 网易云信
@property
(
nonatomic
,
strong
)
GMNeteaseIMModel
*
neteaseModel
;
@end
@implementation
GMDoctorVideoTelephoneLogin
...
...
@@ -41,6 +47,14 @@ static GMDoctorVideoTelephoneLogin *loginManager = nil;
GMTelephoneAudioPlay
*
_audioPlay
;
GMTelephoneView
*
_telephoneView
;
//医生端接电话页面
GMVideoTelephoneWindow
*
_window
;
GMVideoTelephoneModel
*
_videoModel
;
/// 加入房间重试次数,大于等于0,0代表不重试
NSInteger
_joinChannelRetryCount
;
/// 重试间隔,毫秒,大于等于0
NSInteger
_joinChannelRetryMs
;
}
+
(
GMDoctorVideoTelephoneLogin
*
)
sharedDoctorVideoTelephoneLogin
{
...
...
@@ -69,8 +83,11 @@ static GMDoctorVideoTelephoneLogin *loginManager = nil;
if
(
success
)
{
[[[
UIApplication
sharedApplication
]
keyWindow
]
endEditing
:
YES
];
if
(
_telephoneView
==
nil
)
{
GMVideoTelephoneModel
*
model
=
modelDict
[
@"model"
];
[
self
showTelephoneView
:
model
];
_videoModel
=
modelDict
[
@"model"
];
// 重试数据
_joinChannelRetryMs
=
_videoModel
.
joinChannelRetryMs
;
_joinChannelRetryCount
=
_videoModel
.
joinChannelRetryCount
;
[
self
showTelephoneView
:
_videoModel
];
}
}
else
{
TTManager
.
telephoneStatus
=
TelephoneVideoStatus_rest
;
...
...
@@ -97,6 +114,7 @@ static GMDoctorVideoTelephoneLogin *loginManager = nil;
_uid
=
(
NSInteger
)[[
GMRouter
sharedInstance
]
pushScheme
:
@"gengmei://gm_userId"
];;
_channelId
=
model
.
channelId
;
_pushURL
=
model
.
streamUrl
;
_neteaseModel
=
model
.
neteaseIm
;
if
(
_channelId
.
integerValue
==
0
||
_channelId
.
length
>=
19
)
{
TTManager
.
telephoneStatus
=
TelephoneVideoStatus_rest
;
...
...
@@ -133,7 +151,7 @@ static GMDoctorVideoTelephoneLogin *loginManager = nil;
#pragma mark - 医生端展示电话页面
-
(
void
)
showTelephoneView
:
(
GMVideoTelephoneModel
*
)
model
{
[
_audioPlay
startAudioPlay
];
[
_audioPlay
startAudioPlay
AndVibration
];
_telephoneView
=
[[
GMTelephoneView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
MAINSCREEN_WIDTH
,
MAINSCREEN_HEIGHT
)];
_telephoneView
.
model
=
model
;
_telephoneView
.
delegate
=
self
;
...
...
@@ -184,7 +202,7 @@ static GMDoctorVideoTelephoneLogin *loginManager = nil;
}
-
(
void
)
killCurrentView
{
[
_audioPlay
stopAudioPlay
];
[
_audioPlay
stopAudioPlay
AndVibration
];
_telephoneView
.
hidden
=
YES
;
[
_telephoneView
removeFromSuperview
];
_telephoneView
=
nil
;
...
...
@@ -203,6 +221,17 @@ static GMDoctorVideoTelephoneLogin *loginManager = nil;
#pragma mark - TTTRtcEngineDelegate初始化成功
-
(
void
)
rtcEngine
:
(
TTTRtcEngineKit
*
)
engine
didJoinChannel
:
(
NSString
*
)
channel
withUid
:
(
int64_t
)
uid
elapsed
:
(
NSInteger
)
elapsed
{
// 加入房间并邀请
if
(
_neteaseModel
&&
[
_neteaseModel
.
toAccountId
isNonEmpty
]
&&
[
_neteaseModel
.
channelId
isNonEmpty
])
{
[[
GMNimChannelManager
shareInstance
]
doJoinAndInviteJoinChannelWithChannelId
:
_neteaseModel
.
channelId
accountId
:
_neteaseModel
.
toAccountId
customInfo
:
_neteaseModel
.
inviteExt
resultBlock
:^
(
BOOL
isSuccess
)
{
if
(
!
isSuccess
)
{
#ifdef DEBUG
[[
GMBaseTool
getCurrentViewController
]
toast
:
@"doJoinAndInviteJoinChannelWithChannelId失败"
];
#endif
}
}];
}
[
GMVideoTelephoneRequestTool
telephoneMessageEventType
:
GMEventType_addSuccess
consultationRecordId
:
TTManager
.
consultationRecordId
finishBlock
:
nil
];
[
self
showWindow
:
_clientRole
];
}
...
...
@@ -231,6 +260,22 @@ static GMDoctorVideoTelephoneLogin *loginManager = nil;
errorInfo
=
@"未知错误"
;
break
;
}
TTManager
.
telephoneStatus
=
TelephoneVideoStatus_rest
;
[
self
tryAgainIfFailedWithErrorInfo
:
errorInfo
errorCode
:
errorCode
];
}
-
(
void
)
tryAgainIfFailedWithErrorInfo
:
(
NSString
*
)
errorInfo
errorCode
:
(
TTTRtcErrorCode
)
errorCode
{
if
(
_clientRole
==
TTTRtc_ClientRole_Broadcaster
&&
_joinChannelRetryCount
>
0
)
{
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
_joinChannelRetryMs
/
1000
.
0
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
[
self
doctorLoginVideoRoomModel
:
_videoModel
];
_joinChannelRetryCount
--
;
});
}
else
{
[
self
uploadFailedRecordWithErrorInfo
:
errorInfo
];
}
}
-
(
void
)
uploadFailedRecordWithErrorInfo
:
(
NSString
*
)
errorInfo
{
[
GMVideoTelephoneRequestTool
telephoneMessageEventType
:
GMEventType_addFail
consultationRecordId
:
TTManager
.
consultationRecordId
finishBlock
:
nil
];
[
GMHudModule
showWarning
:
errorInfo
];
if
(
_telephoneView
)
{
//关闭医生端接电话图层
...
...
@@ -238,7 +283,6 @@ static GMDoctorVideoTelephoneLogin *loginManager = nil;
_telephoneView
=
nil
;
[
_audioPlay
stopAudioPlay
];
}
TTManager
.
telephoneStatus
=
TelephoneVideoStatus_rest
;
}
...
...
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/VideoTelephone/manager/GMNimChannelManager.h
View file @
3ab0a117
...
...
@@ -30,6 +30,13 @@ typedef void(^NIMResultCreateBlock)(NIMSignalingChannelInfo *);
/// @param resultBlock 结果
-
(
void
)
doJoinChannelWithChannelId
:(
NSString
*
)
channelId
resultBlock
:(
NIMResultBlock
)
resultBlock
;
/// 加入并邀请对方加入频道
/// @param channelId channelId
/// @param accountId 对方,被邀请人,必填
/// @param customInfo 通知事件额外字段,非必填(邀请者附加的自定义信息,透传给被邀请者)
/// @param resultBlock 结果
-
(
void
)
doJoinAndInviteJoinChannelWithChannelId
:(
NSString
*
)
channelId
accountId
:(
NSString
*
)
accountId
customInfo
:(
NSString
*
)
customInfo
resultBlock
:(
nonnull
NIMResultBlock
)
resultBlock
;
/// 离开频道
/// @param channelId channelId
/// @param resultBlock 结果
...
...
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/VideoTelephone/manager/GMNimChannelManager.m
View file @
3ab0a117
...
...
@@ -46,6 +46,24 @@
}
}];
}
/// 加入并邀请对方加入频道
/// @param channelId channelId
/// @param accountId 对方,被邀请人,必填
/// @param customInfo 通知事件额外字段,非必填(邀请者附加的自定义信息,透传给被邀请者)
/// @param resultBlock 结果
-
(
void
)
doJoinAndInviteJoinChannelWithChannelId
:
(
NSString
*
)
channelId
accountId
:
(
NSString
*
)
accountId
customInfo
:
(
NSString
*
)
customInfo
resultBlock
:
(
nonnull
NIMResultBlock
)
resultBlock
{
[
self
doJoinChannelWithChannelId
:
channelId
resultBlock
:
^
(
BOOL
isSuccess
)
{
if
(
isSuccess
)
{
[
self
doInviteJoinWithChannelId
:
channelId
accountId
:
accountId
customInfo
:
customInfo
resultBlock
:^
(
BOOL
isSuccess
)
{
resultBlock
(
isSuccess
);
}];
}
else
{
resultBlock
(
NO
);
}
}];
}
/// 离开频道
/// @param channelId channelId
/// @param resultBlock 结果
...
...
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/VideoTelephone/manager/GMTelephoneAudioPlay.h
View file @
3ab0a117
...
...
@@ -14,6 +14,12 @@ NS_ASSUME_NONNULL_BEGIN
-
(
GMTelephoneAudioPlay
*
)
initWithAudioSource
:(
NSString
*
)
name
ofType
:(
NSString
*
)
type
;
-
(
void
)
startAudioPlay
;
-
(
void
)
stopAudioPlay
;
/// 声音加震动
-
(
void
)
startAudioPlayAndVibration
;
/// 关闭声音和震动
-
(
void
)
stopAudioPlayAndVibration
;
@end
NS_ASSUME_NONNULL_END
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/VideoTelephone/manager/GMTelephoneAudioPlay.m
View file @
3ab0a117
...
...
@@ -8,6 +8,7 @@
#import "GMTelephoneAudioPlay.h"
#import <AVFoundation/AVFoundation.h>
#import <AudioToolbox/AudioToolbox.h>
@interface
GMTelephoneAudioPlay
()
@property
(
nonatomic
,
strong
)
AVAudioPlayer
*
audioPlay
;
...
...
@@ -43,4 +44,25 @@
-
(
void
)
stopAudioPlay
{
[
self
.
audioPlay
pause
];
}
-
(
void
)
startAudioPlayAndVibration
{
[
self
startAudioPlay
];
// 开始震动
AudioServicesAddSystemSoundCompletion
(
kSystemSoundID_Vibrate
,
NULL
,
NULL
,
vibrationCompleteCallback
,
NULL
);
AudioServicesPlaySystemSound
(
kSystemSoundID_Vibrate
);
}
-
(
void
)
stopAudioPlayAndVibration
{
[
self
stopAudioPlay
];
// 停止震动
AudioServicesRemoveSystemSoundCompletion
(
kSystemSoundID_Vibrate
);
AudioServicesDisposeSystemSoundID
(
kSystemSoundID_Vibrate
);
}
void
vibrationCompleteCallback
(
SystemSoundID
sound
,
void
*
clientData
)
{
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
800
*
NSEC_PER_MSEC
)),
dispatch_get_global_queue
(
0
,
0
),
^
{
AudioServicesPlaySystemSound
(
sound
);
});
}
@end
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/VideoTelephone/manager/GMUserVideoTelephoneLogin.m
View file @
3ab0a117
...
...
@@ -48,6 +48,11 @@ static GMUserVideoTelephoneLogin *loginManager = nil;
GMRtcManager
*
TTManager
;
GMTelephoneAudioPlay
*
_audioPlay
;
GMVideoTelephoneWindow
*
_window
;
/// 加入房间重试次数,大于等于0,0代表不重试
NSInteger
_joinChannelRetryCount
;
/// 重试间隔,毫秒,大于等于0
NSInteger
_joinChannelRetryMs
;
}
+
(
GMUserVideoTelephoneLogin
*
)
sharedVideoTelephoneLogin
{
...
...
@@ -107,7 +112,10 @@ static GMUserVideoTelephoneLogin *loginManager = nil;
_clientRole
=
TTTRtc_ClientRole_Broadcaster
;
_extensionDict
=
extentsionDict
;
TTManager
=
[
GMRtcManager
sharedRtcManager
];
GMVideoTelephoneModel
*
model
=
[[
GMVideoTelephoneModel
alloc
]
initWithDictionary
:
messageDict
error
:
nil
];;
GMVideoTelephoneModel
*
model
=
[[
GMVideoTelephoneModel
alloc
]
initWithDictionary
:
messageDict
error
:
nil
];
// 重试数据
_joinChannelRetryMs
=
model
.
joinChannelRetryMs
;
_joinChannelRetryCount
=
model
.
joinChannelRetryCount
;
[
self
userLoginVideoRoomModel
:
model
];
}
...
...
@@ -155,16 +163,17 @@ static GMUserVideoTelephoneLogin *loginManager = nil;
#pragma mark - TTTRtcEngineDelegate初始化成功
-
(
void
)
rtcEngine
:
(
TTTRtcEngineKit
*
)
engine
didJoinChannel
:
(
NSString
*
)
channel
withUid
:
(
int64_t
)
uid
elapsed
:
(
NSInteger
)
elapsed
{
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"gm_push_remove_waiting_success"
object
:
nil
];
// 加入房间并邀请
[[
GMNimChannelManager
shareInstance
]
doJoinChannelWithChannelId
:
_neteaseModel
.
channelId
resultBlock
:
^
(
BOOL
isSuccess
)
{
if
(
isSuccess
)
{
NSDictionary
*
customInfo
=
@{
@"type"
:
@1
,
@"consultation_record_id"
:
TTManager
.
consultationRecordId
}
;
[[
GMNimChannelManager
shareInstance
]
doInviteJoinWithChannelId
:
_neteaseModel
.
channelId
accountId
:
_neteaseModel
.
toAccountId
customInfo
:
[
NSDictionary
dictionaryToJson
:
customInfo
]
resultBlock
:^
(
BOOL
isSuccess
)
{
}
];
}
}
];
if
(
_neteaseModel
&&
[
_neteaseModel
.
toAccountId
isNonEmpty
]
&&
[
_neteaseModel
.
channelId
isNonEmpty
]
)
{
[[
GMNimChannelManager
shareInstance
]
doJoinAndInviteJoinChannelWithChannelId
:
_neteaseModel
.
channelId
accountId
:
_neteaseModel
.
toAccountId
customInfo
:
_neteaseModel
.
inviteExt
resultBlock
:^
(
BOOL
isSuccess
)
{
if
(
!
isSuccess
)
{
#ifdef DEBUG
[[
GMBaseTool
getCurrentViewController
]
toast
:
@"doJoinAndInviteJoinChannelWithChannelId失败"
]
;
#endif
}
}
];
}
[
GMVideoTelephoneRequestTool
telephoneMessageEventType
:
GMEventType_addSuccess
consultationRecordId
:
TTManager
.
consultationRecordId
finishBlock
:
nil
];
[
self
showWindow
:
_clientRole
];
...
...
@@ -193,11 +202,33 @@ static GMUserVideoTelephoneLogin *loginManager = nil;
errorInfo
=
@"未知错误"
;
break
;
}
TTManager
.
telephoneStatus
=
TelephoneVideoStatus_rest
;
// 增加失败重试功能(当我是复播的时候)
[
self
tryAgainIfFailedWithErrorInfo
:
errorInfo
errorCode
:
errorCode
];
}
/// 初始化失败重试
/// @param errorInfo 错误toast
/// @param errorCode 错误代码
-
(
void
)
tryAgainIfFailedWithErrorInfo
:
(
NSString
*
)
errorInfo
errorCode
:
(
TTTRtcErrorCode
)
errorCode
{
if
(
_clientRole
==
TTTRtc_ClientRole_Broadcaster
&&
_joinChannelRetryCount
>
0
)
{
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
_joinChannelRetryMs
/
1000
.
0
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
[
self
userLoginVideoRoomModel
:[[
GMVideoTelephoneModel
alloc
]
initWithDictionary
:
_messageDict
error
:
nil
]];
_joinChannelRetryCount
--
;
});
}
else
{
[
self
uploadFailedRecordWithErrorInfo
:
errorInfo
];
}
}
/// 上传状态到服务器
/// @param errorInfo 错误信息
-
(
void
)
uploadFailedRecordWithErrorInfo
:
(
NSString
*
)
errorInfo
{
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"gm_push_remove_waiting_success"
object
:
nil
];
[
GMVideoTelephoneRequestTool
telephoneMessageEventType
:
GMEventType_addFail
consultationRecordId
:
TTManager
.
consultationRecordId
finishBlock
:
nil
];
if
(
TTManager
.
totalTime
<=
0
)
{
[
GMHudModule
showWarning
:
errorInfo
];
}
TTManager
.
telephoneStatus
=
TelephoneVideoStatus_rest
;
}
#pragma mark - 展示直播页面
...
...
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/VideoTelephone/model/GMVideoTelephoneModel.h
View file @
3ab0a117
...
...
@@ -17,10 +17,13 @@ NS_ASSUME_NONNULL_BEGIN
@protocol
GMNeteaseIMModel
@end
@interface
GMNeteaseIMModel
:
GMObject
/// 被叫方的account_id,可能是空字符串
@property
(
nonatomic
,
strong
)
NSString
*
toAccountId
;
@property
(
nonatomic
,
copy
)
NSString
*
toAccountId
;
/// 双方需要加入的信令房间id,可能是空字符串
@property
(
nonatomic
,
strong
)
NSString
*
channelId
;
@property
(
nonatomic
,
copy
)
NSString
*
channelId
;
/// 额外参数
@property
(
nonatomic
,
copy
)
NSString
*
inviteExt
;
@end
@interface
GMVideoTelephoneModel
:
GMObject
...
...
@@ -54,6 +57,11 @@ NS_ASSUME_NONNULL_BEGIN
@property
(
nonatomic
,
strong
)
GMConsultationInfoModel
*
counsellorInfo
;
// 网易云信
@property
(
nonatomic
,
strong
)
GMNeteaseIMModel
*
neteaseIm
;
/// 加入房间重试次数,大于等于0,0代表不重试
@property
(
nonatomic
,
assign
)
NSInteger
joinChannelRetryCount
;
/// 重试间隔,毫秒,大于等于0
@property
(
nonatomic
,
assign
)
NSInteger
joinChannelRetryMs
;
/// 获取性别字符串
...
...
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/VideoTelephone/window/GMDoctorVideoTelephoneWindow.m
View file @
3ab0a117
...
...
@@ -145,9 +145,7 @@
#pragma mark - 超时退出直播间
-
(
void
)
userExitTime
{
[
super
userExitTime
];
//主播与副主播的被动挂断提示不同
NSString
*
message
=
_TTManager
.
me
.
clientRole
==
TTTRtc_ClientRole_Anchor
?
@"用户接入异常,即将退出视频通话"
:
@"用户接入异常,即将退出视频"
;
[
GMHudModule
showWarning
:
message
];
[
GMHudModule
showWarning
:
@"用户取消,连线结束"
];
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
2
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
[
self
exitRoom
:
NO
];
});
...
...
@@ -208,9 +206,7 @@
#pragma mark - 记录通话时长
-
(
void
)
doctorTimeChange
:
(
int
)
currentTime
{
_TTManager
.
totalTime
=
currentTime
;
if
(
currentTime
%
10
==
0
)
{
// 10s 上报一次
[
GMVideoTelephoneRequestTool
telephoneMessageEventType
:
GMEventType_video
consultationRecordId
:
_TTManager
.
consultationRecordId
finishBlock
:
nil
];
}
[
GMVideoTelephoneRequestTool
telephoneMessageEventType
:
GMEventType_video
consultationRecordId
:
_TTManager
.
consultationRecordId
finishBlock
:
nil
];
}
#pragma mark - 退出房间 status yes 正常退出 no 异常退出
...
...
@@ -276,6 +272,21 @@
[
self
.
userVideoView
configureRegion
:
_user
];
[
_TTManager
setTelephoneVideoCompositingLayout
:
self
.
windowStatu
userId
:
uid
doctorId
:
_TTManager
.
me
.
uid
];
[
GMHudModule
toastInView
:
self
text
:
@"已接通"
];
[
GMVideoTelephoneRequestTool
telephoneMessageEventType
:
GMEventType_video
consultationRecordId
:
_TTManager
.
consultationRecordId
finishBlock
:^
(
BOOL
success
,
NSDictionary
*
message
)
{
if
(
success
)
{
// 在医生抢单的瞬间,用户取消派单会出现 医生进入视频页面一直不取消,所以加此处理逻辑
if
([
message
.
allKeys
containsObject
:
@"model"
])
{
GMTelphoneStatusModel
*
model
=
message
[
@"model"
];
if
(
model
.
status
==
3
)
{
// 已结束
[
self
userExitTime
];
}
}
}
}];
[
_functionView
startTime
];
}
...
...
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/VideoTelephone/window/GMUserVideoTelephoneWindow.m
View file @
3ab0a117
...
...
@@ -297,9 +297,7 @@
#pragma mark - 更新记录通话时长
-
(
void
)
userTimeChange
:
(
int
)
currentTime
{
_TTManager
.
totalTime
=
currentTime
;
if
(
currentTime
%
10
==
0
)
{
// 10s 上报一次
[
GMVideoTelephoneRequestTool
telephoneMessageEventType
:
GMEventType_video
consultationRecordId
:
_TTManager
.
consultationRecordId
finishBlock
:
nil
];
}
[
GMVideoTelephoneRequestTool
telephoneMessageEventType
:
GMEventType_video
consultationRecordId
:
_TTManager
.
consultationRecordId
finishBlock
:
nil
];
}
#pragma mark - 变成小窗口
...
...
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/Waiting/GMNoticeInfoObject.h
View file @
3ab0a117
...
...
@@ -26,6 +26,15 @@ NS_ASSUME_NONNULL_BEGIN
@property
(
nonatomic
,
copy
)
NSString
*
consultPeopleNumber
;
/** 展示类型,0:不显示 1: 好评率 + 接通率 2: 好评率 + 有效面诊人数*/
@property
(
nonatomic
,
assign
)
NSInteger
showType
;
/// 是否显示倒计时
@property
(
nonatomic
,
assign
)
BOOL
showCountdown
;
/// 倒计时 单位 微秒
@property
(
nonatomic
,
assign
)
NSInteger
countdown
;
/// 显示文案
@property
(
nonatomic
,
copy
)
NSString
*
countdownText
;
@end
NS_ASSUME_NONNULL_END
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/Waiting/GMVideoWaitingView.m
View file @
3ab0a117
...
...
@@ -34,12 +34,17 @@
@property
(
nonatomic
,
strong
)
GMWaitingSuccessView
*
successView
;
@property
(
nonatomic
,
strong
)
SDAnimatedImageView
*
animationView
;
@property
(
nonatomic
,
strong
)
GMImageView
*
beijingView
;
@property
(
nonatomic
,
assign
)
BOOL
isCanceling
;
@end
@implementation
GMVideoWaitingView
-
(
void
)
setup
{
[
super
setup
];
// 监听 是否有人抢单成功(信令消息)
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
fetchAndPingCurrentDispatch
)
name
:
@"gm_push_consouller_accept"
object
:
nil
];
self
.
container
.
size
=
CGSizeMake
(
MAINSCREEN_WIDTH
,
380
+
UIView
.
safeAreaInsetsBottom
);
[
self
containerRectCorner
:
self
.
container
];
...
...
@@ -178,19 +183,11 @@
self
.
bottomLabel
.
text
=
[
NSString
stringWithFormat
:
@"%ds"
,
self
.
currentTime
];
self
.
currentTime
--
;
if
(
self
.
currentTime
%
5
==
0
)
{
__weak
__typeof
(
self
)
weakSelf
=
self
;
[
GMNetworking
requestOCWithApi
:
@"/api/consultation_counsel/get_current_dispatch_info"
method
:
GMHTTPMethodGet
parameters
:
nil
completion
:^
(
GMResponseOC
*
_Nonnull
response
)
{
if
(
response
.
data
[
@"notice_info"
])
{
[
weakSelf
showSuccessView
];
weakSelf
.
successView
.
object
=
[[
GMNoticeInfoObject
alloc
]
initWithDictionary
:
response
.
data
[
@"notice_info"
]
error
:
nil
];
NSMutableDictionary
*
dict
=
[
NSMutableDictionary
dictionaryWithDictionary
:
response
.
data
[
@"consultation_record_info"
]];
[
dict
setValue
:
@
(
weakSelf
.
counsellorType
)
forKey
:
@"counsellor_type"
];
[
dict
setValue
:
@
(
weakSelf
.
consultationType
)
forKey
:
@"consultation_type"
];
weakSelf
.
successView
.
info
=
dict
;
[
GMVideoPhobos
video_monitoringWithActionStep
:
@"用户客户端收到匹配成功回执"
consultId
:
weakSelf
.
successView
.
info
[
@"consultation_record_id"
]
traceId
:
nil
];
}
}];
[
self
fetchCurrentDispatchInfo
];
}
// 1s请求一次
[
self
pingCurrentDispatch
];
}
else
{
NSString
*
str
=
self
.
counsellorType
==
1
?
@"医生"
:
@"面诊师"
;
str
=
[
NSString
stringWithFormat
:
@"抱歉,暂无%@接单,请稍后再试,本次视频面诊订单金额将原路退还至您的账户中"
,
str
];
...
...
@@ -204,16 +201,56 @@
}
}
-
(
void
)
cancelDispatch
{
[
GMNetworking
requestOCWithApi
:
@"/api/consultation_counsel/cancel_dispatch"
method
:
GMHTTPMethodPost
parameters
:
nil
completion
:^
(
GMResponseOC
*
_Nonnull
response
)
{
-
(
void
)
fetchCurrentDispatchInfo
{
if
(
self
.
isCanceling
)
{
return
;
}
__weak
__typeof
(
self
)
weakSelf
=
self
;
[
GMNetworking
requestOCWithApi
:
@"/api/consultation_counsel/get_current_dispatch_info"
method
:
GMHTTPMethodGet
parameters
:
nil
completion
:^
(
GMResponseOC
*
_Nonnull
response
)
{
if
(
response
.
data
[
@"notice_info"
])
{
[
weakSelf
showSuccessView
];
weakSelf
.
successView
.
object
=
[[
GMNoticeInfoObject
alloc
]
initWithDictionary
:
response
.
data
[
@"notice_info"
]
error
:
nil
];
NSMutableDictionary
*
dict
=
[
NSMutableDictionary
dictionaryWithDictionary
:
response
.
data
[
@"consultation_record_info"
]];
[
dict
setValue
:
@
(
weakSelf
.
counsellorType
)
forKey
:
@"counsellor_type"
];
[
dict
setValue
:
@
(
weakSelf
.
consultationType
)
forKey
:
@"consultation_type"
];
weakSelf
.
successView
.
info
=
dict
;
[
GMVideoPhobos
video_monitoringWithActionStep
:
@"用户客户端收到匹配成功回执"
consultId
:
weakSelf
.
successView
.
info
[
@"consultation_record_id"
]
traceId
:
nil
];
}
}];
}
-
(
void
)
pingCurrentDispatch
{
// 只要客户端还处于等待派单的状态,就每1秒POST一次
[
GMNetworking
requestOCWithApi
:
@"/api/consultation_counsel/current_dispatch_ping"
method
:
GMHTTPMethodPost
parameters
:
nil
completion
:
nil
];
}
-
(
void
)
fetchAndPingCurrentDispatch
{
if
(
self
.
isCanceling
)
{
return
;
}
[
self
fetchCurrentDispatchInfo
];
[
self
pingCurrentDispatch
];
}
-
(
void
)
cancelDispatch
{
__weak
typeof
(
self
)
weakSelf
=
self
;
[
GMNetworking
requestOCWithApi
:
@"/api/consultation_counsel/cancel_dispatch"
method
:
GMHTTPMethodPost
parameters
:
nil
completion
:^
(
GMResponseOC
*
_Nonnull
response
)
{
if
(
response
.
isSuccess
)
{
if
(
weakSelf
.
isCanceling
)
{
[
weakSelf
waitViewHide
];
}
}
else
{
weakSelf
.
isCanceling
=
NO
;
[
weakSelf
fetchAndPingCurrentDispatch
];
}
}];
}
-
(
void
)
cancelBtnClick
{
if
(
self
.
currentTime
>=
0
)
{
self
.
isCanceling
=
YES
;
[
self
cancelDispatch
];
[
self
waitViewHide
];
}
else
{
__weak
__typeof
(
self
)
weakSelf
=
self
;
UIAlertController
*
alert
=
[
UIAlertController
alert
:
@"正在为您全力匹配医生、面诊师 真的不再等一等了么?"
leftTitle
:
@"残忍离开"
rightTitle
:
@"取消"
leftAlterAction
:^
{
...
...
@@ -228,10 +265,10 @@
-
(
void
)
showSuccessView
{
[
self
invalidateCountDownTimer
];
[
self
removeAnimation
];
[
self
hide
];
[
self
.
successView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
edges
.
mas_equalTo
(
0
);
}];
[
self
hide
];
}
-
(
void
)
invalidateCountDownTimer
{
[
_timer
invalidate
];
...
...
@@ -276,4 +313,9 @@
}
return
_animationView
;
}
-
(
void
)
dealloc
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
}
@end
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/Waiting/GMWaitingSuccessView.m
View file @
3ab0a117
...
...
@@ -16,7 +16,7 @@
@interface
GMWaitingSuccessView
()
{
NSTimer
*
_timer
;
in
t
currentTime
;
CGFloa
t
currentTime
;
}
@property
(
nonatomic
,
strong
)
GMImageView
*
doctorView
;
@property
(
nonatomic
,
strong
)
GMLabel
*
nameLabel
;
...
...
@@ -35,6 +35,9 @@
-
(
void
)
setup
{
[
super
setup
];
// 监听 successview 啥时候移除
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
dismissSelf
)
name
:
@"gm_push_remove_waiting_success"
object
:
nil
];
self
.
container
.
size
=
CGSizeMake
(
MAINSCREEN_WIDTH
,
323
+
UIView
.
safeAreaInsetsBottom
);
[
self
containerRectCorner
:
self
.
container
];
...
...
@@ -151,7 +154,6 @@
make
.
centerX
.
mas_equalTo
(
0
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
56
,
56
));
}];
currentTime
=
5
;
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
didBecomeActive
)
name
:
UIApplicationDidBecomeActiveNotification
object
:
nil
];
...
...
@@ -165,13 +167,12 @@
}
-
(
void
)
didBecomeActive
{
[
self
invalidateCountDownTimer
];
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
[
self
removeFromSuperview
];
[[
GMUserVideoTelephoneLogin
sharedVideoTelephoneLogin
]
userEnterVideoRoom
:
self
.
info
extension
:
nil
];
}
-
(
void
)
setObject
:
(
GMNoticeInfoObject
*
)
object
{
_object
=
object
;
currentTime
=
object
.
countdown
/
1000
.
0
;
[
self
addCountDownTimer
];
[
self
.
doctorView
setImageWithUrlString
:
object
.
portraitUrl
placeHolder
:
nil
];
[
self
.
iconView
setImageWithUrlString
:
object
.
iconUrl
placeHolder
:
nil
];
...
...
@@ -211,24 +212,37 @@
}
}
-
(
void
)
addCountDownTimer
{
_timer
=
[
NSTimer
scheduledTimerWithTimeInterval
:
1
target
:
self
selector
:
@selector
(
updateCountDown
)
userInfo
:
nil
repeats
:
YES
];
[
_timer
fire
];
-
(
void
)
addCountDownTimer
{
// 展示倒计时
if
(
_object
.
showCountdown
)
{
_timer
=
[
NSTimer
scheduledTimerWithTimeInterval
:
1
target
:
self
selector
:
@selector
(
updateCountDown
)
userInfo
:
nil
repeats
:
YES
];
[
_timer
fire
];
}
else
{
// 不展示倒计时
self
.
successInfoLabel
.
text
=
SafeString
(
_object
.
countdownText
);
// 等待一段时间移除页面,接通视频
dispatch_after
(
dispatch_time
(
DISPATCH_TIME_NOW
,
(
int64_t
)(
currentTime
*
NSEC_PER_SEC
)),
dispatch_get_main_queue
(),
^
{
[[
GMUserVideoTelephoneLogin
sharedVideoTelephoneLogin
]
userEnterVideoRoom
:
self
.
info
extension
:
nil
];
});
}
}
-
(
void
)
hide
{
}
-
(
void
)
dismissSelf
{
[
self
removeFromSuperview
];
}
-
(
void
)
updateCountDown
{
if
(
currentTime
>=
0
)
{
NSMutableAttributedString
*
attribute
=
[[
NSMutableAttributedString
alloc
]
initWithString
:[
NSString
stringWithFormat
:
@"%dS
后开启摄像头进行视频通话
\n
建议您选择安静、光线充足的环境"
,
currentTime
]];
NSMutableAttributedString
*
attribute
=
[[
NSMutableAttributedString
alloc
]
initWithString
:[
NSString
stringWithFormat
:
@"%dS
%@
\n
建议您选择安静、光线充足的环境"
,
currentTime
,
_object
.
countdownText
]];
[
attribute
addAttribute
:
NSForegroundColorAttributeName
value
:
RGBCOLOR_HEX
(
0x4ABAB4
)
range
:
NSMakeRange
(
0
,
2
)];
self
.
successInfoLabel
.
attributedText
=
attribute
;
currentTime
--
;
}
else
{
[
self
invalidateCountDownTimer
];
[
self
removeFromSuperview
];
[[
GMUserVideoTelephoneLogin
sharedVideoTelephoneLogin
]
userEnterVideoRoom
:
self
.
info
extension
:
nil
];
}
}
...
...
@@ -238,4 +252,8 @@
_timer
=
nil
;
}
-
(
void
)
dealloc
{
[[
NSNotificationCenter
defaultCenter
]
removeObserver
:
self
];
}
@end
This diff is collapsed.
Click to expand it.
GMAILab/Classes/ToFace/WorkingTable/View/GMWaitingGrabListCell.m
View file @
3ab0a117
...
...
@@ -55,9 +55,7 @@
_grabBtn
=
[
GMButton
new
];
[
_grabBtn
setImage
:[
UIImage
imageNamed
:
@"wt_can_select_grab_icon"
]
forState
:
UIControlStateNormal
];
[
_grabBtn
addTarget
:
self
action
:
@selector
(
grabBtnAction
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
// _grabBtn.userInteractionEnabled = NO;
// [_grabBtn setBackgroundColor:GMColorD5D5D5 forState:UIControlStateNormal];
_grabBtn
.
multiControlTimeInterva
=
2
.
f
;
[
_bgImage
addSubview
:
_grabBtn
];
[
_grabBtn
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
size
.
mas_equalTo
(
CGSizeMake
(
60
,
60
));
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment