@@ -364,9 +364,13 @@ open class SBUChannelListViewController: SBUBaseChannelListViewController {
364
364
return
365
365
}
366
366
367
+ self . shouldShowLoadingIndicator ( )
367
368
self . channelListQuery? . loadNextPage ( completionHandler: { [ weak self] channels, error in
368
369
guard let self = self else { return }
369
- defer { self . setLoading ( false , false ) }
370
+ defer {
371
+ self . shouldDismissLoadingIndicator ( ) ;
372
+ self . setLoading ( false , false )
373
+ }
370
374
371
375
if let error = error {
372
376
SBULog . error ( """
@@ -405,6 +409,7 @@ open class SBUChannelListViewController: SBUBaseChannelListViewController {
405
409
channelLogsParams = SBDGroupChannelChangeLogsParams . create ( with: channelListQuery)
406
410
}
407
411
412
+ self . shouldShowLoadingIndicator ( )
408
413
if let token = token {
409
414
SBULog . info ( " [Request] Channel change logs with token " )
410
415
@@ -413,6 +418,8 @@ open class SBUChannelListViewController: SBUBaseChannelListViewController {
413
418
params: channelLogsParams
414
419
) { [ weak self] updatedChannels, deletedChannelUrls, hasMore, token, error in
415
420
guard let self = self else { return }
421
+ defer { self . shouldDismissLoadingIndicator ( ) }
422
+
416
423
if let error = error {
417
424
SBULog . error ( """
418
425
[Failed]
@@ -442,6 +449,8 @@ open class SBUChannelListViewController: SBUBaseChannelListViewController {
442
449
params: channelLogsParams
443
450
) { [ weak self] updatedChannels, deletedChannelUrls, hasMore, token, error in
444
451
guard let self = self else { return }
452
+ defer { self . shouldDismissLoadingIndicator ( ) }
453
+
445
454
if let error = error {
446
455
SBULog . error ( """
447
456
[Failed]
@@ -1040,7 +1049,6 @@ extension SBUChannelListViewController: SBDChannelDelegate, SBDConnectionDelegat
1040
1049
}
1041
1050
}
1042
1051
1043
-
1044
1052
// MARK: - SBUCreateChannelTypeSelectorDelegate
1045
1053
extension SBUChannelListViewController : SBUCreateChannelTypeSelectorDelegate {
1046
1054
open func didSelectCloseSelector( ) {
@@ -1074,3 +1082,13 @@ extension SBUChannelListViewController: SBUCreateChannelTypeSelectorDelegate {
1074
1082
self . showCreateChannel ( type: . broadcast)
1075
1083
}
1076
1084
}
1085
+
1086
+ // MARK: - LoadingIndicatorDelegate
1087
+ extension SBUChannelListViewController : LoadingIndicatorDelegate {
1088
+ @discardableResult
1089
+ open func shouldShowLoadingIndicator( ) -> Bool {
1090
+ return false
1091
+ }
1092
+
1093
+ open func shouldDismissLoadingIndicator( ) { }
1094
+ }
0 commit comments