forked from mirrors/linphone-iphone
Add ChatConversationViewModel
This commit is contained in:
parent
66b1a5a85f
commit
7af4ac2633
8 changed files with 64 additions and 16 deletions
|
|
@ -1,14 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="21507" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" colorMatched="YES">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21505"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ChatConversationView">
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ChatConversationViewSwift">
|
||||
<connections>
|
||||
<outlet property="addressLabel" destination="40" id="43"/>
|
||||
<outlet property="backButton" destination="9" id="Jcb-ET-bKd"/>
|
||||
|
|
|
|||
|
|
@ -161,8 +161,7 @@ static UICompositeViewDescription *compositeDescription = nil;
|
|||
}
|
||||
|
||||
- (IBAction)onChatRoomSwiftClick:(id)event {
|
||||
DetailChatRoomFragment *view = VIEW(DetailChatRoomFragment);
|
||||
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
|
||||
[PhoneMainView.instance changeCurrentView:ChatConversationViewSwift.compositeViewDescription];
|
||||
}
|
||||
|
||||
- (IBAction)onAddClick:(id)event {
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@
|
|||
- (void)getOrCreateOneToOneChatRoom:(const LinphoneAddress *)remoteAddress waitView:(UIView *)waitView isEncrypted:(BOOL)isEncrypted;
|
||||
- (LinphoneChatRoom *)createChatRoom:(const char *)subject addresses:(bctbx_list_t *)addresses andWaitView:(UIView *)waitView isEncrypted:(BOOL)isEncrypted isGroup:(BOOL)isGroup;
|
||||
- (void)goToChatRoom:(LinphoneChatRoom *)cr;
|
||||
- (void)goToChatRoomSwift:(LinphoneChatRoom *)cr;
|
||||
+ (PhoneMainView*) instance;
|
||||
|
||||
- (BOOL)isIphoneXDevice;
|
||||
|
|
|
|||
|
|
@ -924,6 +924,28 @@ static RootViewManager *rootViewManagerInstance = nil;
|
|||
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
|
||||
}
|
||||
|
||||
|
||||
- (void)goToChatRoomSwift:(LinphoneChatRoom *)cr {
|
||||
/*
|
||||
_waitView.hidden = YES;
|
||||
_waitView = NULL;
|
||||
ChatConversationViewSwift *view = VIEW(ChatConversationViewSwift);
|
||||
if (view.chatRoom && view.chatRoomCbs)
|
||||
linphone_chat_room_remove_callbacks(view.chatRoom, view.chatRoomCbs);
|
||||
|
||||
view.chatRoomCbs = NULL;
|
||||
if (view.chatRoom != cr)
|
||||
[view clearMessageView];
|
||||
view.chatRoom = cr;
|
||||
view.peerAddress = linphone_address_as_string(linphone_chat_room_get_peer_address(cr));
|
||||
self.currentRoom = view.chatRoom;
|
||||
if (PhoneMainView.instance.currentView == view.compositeViewDescription)
|
||||
[view configureForRoom:FALSE];
|
||||
else
|
||||
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
|
||||
*/
|
||||
}
|
||||
|
||||
void main_view_chat_room_conference_joined(LinphoneChatRoom *cr, const LinphoneEventLog *event_log) {
|
||||
PhoneMainView *view = PhoneMainView.instance;
|
||||
LOGI(@"Chat room [%p] conference joined.", cr);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
//
|
||||
// ChatConversationViewModelSwift.swift
|
||||
// linphone
|
||||
//
|
||||
// Created by Benoît Martins on 23/11/2022.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import Foundation
|
||||
import linphonesw
|
||||
|
||||
|
||||
class ChatConversationViewModel: ControlsViewModel {
|
||||
|
||||
static let sharedModel = ChatConversationViewModel()
|
||||
|
||||
override init() {
|
||||
super.init()
|
||||
}
|
||||
}
|
||||
|
|
@ -22,12 +22,16 @@ import UIKit
|
|||
import Foundation
|
||||
import linphonesw
|
||||
|
||||
@objc class DetailChatRoomFragment: BackActionsNavigationView, UICompositeViewDelegate { // Replaces ChatConversationView
|
||||
@objc class ChatConversationViewSwift: BackActionsNavigationView, UICompositeViewDelegate { // Replaces ChatConversationView
|
||||
|
||||
let controlsView = ControlsView(showVideo: true, controlsViewModel: ChatConversationViewModel.sharedModel)
|
||||
|
||||
static let compositeDescription = UICompositeViewDescription(DetailChatRoomFragment.self, statusBar: StatusBarView.self, tabBar: nil, sideMenu: SideMenuView.self, fullscreen: false, isLeftFragment: false,fragmentWith: nil)
|
||||
static let compositeDescription = UICompositeViewDescription(ChatConversationViewSwift.self, statusBar: StatusBarView.self, tabBar: nil, sideMenu: SideMenuView.self, fullscreen: false, isLeftFragment: false,fragmentWith: nil)
|
||||
|
||||
static func compositeViewDescription() -> UICompositeViewDescription! { return compositeDescription }
|
||||
|
||||
func compositeViewDescription() -> UICompositeViewDescription! { return type(of: self).compositeDescription }
|
||||
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad(
|
||||
backAction: {
|
||||
|
|
@ -39,10 +43,10 @@ import linphonesw
|
|||
action2: {
|
||||
|
||||
},
|
||||
//title:"benoit.martins.test1"
|
||||
title:"Coin à champis de François"
|
||||
title:"benoit.martins.test1"
|
||||
//title:"Coin à champis de François"
|
||||
)
|
||||
view.backgroundColor = VoipTheme.backgroundColor3.get()
|
||||
//view.backgroundColor = VoipTheme.backgroundColor3.get()
|
||||
}
|
||||
|
||||
func goBackChatListView() {
|
||||
|
|
@ -75,10 +75,8 @@ import linphonesw
|
|||
|
||||
topBar.addSubview(titleLabel)
|
||||
titleLabel.toRightOf(backButton, withLeftMargin: 10).matchParentHeight().done()
|
||||
//let titlelabel = title.prefix(13)
|
||||
//titleLabel.text = title.count > 13 ? String(titlelabel+"...") : title
|
||||
titleLabel.toLeftOf(action1Button, withRightMargin: 20).done()
|
||||
titleLabel.text = title
|
||||
//titleLabel.truncationMode(.tail)
|
||||
|
||||
super.viewDidLoad()
|
||||
|
||||
|
|
|
|||
|
|
@ -943,7 +943,9 @@
|
|||
D3F83F8E15822ABE00336684 /* PhoneMainView.m in Sources */ = {isa = PBXBuildFile; fileRef = D3F83F8D15822ABD00336684 /* PhoneMainView.m */; };
|
||||
D7DA18712A02598700FABA0D /* TextViewer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7DA18702A02598700FABA0D /* TextViewer.swift */; };
|
||||
D7421D9E29228A5200290CAB /* DetailChatRoomFragment.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7421D9D29228A5200290CAB /* DetailChatRoomFragment.swift */; };
|
||||
D7421D9E29228A5200290CAB /* ChatConversationViewSwift.swift in Sources */ = {isa = PBXBuildFile; fileRef = D7421D9D29228A5200290CAB /* ChatConversationViewSwift.swift */; };
|
||||
D74A44912923BAF90017D063 /* BackActionsNavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D74A44902923BAF90017D063 /* BackActionsNavigationView.swift */; };
|
||||
D77057F1292E4A340031A970 /* ChatConversationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D77057F0292E4A340031A970 /* ChatConversationViewModel.swift */; };
|
||||
EA0007A62356008F003CC6BF /* msgNotificationService.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = EA5F25D9232BD3E200475F2E /* msgNotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
EA3650DB2330D2E30001148A /* NotificationService.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA5F25DB232BD3E200475F2E /* NotificationService.swift */; };
|
||||
EA88A405242A6216007FEC61 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 63AADBC41B6A0FF200AA16FD /* Localizable.strings */; };
|
||||
|
|
@ -2174,7 +2176,9 @@
|
|||
D3F83F8D15822ABD00336684 /* PhoneMainView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PhoneMainView.m; sourceTree = "<group>"; };
|
||||
D7DA18702A02598700FABA0D /* TextViewer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextViewer.swift; sourceTree = "<group>"; };
|
||||
D7421D9D29228A5200290CAB /* DetailChatRoomFragment.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetailChatRoomFragment.swift; sourceTree = "<group>"; };
|
||||
D7421D9D29228A5200290CAB /* ChatConversationViewSwift.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatConversationViewSwift.swift; sourceTree = "<group>"; };
|
||||
D74A44902923BAF90017D063 /* BackActionsNavigationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BackActionsNavigationView.swift; sourceTree = "<group>"; };
|
||||
D77057F0292E4A340031A970 /* ChatConversationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatConversationViewModel.swift; sourceTree = "<group>"; };
|
||||
DF241FDC6C7431777AB3BD58 /* Pods-msgNotificationContent.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-msgNotificationContent.debug.xcconfig"; path = "Target Support Files/Pods-msgNotificationContent/Pods-msgNotificationContent.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
E19FC645A566E91D4EEB9C8F /* Pods-msgNotificationService.distributionadhoc.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-msgNotificationService.distributionadhoc.xcconfig"; path = "Target Support Files/Pods-msgNotificationService/Pods-msgNotificationService.distributionadhoc.xcconfig"; sourceTree = "<group>"; };
|
||||
EA5F25D9232BD3E200475F2E /* msgNotificationService.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = msgNotificationService.appex; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
|
|
@ -3812,6 +3816,7 @@
|
|||
D7421D9A292283D300290CAB /* ViewModels */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D77057F0292E4A340031A970 /* ChatConversationViewModel.swift */,
|
||||
);
|
||||
path = ViewModels;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -3826,7 +3831,7 @@
|
|||
D7421D9C292283ED00290CAB /* Views */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D7421D9D29228A5200290CAB /* DetailChatRoomFragment.swift */,
|
||||
D7421D9D29228A5200290CAB /* ChatConversationViewSwift.swift */,
|
||||
);
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -5036,6 +5041,7 @@
|
|||
C63F723E285A24B10066163B /* VoipTexts.swift in Sources */,
|
||||
C63F722A285A24B10066163B /* UIImageViewExtensions.swift in Sources */,
|
||||
D3549816158761D0000081D8 /* ContactsListTableView.m in Sources */,
|
||||
D77057F1292E4A340031A970 /* ChatConversationViewModel.swift in Sources */,
|
||||
633888461BFB2C49001D5E7B /* HPTextViewInternal.m in Sources */,
|
||||
C63F7242285A24B10066163B /* VoipParticipantCell.swift in Sources */,
|
||||
D35498211587716B000081D8 /* StatusBarView.m in Sources */,
|
||||
|
|
@ -5098,7 +5104,7 @@
|
|||
D37C639B15AADEF6009D0BAC /* ContactDetailsTableView.m in Sources */,
|
||||
63E59A3F1ADE70D900646FB3 /* InAppProductsManager.m in Sources */,
|
||||
D3C6526715AC1A8F0092A874 /* UIContactDetailsCell.m in Sources */,
|
||||
D7421D9E29228A5200290CAB /* DetailChatRoomFragment.swift in Sources */,
|
||||
D7421D9E29228A5200290CAB /* ChatConversationViewSwift.swift in Sources */,
|
||||
C63F7227285A24B10066163B /* UILabelExtensions.swift in Sources */,
|
||||
631348301B6F7B6600C6BDCB /* UIRoundBorderedButton.m in Sources */,
|
||||
C90FAA7915AF54E6002091CB /* HistoryDetailsView.m in Sources */,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue