diff options
Diffstat (limited to 'StoneIsland/plugins')
31 files changed, 412 insertions, 455 deletions
diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/.npmignore b/StoneIsland/plugins/cordova-plugin-x-socialsharing/.npmignore new file mode 100644 index 00000000..b9691135 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/.npmignore @@ -0,0 +1,3 @@ +.idea +screenshots +tests
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/.travis.yml b/StoneIsland/plugins/cordova-plugin-x-socialsharing/.travis.yml new file mode 100644 index 00000000..b9af4c58 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +sudo: false +node_js: + - "4.2" diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/MIT b/StoneIsland/plugins/cordova-plugin-x-socialsharing/LICENSE index f932f6d9..7aa3caf0 100644 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/MIT +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/LICENSE @@ -1,7 +1,5 @@ The MIT License (MIT) -Copyright (c) 2014-2016 Eddy Verbruggen - Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/README.md b/StoneIsland/plugins/cordova-plugin-x-socialsharing/README.md index 52e5515c..7ab40f21 100644 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/README.md +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/README.md @@ -205,14 +205,14 @@ Example: share a PDF file from the local www folder: ### Sharing directly to.. -####Twitter +#### Twitter ```html <!-- unlike most apps Twitter doesn't like it when you use an array to pass multiple files as the second param --> <button onclick="window.plugins.socialsharing.shareViaTwitter('Message via Twitter')">message via Twitter</button> <button onclick="window.plugins.socialsharing.shareViaTwitter('Message and link via Twitter', null /* img */, 'http://www.x-services.nl')">msg and link via Twitter</button> ``` -####Facebook +#### Facebook ```html <button onclick="window.plugins.socialsharing.shareViaFacebook('Message via Facebook', null /* img */, null /* url */, function() {console.log('share ok')}, function(errormsg){alert(errormsg)})">msg via Facebook (with errcallback)</button> ``` @@ -234,7 +234,7 @@ Whitelisting Facebook in your app's .plist: </array> ``` -####Instagram +#### Instagram ```html <button onclick="window.plugins.socialsharing.shareViaInstagram('Message via Instagram', 'https://www.google.nl/images/srpr/logo4w.png', function() {console.log('share ok')}, function(errormsg){alert(errormsg)})">msg via Instagram</button> ``` @@ -266,7 +266,7 @@ Don't pass in an image on iOS because that can't be sent to someone directly unf On Android pass in the phone number of the person you want to send a message to (untested at the moment). -####SMS +#### SMS Note that on Android, SMS via Hangouts may not behave correctly ```html <!-- Want to share a prefilled SMS text? --> @@ -277,7 +277,7 @@ Note that on Android, SMS via Hangouts may not behave correctly <button onclick="window.plugins.socialsharing.shareViaSMS({'message':'My cool message', 'subject':'The subject', 'image':'https://www.google.nl/images/srpr/logo4w.png'}, '0612345678,0687654321', function(msg) {console.log('ok: ' + msg)}, function(msg) {alert('error: ' + msg)})">share via SMS</button> ``` -####Email +#### Email Code inspired by the [EmailComposer plugin](https://github.com/katzer/cordova-plugin-email-composer), note that this is not supported on the iOS 8 simulator (an alert will be shown if your try to). ```js window.plugins.socialsharing.shareViaEmail( @@ -419,6 +419,23 @@ Here's the list of available activities you can disable : - com.apple.UIKit.activity.AddToReadingList - com.apple.UIKit.activity.AirDrop +#### Web Share API + +Chrome is introducing a new [Web Share API](https://github.com/WICG/web-share) to share data. + +```js +navigator.share({ + 'title': 'Optional title', + 'text': 'Optional message', + 'url': 'http://www.myurl.com' +}).then(function() { + console.log('Successful share'); +}).catch(function(error) { + console.log('Error sharing:', error) +}); +``` + +It doesn't provide all the options that the other share methods do but it is spec compliant. ## 4b. Usage on Windows Phone The available methods on WP8 are: `available`, `canShareViaEmail`, `share`, `shareViaEmail` and `shareViaSMS`. @@ -496,7 +513,7 @@ This is a stright forward approach - you just manually edit the .plist file - ei There is a plugin designed specifically to address query schema whitelisting. You can find the plugin and how to use it [here](https://www.npmjs.com/package/cordova-plugin-queries-schemes). In general, after installation, you can change plugin.xml file under the plugin subfolder within the plugins directory of your project to add the required schemas. Here again though, you have to edit an additional file and should take care not to overwrite it when making changes to your project. ### Use Custom Config plugin -The Custom Config plugin ([here](https://github.com/dpa99c/cordova-custom-config)) allows you to add configuration to your platforms "native" configuration files (e.g. .plist or AndroidManifest.xml) through the project's main config.xml file. +The Custom Config plugin ([here](https://github.com/dpa99c/cordova-custom-config)) allows you to add configuration to your platforms "native" configuration files (e.g. .plist or AndroidManifest.xml) through the project's main config.xml file. To address query schema issue, after installaing the plugin you can edit the iOS platform section of your config.xml (in the project main folder) to include the required entries: @@ -506,11 +523,11 @@ To address query schema issue, after installaing the plugin you can edit the iOS version="0.9.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> - + <!-- a bunch of elements like name, description etc --> - + <platform name="ios"> - + <!-- add this entry --> <config-file platform="ios" target="*-Info.plist" parent="LSApplicationQueriesSchemes"> <array> diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/package.json b/StoneIsland/plugins/cordova-plugin-x-socialsharing/package.json index 62e6a1c0..b06fe392 100644 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/package.json +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/package.json @@ -1,19 +1,53 @@ { - "name": "cordova-plugin-x-socialsharing", - "version": "5.1.3", - "description": "Share text, images (and other files), or a link via the native sharing widget of your device. Android is fully supported, as well as iOS 6 and up. WP8 has somewhat limited support.", + "_from": "cordova-plugin-x-socialsharing@~5.1.3", + "_id": "cordova-plugin-x-socialsharing@5.1.8", + "_inBundle": false, + "_integrity": "sha1-Q5odL0c2YnYogm5Rla5Tm1TmJIo=", + "_location": "/cordova-plugin-x-socialsharing", + "_phantomChildren": {}, + "_requested": { + "type": "range", + "registry": true, + "raw": "cordova-plugin-x-socialsharing@~5.1.3", + "name": "cordova-plugin-x-socialsharing", + "escapedName": "cordova-plugin-x-socialsharing", + "rawSpec": "~5.1.3", + "saveSpec": null, + "fetchSpec": "~5.1.3" + }, + "_requiredBy": [ + "/" + ], + "_resolved": "https://registry.npmjs.org/cordova-plugin-x-socialsharing/-/cordova-plugin-x-socialsharing-5.1.8.tgz", + "_shasum": "439a1d2f4736627628826e5195ae539b54e6248a", + "_spec": "cordova-plugin-x-socialsharing@~5.1.3", + "_where": "/Users/user/Sites/stone-island/StoneIsland", + "author": { + "name": "Eddy Verbruggen - @EddyVerbruggen" + }, + "bugs": { + "url": "https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/issues" + }, + "bundleDependencies": false, "cordova": { "id": "cordova-plugin-x-socialsharing", "platforms": [ "ios", "android", - "wp8" + "wp8", + "windows", + "web" ] }, - "repository": { - "type": "git", - "url": "git+https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git" - }, + "deprecated": false, + "description": "Share text, images (and other files), or a link via the native sharing widget of your device. Android is fully supported, as well as iOS 6 and up. WP8 has somewhat limited support.", + "engines": [ + { + "name": "cordova", + "version": ">=3.0.0" + } + ], + "homepage": "https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin#readme", "keywords": [ "Social", "Share", @@ -26,21 +60,17 @@ "Pocket", "LinkedIn", "cordova", + "WebShare", "ecosystem:cordova", "cordova-ios", "cordova-android", "cordova-windows" ], - "engines": [ - { - "name": "cordova", - "version": ">=3.0.0" - } - ], - "author": "Eddy Verbruggen - @EddyVerbruggen", "license": "MIT", - "bugs": { - "url": "https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/issues" + "name": "cordova-plugin-x-socialsharing", + "repository": { + "type": "git", + "url": "git+https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git" }, - "homepage": "https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin#readme" + "version": "5.1.8" } diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/plugin.xml b/StoneIsland/plugins/cordova-plugin-x-socialsharing/plugin.xml index 0a367427..cb4bf8bf 100755 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/plugin.xml +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/plugin.xml @@ -2,7 +2,7 @@ <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" xmlns:android="http://schemas.android.com/apk/res/android" id="cordova-plugin-x-socialsharing" - version="5.1.3"> + version="5.1.8"> <name>SocialSharing</name> @@ -25,6 +25,8 @@ <engine name="cordova" version=">=3.0.0"/> </engines> + <dependency id="es6-promise-plugin"/> + <js-module src="www/SocialSharing.js" name="SocialSharing"> <clobbers target="window.plugins.socialsharing" /> </js-module> @@ -39,8 +41,8 @@ </feature> </config-file> - <header-file src="src/ios/NSString+URLEncoding.h"/> - <source-file src="src/ios/NSString+URLEncoding.m"/> + <header-file src="src/ios/NSString+SSURLEncoding.h"/> + <source-file src="src/ios/NSString+SSURLEncoding.m"/> <header-file src="src/ios/SocialSharing.h"/> <source-file src="src/ios/SocialSharing.m"/> @@ -61,7 +63,17 @@ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> </config-file> + <config-file target="AndroidManifest.xml" parent="/manifest/application"> + <provider android:authorities="${applicationId}.sharing.provider" android:exported="false" android:grantUriPermissions="true" android:name="nl.xservices.plugins.FileProvider"> + <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/sharing_paths" /> + </provider> + </config-file> + <source-file src="src/android/nl/xservices/plugins/SocialSharing.java" target-dir="src/nl/xservices/plugins"/> + <source-file src="src/android/nl/xservices/plugins/FileProvider.java" target-dir="src/nl/xservices/plugins"/> + <source-file src="src/android/res/xml/sharing_paths.xml" target-dir="res/xml"/> + + <framework src="com.android.support:support-v4:24.1.1+" /> </platform> <!-- wp8 --> @@ -75,11 +87,11 @@ <source-file src="src/wp8/SocialSharing.cs" /> <framework src="src/wp8/Newtonsoft.Json.dll" custom="true"/> </platform> - + <!-- windows --> <platform name="windows"> <js-module src="src/windows/SocialSharingProxy.js" name="SocialSharingProxy"> - <merges target="" /> + <runs /> </js-module> </platform> diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-android-share.png b/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-android-share.png Binary files differdeleted file mode 100644 index f3ab135f..00000000 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-android-share.png +++ /dev/null diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-ios6-share.png b/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-ios6-share.png Binary files differdeleted file mode 100644 index 63b0b4c5..00000000 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-ios6-share.png +++ /dev/null diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-ios7-ipad-share.png b/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-ios7-ipad-share.png Binary files differdeleted file mode 100644 index 640c94f8..00000000 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-ios7-ipad-share.png +++ /dev/null diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-ios7-share.png b/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-ios7-share.png Binary files differdeleted file mode 100644 index 7545d10d..00000000 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-ios7-share.png +++ /dev/null diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-wp8-share.jpg b/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-wp8-share.jpg Binary files differdeleted file mode 100644 index 0ced2eb5..00000000 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshot-wp8-share.jpg +++ /dev/null diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshots-ios7-shareconfig.png b/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshots-ios7-shareconfig.png Binary files differdeleted file mode 100644 index 3afe5fef..00000000 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/screenshots/screenshots-ios7-shareconfig.png +++ /dev/null diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/android/nl/xservices/plugins/FileProvider.java b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/android/nl/xservices/plugins/FileProvider.java new file mode 100644 index 00000000..ef862604 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/android/nl/xservices/plugins/FileProvider.java @@ -0,0 +1,5 @@ +package nl.xservices.plugins; + + +public class FileProvider extends android.support.v4.content.FileProvider { +}
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/android/nl/xservices/plugins/SocialSharing.java b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/android/nl/xservices/plugins/SocialSharing.java index 8de31da8..faa96ced 100644 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/android/nl/xservices/plugins/SocialSharing.java +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/android/nl/xservices/plugins/SocialSharing.java @@ -34,6 +34,8 @@ import java.util.TimerTask; import java.util.regex.Matcher; import java.util.regex.Pattern; +import nl.xservices.plugins.FileProvider; + public class SocialSharing extends CordovaPlugin { private static final String ACTION_AVAILABLE_EVENT = "available"; @@ -81,10 +83,10 @@ public class SocialSharing extends CordovaPlugin { } else if (ACTION_SHARE_VIA_TWITTER_EVENT.equals(action)) { return doSendIntent(callbackContext, args.getString(0), args.getString(1), args.getJSONArray(2), args.getString(3), "twitter", null, false, true); } else if (ACTION_SHARE_VIA_FACEBOOK_EVENT.equals(action)) { - return doSendIntent(callbackContext, args.getString(0), args.getString(1), args.getJSONArray(2), args.getString(3), "com.facebook.katana", null, false, true); + return doSendIntent(callbackContext, args.getString(0), args.getString(1), args.getJSONArray(2), args.getString(3), "com.facebook.katana", null, false, true, "com.facebook.composer.shareintent"); } else if (ACTION_SHARE_VIA_FACEBOOK_WITH_PASTEMESSAGEHINT.equals(action)) { this.pasteMessage = args.getString(4); - return doSendIntent(callbackContext, args.getString(0), args.getString(1), args.getJSONArray(2), args.getString(3), "com.facebook.katana", null, false, true); + return doSendIntent(callbackContext, args.getString(0), args.getString(1), args.getJSONArray(2), args.getString(3), "com.facebook.katana", null, false, true, "com.facebook.composer.shareintent"); } else if (ACTION_SHARE_VIA_WHATSAPP_EVENT.equals(action)) { if (notEmpty(args.getString(4))) { return shareViaWhatsAppDirectly(callbackContext, args.getString(0), args.getString(1), args.getJSONArray(2), args.getString(3), args.getString(4)); @@ -169,6 +171,7 @@ public class SocialSharing extends CordovaPlugin { } } catch (Exception e) { callbackContext.error(e.getMessage()); + return; } // this was added to start the intent in a new window as suggested in #300 to prevent crashes upon return @@ -215,6 +218,19 @@ public class SocialSharing extends CordovaPlugin { } private boolean doSendIntent( + final CallbackContext callbackContext, + final String msg, + final String subject, + final JSONArray files, + final String url, + final String appPackageName, + final String chooserTitle, + final boolean peek, + final boolean boolResult) { + return doSendIntent(callbackContext, msg, subject, files, url, appPackageName, chooserTitle, peek, boolResult, null); + } + + private boolean doSendIntent( final CallbackContext callbackContext, final String msg, final String subject, @@ -223,7 +239,8 @@ public class SocialSharing extends CordovaPlugin { final String appPackageName, final String chooserTitle, final boolean peek, - final boolean boolResult) { + final boolean boolResult, + final String appName) { final CordovaInterface mycordova = cordova; final CordovaPlugin plugin = this; @@ -243,6 +260,7 @@ public class SocialSharing extends CordovaPlugin { Uri fileUri = null; for (int i = 0; i < files.length(); i++) { fileUri = getFileUriAndSetType(sendIntent, dir, files.getString(i), subject, i); + fileUri = FileProvider.getUriForFile(webView.getContext(), cordova.getActivity().getPackageName()+".sharing.provider", new File(fileUri.getPath())); if (fileUri != null) { fileUris.add(fileUri); } @@ -295,7 +313,7 @@ public class SocialSharing extends CordovaPlugin { packageName = items[0]; passedActivityName = items[1]; } - final ActivityInfo activity = getActivity(callbackContext, sendIntent, packageName); + final ActivityInfo activity = getActivity(callbackContext, sendIntent, packageName, appName); if (activity != null) { if (peek) { callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK)); @@ -369,6 +387,8 @@ public class SocialSharing extends CordovaPlugin { String localImage = image; if (image.endsWith("mp4") || image.endsWith("mov") || image.endsWith("3gp")){ sendIntent.setType("video/*"); + } else if (image.endsWith("mp3")) { + sendIntent.setType("audio/x-mpeg"); } else { sendIntent.setType("image/*"); } @@ -432,7 +452,7 @@ public class SocialSharing extends CordovaPlugin { final String encodedImg = image.substring(image.indexOf(";base64,") + 8); sendIntent.setType(fileType); saveFile(Base64.decode(encodedImg, Base64.DEFAULT), dir, sanitizeFilename(fileName)); - localImage = "file://" + dir + "/" + fileName; + localImage = "file://" + dir + "/" + sanitizeFilename(fileName); } else if (!image.startsWith("file://")) { throw new IllegalArgumentException("URL_NOT_SUPPORTED"); } else { @@ -649,12 +669,14 @@ public class SocialSharing extends CordovaPlugin { return null; } - private ActivityInfo getActivity(final CallbackContext callbackContext, final Intent shareIntent, final String appPackageName) { + private ActivityInfo getActivity(final CallbackContext callbackContext, final Intent shareIntent, final String appPackageName, final String appName) { final PackageManager pm = webView.getContext().getPackageManager(); List<ResolveInfo> activityList = pm.queryIntentActivities(shareIntent, 0); for (final ResolveInfo app : activityList) { if ((app.activityInfo.packageName).contains(appPackageName)) { - return app.activityInfo; + if (appName == null || (app.activityInfo.name).contains(appName)) { + return app.activityInfo; + } } } // no matching app found diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/android/res/xml/sharing_paths.xml b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/android/res/xml/sharing_paths.xml new file mode 100644 index 00000000..278084a2 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/android/res/xml/sharing_paths.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<paths> + <external-path + name="Android/data/${applicationId}/socialsharing_downloads" + path="./socialsharing-downloads"/> + + <root-path + name="root" + path="/"/> + +</paths>
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/ios/NSString+URLEncoding.h b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/ios/NSString+SSURLEncoding.h index d7da331d..71447b60 100644 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/ios/NSString+URLEncoding.h +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/ios/NSString+SSURLEncoding.h @@ -1,5 +1,5 @@ #import <Foundation/Foundation.h> -@interface NSString (URLEncoding) +@interface NSString (SSURLEncoding) @property (readonly) NSString *URLEncodedString; @end diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/ios/NSString+URLEncoding.m b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/ios/NSString+SSURLEncoding.m index b737626c..c8e746d3 100644 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/ios/NSString+URLEncoding.m +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/ios/NSString+SSURLEncoding.m @@ -1,6 +1,6 @@ -#import "NSString+URLEncoding.h" +#import "NSString+SSURLEncoding.h" -@implementation NSString (URLEncoding) +@implementation NSString (SSURLEncoding) - (NSString*)URLEncodedString { NSString* result = (NSString *)CFBridgingRelease( diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/ios/SocialSharing.m b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/ios/SocialSharing.m index 014925bd..57336cd9 100644 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/ios/SocialSharing.m +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/ios/SocialSharing.m @@ -1,5 +1,5 @@ #import "SocialSharing.h" -#import "NSString+URLEncoding.h" +#import "NSString+SSURLEncoding.h" #import <Cordova/CDV.h> #import <Social/Social.h> #import <Foundation/NSException.h> @@ -137,7 +137,7 @@ static NSString *const kShareOptionUrl = @"url"; #pragma GCC diagnostic ignored "-Wdeprecated-declarations" [activityVC setCompletionHandler:^(NSString *activityType, BOOL completed) { [self cleanupStoredFiles]; - NSDictionary * result = @{@"completed":@(completed), @"app":activityType}; + NSDictionary * result = @{@"completed":@(completed), @"app":activityType == nil ? @"" : activityType}; CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result]; [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; }]; @@ -361,21 +361,43 @@ static NSString *const kShareOptionUrl = @"url"; NSURL *file = [self getFile:path]; NSData* data = [fileManager contentsAtPath:file.path]; + if (!data) { + CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"invalid attachment"]; + [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId]; + return; + } + NSString* fileName; NSString* mimeType; NSString* basename = [self getBasenameFromAttachmentPath:path]; - if ([basename hasPrefix:@"data:"]) { - mimeType = (NSString*)[[[basename substringFromIndex:5] componentsSeparatedByString: @";"] objectAtIndex:0]; - fileName = @"attachment."; - fileName = [fileName stringByAppendingString:(NSString*)[[mimeType componentsSeparatedByString: @"/"] lastObject]]; - NSString *base64content = (NSString*)[[basename componentsSeparatedByString: @","] lastObject]; - data = [SocialSharing dataFromBase64String:base64content]; - } else { - fileName = [basename pathComponents].lastObject; - mimeType = [self getMimeTypeFromFileExtension:[basename pathExtension]]; - } - [self.globalMailComposer addAttachmentData:data mimeType:mimeType fileName:fileName]; + //Find data anywhere in string + NSRange rangeData = [basename rangeOfString:@"data:"]; + if (rangeData.location == NSNotFound) + { + fileName = [basename pathComponents].lastObject; + mimeType = [self getMimeTypeFromFileExtension:[basename pathExtension]]; + } + else + { + mimeType = (NSString*)[[[basename substringFromIndex:rangeData.location+rangeData.length] componentsSeparatedByString: @";"] objectAtIndex:0]; + + //Find df anywhere in string + NSRange rangeDF = [basename rangeOfString:@"df:"]; + //If not found fallback to default name + if (rangeDF.location == NSNotFound) { + fileName = @"attachment."; + fileName = [fileName stringByAppendingString:(NSString*)[[mimeType componentsSeparatedByString: @"/"] lastObject]]; + } else { + //Found, apply name + fileName = (NSString*)[[[basename substringFromIndex:rangeDF.location+rangeDF.length] componentsSeparatedByString: @";"] objectAtIndex:0]; + } + + + NSString *base64content = (NSString*)[[basename componentsSeparatedByString: @","] lastObject]; + data = [SocialSharing dataFromBase64String:base64content]; + } + [self.globalMailComposer addAttachmentData:data mimeType:mimeType fileName:fileName]; } } @@ -479,7 +501,7 @@ static NSString *const kShareOptionUrl = @"url"; _command = command; [self.commandDelegate runInBackground:^{ picker.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; - [[self getTopMostViewController] presentViewController:picker animated:YES completion:nil]; + [[self getTopMostViewController] presentViewController:picker animated:NO completion:nil]; }]; } else { CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"not available"]; @@ -694,6 +716,7 @@ static NSString *const kShareOptionUrl = @"url"; -(NSURL*)getFile: (NSString *)fileName { NSURL *file = nil; if (fileName != (id)[NSNull null]) { + NSRange rangeData = [fileName rangeOfString:@"data:"]; if ([fileName hasPrefix:@"http"]) { NSURL *url = [NSURL URLWithString:fileName]; NSData *fileData = [NSData dataWithContentsOfURL:url]; @@ -706,14 +729,27 @@ static NSString *const kShareOptionUrl = @"url"; } else if ([fileName hasPrefix:@"file://"]) { // stripping the first 6 chars, because the path should start with / instead of file:// file = [NSURL fileURLWithPath:[fileName substringFromIndex:6]]; - } else if ([fileName hasPrefix:@"data:"]) { - // using a base64 encoded string - // extract some info from the 'fileName', which is for example: data:text/calendar;base64,<encoded stuff here> - NSString *fileType = (NSString*)[[[fileName substringFromIndex:5] componentsSeparatedByString: @";"] objectAtIndex:0]; - fileType = (NSString*)[[fileType componentsSeparatedByString: @"/"] lastObject]; - NSString *base64content = (NSString*)[[fileName componentsSeparatedByString: @","] lastObject]; - NSData *fileData = [SocialSharing dataFromBase64String:base64content]; - file = [NSURL fileURLWithPath:[self storeInFile:[NSString stringWithFormat:@"%@.%@", @"file", fileType] fileData:fileData]]; + } else if (rangeData.location != NSNotFound ){ + //If found "data:" + NSString *fileType = (NSString*)[[[fileName substringFromIndex:rangeData.location+rangeData.length] componentsSeparatedByString: @";"] objectAtIndex:0]; + + NSString* attachmentName; + //Find df anywhere in string + NSRange rangeDF = [fileName rangeOfString:@"df:"]; + //If not found fallback to default name + if (rangeDF.location == NSNotFound) { + attachmentName = @"attachment."; + attachmentName = [attachmentName stringByAppendingString:(NSString*)[[fileType componentsSeparatedByString: @"/"] lastObject]]; + } else { + //Found, apply name + attachmentName = (NSString*)[[[fileName substringFromIndex:rangeDF.location+rangeDF.length] componentsSeparatedByString: @";"] objectAtIndex:0]; + } + + + NSString *base64content = (NSString*)[[fileName componentsSeparatedByString: @","] lastObject]; + NSData* data = [SocialSharing dataFromBase64String:base64content]; + file = [NSURL fileURLWithPath:[self storeInFile:attachmentName fileData:data]]; + } else { // assume anywhere else, on the local filesystem file = [NSURL fileURLWithPath:fileName]; diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/windows/SocialSharingProxy.js b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/windows/SocialSharingProxy.js index ff257d52..b52fa12f 100644 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/windows/SocialSharingProxy.js +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/windows/SocialSharingProxy.js @@ -1,4 +1,4 @@ -var cordova = require('cordova'); +var cordova = require('cordova'); module.exports = { share: function (win, fail, args) { @@ -10,7 +10,7 @@ module.exports = { var fileOrFileArray = args[2]; //Web link var url = args[3]; - + var folder = Windows.Storage.ApplicationData.current.temporaryFolder; var getExtension = function (strBase64) { @@ -49,7 +49,7 @@ module.exports = { var deferral = e.request.getDeferral(); var storageItems = []; var filesCount = fileOrFileArray.length; - + var completeFile = function () { if (!--filesCount) { storageItems.length && e.request.data.setStorageItems(storageItems); @@ -60,7 +60,7 @@ module.exports = { for (var i = 0; i < fileOrFileArray.length; i++) { var file = fileOrFileArray[i]; - if (file.indexOf("data:") >= 0) { + if (file.indexOf("data:") >= 0) { var fileName = getFileName(i, getExtension(file)); var buffer = Windows.Security.Cryptography.CryptographicBuffer.decodeFromBase64String(file.split(',')[1]); if (buffer) { @@ -162,6 +162,15 @@ module.exports = { } catch (err) { fail(err); } + }, + + shareViaSMS: function (win, fail, args) { + var chatMessage = new Windows.ApplicationModel.Chat.ChatMessage(); + chatMessage.body = args[0].message; + if (!!args[1]) { + chatMessage.recipients.push(args[1]); + } + Windows.ApplicationModel.Chat.ChatMessageManager.showComposeSmsMessageAsync(chatMessage).done(win, fail); } }; diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/wp8/Newtonsoft.Json.dll b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/wp8/Newtonsoft.Json.dll Binary files differnew file mode 100755 index 00000000..b8194284 --- /dev/null +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/src/wp8/Newtonsoft.Json.dll diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/tests/plugin.xml b/StoneIsland/plugins/cordova-plugin-x-socialsharing/tests/plugin.xml deleted file mode 100644 index 1ccb2217..00000000 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/tests/plugin.xml +++ /dev/null @@ -1,13 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> - -<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" - xmlns:rim="http://www.blackberry.com/ns/widgets" - xmlns:android="http://schemas.android.com/apk/res/android" - id="nl.x-services.plugins.socialsharing.tests" - version="4.3.15"> - <name>SocialSharing Tests</name> - <author>Nicolas Oliver</author> - <license>MIT</license> - - <js-module src="test.js" name="tests"></js-module> -</plugin>
\ No newline at end of file diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/tests/test.js b/StoneIsland/plugins/cordova-plugin-x-socialsharing/tests/test.js deleted file mode 100644 index ad1a8229..00000000 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/tests/test.js +++ /dev/null @@ -1,363 +0,0 @@ -/** - * Jasmine Based test suites - * - * Several of SocialSharing APIs cannot be automatically tested, because - * they depend on user interaction in order to call success or fail - * handlers. For most of them, there is a basic test that assert the presence of - * the API. - * - * There are some cases that test automation can be applied, i.e in "canShareVia", - * "canShareViaEmail" and "available" methods. For those cases, there is some level - * of automatic test coverage. - */ -exports.defineAutoTests = function () { - 'use strict'; - - describe('socialsharing', function () { - it('should be defined', function () { - expect(window.plugins.socialsharing).toBeDefined(); - }); - - describe('share', function () { - it('should be defined', function () { - expect(window.plugins.socialsharing.share).toBeDefined(); - }); - - it('should be a function', function () { - expect(typeof window.plugins.socialsharing.share).toEqual('function'); - }); - }); - - describe('shareVia', function () { - it('should be defined', function () { - expect(window.plugins.socialsharing.shareVia).toBeDefined(); - }); - - it('should be a function', function () { - expect(typeof window.plugins.socialsharing.shareVia).toEqual('function'); - }); - }); - - describe('shareViaTwitter', function () { - it('should be defined', function () { - expect(window.plugins.socialsharing.shareViaTwitter).toBeDefined(); - }); - - it('should be a function', function () { - expect(typeof window.plugins.socialsharing.shareViaTwitter).toEqual('function'); - }); - }); - - describe('shareViaFacebook', function () { - it('should be defined', function () { - expect(window.plugins.socialsharing.shareViaFacebook).toBeDefined(); - }); - - it('should be a function', function () { - expect(typeof window.plugins.socialsharing.shareViaFacebook).toEqual('function'); - }); - }); - - describe('shareViaFacebookWithPasteMessageHint', function () { - it('should be defined', function () { - expect(window.plugins.socialsharing.shareViaFacebookWithPasteMessageHint).toBeDefined(); - }); - - it('should be a function', function () { - expect(typeof window.plugins.socialsharing.shareViaFacebookWithPasteMessageHint).toEqual('function'); - }); - }); - - describe('shareViaWhatsApp', function () { - it('should be defined', function () { - expect(window.plugins.socialsharing.shareViaWhatsApp).toBeDefined(); - }); - - it('should be a function', function () { - expect(typeof window.plugins.socialsharing.shareViaWhatsApp).toEqual('function'); - }); - }); - - describe('shareViaSMS', function () { - it('should be defined', function () { - expect(window.plugins.socialsharing.shareViaSMS).toBeDefined(); - }); - - it('should be a function', function () { - expect(typeof window.plugins.socialsharing.shareViaSMS).toEqual('function'); - }); - }); - - describe('shareViaEmail', function () { - it('should be defined', function () { - expect(window.plugins.socialsharing.shareViaEmail).toBeDefined(); - }); - - it('should be a function', function () { - expect(typeof window.plugins.socialsharing.shareViaEmail).toEqual('function'); - }); - }); - - describe('canShareVia', function () { - it('should be defined', function () { - expect(window.plugins.socialsharing.canShareVia).toBeDefined(); - }); - - it('should be a function', function () { - expect(typeof window.plugins.socialsharing.canShareVia).toEqual('function'); - }); - - it('should always call callback or error function', function (done) { - function onSuccess(data){ - expect(data).not.toEqual(null); - done(); - } - - function onError(error){ - expect(error).not.toEqual(null); - done(); - } - - window.plugins.socialsharing.canShareVia('dummytarget','dummymessage', null, null, null, onSuccess, onError); - }); - }); - - describe('canshareViaEmail', function(){ - it('should be defined', function () { - expect(window.plugins.socialsharing.canShareViaEmail).toBeDefined(); - }); - - it('should be a function', function () { - expect(typeof window.plugins.socialsharing.canShareViaEmail).toEqual('function'); - }); - - it('should always call callback or error function', function (done) { - function onSuccess(data){ - expect(data).not.toEqual(null); - done(); - } - - function onError(error){ - expect(error).not.toEqual(null); - done(); - } - - window.plugins.socialsharing.canShareViaEmail(onSuccess, onError); - }); - }); - - describe('availabe', function(){ - it('should be defined', function () { - expect(window.plugins.socialsharing.available).toBeDefined(); - }); - - it('should be a function', function () { - expect(typeof window.plugins.socialsharing.available).toEqual('function'); - }); - - it('should return a boolean when called', function(done){ - window.plugins.socialsharing.available(function(isAvailable) { - expect(typeof isAvailable).toEqual('boolean'); - done(); - }); - }); - }); - }); -}; - -/** - * Manual tests suites - * - * Some actions buttons to execute SocialSharing plugin methods - */ -exports.defineManualTests = function (contentEl, createActionButton) { - 'use strict'; - - /** helper function to log messages in the log div element */ - function logMessage(message, color) { - var log = document.getElementById('info'), - logLine = document.createElement('div'); - - if (color) { - logLine.style.color = color; - } - - logLine.innerHTML = message; - log.appendChild(logLine); - } - - /** helper function to clear the log div element */ - function clearLog() { - var log = document.getElementById('info'); - log.innerHTML = ''; - } - - /** helper function to declare a not implemented test */ - function testNotImplemented(testName) { - return function () { - console.error(testName, 'test not implemented'); - }; - } - - /** init method called on deviceready event */ - function init() {} - - /** object to hold properties and configs */ - var TestSuite = {}; - - TestSuite.getCanShareViaTarget = function(){ - return document.getElementById('inputCanShareVia').value; - }; - - TestSuite.$markup = '' + - '<fieldset>' + - '<legend>Available Tests</legend>' + - - '<h3>Available</h3>' + - '<div id="buttonIsAvailable"></div>' + - 'Expected result: Should log if the plugin is available or not' + - '</fieldset>' + - - '<fieldset>' + - '<legend>Share Tests</legend>' + - - '<h3>Share Message</h3>' + - '<div id="buttonShareMessage"></div>' + - 'Expected result: Should display share widget, and the message to share should contain "Message body"' + - - '<h3>Share Message with Subject</h3>' + - '<div id="buttonShareMessageWithSubject"></div>' + - 'Expected result: Should display share widget, and the message to share should contain "Message body", and the subject should be "Message subject"' + - - '<h3>Share Link</h3>' + - '<div id="buttonShareLink"></div>' + - 'Expected result: Should display share widget, and the message to share should contain "http://www.x-services.nl"' + - - '<h3>Share Message with Link</h3>' + - '<div id="buttonShareMessageAndLink"></div>' + - 'Expected result: Should display share widget, and the message to share should contain "Message body http://www.x-services.nl"' + - - '<h3>Share Image</h3>' + - '<div id="buttonShareImage"></div>' + - 'Expected result: Should display share widget, and the message to share should contain an image' + - - '<h3>Share Image in base 64</h3>' + - '<div id="buttonShareImageBase64"></div>' + - 'Expected result: Should display share widget, and the message to share should contain an image. The image is encoded in base 64' + - - '<h3>Share Image with Message</h3>' + - '<div id="buttonShareMessageImage"></div>' + - 'Expected result: Should display share widget, and the message to share should contain "Message body" and an image' + - - '<h3>Share Image with Message and Link</h3>' + - '<div id="buttonShareMessageImageLink"></div>' + - 'Expected result: Should display share widget, and the message to share should contain "Message body http://www.x-services.nl" and an image' + - - '<h3>Share Image with Message, Subject and Link</h3>' + - '<div id="buttonShareMessageSubjectImageLink"></div>' + - 'Expected result: Should display share widget, and the message to share should contain "Message body http://www.x-services.nl", "Message subject" as subject, and an image' + - '</fieldset>' + - - '<fieldset>' + - '<legend>Can Share Tests</legend>' + - - 'Target: <input id="inputCanShareVia" type="text"/><br>' + - - '<h3>Can Share via</h3>' + - '<div id="buttonCanShareVia"></div>' + - 'Expected result: should log OK if can share, or should log a list of available share targets' + - - '<h3>Can Share via Email</h3>' + - '<div id="buttonCanShareViaEmail"></div>' + - 'Expected result: should log OK if can share' + - '</fieldset>' + - ''; - - contentEl.innerHTML = '<div id="info"></div>' + TestSuite.$markup; - - createActionButton('availabe', function () { - clearLog(); - window.plugins.socialsharing.available(function(isAvailable) { - var message = 'is this plugin available? '; - message += isAvailable? 'Yes' : 'No'; - - logMessage(message, isAvailable? 'green' : 'red'); - }); - }, 'buttonIsAvailable'); - - createActionButton('share message', function () { - window.plugins.socialsharing.share('Message body'); - }, 'buttonShareMessage'); - - createActionButton('share message and subject', function () { - window.plugins.socialsharing.share('Message body', 'Message subject'); - }, 'buttonShareMessageWithSubject'); - - createActionButton('share link', function () { - window.plugins.socialsharing.share(null, null, null, 'http://www.x-services.nl'); - }, 'buttonShareLink'); - - createActionButton('share message and link', function () { - window.plugins.socialsharing.share('Message body', null, null, 'http://www.x-services.nl'); - }, 'buttonShareMessageAndLink'); - - createActionButton('share image', function () { - window.plugins.socialsharing.share(null, null, 'https://www.google.nl/images/srpr/logo4w.png', null); - }, 'buttonShareImage'); - - createActionButton('share image base 64', function () { - window.plugins.socialsharing.share(null, 'Android filename', 'data:image/png;base64,R0lGODlhDAAMALMBAP8AAP///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAUKAAEALAAAAAAMAAwAQAQZMMhJK7iY4p3nlZ8XgmNlnibXdVqolmhcRQA7', null); - }, 'buttonShareImageBase64'); - - createActionButton('share message with image', function () { - window.plugins.socialsharing.share('Message body', null, 'https://www.google.nl/images/srpr/logo4w.png', null); - }, 'buttonShareMessageImage'); - - createActionButton('share message, image, and link', function () { - window.plugins.socialsharing.share('Message body', null, 'https://www.google.nl/images/srpr/logo4w.png', 'http://www.x-services.nl'); - }, 'buttonShareMessageImageLink'); - - createActionButton('share message, subject, image, and link', function () { - window.plugins.socialsharing.share('Message body', 'Message subject', 'https://www.google.nl/images/srpr/logo4w.png', 'http://www.x-services.nl'); - }, 'buttonShareMessageSubjectImageLink'); - - createActionButton('can share via', function () { - var target = TestSuite.getCanShareViaTarget(); - - if(!target){ - console.error('must have a canShareVia target'); - } - else { - clearLog(); - window.plugins.socialsharing.canShareVia(target, 'msg', null, null, null, function(e){ - console.log('canShareVia success, see log for more information'); - logMessage('canShareVia: ' + e,'green'); - }, function(e){ - console.error('canShareVia fail, see log for more information'); - var message = "Share targets<br>"; - - message += "<ul>"; - - e.forEach(function(target){ - message += "<li>" + target + "</li>"; - }); - - message += "</ul>"; - logMessage(message,'red'); - }); - } - }, 'buttonCanShareVia'); - - createActionButton('can share via email', function () { - clearLog(); - window.plugins.socialsharing.canShareViaEmail(function(e){ - console.log('canShareViaEmail success, see log for more information'); - logMessage('canShareViaEmail: ' + e,'green'); - }, function(e){ - console.error('canShareViaEmail fail, see log for more information'); - logMessage('canShareViaEmail: ' + e,'red'); - }); - }, 'buttonCanShareViaEmail'); - - document.addEventListener('deviceready', init, false); -}; diff --git a/StoneIsland/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js b/StoneIsland/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js index 3fc9bb92..eea2a762 100644 --- a/StoneIsland/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js +++ b/StoneIsland/plugins/cordova-plugin-x-socialsharing/www/SocialSharing.js @@ -28,6 +28,23 @@ SocialSharing.prototype.shareWithOptions = function (options, successCallback, e cordova.exec(successCallback, this._getErrorCallback(errorCallback, "shareWithOptions"), "SocialSharing", "shareWithOptions", [options]); }; +SocialSharing.prototype.shareW3C = function (sharedata) { + return new Promise(function(resolve, reject) { + var options = { + subject: sharedata.title, + message: sharedata.text, + url: sharedata.url + }; + if(sharedata.hasOwnProperty('title') || + sharedata.hasOwnProperty('text') || + sharedata.hasOwnProperty('url')) { + cordova.exec(resolve, reject, "SocialSharing", "shareWithOptions", [options]); + } else { + reject(); + } + }); +}; + SocialSharing.prototype.share = function (message, subject, fileOrFileArray, url, successCallback, errorCallback) { cordova.exec(successCallback, this._getErrorCallback(errorCallback, "share"), "SocialSharing", "share", [message, subject, this._asArray(fileOrFileArray), url]); }; @@ -116,7 +133,8 @@ SocialSharing.install = function () { } window.plugins.socialsharing = new SocialSharing(); + navigator.share = window.plugins.socialsharing.shareW3C; return window.plugins.socialsharing; }; -cordova.addConstructor(SocialSharing.install);
\ No newline at end of file +cordova.addConstructor(SocialSharing.install); diff --git a/StoneIsland/plugins/es6-promise-plugin/CHANGELOG.md b/StoneIsland/plugins/es6-promise-plugin/CHANGELOG.md new file mode 100644 index 00000000..231dd35a --- /dev/null +++ b/StoneIsland/plugins/es6-promise-plugin/CHANGELOG.md @@ -0,0 +1,9 @@ +# 4.2.2 / 2017-12-27 + +* updated to es6-promise 4.2.2 +* added browser platform support + +# 4.1.1 / 2017-09-12 + +* updated to es6-promise 4.1.1 +* updated build script diff --git a/StoneIsland/plugins/es6-promise-plugin/LICENSE b/StoneIsland/plugins/es6-promise-plugin/LICENSE new file mode 100644 index 00000000..8a4d435c --- /dev/null +++ b/StoneIsland/plugins/es6-promise-plugin/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014-15 Vlad Stirbu + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/StoneIsland/plugins/es6-promise-plugin/README.md b/StoneIsland/plugins/es6-promise-plugin/README.md new file mode 100644 index 00000000..e8cb30f9 --- /dev/null +++ b/StoneIsland/plugins/es6-promise-plugin/README.md @@ -0,0 +1,36 @@ +# PromisesPlugin + +ES6-Promises polyfill for Cordova/PhoneGap + +# Motivation + +The web view components on Cordova supported platforms lack suport for ES6 Promise. A polyfill library bundled with the plugin fixes the limitation. However, as more plugin use promises, the application developer using these plugins will end up with multiple promise polyfill libraries. + +This plugin attempts to fix this situation by providing a Promise polyfill so that other plugins can rely on this functionality. + +# How to use + +Configure your plugin's plugin.xml by adding this dependency: + +``` +<dependency id="es6-promise-plugin" version="4.1.0" /> +``` + +Cordova CLI takes care to install PromisesPlugin automatically: + +``` +$ cordova plugins add {yourPlugin} + +> Installing "{yourPlugin}" for {platform} +> Installing "es6-promise-plugin" for {platform} +``` + +This is all. ```window.Promise``` is available for use in your plugin. + +# Credits + +This plugin wraps [es6-promise](https://github.com/jakearchibald/es6-promise) in a Cordova/PhoneGap friendly way. + +# License + +The plugin is available under MIT license. diff --git a/StoneIsland/plugins/es6-promise-plugin/package.json b/StoneIsland/plugins/es6-promise-plugin/package.json new file mode 100644 index 00000000..44d89413 --- /dev/null +++ b/StoneIsland/plugins/es6-promise-plugin/package.json @@ -0,0 +1,51 @@ +{ + "_from": "es6-promise-plugin", + "_id": "es6-promise-plugin@4.2.2", + "_inBundle": false, + "_integrity": "sha512-uoA4aVplXI9oqUYJFBAVRwAqIN9/n9JgrTAUGX3qPbnSZVE5yY1+6/MsoN5f4xsaPO62WjPHOdtts6okMN6tNA==", + "_location": "/es6-promise-plugin", + "_phantomChildren": {}, + "_requested": { + "type": "tag", + "registry": true, + "raw": "es6-promise-plugin", + "name": "es6-promise-plugin", + "escapedName": "es6-promise-plugin", + "rawSpec": "", + "saveSpec": null, + "fetchSpec": "latest" + }, + "_requiredBy": [ + "#DEV:/", + "#USER" + ], + "_resolved": "https://registry.npmjs.org/es6-promise-plugin/-/es6-promise-plugin-4.2.2.tgz", + "_shasum": "cfa0cc1383d91f999a62a2bbf4bd97bec305e0ac", + "_spec": "es6-promise-plugin", + "_where": "/Users/user/work/stone-island/StoneIsland", + "author": "", + "bugs": { + "url": "https://github.com/vstirbu/PromisesPlugin/issues" + }, + "bundleDependencies": false, + "dependencies": {}, + "deprecated": false, + "description": "ES6-Promises polyfill for Cordova/PhoneGap", + "devDependencies": { + "browserify": "^14.4.0", + "es6-promise": "^4.2.2" + }, + "ecosystem": "cordova", + "homepage": "https://github.com/vstirbu/PromisesPlugin#readme", + "license": "MIT", + "main": "www/promise.js", + "name": "es6-promise-plugin", + "repository": { + "type": "git", + "url": "git+https://github.com/vstirbu/PromisesPlugin.git" + }, + "scripts": { + "build": "./build" + }, + "version": "4.2.2" +} diff --git a/StoneIsland/plugins/es6-promise-plugin/plugin.xml b/StoneIsland/plugins/es6-promise-plugin/plugin.xml new file mode 100644 index 00000000..ee32c3ca --- /dev/null +++ b/StoneIsland/plugins/es6-promise-plugin/plugin.xml @@ -0,0 +1,27 @@ +<plugin + xmlns="http://www.phonegap.com/ns/plugins/1.0" + id="es6-promise-plugin" + version="4.2.2"> + + <name>Promise</name> + <author>Vlad Stirbu</author> + <license>MIT</license> + <keywords>es6-promise,polyfill</keywords> + + <description> + A polyfill for ES6-style Promises, tracking npm es6-promise + </description> + + <engines> + <engine name="cordova" version=">=3.0.0" /> + </engines> + + <js-module src="www/promise.js" name="Promise"> + <runs /> + </js-module> + + <platform name="ios"></platform> + <platform name="android"></platform> + <platform name="windows"></platform> + <platform name="browser"></platform> +</plugin> diff --git a/StoneIsland/plugins/es6-promise-plugin/www/promise.js b/StoneIsland/plugins/es6-promise-plugin/www/promise.js new file mode 100644 index 00000000..4f8a0f41 --- /dev/null +++ b/StoneIsland/plugins/es6-promise-plugin/www/promise.js @@ -0,0 +1,10 @@ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE + * @version v4.2.2+97478eb6 + */ + +!function t(e,n,r){function o(u,s){if(!n[u]){if(!e[u]){var c="function"==typeof require&&require;if(!s&&c)return c(u,!0);if(i)return i(u,!0);var f=new Error("Cannot find module '"+u+"'");throw f.code="MODULE_NOT_FOUND",f}var a=n[u]={exports:{}};e[u][0].call(a.exports,function(t){var n=e[u][1][t];return o(n?n:t)},a,a.exports,t,e,n,r)}return n[u].exports}for(var i="function"==typeof require&&require,u=0;u<r.length;u++)o(r[u]);return o}({1:[function(t){void 0===window.Promise&&t("es6-promise").polyfill()},{"es6-promise":2}],2:[function(t,e,n){(function(r,o){!function(t,r){"object"==typeof n&&"undefined"!=typeof e?e.exports=r():"function"==typeof define&&define.amd?define(r):t.ES6Promise=r()}(this,function(){"use strict";function e(t){var e=typeof t;return null!==t&&("object"===e||"function"===e)}function n(t){return"function"==typeof t}function i(t){J=t}function u(t){Q=t}function s(){return function(){return r.nextTick(h)}}function c(){return"undefined"!=typeof I?function(){I(h)}:l()}function f(){var t=0,e=new X(h),n=document.createTextNode("");return e.observe(n,{characterData:!0}),function(){n.data=t=++t%2}}function a(){var t=new MessageChannel;return t.port1.onmessage=h,function(){return t.port2.postMessage(0)}}function l(){var t=setTimeout;return function(){return t(h,1)}}function h(){for(var t=0;H>t;t+=2){var e=te[t],n=te[t+1];e(n),te[t]=void 0,te[t+1]=void 0}H=0}function p(){try{var e=t,n=e("vertx");return I=n.runOnLoop||n.runOnContext,c()}catch(r){return l()}}function d(t,e){var n=this,r=new this.constructor(y);void 0===r[ne]&&D(r);var o=n._state;if(o){var i=arguments[o-1];Q(function(){return L(o,r,i,n._result)})}else O(n,r,t,e);return r}function v(t){var e=this;if(t&&"object"==typeof t&&t.constructor===e)return t;var n=new e(y);return E(n,t),n}function y(){}function m(){return new TypeError("You cannot resolve a promise with itself")}function _(){return new TypeError("A promises callback cannot return that same promise.")}function w(t){try{return t.then}catch(e){return ue.error=e,ue}}function g(t,e,n,r){try{t.call(e,n,r)}catch(o){return o}}function b(t,e,n){Q(function(t){var r=!1,o=g(n,e,function(n){r||(r=!0,e!==n?E(t,n):j(t,n))},function(e){r||(r=!0,x(t,e))},"Settle: "+(t._label||" unknown promise"));!r&&o&&(r=!0,x(t,o))},t)}function T(t,e){e._state===oe?j(t,e._result):e._state===ie?x(t,e._result):O(e,void 0,function(e){return E(t,e)},function(e){return x(t,e)})}function A(t,e,r){e.constructor===t.constructor&&r===d&&e.constructor.resolve===v?T(t,e):r===ue?(x(t,ue.error),ue.error=null):void 0===r?j(t,e):n(r)?b(t,e,r):j(t,e)}function E(t,n){t===n?x(t,m()):e(n)?A(t,n,w(n)):j(t,n)}function S(t){t._onerror&&t._onerror(t._result),M(t)}function j(t,e){t._state===re&&(t._result=e,t._state=oe,0!==t._subscribers.length&&Q(M,t))}function x(t,e){t._state===re&&(t._state=ie,t._result=e,Q(S,t))}function O(t,e,n,r){var o=t._subscribers,i=o.length;t._onerror=null,o[i]=e,o[i+oe]=n,o[i+ie]=r,0===i&&t._state&&Q(M,t)}function M(t){var e=t._subscribers,n=t._state;if(0!==e.length){for(var r=void 0,o=void 0,i=t._result,u=0;u<e.length;u+=3)r=e[u],o=e[u+n],r?L(n,r,o,i):o(i);t._subscribers.length=0}}function P(){this.error=null}function C(t,e){try{return t(e)}catch(n){return se.error=n,se}}function L(t,e,r,o){var i=n(r),u=void 0,s=void 0,c=void 0,f=void 0;if(i){if(u=C(r,o),u===se?(f=!0,s=u.error,u.error=null):c=!0,e===u)return x(e,_()),void 0}else u=o,c=!0;e._state!==re||(i&&c?E(e,u):f?x(e,s):t===oe?j(e,u):t===ie&&x(e,u))}function k(t,e){try{e(function(e){E(t,e)},function(e){x(t,e)})}catch(n){x(t,n)}}function q(){return ce++}function D(t){t[ne]=ce++,t._state=void 0,t._result=void 0,t._subscribers=[]}function F(){return new Error("Array Methods must be provided an Array")}function F(){return new Error("Array Methods must be provided an Array")}function N(t){return new fe(this,t).promise}function U(t){var e=this;return G(t)?new e(function(n,r){for(var o=t.length,i=0;o>i;i++)e.resolve(t[i]).then(n,r)}):new e(function(t,e){return e(new TypeError("You must pass an array to race."))})}function Y(t){var e=this,n=new e(y);return x(n,t),n}function K(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function W(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function z(){var t=void 0;if("undefined"!=typeof o)t=o;else if("undefined"!=typeof self)t=self;else try{t=Function("return this")()}catch(e){throw new Error("polyfill failed because global object is unavailable in this environment")}var n=t.Promise;if(n){var r=null;try{r=Object.prototype.toString.call(n.resolve())}catch(e){}if("[object Promise]"===r&&!n.cast)return}t.Promise=ae}var B=void 0;B=Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};var G=B,H=0,I=void 0,J=void 0,Q=function(t,e){te[H]=t,te[H+1]=e,H+=2,2===H&&(J?J(h):ee())},R="undefined"!=typeof window?window:void 0,V=R||{},X=V.MutationObserver||V.WebKitMutationObserver,Z="undefined"==typeof self&&"undefined"!=typeof r&&"[object process]"==={}.toString.call(r),$="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,te=new Array(1e3),ee=void 0;ee=Z?s():X?f():$?a():void 0===R&&"function"==typeof t?p():l();var ne=Math.random().toString(36).substring(16),re=void 0,oe=1,ie=2,ue=new P,se=new P,ce=0,fe=function(){function t(t,e){this._instanceConstructor=t,this.promise=new t(y),this.promise[ne]||D(this.promise),G(e)?(this.length=e.length,this._remaining=e.length,this._result=new Array(this.length),0===this.length?j(this.promise,this._result):(this.length=this.length||0,this._enumerate(e),0===this._remaining&&j(this.promise,this._result))):x(this.promise,F())}return t.prototype._enumerate=function(t){for(var e=0;this._state===re&&e<t.length;e++)this._eachEntry(t[e],e)},t.prototype._eachEntry=function(t,e){var n=this._instanceConstructor,r=n.resolve;if(r===v){var o=w(t);if(o===d&&t._state!==re)this._settledAt(t._state,e,t._result);else if("function"!=typeof o)this._remaining--,this._result[e]=t;else if(n===ae){var i=new n(y);A(i,t,o),this._willSettleAt(i,e)}else this._willSettleAt(new n(function(e){return e(t)}),e)}else this._willSettleAt(r(t),e)},t.prototype._settledAt=function(t,e,n){var r=this.promise;r._state===re&&(this._remaining--,t===ie?x(r,n):this._result[e]=n),0===this._remaining&&j(r,this._result)},t.prototype._willSettleAt=function(t,e){var n=this;O(t,void 0,function(t){return n._settledAt(oe,e,t)},function(t){return n._settledAt(ie,e,t)})},t}(),ae=function(){function t(e){this[ne]=q(),this._result=this._state=void 0,this._subscribers=[],y!==e&&("function"!=typeof e&&K(),this instanceof t?k(this,e):W())}return t.prototype.catch=function(t){return this.then(null,t)},t.prototype.finally=function(t){var e=this,n=e.constructor;return e.then(function(e){return n.resolve(t()).then(function(){return e})},function(e){return n.resolve(t()).then(function(){throw e})})},t}();return ae.prototype.then=d,ae.all=N,ae.race=U,ae.resolve=v,ae.reject=Y,ae._setScheduler=i,ae._setAsap=u,ae._asap=Q,ae.polyfill=z,ae.Promise=ae,ae})}).call(this,t("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:3}],3:[function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(t){if(a===setTimeout)return setTimeout(t,0);if((a===n||!a)&&setTimeout)return a=setTimeout,setTimeout(t,0);try{return a(t,0)}catch(e){try{return a.call(null,t,0)}catch(e){return a.call(this,t,0)}}}function i(t){if(l===clearTimeout)return clearTimeout(t);if((l===r||!l)&&clearTimeout)return l=clearTimeout,clearTimeout(t);try{return l(t)}catch(e){try{return l.call(null,t)}catch(e){return l.call(this,t)}}}function u(){v&&p&&(v=!1,p.length?d=p.concat(d):y=-1,d.length&&s())}function s(){if(!v){var t=o(u);v=!0;for(var e=d.length;e;){for(p=d,d=[];++y<e;)p&&p[y].run();y=-1,e=d.length}p=null,v=!1,i(t)}}function c(t,e){this.fun=t,this.array=e}function f(){}var a,l,h=e.exports={};!function(){try{a="function"==typeof setTimeout?setTimeout:n}catch(t){a=n}try{l="function"==typeof clearTimeout?clearTimeout:r}catch(t){l=r}}();var p,d=[],v=!1,y=-1;h.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];d.push(new c(t,e)),1!==d.length||v||o(s)},c.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=f,h.addListener=f,h.once=f,h.off=f,h.removeListener=f,h.removeAllListeners=f,h.emit=f,h.prependListener=f,h.prependOnceListener=f,h.listeners=function(){return[]},h.binding=function(){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},{}]},{},[1]); + diff --git a/StoneIsland/plugins/fetch.json b/StoneIsland/plugins/fetch.json index 8f4521fd..c81ac6fc 100755 --- a/StoneIsland/plugins/fetch.json +++ b/StoneIsland/plugins/fetch.json @@ -7,14 +7,6 @@ "is_top_level": true, "variables": {} }, - "cordova-plugin-x-socialsharing": { - "source": { - "type": "registry", - "id": "cordova-plugin-x-socialsharing" - }, - "is_top_level": true, - "variables": {} - }, "cordova-plugin-customurlscheme": { "source": { "type": "registry", @@ -148,5 +140,21 @@ "variables": { "GEOLOCATION_USAGE_DESCRIPTION": "Stone Island needs to serve content based on your location." } + }, + "cordova-plugin-x-socialsharing": { + "source": { + "type": "registry", + "id": "cordova-plugin-x-socialsharing" + }, + "is_top_level": true, + "variables": {} + }, + "es6-promise-plugin": { + "source": { + "type": "registry", + "id": "es6-promise-plugin" + }, + "is_top_level": false, + "variables": {} } }
\ No newline at end of file diff --git a/StoneIsland/plugins/ios.json b/StoneIsland/plugins/ios.json index e653cb5f..92414437 100644 --- a/StoneIsland/plugins/ios.json +++ b/StoneIsland/plugins/ios.json @@ -35,6 +35,9 @@ }, "cordova-plugin-geolocation": { "PACKAGE_NAME": "us.okfoc.stoneisland" + }, + "cordova-plugin-x-socialsharing": { + "PACKAGE_NAME": "us.okfoc.stoneisland" } }, "dependent_plugins": { @@ -46,6 +49,9 @@ }, "cordova-plugin-androidx-adapter": { "PACKAGE_NAME": "us.okfoc.stoneisland" + }, + "es6-promise-plugin": { + "PACKAGE_NAME": "us.okfoc.stoneisland" } } } |
