From f0f70bf3d50de938e28e59cf050becb2abab8d0c Mon Sep 17 00:00:00 2001 From: Pepe Becker Date: Mon, 9 Sep 2019 20:21:06 +0900 Subject: [PATCH] Create SinchModule --- .../Classes/Convenience/BModuleHelper.m | 1 + ChatSDKCore/Classes/Core.h | 3 ++ .../Abstract/BAbstractNetworkAdapter.h | 1 + ChatSDKCore/Classes/Interfaces/PCall.h | 27 +++++++++++ .../Classes/Interfaces/PCallDelegate.h | 22 +++++++++ ChatSDKCore/Classes/Interfaces/PCallHandler.h | 43 ++++++++++++++++++ .../Classes/Interfaces/PNetworkAdapter.h | 3 ++ ChatSDKCore/Classes/Session/BChatSDK.h | 1 + ChatSDKCore/Classes/Session/BChatSDK.m | 4 ++ ChatSDKUI/Assets/call_white_24pt.png | Bin 0 -> 241 bytes ChatSDKUI/Assets/call_white_24pt@2x.png | Bin 0 -> 395 bytes ChatSDKUI/Assets/call_white_24pt@3x.png | Bin 0 -> 552 bytes .../Chat View/BChatViewController.m | 12 +++++ Xcode/Podfile | 1 + 14 files changed, 118 insertions(+) create mode 100644 ChatSDKCore/Classes/Interfaces/PCall.h create mode 100644 ChatSDKCore/Classes/Interfaces/PCallDelegate.h create mode 100644 ChatSDKCore/Classes/Interfaces/PCallHandler.h create mode 100755 ChatSDKUI/Assets/call_white_24pt.png create mode 100755 ChatSDKUI/Assets/call_white_24pt@2x.png create mode 100755 ChatSDKUI/Assets/call_white_24pt@3x.png diff --git a/ChatSDKCore/Classes/Convenience/BModuleHelper.m b/ChatSDKCore/Classes/Convenience/BModuleHelper.m index 95abd5f6..3fa7fff6 100755 --- a/ChatSDKCore/Classes/Convenience/BModuleHelper.m +++ b/ChatSDKCore/Classes/Convenience/BModuleHelper.m @@ -50,6 +50,7 @@ -(void) activateModulesForXMPP { -(void) activateCommonModules: (NSString *) server { [self activateModuleForName:@"BBlockingModule"]; + [self activateModuleForName:@"BSinchModule"]; [self activateModuleForName:@"BLastOnlineModule"]; [self activateModuleForName:@"BAudioMessageModule"]; [self activateModuleForName:@"BVideoMessageModule"]; diff --git a/ChatSDKCore/Classes/Core.h b/ChatSDKCore/Classes/Core.h index 826bbae0..3003a523 100755 --- a/ChatSDKCore/Classes/Core.h +++ b/ChatSDKCore/Classes/Core.h @@ -73,6 +73,9 @@ #import #import #import +#import +#import +#import #import #import #import diff --git a/ChatSDKCore/Classes/Handlers/Abstract/BAbstractNetworkAdapter.h b/ChatSDKCore/Classes/Handlers/Abstract/BAbstractNetworkAdapter.h index 16023476..e7215e3e 100755 --- a/ChatSDKCore/Classes/Handlers/Abstract/BAbstractNetworkAdapter.h +++ b/ChatSDKCore/Classes/Handlers/Abstract/BAbstractNetworkAdapter.h @@ -25,6 +25,7 @@ @property (nonatomic, readwrite) id search; @property (nonatomic, readwrite) id publicThread; @property (nonatomic, readwrite) id blocking; +@property (nonatomic, readwrite) id calling; @property (nonatomic, readwrite) id lastOnline; @property (nonatomic, readwrite) id nearbyUsers; @property (nonatomic, readwrite) id readReceipt; diff --git a/ChatSDKCore/Classes/Interfaces/PCall.h b/ChatSDKCore/Classes/Interfaces/PCall.h new file mode 100644 index 00000000..93e5f893 --- /dev/null +++ b/ChatSDKCore/Classes/Interfaces/PCall.h @@ -0,0 +1,27 @@ +// +// PCall.h +// ChatSDK +// +// Created by Pepe Becker on 9/3/19. +// + +#ifndef PCall_h +#define PCall_h + +@protocol PCall + +- (void)answer; +- (void)hangup; +- (void)pauseVideo; +- (void)resumeVideo; + +- (void)setDelegate:(id)delegate; +- (id)delegate; + +- (NSString *)callId; +- (NSString *)remoteUserId; +- (BOOL)isOutgoing; + +@end + +#endif /* PCall_h */ diff --git a/ChatSDKCore/Classes/Interfaces/PCallDelegate.h b/ChatSDKCore/Classes/Interfaces/PCallDelegate.h new file mode 100644 index 00000000..61d4809b --- /dev/null +++ b/ChatSDKCore/Classes/Interfaces/PCallDelegate.h @@ -0,0 +1,22 @@ +// +// PCallDelegate.h +// ChatSDK +// +// Created by Pepe Becker on 9/5/19. +// + +#ifndef PCallDelegate_h +#define PCallDelegate_h + +@protocol PCall; + +@protocol PCallDelegate +@optional +- (void)callDidEnd:(id)call; +- (void)callDidProgress:(id)call; +- (void)callDidEstablish:(id)call; +- (void)callDidPauseVideo:(id)call; +- (void)callDidResumeVideo:(id)call; +@end + +#endif /* PCallDelegate_h */ diff --git a/ChatSDKCore/Classes/Interfaces/PCallHandler.h b/ChatSDKCore/Classes/Interfaces/PCallHandler.h new file mode 100644 index 00000000..53dd1978 --- /dev/null +++ b/ChatSDKCore/Classes/Interfaces/PCallHandler.h @@ -0,0 +1,43 @@ +// +// PCallHandler.h +// ChatSDKModules +// +// Created by Pepe Becker on 9/3/19. +// + +#ifndef PCallHandler_h +#define PCallHandler_h + +@class RXPromise; +@protocol PCall; + +@protocol PCallHandler + +- (RXPromise *)startWithUserId:(NSString *)userId; +- (RXPromise *)callUserWithId:(NSString *)userId; +- (id)activeCall; +- (id)incomingCall; +- (void)answerIncomingCall; +- (void)hangupIncomingCall; +- (void)hangupActiveCall; + +- (UIView *)localView; +- (UIView *)remoteView; + +- (void)enableSpeaker; +- (void)disableSpeaker; + +- (int)captureDevicePosition; +- (void)setCaptureDevicePosition:(int)i; +- (void)toggleCaptureDevicePosition; + +- (UINavigationController *)callNavigationController; +- (UINavigationController *)incomingCallNavigationController; +- (UIViewController *)callViewController; +- (UIViewController *)incomingCallViewController; +- (void)setCallViewControllerClass:(Class)controllerClass; +- (void)setIncomingCallViewControllerClass:(Class)controllerClass; + +@end + +#endif /* PCallHandler_h */ diff --git a/ChatSDKCore/Classes/Interfaces/PNetworkAdapter.h b/ChatSDKCore/Classes/Interfaces/PNetworkAdapter.h index 614bba78..641ae5fb 100755 --- a/ChatSDKCore/Classes/Interfaces/PNetworkAdapter.h +++ b/ChatSDKCore/Classes/Interfaces/PNetworkAdapter.h @@ -27,6 +27,7 @@ @protocol PPublicThreadHandler; @protocol PLastOnlineHandler; @protocol PBlockingHandler; +@protocol PCallHandler; @protocol PNearbyUsersHandler; @protocol PReadReceiptHandler; @protocol PStickerMessageHandler; @@ -98,6 +99,7 @@ -(id) publicThread; -(id) lastOnline; -(id) blocking; +-(id) calling; -(id) nearbyUsers; -(id) readReceipt; -(id) stickerMessage; @@ -125,6 +127,7 @@ -(void) setPublicThread: (id) publicThread; -(void) setLastOnline: (id) lastOnline; -(void) setBlocking: (id) blocking; +-(void) setCalling: (id) calling; -(void) setNearbyUsers: (id) nearbyUsers; -(void) setReadReceipt: (id) readReceipt; -(void) setStickerMessage: (id) stickerMessage; diff --git a/ChatSDKCore/Classes/Session/BChatSDK.h b/ChatSDKCore/Classes/Session/BChatSDK.h index 096fe1d7..260f5856 100755 --- a/ChatSDKCore/Classes/Session/BChatSDK.h +++ b/ChatSDKCore/Classes/Session/BChatSDK.h @@ -79,6 +79,7 @@ +(id) search; +(id) publicThread; +(id) blocking; ++(id) calling; +(id) lastOnline; +(id) nearbyUsers; +(id) readReceipt; diff --git a/ChatSDKCore/Classes/Session/BChatSDK.m b/ChatSDKCore/Classes/Session/BChatSDK.m index ffe64809..20be6d02 100755 --- a/ChatSDKCore/Classes/Session/BChatSDK.m +++ b/ChatSDKCore/Classes/Session/BChatSDK.m @@ -272,6 +272,10 @@ -(BBackgroundPushNotificationQueue *) pushQueue { return self.a.blocking; } ++(id) calling { + return self.a.calling; +} + +(id) lastOnline { return self.a.lastOnline; } diff --git a/ChatSDKUI/Assets/call_white_24pt.png b/ChatSDKUI/Assets/call_white_24pt.png new file mode 100755 index 0000000000000000000000000000000000000000..34c17c8729d58a23afdd0e4cb5bfb607020c18ea GIT binary patch literal 241 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_+i9iA?ZAr*{gPOFv(1TZih=oh=A zI;n7apUbbsj{Pc2gg$QlYEWKYetnxw`QFS~|8~3<=hMB)VAn38#;DRR@ryB}UE&mj zkA;-55MzP5+8*``k4tV`nJn7(S|j2j4^1&o z?Dn2#DfjJ}a>U2G8wKVVcNpHR`?)dvX98bIL-xF;G}p}Bm~DJE|GE3a2~Ruo`5qa>FJ;^-)ERO30pNBm3Bg;athdaD>(F^CrWUkoRgAcF<= zrTD-lwy}yCjG=*|U=D?y3Atb(c@&q=c16K5@(JJ`?eql=iNltpXqZ6`0c3NEw%p{m z6cs~>BLYQ7Bd)m>uu+-~B)Ju^QG-2XxD~KbkNsr06|hmCZM=0WV51b{ImLa7dmvBL pVhn3J#1-!Fl60OhTrn}OJ_GPriZQ!Jh5P^j002ovPDHLkV1f%Bs{sH2 literal 0 HcmV?d00001 diff --git a/ChatSDKUI/Assets/call_white_24pt@3x.png b/ChatSDKUI/Assets/call_white_24pt@3x.png new file mode 100755 index 0000000000000000000000000000000000000000..d9d2b8770f5f45c6ede97371f68b3047803dcab3 GIT binary patch literal 552 zcmV+@0@wYCP)*u)i=xPVPAaf!p&)Df51f=wrJ ziHX?E6_;p>%@J{lD%gA?nYcr8>>7(p+`?wQxWqzic8g0i#b$`OL~4RNPC{{u^8~h$ z#NryG2xNk2AUpm<&`Pv$5YsEFiyk^*sv(+4&PO9?mgr)x5fnil(L`1vjij}ri^Z54 zi6#mXZ3I0bjc8&Krmdoh^t{B>TQt!PQxug&4{H62M;8mJsTNLX^9P#;2pl6Q$JwN0e-p1DhARZ%;P-u ziNaSj * messages = [BChatSDK.db loadMessagesForThread:_thread newest:BChatSDK.config.messagesToLoadPerBatch]; @@ -47,6 +52,13 @@ -(void) viewDidLoad { [self setMessages:messages scrollToBottom:NO animate:NO force: YES]; } +-(void) call { + if (!BChatSDK.calling) return; + [BChatSDK.calling callUserWithId:_thread.otherUser.entityID]; + UIViewController * controller = [BChatSDK.calling callNavigationController]; + [self presentViewController:controller animated:YES completion:nil]; +} + -(void) updateSubtitle { if (BChatSDK.config.userChatInfoEnabled) { diff --git a/Xcode/Podfile b/Xcode/Podfile index a5a7ecfd..fba1b04e 100755 --- a/Xcode/Podfile +++ b/Xcode/Podfile @@ -19,6 +19,7 @@ target 'ChatSDK Demo' do # pod 'FBSDKLoginKit' + #pod "ChatSDKModules/SinchModule", :path => "../ChatSDKModules" #pod "ChatSDKModules/StickerMessage", :path => "../ChatSDKModules" #pod "ChatSDKModules/KeyboardOverlayOptions", :path => "../ChatSDKModules" #pod "ChatSDKModules/ContactBook", :path => "../ChatSDKModules"