зеркало из https://github.com/nextcloud/talk-ios.git
Implement UserStatusSwiftUIView delegate in RoomsTableViewController.
Signed-off-by: Ivan Sein <ivan@nextcloud.com>
This commit is contained in:
Родитель
4512057eff
Коммит
c3508dcb79
|
@ -41,7 +41,7 @@ typedef enum RoomsSections {
|
|||
kRoomsSectionRoomList
|
||||
} RoomsSections;
|
||||
|
||||
@interface RoomsTableViewController () <CCCertificateDelegate, UISearchBarDelegate, UISearchControllerDelegate, UISearchResultsUpdating>
|
||||
@interface RoomsTableViewController () <CCCertificateDelegate, UISearchBarDelegate, UISearchControllerDelegate, UISearchResultsUpdating, UserStatusViewDelegate>
|
||||
{
|
||||
RLMNotificationToken *_rlmNotificationToken;
|
||||
NSMutableArray *_rooms;
|
||||
|
@ -442,6 +442,13 @@ typedef enum RoomsSections {
|
|||
AudioServicesPlaySystemSound(1519);
|
||||
}
|
||||
|
||||
#pragma mark - User Status SwiftUI View Delegate
|
||||
|
||||
- (void)userStatusViewDidDisappear
|
||||
{
|
||||
[self getUserStatusWithCompletionBlock:nil];
|
||||
}
|
||||
|
||||
#pragma mark - Title menu
|
||||
|
||||
- (void)setNavigationLogoButton
|
||||
|
@ -471,7 +478,7 @@ typedef enum RoomsSections {
|
|||
|
||||
NCUserStatus *userStatus = [NCUserStatus userStatusWithDictionary:userStatusDict];
|
||||
UIImage *userStatusImage = [userStatus getSFUserStatusIcon];
|
||||
UIViewController *vc = [UserStatusSwiftUIViewFactory createWithUserStatus:userStatus];
|
||||
UIViewController *vc = [UserStatusSwiftUIViewFactory createWithUserStatus:userStatus delegate:self];
|
||||
|
||||
UIAction *onlineOption = [UIAction actionWithTitle:[userStatus readableUserStatusOrMessage] image:userStatusImage identifier:nil handler:^(UIAction *action) {
|
||||
[self presentViewController:vc animated:YES completion:nil];
|
||||
|
|
|
@ -8,7 +8,7 @@ import SwiftUI
|
|||
import SwiftUIIntrospect
|
||||
@_spi(Advanced) import SwiftUIIntrospect
|
||||
|
||||
protocol UserStatusViewDelegate: AnyObject {
|
||||
@objc protocol UserStatusViewDelegate: AnyObject {
|
||||
func userStatusViewDidDisappear()
|
||||
}
|
||||
|
||||
|
@ -99,8 +99,9 @@ struct UserStatusSwiftUIView: View {
|
|||
|
||||
@objc class UserStatusSwiftUIViewFactory: NSObject {
|
||||
|
||||
@objc static func create(userStatus: NCUserStatus) -> UIViewController {
|
||||
let userStatusView = UserStatusSwiftUIView(userStatus: userStatus)
|
||||
@objc static func create(userStatus: NCUserStatus, delegate: UserStatusViewDelegate) -> UIViewController {
|
||||
var userStatusView = UserStatusSwiftUIView(userStatus: userStatus)
|
||||
userStatusView.delegate = delegate
|
||||
let hostingController = UIHostingController(rootView: userStatusView)
|
||||
|
||||
return hostingController
|
||||
|
|
Загрузка…
Ссылка в новой задаче