Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
psabater committed Jul 3, 2020
2 parents 5ca0ec6 + bb4d661 commit e14940f
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cordova-plugin-sightcall",
"version": "4.0.2",
"version": "4.0.3",
"description": "Cordova SightCall Plugin",
"cordova": {
"id": "cordova-plugin-sightcall",
Expand Down
2 changes: 1 addition & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-sightcall" version="4.0.2">
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-sightcall" version="4.0.3">
<name>SightCall</name>
<description>Cordova SightCall Plugin</description>
<license>MIT</license>
Expand Down
15 changes: 10 additions & 5 deletions src/ios/AppDelegate+Sightcall.m
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,16 @@ - (AppDelegate *)pluginSwizzledInit
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

NSLog(@"Sightcall - Notifications device token received: %@", deviceToken);
NSString * deviceTokenString = [[[[deviceToken description]
stringByReplacingOccurrencesOfString: @"<" withString: @""]
stringByReplacingOccurrencesOfString: @">" withString: @""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
[CDVSightCall setNotificationDeviceToken:deviceTokenString];
NSUInteger length = deviceToken.length;
if (length == 0) {
return;
}
const unsigned char *buffer = deviceToken.bytes;
NSMutableString *hexString = [NSMutableString stringWithCapacity:(length * 2)];
for (int i = 0; i < length; ++i) {
[hexString appendFormat:@"%02x", buffer[i]];
}
[CDVSightCall setNotificationDeviceToken:[hexString copy]];
}


Expand Down
2 changes: 2 additions & 0 deletions src/ios/CDVSightCall.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#endif
@property (nonatomic, copy) NSString *listenerCallbackID;

@property NSString *apnsToken;

- (void)registerListener:(CDVInvokedUrlCommand *)command;
- (void)demo:(CDVInvokedUrlCommand*)command;
- (void)enableLogger:(CDVInvokedUrlCommand*)command;
Expand Down
5 changes: 5 additions & 0 deletions src/ios/CDVSightCall.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ - (void)pluginInitialize

- (void)initSightcall {
self.lsUniversal = [[LSUniversal alloc] init];
if (self.apnsToken) {
[self.lsUniversal.agentHandler setNotificationToken: self.apnsToken];
}
self.lsUniversal.delegate = self;
[self.lsUniversal setPictureDelegate: self];
self.lsUniversal.logDelegate = self;
Expand Down Expand Up @@ -268,6 +271,8 @@ - (void)generateCallURL:(CDVInvokedUrlCommand*)command
+ (void)setNotificationDeviceToken:(NSString *)token {
CDVSightCall *plugin = instance;
if (plugin == NULL) { return; }
NSLog(@"Calling setNotificationToken with notification token: %@", token);
plugin.apnsToken = token;
[plugin.lsUniversal.agentHandler setNotificationToken: token];
}

Expand Down

0 comments on commit e14940f

Please sign in to comment.