Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Open iOS
BJLiveCore
Commits
a354b899
Commit
a354b899
authored
Aug 15, 2020
by
戴曦嘉
Browse files
demo update
parent
6d63ddc3
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
136 additions
and
251 deletions
+136
-251
demo/BJLiveCore/AppDelegate+ui.m
demo/BJLiveCore/AppDelegate+ui.m
+2
-3
demo/BJLiveCore/AppDelegate+util.m
demo/BJLiveCore/AppDelegate+util.m
+6
-6
demo/BJLiveCore/classes/extention/UIViewController+BJUtil.h
demo/BJLiveCore/classes/extention/UIViewController+BJUtil.h
+0
-52
demo/BJLiveCore/classes/extention/UIViewController+BJUtil.m
demo/BJLiveCore/classes/extention/UIViewController+BJUtil.m
+0
-56
demo/BJLiveCore/classes/live/BJRoomViewController+media.m
demo/BJLiveCore/classes/live/BJRoomViewController+media.m
+13
-13
demo/BJLiveCore/classes/live/BJRoomViewController+users.m
demo/BJLiveCore/classes/live/BJRoomViewController+users.m
+15
-15
demo/BJLiveCore/classes/live/BJRoomViewController.m
demo/BJLiveCore/classes/live/BJRoomViewController.m
+23
-23
demo/BJLiveCore/classes/login/BJLoginView.m
demo/BJLiveCore/classes/login/BJLoginView.m
+2
-2
demo/BJLiveCore/classes/login/BJLoginViewController.m
demo/BJLiveCore/classes/login/BJLoginViewController.m
+8
-14
demo/Podfile.lock
demo/Podfile.lock
+67
-67
No files found.
demo/BJLiveCore/AppDelegate+ui.m
View file @
a354b899
...
...
@@ -7,7 +7,6 @@
//
#import "AppDelegate+ui.h"
#import "UIViewController+BJUtil.h"
#import "BJAppearance.h"
...
...
@@ -15,6 +14,7 @@
#import "BJLoginViewController.h"
#import "BJAppConfig.h"
#import "UIViewController+BJUtil.h"
@implementation
AppDelegate
(
ui
)
...
...
@@ -41,8 +41,7 @@
}
if
(
!
[
activeViewController
isKindOfClass
:
viewControllerClass
])
{
UINavigationController
*
viewController
=
[[
viewControllerClass
new
]
bjl_wrapWithNavigationController
];
viewController
.
delegate
=
[
viewController
bjl_asDelegate
];
UINavigationController
*
viewController
=
[[
viewControllerClass
new
]
bjl_wrapWithLightNavigationController
];
if
(
rootViewController
.
presentedViewController
)
{
[
rootViewController
bjl_dismissPresentedViewControllerAnimated
:
NO
completion
:
^
{
[
rootViewController
switchViewController
:
viewController
...
...
demo/BJLiveCore/AppDelegate+util.m
View file @
a354b899
...
...
@@ -113,9 +113,9 @@ static UIAlertController *AlertController = nil;
AlertController
.
popoverPresentationController
.
sourceRect
=
[
UIApplication
sharedApplication
].
statusBarFrame
;
AlertController
.
popoverPresentationController
.
permittedArrowDirections
=
UIPopoverArrowDirectionUp
|
UIPopoverArrowDirectionDown
;
[
[
UI
ViewController
bjl_top
ViewController
]
presentViewController
:
AlertController
animated:
YES
completion:
nil
];
[
UI
Window
.
bjl_keyWindow
.
bjl_visible
ViewController
bjl_
presentViewController
:
AlertController
animated:
YES
completion:
nil
];
}
-
(
void
)
askToSwitchDeployType
{
...
...
@@ -156,9 +156,9 @@ static UIAlertController *AlertController = nil;
AlertController
.
popoverPresentationController
.
sourceRect
=
[
UIApplication
sharedApplication
].
statusBarFrame
;
AlertController
.
popoverPresentationController
.
permittedArrowDirections
=
UIPopoverArrowDirectionUp
|
UIPopoverArrowDirectionDown
;
[
[
UI
ViewController
bjl_top
ViewController
]
presentViewController
:
AlertController
animated:
YES
completion:
nil
];
[
UI
Window
.
bjl_keyWindow
.
bjl_visible
ViewController
bjl_
presentViewController
:
AlertController
animated:
YES
completion:
nil
];
}
-
(
NSString
*
)
nameOfDeployType
:(
BJLDeployType
)
deployType
{
...
...
demo/BJLiveCore/classes/extention/UIViewController+BJUtil.h
View file @
a354b899
...
...
@@ -8,58 +8,6 @@
#import <UIKit/UIKit.h>
@interface
UINavigationController
(
BJ_M9Dev
)
#pragma mark - for <UINavigationControllerDelegate>
-
(
id
<
UINavigationControllerDelegate
>
)
bjl_asDelegate
;
/**
* var topViewController = [self bjl_topViewControllerExceptAlertController:YES]
* #return topViewController.supportedInterfaceOrientations if has topViewController
* otherwise
* UIInterfaceOrientationMaskAllButUpsideDown for iPhone
* UIInterfaceOrientationMaskAll for iPad
*/
-
(
UIInterfaceOrientationMask
)
navigationControllerSupportedInterfaceOrientations
:(
UINavigationController
*
)
navigationController
;
/**
* var topViewController = [self bjl_topViewControllerExceptAlertController:YES]
* #return topViewController.preferredInterfaceOrientationForPresentation if has topViewController
* otherwise
* [UIApplication sharedApplication].statusBarOrientation
*/
-
(
UIInterfaceOrientation
)
navigationControllerPreferredInterfaceOrientationForPresentation
:(
UINavigationController
*
)
navigationController
;
@end
#pragma mark -
@interface
UITabBarController
(
BJ_M9Dev
)
#pragma mark - for <UITabBarControllerDelegate>
-
(
id
<
UITabBarControllerDelegate
>
)
bjl_asDelegate
;
/**
* var topViewController = [self bjl_topViewControllerExceptAlertController:YES]
* #return topViewController.supportedInterfaceOrientations if has topViewController
* otherwise
* UIInterfaceOrientationMaskAllButUpsideDown for iPhone
* UIInterfaceOrientationMaskAll for iPad
*/
-
(
UIInterfaceOrientationMask
)
tabBarControllerSupportedInterfaceOrientations
:(
UITabBarController
*
)
tabBarController
;
/**
* var topViewController = [self bjl_topViewControllerExceptAlertController:YES]
* #return topViewController.preferredInterfaceOrientationForPresentation if has topViewController
* otherwise
* [UIApplication sharedApplication].statusBarOrientation
*/
-
(
UIInterfaceOrientation
)
tabBarControllerPreferredInterfaceOrientationForPresentation
:(
UITabBarController
*
)
tabBarController
;
@end
@interface
UIViewController
(
BJBack
)
-
(
void
)
addChildViewController
:(
UIViewController
*
)
childController
superview
:(
UIView
*
)
superview
;
...
...
demo/BJLiveCore/classes/extention/UIViewController+BJUtil.m
View file @
a354b899
...
...
@@ -10,62 +10,6 @@
#import "UIViewController+BJUtil.h"
@implementation
UINavigationController
(
BJ_M9Dev
)
#pragma mark - <UINavigationControllerDelegate>
-
(
id
<
UINavigationControllerDelegate
>
)
bjl_asDelegate
{
return
(
id
<
UINavigationControllerDelegate
>
)
self
;
}
-
(
UIInterfaceOrientationMask
)
navigationControllerSupportedInterfaceOrientations
:(
UINavigationController
*
)
navigationController
{
UIViewController
*
topViewController
=
navigationController
.
topViewController
;
return
((
topViewController
&&
topViewController
!=
self
)
?
topViewController
.
supportedInterfaceOrientations
:
(
UI_USER_INTERFACE_IDIOM
()
==
UIUserInterfaceIdiomPhone
?
UIInterfaceOrientationMaskAllButUpsideDown
:
UIInterfaceOrientationMaskAll
));
}
-
(
UIInterfaceOrientation
)
navigationControllerPreferredInterfaceOrientationForPresentation
:(
UINavigationController
*
)
navigationController
{
UIViewController
*
topViewController
=
navigationController
.
topViewController
;
return
((
topViewController
&&
topViewController
!=
self
)
?
topViewController
.
preferredInterfaceOrientationForPresentation
:
[
UIApplication
sharedApplication
].
statusBarOrientation
);
}
@end
#pragma mark -
@implementation
UITabBarController
(
BJ_M9Dev
)
#pragma mark - <UITabBarControllerDelegate>
-
(
id
<
UITabBarControllerDelegate
>
)
bjl_asDelegate
{
return
(
id
<
UITabBarControllerDelegate
>
)
self
;
}
-
(
UIInterfaceOrientationMask
)
tabBarControllerSupportedInterfaceOrientations
:(
UITabBarController
*
)
tabBarController
{
UIViewController
*
topViewController
=
(
bjl_as
(
tabBarController
.
selectedViewController
,
UINavigationController
).
topViewController
?:
tabBarController
.
selectedViewController
);
return
((
topViewController
&&
topViewController
!=
self
)
?
topViewController
.
supportedInterfaceOrientations
:
(
UI_USER_INTERFACE_IDIOM
()
==
UIUserInterfaceIdiomPhone
?
UIInterfaceOrientationMaskAllButUpsideDown
:
UIInterfaceOrientationMaskAll
));
}
-
(
UIInterfaceOrientation
)
tabBarControllerPreferredInterfaceOrientationForPresentation
:(
UITabBarController
*
)
tabBarController
{
UIViewController
*
topViewController
=
(
bjl_as
(
tabBarController
.
selectedViewController
,
UINavigationController
).
topViewController
?:
tabBarController
.
selectedViewController
);
return
((
topViewController
&&
topViewController
!=
self
)
?
topViewController
.
preferredInterfaceOrientationForPresentation
:
[
UIApplication
sharedApplication
].
statusBarOrientation
);
}
@end
@implementation
UIViewController
(
BJBack
)
-
(
void
)
addChildViewController
:(
UIViewController
*
)
childViewController
superview
:(
UIView
*
)
superview
{
...
...
demo/BJLiveCore/classes/live/BJRoomViewController+media.m
View file @
a354b899
...
...
@@ -24,13 +24,13 @@
}
-
(
void
)
makeSpeakingEvents
{
@
weakify
(
self
);
bjl_
weakify
(
self
);
if
(
self
.
room
.
loginUser
.
isTeacher
)
{
// 有学生请求发言
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
.
speakingRequestVM
,
didReceiveSpeakingRequestFromUser
:)
observer:
^
BOOL
(
BJLUser
*
user
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
// 自动同意
[
self
.
room
.
speakingRequestVM
replySpeakingRequestToUserID
:
user
.
ID
allowed
:
YES
];
[
self
.
console
printFormat
:
@"%@ 请求发言、已同意"
,
user
.
name
];
...
...
@@ -41,7 +41,7 @@
// 发言请求被处理
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
.
speakingRequestVM
,
speakingRequestDidReplyEnabled
:
isUserCancelled
:
user
:
)
observer:
(
BJLMethodObserver
)
^
BOOL
(
BOOL
speakingEnabled
,
BOOL
isUserCancelled
,
BJLUser
*
user
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
.
console
printFormat
:
@"发言申请已被%@"
,
speakingEnabled
?
@"允许"
:
@"拒绝"
];
if
(
speakingEnabled
)
{
[
self
.
room
.
recordingVM
setRecordingAudio
:
YES
...
...
@@ -60,18 +60,18 @@
}
-
(
void
)
makeRecordingEvents
{
@
weakify
(
self
);
bjl_
weakify
(
self
);
self
.
room
.
recordingView
.
userInteractionEnabled
=
NO
;
self
.
room
.
recordingVM
.
videoRecordingOrientation
=
BJLVideoRecordingOrientation_auto
;
[
self
bjl_kvo
:
BJLMakeProperty
(
self
.
room
.
recordingVM
,
recordingVideo
)
filter:
^
BOOL
(
NSNumber
*
now
,
NSNumber
*
old
,
BJLPropertyChange
*
_Nullable
change
)
{
//
@
strongify(self);
//
bjl_
strongify(self);
return
old
.
integerValue
!=
now
.
integerValue
;
}
observer:
^
BOOL
(
id
now
,
id
old
,
BJLPropertyChange
*
_Nullable
change
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
BOOL
recordingVideo
=
[
now
boolValue
];
if
(
!
recordingVideo
&&
!
self
.
room
.
recordingVM
.
recordingAudio
)
{
// 音视频采集都被关闭
[
self
hideRecordingView
];
...
...
@@ -85,11 +85,11 @@
[
self
bjl_kvo
:
BJLMakeProperty
(
self
.
room
.
recordingVM
,
recordingAudio
)
filter:
^
BOOL
(
NSNumber
*
now
,
NSNumber
*
old
,
BJLPropertyChange
*
_Nullable
change
)
{
//
@
strongify(self);
//
bjl_
strongify(self);
return
old
.
integerValue
!=
now
.
integerValue
;
}
observer:
^
BOOL
(
id
now
,
id
old
,
BJLPropertyChange
*
_Nullable
change
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
BOOL
recordingAudio
=
[
now
boolValue
];
if
(
!
recordingAudio
&&
!
self
.
room
.
recordingVM
.
recordingVideo
)
{
// 音视频采集都被关闭
[
self
hideRecordingView
];
...
...
@@ -103,7 +103,7 @@
[[
self
.
recordingView
rac_signalForControlEvents
:
UIControlEventTouchUpInside
]
subscribeNext:
^
(
id
x
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
if
(
!
self
.
room
.
loginUser
.
isTeacherOrAssistant
&&
!
self
.
room
.
speakingRequestVM
.
speakingEnabled
)
{
...
...
@@ -252,11 +252,11 @@
}
-
(
void
)
makePlayingEvents
{
@
weakify
(
self
);
bjl_
weakify
(
self
);
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
.
playingVM
,
playingUserDidUpdate
:
old
:
)
observer:
^
BOOL
(
BJLMediaUser
*
now
,
BJLMediaUser
*
old
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
if
(
!
now
.
videoOn
)
{
[
self
stopPlayingForUser
:
now
];
}
...
...
@@ -266,7 +266,7 @@
}
-
(
void
)
makeSlideshowAndWhiteboardEvents
{
@
weakify
(
self
);
bjl_
weakify
(
self
);
BOOL
existSlideshowViewController
=
self
.
room
.
slideshowViewController
;
if
(
existSlideshowViewController
)
{
[
self
addChildViewController
:
self
.
room
.
slideshowViewController
...
...
@@ -292,7 +292,7 @@
[[
infoButton
rac_signalForControlEvents
:
UIControlEventTouchUpInside
]
subscribeNext:
^
(
id
x
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
UIAlertController
*
actionSheet
=
[
UIAlertController
alertControllerWithTitle:
existSlideshowViewController
?
@"课件&画板"
:
@"黑板"
...
...
demo/BJLiveCore/classes/live/BJRoomViewController+users.m
View file @
a354b899
...
...
@@ -13,36 +13,36 @@
@implementation
BJRoomViewController
(
users
)
-
(
void
)
makeUserEvents
{
@
weakify
(
self
);
bjl_
weakify
(
self
);
[
self
bjl_kvo
:
BJLMakeProperty
(
self
.
room
.
onlineUsersVM
,
onlineUsersTotalCount
)
filter:
^
BOOL
(
NSNumber
*
now
,
NSNumber
*
old
,
BJLPropertyChange
*
_Nullable
change
)
{
//
@
strongify(self);
//
bjl_
strongify(self);
return
old
.
integerValue
!=
now
.
integerValue
;
}
observer:
^
BOOL
(
id
now
,
id
old
,
BJLPropertyChange
*
_Nullable
change
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
.
console
printFormat
:
@"onlineUsers count: %@"
,
now
];
return
YES
;
}];
[
self
bjl_kvo
:
BJLMakeProperty
(
self
.
room
.
onlineUsersVM
,
onlineTeacher
)
observer:
^
BOOL
(
BJLUser
*
now
,
id
old
,
BJLPropertyChange
*
_Nullable
change
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
.
console
printFormat
:
@"onlineUsers teacher: %@"
,
now
.
name
];
return
YES
;
}];
[
self
bjl_kvo
:
BJLMakeProperty
(
self
.
room
.
onlineUsersVM
,
currentPresenter
)
observer:
^
BOOL
(
BJLUser
*
now
,
id
old
,
BJLPropertyChange
*
_Nullable
change
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
.
console
printFormat
:
@"onlineUsers currentPresenter: %@"
,
now
.
name
];
return
YES
;
}];
[
self
bjl_kvo
:
BJLMakeProperty
(
self
.
room
.
onlineUsersVM
,
onlineUsers
)
observer:
^
BOOL
(
NSArray
<
BJLUser
*>
*
now
,
id
old
,
BJLPropertyChange
*
_Nullable
change
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
NSMutableArray
*
userNames
=
[
NSMutableArray
new
];
for
(
BJLUser
*
user
in
now
)
{
[
userNames
bjl_addObject
:
user
.
name
];
...
...
@@ -54,21 +54,21 @@
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
.
onlineUsersVM
,
onlineUserDidEnter
:)
observer:
^
BOOL
(
BJLUser
*
user
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
.
console
printFormat
:
@"onlineUsers in: %@"
,
user
.
name
];
return
YES
;
}];
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
.
onlineUsersVM
,
onlineUserDidExit
:)
observer:
^
BOOL
(
BJLUser
*
user
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
.
console
printFormat
:
@"onlineUsers out: %@"
,
user
.
name
];
return
YES
;
}];
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
.
roomVM
,
didReceiveRollcallWithTimeout
:)
observer:
^
BOOL
(
NSTimeInterval
timeout
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
UIAlertController
*
actionSheet
=
[
UIAlertController
alertControllerWithTitle:
@"老师点名"
...
...
@@ -102,7 +102,7 @@
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
.
roomVM
,
didReceiveSurveyHistory
:
rightCount
:
wrongCount
:
)
observer:
^
BOOL
(
NSArray
<
BJLSurvey
*>
*
surveyHistory
,
NSInteger
rightCount
,
NSInteger
wrongCount
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
.
console
printFormat
:
@"收到历史测验: %@ - 正确 %td, 错误 %td"
,
[
surveyHistory
bjlyy_modelToJSONObject
],
rightCount
,
wrongCount
];
return
YES
;
...
...
@@ -110,7 +110,7 @@
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
.
roomVM
,
didReceiveSurvey
:)
observer:
^
BOOL
(
BJLSurvey
*
survey
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
UIAlertController
*
alert
=
[
UIAlertController
alertControllerWithTitle:
[
NSString
stringWithFormat
:
@"测验-%td"
,
survey
.
order
]
message:
survey
.
question
...
...
@@ -149,7 +149,7 @@
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
.
roomVM
,
didReceiveSurveyResults
:
order
:
)
observer:
^
BOOL
(
NSDictionary
<
NSString
*
,
NSNumber
*>
*
results
,
NSInteger
order
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
.
console
printFormat
:
@"收到测验结果: %td - %@"
,
order
,
[
results
bjlyy_modelToJSONObject
]];
return
YES
;
...
...
@@ -159,18 +159,18 @@
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
.
roomVM
,
didReceiveCustomizedBroadcast
:
value
:
isCache
:
)
observer:
(
BJLMethodObserver
)
^
BOOL
(
NSString
*
key
,
id
value
,
BOOL
isCache
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
.
console
printFormat
:
@"客户定制信令 %@: %@ - %@"
,
isCache
?
@"cached"
:
@"received"
,
key
,
value
];
return
YES
;
}];
[
self
bjl_kvo
:
BJLMakeProperty
(
self
.
room
.
roomVM
,
rollcallTimeRemaining
)
filter:
^
BOOL
(
NSNumber
*
_Nullable
now
,
NSNumber
*
_Nullable
old
,
BJLPropertyChange
*
_Nullable
change
)
{
//
@
strongify(self);
//
bjl_
strongify(self);
return
now
.
doubleValue
!=
old
.
doubleValue
;
}
observer:
^
BOOL
(
NSNumber
*
_Nullable
now
,
NSNumber
*
_Nullable
old
,
BJLPropertyChange
*
_Nullable
change
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
.
console
printFormat
:
@"答到倒计时: %f"
,
now
.
doubleValue
];
return
YES
;
}];
...
...
demo/BJLiveCore/classes/live/BJRoomViewController.m
View file @
a354b899
...
...
@@ -66,11 +66,11 @@ static NSInteger const playingViewCount = 4;
avatar:@"http://static.sunlands.com/user_center_test/newUserImagePath/1602910/1602910.jpg"
role:BJLUserRole_student]]; */
@
weakify
(
self
);
bjl_
weakify
(
self
);
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
,
enterRoomSuccess
)
observer:
^
BOOL
()
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
if
(
self
.
room
.
loginUser
.
isTeacher
)
{
[
self
.
room
.
roomVM
sendLiveStarted
:
YES
];
// 上课
}
...
...
@@ -80,7 +80,7 @@ static NSInteger const playingViewCount = 4;
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
,
roomWillExitWithError
:)
observer:
^
BOOL
(
BJLError
*
error
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
if
(
self
.
room
.
loginUser
.
isTeacher
)
{
[
self
.
room
.
roomVM
sendLiveStarted
:
NO
];
// 下课
}
...
...
@@ -89,7 +89,7 @@ static NSInteger const playingViewCount = 4;
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
,
roomDidExitWithError
:)
observer:
^
BOOL
(
BJLError
*
error
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
if
(
!
error
)
{
[
self
goBack
];
...
...
@@ -124,17 +124,17 @@ static NSInteger const playingViewCount = 4;
[
self
bjl_kvo
:
BJLMakeProperty
(
self
.
room
,
loadingVM
)
filter:
^
BOOL
(
id
now
,
id
old
,
BJLPropertyChange
*
_Nullable
change
)
{
//
@
strongify(self);
//
bjl_
strongify(self);
return
!!
now
;
}
observer:
^
BOOL
(
BJLLoadingVM
*
now
,
id
old
,
BJLPropertyChange
*
_Nullable
change
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
makeEventsForLoadingVM
:
now
];
return
YES
;
}];
[
self
.
room
setReloadingBlock
:
^
(
BJLLoadingVM
*
_Nonnull
reloadingVM
,
void
(
^
_Nonnull
callback
)(
BOOL
))
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
.
console
printLine
:
@"网络连接断开"
];
UIAlertController
*
alert
=
[
UIAlertController
alertControllerWithTitle
:
@"网络连接断开"
message:
@"重连 或 退出?"
...
...
@@ -312,9 +312,9 @@ static NSInteger const playingViewCount = 4;
button
.
clipsToBounds
=
YES
;
[
button
setTitle
:[
NSString
stringWithFormat
:
@"播放%d"
,
i
+
1
]
forState
:
UIControlStateNormal
];
button
.
backgroundColor
=
[[
UIColor
greenColor
]
colorWithAlphaComponent
:
0
.
2
];
@
weakify
(
self
);
bjl_
weakify
(
self
);
[[
button
rac_signalForControlEvents
:
UIControlEventTouchUpInside
]
subscribeNext
:
^
(
id
x
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
showAlertWithPlayingView
:
button
];
}];
[
button
addTarget
:
self
action
:
@selector
(
showAlertWithPlayingView
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
...
...
@@ -370,14 +370,14 @@ static NSInteger const playingViewCount = 4;
self
.
room
.
loginUser
.
name
];
// if (!self.room.loginUser.isTeacher) {
@
weakify
(
self
);
bjl_
weakify
(
self
);
[
self
bjl_kvo
:
BJLMakeProperty
(
self
.
room
.
roomVM
,
liveStarted
)
filter:
^
BOOL
(
NSNumber
*
now
,
NSNumber
*
old
,
BJLPropertyChange
*
_Nullable
change
)
{
//
@
strongify(self);
//
bjl_
strongify(self);
return
old
.
integerValue
!=
now
.
integerValue
;
}
observer:
^
BOOL
(
id
now
,
id
old
,
BJLPropertyChange
*
_Nullable
change
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
.
console
printFormat
:
@"liveStarted: %@"
,
self
.
room
.
roomVM
.
liveStarted
?
@"YES"
:
@"NO"
];
return
YES
;
}];
...
...
@@ -389,13 +389,13 @@ static NSInteger const playingViewCount = 4;
}
-
(
void
)
makeEventsForLoadingVM
:(
BJLLoadingVM
*
)
loadingVM
{
@
weakify
(
self
/* , loadingVM */
);
bjl_
weakify
(
self
/* , loadingVM */
);
loadingVM
.
suspendBlock
=
^
(
BJLLoadingStep
step
,
BJLLoadingSuspendReason
reason
,
BJLError
*
error
,
void
(
^
continueCallback
)(
BOOL
isContinue
))
{
@
strongify
(
self
/* , loadingVM */
);
bjl_
strongify
(
self
/* , loadingVM */
);
if
(
reason
==
BJLLoadingSuspendReason_stepOver
)
{
[
self
.
console
printFormat
:
@"loading step over: %td"
,
step
];
...
...
@@ -436,32 +436,32 @@ static NSInteger const playingViewCount = 4;
[
self
bjl_observe
:
BJLMakeMethod
(
loadingVM
,
loadingUpdateProgress
:)
observer:
(
BJLMethodObserver
)
^
BOOL
(
CGFloat
progress
)
{
@
strongify
(
self
/* , loadingVM */
);
bjl_
strongify
(
self
/* , loadingVM */
);
[
self
.
console
printFormat
:
@"loading progress: %f"
,
progress
];
return
YES
;
}];
[
self
bjl_observe
:
BJLMakeMethod
(
loadingVM
,
loadingSuccess
)
observer:
^
BOOL
()
{
@
strongify
(
self
/* , loadingVM */
);
bjl_
strongify
(
self
/* , loadingVM */
);
[
self
.
console
printLine
:
@"loading success"
];
return
YES
;
}];
[
self
bjl_observe
:
BJLMakeMethod
(
loadingVM
,
loadingFailureWithError
:)
observer:
^
BOOL
(
BJLError
*
error
)
{
@
strongify
(
self
/* , loadingVM */
);
bjl_
strongify
(
self
/* , loadingVM */
);
[
self
.
console
printLine
:
@"loading failure"
];
return
YES
;
}];
}
-
(
void
)
makeChatEvents
{
@
weakify
(
self
);
bjl_
weakify
(
self
);
[
self
bjl_observe
:
BJLMakeMethod
(
self
.
room
.
chatVM
,
didReceiveMessages
:)
observer:
^
BOOL
(
NSArray
<
BJLMessage
*>
*
messages
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
for
(
BJLMessage
*
message
in
messages
)
{
[
self
.
console
printFormat
:
@"chat %@: %@"
,
message
.
fromUser
.
name
,
message
.
text
];
}
...
...
@@ -487,26 +487,26 @@ static NSInteger const playingViewCount = 4;
#pragma mark - events
-
(
void
)
makeEvents
{
@
weakify
(
self
);
bjl_
weakify
(
self
);
[[
self
.
textField
.
rac_textSignal
map:
^
id
(
NSString
*
text
)
{
return
@
(
!!
text
.
length
)
;
}
]
subscribeNext:
^
(
NSNumber
*
enabled
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
self
.
doneButton
.
enabled
=
enabled
.
boolValue
;
}];
[[
self
.
backButton
rac_signalForControlEvents
:
UIControlEventTouchUpInside
]
subscribeNext:
^
(
id
x
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
goBack
];
}];
[[
self
.
doneButton
rac_signalForControlEvents
:
UIControlEventTouchUpInside
]
subscribeNext:
^
(
id
x
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
sendMessage
];
}
];
}
...
...
demo/BJLiveCore/classes/login/BJLoginView.m
View file @
a354b899
...
...
@@ -199,10 +199,10 @@ static CGFloat const margin = 10.0/* , textLeftMargin = 5.0 */;
make
.
size
.
mas_equalTo
(
CGSizeMake
(
27
.
0
,
27
.
0
));
}];
@
weakify
(
/* self, */
textField
);
bjl_
weakify
(
/* self, */
textField
);
[[
button
rac_signalForControlEvents
:
UIControlEventTouchUpInside
]
subscribeNext:
^
(
id
x
)
{
@
strongify
(
/* self, */
textField
);
bjl_
strongify
(
/* self, */
textField
);
[
textField
becomeFirstResponder
];
}];
...
...
demo/BJLiveCore/classes/login/BJLoginViewController.m
View file @
a354b899
...
...
@@ -30,7 +30,6 @@ static NSString * const BJLoginDomainKey = @"BJLoginDomainKey";
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
view
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
bjl_hidesNavigationBarWhenPushed
=
YES
;
NSUserDefaults
*
userDefaults
=
[
NSUserDefaults
standardUserDefaults
];
...
...
@@ -45,12 +44,7 @@ static NSString * const BJLoginDomainKey = @"BJLoginDomainKey";
-
(
void
)
viewWillAppear
:(
BOOL
)
animated
{
[
super
viewWillAppear
:
animated
];
[
self
.
navigationController
setNavigationBarHidden
:
YES
animated
:
animated
];
}
-
(
void
)
viewWillDisappear
:(
BOOL
)
animated
{
[
super
viewWillDisappear
:
animated
];
[
self
.
navigationController
setNavigationBarHidden
:
NO
animated
:
animated
];
self
.
bjl_hidesNavigationBarWhenPushed
=
YES
;
}
-
(
BOOL
)
shouldAutorotate
{
...
...
@@ -74,7 +68,7 @@ static NSString * const BJLoginDomainKey = @"BJLoginDomainKey";
}
-
(
void
)
makeSignals
{
@
weakify
(
self
);
bjl_
weakify
(
self
);
// endEditing
UITapGestureRecognizer
*
tapGesture
=
[
UITapGestureRecognizer
new
];
...
...
@@ -84,7 +78,7 @@ static NSString * const BJLoginDomainKey = @"BJLoginDomainKey";
[[
RACSignal
merge
:@[
tapGesture
.
rac_gestureSignal
,
panGesture
.
rac_gestureSignal
]]
subscribeNext:
^
(
UIGestureRecognizer
*
gesture
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
.
view
endEditing
:
YES
];
}];
...
...
@@ -93,7 +87,7 @@ static NSString * const BJLoginDomainKey = @"BJLoginDomainKey";
distinctUntilChanged
]
skip:
1
]
subscribeNext:
^
(
NSString
*
codeText
)
{
//
@
strongify(self);
//
bjl_
strongify(self);
NSUserDefaults
*
userDefaults
=
[
NSUserDefaults
standardUserDefaults
];
[
userDefaults
removeObjectForKey
:
BJLoginCodeKey
];
[
userDefaults
synchronize
];
...
...
@@ -102,7 +96,7 @@ static NSString * const BJLoginDomainKey = @"BJLoginDomainKey";
distinctUntilChanged
]
skip:
1
]
subscribeNext:
^
(
NSString
*
nameText
)
{
//
@
strongify(self);
//
bjl_
strongify(self);
NSUserDefaults
*
userDefaults
=
[
NSUserDefaults
standardUserDefaults
];
[
userDefaults
removeObjectForKey
:
BJLoginNameKey
];
[
userDefaults
synchronize
];
...
...
@@ -119,18 +113,18 @@ static NSString * const BJLoginDomainKey = @"BJLoginDomainKey";
[
RACSignal
merge
:@[
self
.
codeLoginView
.
nameTextField
.
rac_textSignal
,
RACObserve
(
self
.
codeLoginView
.
nameTextField
,
text
)
]]
]
reduce:
^
id
(
NSString
*
codeText
,
NSString
*
nameText
)
{
//
@
strongify(self);
//
bjl_
strongify(self);
return
@
(
codeText
.
length
&&
nameText
.
length
)
;
}
]
subscribeNext
:^
(
NSNumber
*
enabled
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
self
.
codeLoginView
.
doneButton
.
enabled
=
enabled
.
boolValue
;
}];
// login
[[
self
.
codeLoginView
.
doneButton
rac_signalForControlEvents
:
UIControlEventTouchUpInside
]
subscribeNext:
^
(
UIButton
*
button
)
{
@
strongify
(
self
);
bjl_
strongify
(
self
);
[
self
doneWithButton
:
button
];
}
];
}
...
...
demo/Podfile.lock
View file @
a354b899
PODS:
- AgoraRtcEngine_iOS (2.9.0.104)
- BJLiveBase (2.9.
3
):
- BJLiveBase/Base (= 2.9.
3
)
- BJLiveBase/Auth (2.9.
3
)
- BJLiveBase/Base (2.9.
3
):
- BJLiveBase (2.9.
4
):
- BJLiveBase/Base (= 2.9.
4
)
- BJLiveBase/Auth (2.9.
4
)
- BJLiveBase/Base (2.9.
4
):
- BJLiveBase/extobjc
- BJLiveBase/Foundation
- BJLiveBase/UIKit
- BJLiveBase/extobjc (2.9.
3
)
- BJLiveBase/Foundation (2.9.
3
):
- BJLiveBase/extobjc (2.9.
4
)
- BJLiveBase/Foundation (2.9.
4
):
- BJLiveBase/extobjc
- BJLiveBase/Networking (2.9.
3
):
- BJLiveBase/Networking (2.9.
4
):
- BJLiveBase/Base
- "BJLiveBase/Networking+BaijiaYun (2.9.
3
)":
- "BJLiveBase/Networking+BaijiaYun (2.9.
4
)":
- BJLiveBase/Base
- BJLiveBase/Networking
- BJLiveBase/PocketSocket/Client (2.9.
3
):
- BJLiveBase/PocketSocket/Client (2.9.
4
):
- BJLiveBase/PocketSocket/Core
- BJLiveBase/PocketSocket/Core (2.9.
3
)
- BJLiveBase/UIKit (2.9.
3
):
- BJLiveBase/PocketSocket/Core (2.9.
4
)
- BJLiveBase/UIKit (2.9.
4
):
- BJLiveBase/extobjc
- BJLiveBase/Foundation
- BJLiveBase/WebImage/AFNetworking (2.9.
3
):
- BJLiveBase/WebImage/AFNetworking (2.9.
4
):
- BJLiveBase/Networking
- BJLiveBase/WebImage/BJLWebImage
- BJLiveBase/WebImage/BJLWebImage (2.9.
3
)
- BJLiveBase/YYModel (2.9.
3
)
- BJLiveCore (2.9.
3
):
- BJLiveBase (~> 2.9.
3
)
- BJLiveBase/Auth (~> 2.9.
3
)
- BJLiveBase/Base (~> 2.9.
3
)
- BJLiveBase/Networking (~> 2.9.
3
)
- "BJLiveBase/Networking+BaijiaYun (~> 2.9.
3
)"
- BJLiveBase/PocketSocket/Client (~> 2.9.
3
)
- BJLiveBase/WebImage/AFNetworking (~> 2.9.
3
)
- BJLiveBase/WebImage/BJLWebImage (~> 2.9.
3
)
- BJLiveBase/YYModel (~> 2.9.
3
)
- BJLiveCore/static (= 2.9.
3
)
- BJLiveCore/BJHLMediaPlayer (2.9.
3
):
- BJLiveBase (~> 2.9.
3
)
- BJLiveBase/Auth (~> 2.9.
3
)
- BJLiveBase/Base (~> 2.9.
3
)
- BJLiveBase/Networking (~> 2.9.
3
)
- "BJLiveBase/Networking+BaijiaYun (~> 2.9.
3
)"
- BJLiveBase/PocketSocket/Client (~> 2.9.
3
)
- BJLiveBase/WebImage/AFNetworking (~> 2.9.
3
)
- BJLiveBase/WebImage/BJLWebImage (~> 2.9.
3
)
- BJLiveBase/YYModel (~> 2.9.
3
)
- BJLiveCore/BJYRTCEngine (2.9.
3
):
- BJLiveBase (~> 2.9.
3
)
- BJLiveBase/Auth (~> 2.9.
3
)
- BJLiveBase/Base (~> 2.9.
3
)
- BJLiveBase/Networking (~> 2.9.
3
)
- "BJLiveBase/Networking+BaijiaYun (~> 2.9.
3
)"
- BJLiveBase/PocketSocket/Client (~> 2.9.
3
)
- BJLiveBase/WebImage/AFNetworking (~> 2.9.
3
)
- BJLiveBase/WebImage/BJLWebImage (~> 2.9.
3
)
- BJLiveBase/YYModel (~> 2.9.
3
)
- BJLiveCore/default (2.9.
3
):
- BJLiveBase (~> 2.9.
3
)
- BJLiveBase/Auth (~> 2.9.
3
)
- BJLiveBase/Base (~> 2.9.
3
)
- BJLiveBase/Networking (~> 2.9.
3
)
- "BJLiveBase/Networking+BaijiaYun (~> 2.9.
3
)"
- BJLiveBase/PocketSocket/Client (~> 2.9.
3
)
- BJLiveBase/WebImage/AFNetworking (~> 2.9.
3
)
- BJLiveBase/WebImage/BJLWebImage (~> 2.9.
3
)
- BJLiveBase/YYModel (~> 2.9.
3
)
- BJLiveBase/WebImage/BJLWebImage (2.9.
4
)
- BJLiveBase/YYModel (2.9.
4
)
- BJLiveCore (2.9.
4
):
- BJLiveBase (~> 2.9.
4
)
- BJLiveBase/Auth (~> 2.9.
4
)
- BJLiveBase/Base (~> 2.9.
4
)
- BJLiveBase/Networking (~> 2.9.
4
)
- "BJLiveBase/Networking+BaijiaYun (~> 2.9.
4
)"
- BJLiveBase/PocketSocket/Client (~> 2.9.
4
)
- BJLiveBase/WebImage/AFNetworking (~> 2.9.
4
)
- BJLiveBase/WebImage/BJLWebImage (~> 2.9.
4
)
- BJLiveBase/YYModel (~> 2.9.
4
)
- BJLiveCore/static (= 2.9.
4
)
- BJLiveCore/BJHLMediaPlayer (2.9.
4
):
- BJLiveBase (~> 2.9.
4
)
- BJLiveBase/Auth (~> 2.9.
4
)
- BJLiveBase/Base (~> 2.9.
4
)
- BJLiveBase/Networking (~> 2.9.
4
)
- "BJLiveBase/Networking+BaijiaYun (~> 2.9.
4
)"
- BJLiveBase/PocketSocket/Client (~> 2.9.
4
)
- BJLiveBase/WebImage/AFNetworking (~> 2.9.
4
)
- BJLiveBase/WebImage/BJLWebImage (~> 2.9.
4
)
- BJLiveBase/YYModel (~> 2.9.
4
)
- BJLiveCore/BJYRTCEngine (2.9.
4
):
- BJLiveBase (~> 2.9.
4
)
- BJLiveBase/Auth (~> 2.9.
4
)
- BJLiveBase/Base (~> 2.9.
4
)
- BJLiveBase/Networking (~> 2.9.
4
)
- "BJLiveBase/Networking+BaijiaYun (~> 2.9.
4
)"
- BJLiveBase/PocketSocket/Client (~> 2.9.
4
)
- BJLiveBase/WebImage/AFNetworking (~> 2.9.
4
)
- BJLiveBase/WebImage/BJLWebImage (~> 2.9.
4
)
- BJLiveBase/YYModel (~> 2.9.
4
)
- BJLiveCore/default (2.9.
4
):
- BJLiveBase (~> 2.9.
4
)
- BJLiveBase/Auth (~> 2.9.
4
)
- BJLiveBase/Base (~> 2.9.
4
)
- BJLiveBase/Networking (~> 2.9.
4
)
- "BJLiveBase/Networking+BaijiaYun (~> 2.9.
4
)"
- BJLiveBase/PocketSocket/Client (~> 2.9.
4
)
- BJLiveBase/WebImage/AFNetworking (~> 2.9.
4
)
- BJLiveBase/WebImage/BJLWebImage (~> 2.9.
4
)
- BJLiveBase/YYModel (~> 2.9.
4
)
- BJLiveCore/BJHLMediaPlayer
- BJLiveCore/BJYRTCEngine
- BJLiveCore/static (2.9.
3
):
- BJLiveCore/static (2.9.
4
):
- AgoraRtcEngine_iOS (= 2.9.0.104)
- BJLiveBase (~> 2.9.
3
)
- BJLiveBase/Auth (~> 2.9.
3
)
- BJLiveBase/Base (~> 2.9.
3
)
- BJLiveBase/Networking (~> 2.9.
3
)
- "BJLiveBase/Networking+BaijiaYun (~> 2.9.
3
)"
- BJLiveBase/PocketSocket/Client (~> 2.9.
3
)
- BJLiveBase/WebImage/AFNetworking (~> 2.9.
3
)
- BJLiveBase/WebImage/BJLWebImage (~> 2.9.
3
)
- BJLiveBase/YYModel (~> 2.9.
3
)
- BJLiveBase (~> 2.9.
4
)
- BJLiveBase/Auth (~> 2.9.
4
)
- BJLiveBase/Base (~> 2.9.
4
)
- BJLiveBase/Networking (~> 2.9.
4
)
- "BJLiveBase/Networking+BaijiaYun (~> 2.9.
4
)"
- BJLiveBase/PocketSocket/Client (~> 2.9.
4
)
- BJLiveBase/WebImage/AFNetworking (~> 2.9.
4
)
- BJLiveBase/WebImage/BJLWebImage (~> 2.9.
4
)
- BJLiveBase/YYModel (~> 2.9.
4
)
- BJLiveCore/default
- TXLiteAVSDK_TRTC (= 7.2.8956)
- FLEX (2.4.0)
...
...
@@ -109,8 +109,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AgoraRtcEngine_iOS: 7cba8f57c9ac39c1a17df2080cde6cea294229b2
BJLiveBase:
6b7f937fac56c9900a396cff5776f5dcce2818c7
BJLiveCore:
19f3ae5e299a5ee3b06b91317275a3fbd485afdd
BJLiveBase:
0fc8ac8f8a01f0e1b845f7b1bb24bb053825e422
BJLiveCore:
a9c2412f763ba6333a1cfff2e2855c30ad90a74a
FLEX: bd1a39e55b56bb413b6f1b34b3c10a0dc44ef079
Masonry: 678fab65091a9290e40e2832a55e7ab731aad201
ReactiveObjC: 011caa393aa0383245f2dcf9bf02e86b80b36040
...
...
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