This repository has been archived by the owner on Dec 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/CallKit-integration-3280' into develop
- Loading branch information
Showing
44 changed files
with
2,316 additions
and
693 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>CFBundleDevelopmentRegion</key> | ||
<string>en</string> | ||
<key>CFBundleDisplayName</key> | ||
<string>IntentsExtension</string> | ||
<key>CFBundleExecutable</key> | ||
<string>$(EXECUTABLE_NAME)</string> | ||
<key>CFBundleIdentifier</key> | ||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> | ||
<key>CFBundleInfoDictionaryVersion</key> | ||
<string>6.0</string> | ||
<key>CFBundleName</key> | ||
<string>$(PRODUCT_NAME)</string> | ||
<key>CFBundlePackageType</key> | ||
<string>XPC!</string> | ||
<key>CFBundleShortVersionString</key> | ||
<string>1.0</string> | ||
<key>CFBundleVersion</key> | ||
<string>1</string> | ||
<key>NSExtension</key> | ||
<dict> | ||
<key>NSExtensionAttributes</key> | ||
<dict> | ||
<key>IntentsSupported</key> | ||
<array> | ||
<string>INStartAudioCallIntent</string> | ||
</array> | ||
</dict> | ||
<key>NSExtensionPointIdentifier</key> | ||
<string>com.apple.intents-service</string> | ||
<key>NSExtensionPrincipalClass</key> | ||
<string>$(PRODUCT_MODULE_NAME).IntentHandler</string> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
Copyright (C) 2016 Apple Inc. All Rights Reserved. | ||
See LICENSE.txt for this sample’s licensing information | ||
|
||
Abstract: | ||
Intents handler principal class | ||
|
||
Copied from Speakerbox example app. | ||
*/ | ||
|
||
import Intents | ||
|
||
class IntentHandler: INExtension, INStartAudioCallIntentHandling { | ||
|
||
func handle(startAudioCall intent: INStartAudioCallIntent, completion: @escaping (INStartAudioCallIntentResponse) -> Void) { | ||
let response: INStartAudioCallIntentResponse | ||
defer { | ||
completion(response) | ||
} | ||
|
||
// Ensure there is a person handle. | ||
guard intent.contacts?.first?.personHandle != nil else { | ||
response = INStartAudioCallIntentResponse(code: .failure, userActivity: nil) | ||
return | ||
} | ||
|
||
let userActivity = NSUserActivity(activityType: String(describing: INStartAudioCallIntent.self)) | ||
|
||
response = INStartAudioCallIntentResponse(code: .continueInApp, userActivity: userActivity) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
// | ||
// VSLCallManagerTests.m | ||
// Copyright © 2016 Devhouse Spindle. All rights reserved. | ||
// | ||
|
||
#import <OCMock/OCMock.h> | ||
#import <XCTest/XCTest.h> | ||
#import <VialerSIPLib/VSLAccount.h> | ||
#import <VialerSIPLib/VSLCall.h> | ||
#import <VialerSIPLib/VSLCallManager.h> | ||
|
||
@interface VSLCallManagerTests : XCTestCase | ||
@property (strong, nonatomic) id accountMock; | ||
@property (strong, nonatomic) VSLCallManager *callManagerUnderTest; | ||
@end | ||
|
||
@implementation VSLCallManagerTests | ||
|
||
- (void)setUp { | ||
[super setUp]; | ||
self.accountMock = OCMStrictClassMock([VSLAccount class]); | ||
self.callManagerUnderTest = [[VSLCallManager alloc] init]; | ||
} | ||
|
||
- (void)tearDown { | ||
[self.accountMock stopMocking]; | ||
self.accountMock = nil; | ||
[super tearDown]; | ||
} | ||
|
||
- (void)testCallsForAccount { | ||
VSLCall *mockCall1 = [[VSLCall alloc] initInboundCallWithCallId:1 account:self.accountMock]; | ||
VSLCall *mockCall2 = [[VSLCall alloc] initOutboundCallWithNumberToCall:@"123" account:self.accountMock]; | ||
|
||
[self.callManagerUnderTest addCall:mockCall1]; | ||
[self.callManagerUnderTest addCall:mockCall2]; | ||
|
||
NSArray *callsForAccount = [self.callManagerUnderTest callsForAccount:self.accountMock]; | ||
|
||
XCTAssertNotNil(callsForAccount, @"Calls array for account should not have been nil"); | ||
XCTAssert(callsForAccount.count == 2, @"Incorrect number of calls for account returned. Calls count:%@", [[NSNumber numberWithUnsignedInteger:callsForAccount.count] stringValue]); | ||
XCTAssert([callsForAccount containsObject:mockCall1], @"mockCall1 should have been in calls array for account"); | ||
XCTAssert([callsForAccount containsObject:mockCall2], @"mockCall2 should have been in calls array for account"); | ||
|
||
[self.accountMock verify]; | ||
} | ||
|
||
- (void)testCallForDifferentAccountShouldNotBeReturned { | ||
id differentAccountMock = OCMStrictClassMock([VSLAccount class]); | ||
VSLCall *mockCall1 = [[VSLCall alloc] initInboundCallWithCallId:1 account:differentAccountMock]; | ||
VSLCall *mockCall2 = [[VSLCall alloc] initOutboundCallWithNumberToCall:@"123" account:differentAccountMock]; | ||
|
||
[self.callManagerUnderTest addCall:mockCall1]; | ||
[self.callManagerUnderTest addCall:mockCall2]; | ||
|
||
NSArray *callsForAccount = [self.callManagerUnderTest callsForAccount:self.accountMock]; | ||
|
||
XCTAssertNil(callsForAccount, @"Calls for account array should have been nil"); | ||
XCTAssert(callsForAccount.count == 0, @"Incorrect number of calls for account returned. Calls count:%@", [[NSNumber numberWithUnsignedInteger:callsForAccount.count] stringValue]); | ||
XCTAssert(![callsForAccount containsObject:mockCall1], @"mockCall1 should have been in calls array for account"); | ||
XCTAssert(![callsForAccount containsObject:mockCall2], @"mockCall2 should have been in calls array for account"); | ||
|
||
[self.accountMock verify]; | ||
[differentAccountMock verify]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,22 +5,34 @@ | |
|
||
#import <OCMock/OCMock.h> | ||
#import <XCTest/XCTest.h> | ||
#import <VialerSIPLib/VSLAccount.h> | ||
#import <VialerSIPLib/VSLCall.h> | ||
|
||
@interface VSLCall() | ||
- (NSDictionary * _Nonnull)getCallerInfoFromRemoteUri:(NSString * _Nonnull)string; | ||
@end | ||
|
||
@interface VSLCallTests : XCTestCase | ||
|
||
@property (strong, nonatomic) id accountMock; | ||
@end | ||
|
||
@implementation VSLCallTests | ||
|
||
- (void)setUp { | ||
[super setUp]; | ||
self.accountMock = OCMStrictClassMock([VSLAccount class]); | ||
} | ||
|
||
- (void)tearDown { | ||
[self.accountMock stopMocking]; | ||
self.accountMock = nil; | ||
[super tearDown]; | ||
} | ||
|
||
- (void)testCallerNameCallerNumberOne { | ||
NSString *inputString = @"\"test\" <sip:[email protected]>"; | ||
|
||
VSLCall *call = [[VSLCall alloc] init]; | ||
VSLCall *call = [[VSLCall alloc] initInboundCallWithCallId:0 account:self.accountMock]; | ||
NSDictionary *dictionary = [call getCallerInfoFromRemoteUri:inputString]; | ||
|
||
XCTAssert([dictionary[@"caller_name"] isEqualToString:@"test"], @"The caller_name needs to be test"); | ||
|
@@ -30,7 +42,7 @@ - (void)testCallerNameCallerNumberOne { | |
- (void)testCallerNameCallerNumberTwo { | ||
NSString *inputString = @"sip:[email protected] (test)"; | ||
|
||
VSLCall *call = [[VSLCall alloc] init]; | ||
VSLCall *call = [[VSLCall alloc] initInboundCallWithCallId:0 account:self.accountMock]; | ||
NSDictionary *dictionary = [call getCallerInfoFromRemoteUri:inputString]; | ||
|
||
XCTAssert([dictionary[@"caller_name"] isEqualToString:@"test"], @"The caller_name needs to be test"); | ||
|
@@ -40,7 +52,7 @@ - (void)testCallerNameCallerNumberTwo { | |
- (void)testCallerNameNoDisplayNameInRemoteURI { | ||
NSString *inputString = @"<sip:[email protected]>"; | ||
|
||
VSLCall *call = [[VSLCall alloc] init]; | ||
VSLCall *call = [[VSLCall alloc] initInboundCallWithCallId:0 account:self.accountMock]; | ||
NSDictionary *dictionary = [call getCallerInfoFromRemoteUri:inputString]; | ||
|
||
XCTAssert([dictionary[@"caller_name"] isEqualToString:@""], @"The caller_name needs to be empty"); | ||
|
@@ -50,7 +62,7 @@ - (void)testCallerNameNoDisplayNameInRemoteURI { | |
- (void)testCallerNameNoDisplayNameInRemoteURITwo { | ||
NSString *inputString = @"sip:[email protected]"; | ||
|
||
VSLCall *call = [[VSLCall alloc] init]; | ||
VSLCall *call =[[VSLCall alloc] initInboundCallWithCallId:0 account:self.accountMock]; | ||
NSDictionary *dictionary = [call getCallerInfoFromRemoteUri:inputString]; | ||
|
||
XCTAssert([dictionary[@"caller_name"] isEqualToString:@""], @"The caller_name needs to be empty"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.