Skip to content

Commit

Permalink
Merge pull request #2 from okode/update-sdk-version
Browse files Browse the repository at this point in the history
AP-709 Update Sightcall sdk version
  • Loading branch information
psabater authored Jul 2, 2021
2 parents e14940f + 04c3a2f commit bd2710c
Show file tree
Hide file tree
Showing 106 changed files with 62 additions and 7,343 deletions.
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,51 @@ Cordova Plugin for SightCall.

## Troubleshooting guide

Q: I get compilation errors on Android
**Q: I get compilation errors on Android**

A: First, check if your project compiles without this plugin. In that case, verify the plugin version you are using on your project because since 4.0 version we just support Cordova projects that are using Android with AndroidX. Below 4.0 version, take into account that this plugin is not compatible with AndroidX as it uses old Android Support Libraries. In that case, to migrate the plugin code to AndroidX, you can do the following:

- Add plugin to enable AndroidX in the project (`cordova plugin add cordova-plugin-androidx`) and add plugin to patch existing plugin source that uses the Android Support Library to use AndroidX (`cordova plugin add cordova-plugin-androidx-adapter`)

- Or using Jetifier if you are using this plugin on a Capacitor project: https://github.com/mikehardy/jetifier


Q: I get Android compilation errors when linking resources in the manifest file like:
**Q: I get Android compilation errors when linking resources in the manifest file like:**
```
error: attribute android:requestLegacyExternalStorage not found.
error: attribute android:foregroundServiceType not found.
```

A: You need to compile against SDK 29 and maybe use the most recent build tools for aapt to know this attribute, because it's introduced in Android 10.

**Q: Could not resolve all artifacts for configuration ':app:debugCompileClasspath'. Something like:**
```
Execution failed for task ':app:androidDependencies'.
> Could not resolve all artifacts for configuration ':app:debugCompileClasspath'.
> Could not resolve androidx.lifecycle:lifecycle-runtime:2.1.0-beta01.
Required by:
project :app
> Cannot find a version of 'androidx.lifecycle:lifecycle-runtime' that satisfies the version constraints:
Dependency path 'android:app:unspecified' --> 'com.sightcall.universal:universal-sdk:4.3.20' --> 'com.google.android.material:material:1.3.0' --> 'androidx.lifecycle:lifecycle-runtime:2.0.0'
[...]
```

A: There's a collision between plugin dependencies. Try to check app dependencies tree.
```
gradlew -q dependencies app:dependencies --configuration debugCompileClasspath
```
You will need to force versions inside `build-extras.gradle`
```
ext.postBuildExtras = {
[...]
configurations.all {
resolutionStrategy {
forcedModules = [
'androidx.collection:collection:1.0.0',
'androidx.lifecycle:lifecycle-viewmodel:2.1.0',
'androidx.fragment:fragment:1.1.0'
[...]
]
}
}
}
```
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.3",
"version": "4.0.4",
"description": "Cordova SightCall Plugin",
"cordova": {
"id": "cordova-plugin-sightcall",
Expand Down
11 changes: 9 additions & 2 deletions 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.3">
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="cordova-plugin-sightcall" version="4.0.4">
<name>SightCall</name>
<description>Cordova SightCall Plugin</description>
<license>MIT</license>
Expand Down Expand Up @@ -42,7 +42,14 @@
<source-file src="src/ios/AppDelegate+Sightcall.m" />

<!--SightCall framework-->
<framework src="src/ios/Sightcall/LSUniversalSDK.framework" custom="true" embed="true" />
<podspec>
<config>
<source url="https://cdn.cocoapods.org/"/>
</config>
<pods use-frameworks="true">
<pod name="LSUniversalSDK" git="https://github.com/sightcall/iOS-UniversalSDK.git" tag="2.5.1"/>
</pods>
</podspec>

</platform>

Expand Down
2 changes: 1 addition & 1 deletion src/android/build-extras.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ repositories {
}

dependencies {
implementation 'com.sightcall.universal:universal-sdk:4.3.0'
implementation 'com.sightcall.universal:universal-sdk:4.4.0'
}

cdvPluginPostBuildExtras.push({
Expand Down
32 changes: 16 additions & 16 deletions src/ios/CDVSightCall.m
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ - (void)connectionError:(lsConnectionError_t)error
}


- (void)callReport:(lsCallReport_s)callEnd
- (void)callReport:(LSCallReport*)callEnd
{
NSString *callEndReason = NULL;
switch (callEnd.callEnd) {
Expand Down Expand Up @@ -333,12 +333,12 @@ - (void)handleCallLocalNotification:(CDVInvokedUrlCommand*)command {
**/
- (void)savePictoreOnDisk:(UIImage *_Nullable)image with:(int32_t)caseId {
NSData *imageData = UIImagePNGRepresentation(image);

NSString* tempDirectoryPath = NSTemporaryDirectory();

long long now = (long long)([[NSDate date] timeIntervalSince1970] * 1000.0);
NSString *imagePath =[tempDirectoryPath stringByAppendingPathComponent:[NSString stringWithFormat:@"%lld.png", now]];

NSLog(@"pre writing to file");
if (![imageData writeToFile:imagePath atomically:NO])
{
Expand Down Expand Up @@ -371,7 +371,7 @@ - (void)showLocalCallNotification:(NSDictionary*)sightcallPushPayload {
if (SYSTEM_VERSION_GRATERTHAN_OR_EQUALTO(@"10.0")) {
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
UNMutableNotificationContent* content = [CallLocalNotification buildCallNotificationContent: sightcallPushPayload];

UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:1 repeats:false];
UNNotificationRequest* request = [UNNotificationRequest
requestWithIdentifier:@"SIGHTCALL_CALL_ALARM" content:content trigger:trigger];
Expand Down Expand Up @@ -414,14 +414,14 @@ - (BOOL)notifyListener:(NSString *)eventType data:(NSDictionary *)data {
NSLog(@"Listener callback unavailable. event %@", eventType);
return NO;
}

NSMutableDictionary *message = [NSMutableDictionary dictionary];
[message setValue:eventType forKey:EVENT_TYPE];
[message setValue:data forKey:EVENT_DATA];

CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:message];
[result setKeepCallbackAsBool:YES];

[self.commandDelegate sendPluginResult:result callbackId:self.listenerCallbackID];
return YES;
}
Expand Down Expand Up @@ -467,13 +467,13 @@ - (CDVPluginResult *)pluginResultForValue:(id)value status:(CDVCommandStatus)sta
NSNull --> no return value
nil -> no return value
*/

// String
if ([value isKindOfClass:[NSString class]]) {
return [CDVPluginResult resultWithStatus:status
messageAsString:[value stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
}

// Number
if ([value isKindOfClass:[NSNumber class]]) {
CFNumberType numberType = CFNumberGetType((CFNumberRef)value);
Expand All @@ -484,27 +484,27 @@ - (CDVPluginResult *)pluginResultForValue:(id)value status:(CDVCommandStatus)sta
return [CDVPluginResult resultWithStatus:status messageAsDouble:[value doubleValue]];
}
}

// Array
if ([value isKindOfClass:[NSArray class]]) {
return [CDVPluginResult resultWithStatus:status messageAsArray:value];
}

// Object
if ([value isKindOfClass:[NSDictionary class]]) {
return [CDVPluginResult resultWithStatus:status messageAsDictionary:value];
}

// Null
if ([value isKindOfClass:[NSNull class]]) {
return [CDVPluginResult resultWithStatus:status];
}

// Nil
if (!value) {
return [CDVPluginResult resultWithStatus:status];
}

NSLog(@"Cordova callback block returned unrecognized type: %@", NSStringFromClass([value class]));
return [CDVPluginResult resultWithStatus:status];
}
Expand All @@ -522,7 +522,7 @@ - (void)performCallbackWithCommand:(CDVInvokedUrlCommand *)command withBlock:(Co
CDVPluginResult *result = [self pluginResultForValue:value status:status];
[self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
};

if (!block) {
completionHandler(CDVCommandStatus_OK, nil);
} else {
Expand Down
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit bd2710c

Please sign in to comment.