summaryrefslogtreecommitdiff
path: root/StoneIsland/platforms/ios/Stone Island
diff options
context:
space:
mode:
Diffstat (limited to 'StoneIsland/platforms/ios/Stone Island')
-rw-r--r--StoneIsland/platforms/ios/Stone Island/CDVLaunchScreen.storyboard21
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.m36
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Entitlements-Debug.plist8
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Entitlements-Release.plist8
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/AppIcon40x40@2x.pngbin9184 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/Contents.json49
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-1024.pngbin0 -> 35783 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-1025.pngbin325663 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-20.pngbin0 -> 476 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-24@2x.pngbin0 -> 1136 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-27.5@2x.pngbin0 -> 1325 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-29.png (renamed from StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small.png)bin2293 -> 2293 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-29@2x.png (renamed from StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/AppIcon29x29@2x.png)bin6014 -> 6014 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-29@3x.pngbin0 -> 2065 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-40@2x.pngbin7411 -> 9184 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-44@2x.pngbin0 -> 2069 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-86@2x.pngbin0 -> 4022 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-98@2x.pngbin0 -> 4744 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@2x-1.pngbin6014 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@2x.pngbin6014 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@3x.pngbin10331 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/BackgroundColor.colorset/Contents.json15
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Contents.json156
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-568h@2x~iphone.pngbin34225 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-667h.pngbin57532 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-736h.pngbin80929 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h.pngbin79491 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.pngbin212234 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.pngbin91810 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.pngbin212860 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.pngbin91713 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default@2x~iphone.pngbin29475 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default~iphone.pngbin10394 -> 0 bytes
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchStoryboard.imageset/Contents.json704
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/AppDelegate+FirebasePlugin.h11
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/AppDelegate+FirebasePlugin.m557
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePlugin.h119
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePlugin.m1757
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiver.h5
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiver.m17
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiverManager.h6
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiverManager.m24
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-geolocation/CDVLocation.m91
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-inappbrowser/CDVInAppBrowser.h112
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-inappbrowser/CDVInAppBrowser.m1075
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-ionic-keyboard/CDVIonicKeyboard.h (renamed from StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.h)8
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-ionic-keyboard/CDVIonicKeyboard.m411
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVConnection.h34
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVConnection.m156
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVReachability.h85
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVReachability.m266
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.h45
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.m506
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.m89
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-statusbar/CDVStatusBar.h50
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-statusbar/CDVStatusBar.m501
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/NSString+URLEncoding.h5
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/NSString+URLEncoding.m30
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/SocialSharing.h28
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/SocialSharing.m772
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/ionic-plugin-keyboard/IonicKeyboard.h16
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/ionic-plugin-keyboard/IonicKeyboard.m176
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-mobile-accessibility/CDVMobileAccessibility.h82
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-mobile-accessibility/CDVMobileAccessibility.m511
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/AppDelegate+notification.h22
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/AppDelegate+notification.m278
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/PushPlugin.h80
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/PushPlugin.m677
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Resources/GoogleService-Info.plist42
-rwxr-xr-xStoneIsland/platforms/ios/Stone Island/Scripts/copy-www-build-step.sh63
-rw-r--r--StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist62
-rw-r--r--[-rwxr-xr-x]StoneIsland/platforms/ios/Stone Island/config.xml46
-rw-r--r--StoneIsland/platforms/ios/Stone Island/main.m4
73 files changed, 3878 insertions, 5938 deletions
diff --git a/StoneIsland/platforms/ios/Stone Island/CDVLaunchScreen.storyboard b/StoneIsland/platforms/ios/Stone Island/CDVLaunchScreen.storyboard
index 51cdcf6d..924392e3 100644
--- a/StoneIsland/platforms/ios/Stone Island/CDVLaunchScreen.storyboard
+++ b/StoneIsland/platforms/ios/Stone Island/CDVLaunchScreen.storyboard
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -17,11 +17,13 @@
specific language governing permissions and limitations
under the License.
-->
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="10117" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
+ <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
- <development version="6100" identifier="xcode"/>
- <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
+ <capability name="Named colors" minToolsVersion="9.0"/>
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
@@ -33,17 +35,17 @@
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
- <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="LaunchStoryboard" translatesAutoresizingMaskIntoConstraints="NO" id="2ns-9I-Qjs">
- <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
</imageView>
</subviews>
- <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ <color key="backgroundColor" name="BackgroundColor"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="2ns-9I-Qjs" secondAttribute="trailing" id="FZL-3Z-NFz"/>
- <constraint firstItem="2ns-9I-Qjs" firstAttribute="bottom" secondItem="xb3-aO-Qok" secondAttribute="top" id="L9l-pw-wXj"/>
+ <constraint firstItem="2ns-9I-Qjs" firstAttribute="bottom" secondItem="Ze5-6b-2t3" secondAttribute="bottom" id="L9l-pw-wXj"/>
<constraint firstItem="2ns-9I-Qjs" firstAttribute="top" secondItem="Ze5-6b-2t3" secondAttribute="top" id="oGN-hc-Uzj"/>
<constraint firstItem="2ns-9I-Qjs" firstAttribute="leading" secondItem="Ze5-6b-2t3" secondAttribute="leading" id="rS9-Wd-zY4"/>
</constraints>
@@ -56,5 +58,8 @@
</scenes>
<resources>
<image name="LaunchStoryboard" width="1366" height="1366"/>
+ <namedColor name="BackgroundColor">
+ <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+ </namedColor>
</resources>
</document>
diff --git a/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.m b/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.m
index 076e7f74..c995de40 100644
--- a/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.m
+++ b/StoneIsland/platforms/ios/Stone Island/Classes/MainViewController.m
@@ -77,42 +77,6 @@
// Do any additional setup after loading the view from its nib.
}
-- (void)viewDidUnload
-{
- [super viewDidUnload];
- // Release any retained subviews of the main view.
- // e.g. self.myOutlet = nil;
-}
-
-/* Comment out the block below to over-ride */
-
-/*
-- (UIWebView*) newCordovaViewWithFrame:(CGRect)bounds
-{
- return[super newCordovaViewWithFrame:bounds];
-}
-
-// CB-12098
-#if __IPHONE_OS_VERSION_MAX_ALLOWED < 90000
-- (NSUInteger)supportedInterfaceOrientations
-#else
-- (UIInterfaceOrientationMask)supportedInterfaceOrientations
-#endif
-{
- return [super supportedInterfaceOrientations];
-}
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
-{
- return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation];
-}
-
-- (BOOL)shouldAutorotate
-{
- return [super shouldAutorotate];
-}
-*/
-
@end
@implementation MainCommandDelegate
diff --git a/StoneIsland/platforms/ios/Stone Island/Entitlements-Debug.plist b/StoneIsland/platforms/ios/Stone Island/Entitlements-Debug.plist
index 018a6e20..74c85d2e 100644
--- a/StoneIsland/platforms/ios/Stone Island/Entitlements-Debug.plist
+++ b/StoneIsland/platforms/ios/Stone Island/Entitlements-Debug.plist
@@ -1,8 +1,8 @@
<?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>aps-environment</key>
- <string>development</string>
- </dict>
+<dict>
+ <key>aps-environment</key>
+ <string>development</string>
+</dict>
</plist> \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/Stone Island/Entitlements-Release.plist b/StoneIsland/platforms/ios/Stone Island/Entitlements-Release.plist
index dec5aa2e..4b18a83d 100644
--- a/StoneIsland/platforms/ios/Stone Island/Entitlements-Release.plist
+++ b/StoneIsland/platforms/ios/Stone Island/Entitlements-Release.plist
@@ -1,8 +1,8 @@
<?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>aps-environment</key>
- <string>production</string>
- </dict>
+<dict>
+ <key>aps-environment</key>
+ <string>production</string>
+</dict>
</plist> \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/AppIcon40x40@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/AppIcon40x40@2x.png
deleted file mode 100644
index 1813fa48..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/AppIcon40x40@2x.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/Contents.json b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/Contents.json
index 9fa61bb8..2ce78c1b 100644
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/Contents.json
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/Contents.json
@@ -15,25 +15,25 @@
{
"size" : "29x29",
"idiom" : "iphone",
- "filename" : "icon-small.png",
+ "filename" : "icon-29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "iphone",
- "filename" : "icon-small@2x.png",
+ "filename" : "icon-29@2x.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
- "filename" : "icon-small@3x.png",
+ "filename" : "icon-29@3x.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
- "filename" : "icon-small@2x-1.png",
+ "filename" : "icon-40@2x.png",
"scale" : "2x"
},
{
@@ -81,13 +81,13 @@
{
"size" : "29x29",
"idiom" : "ipad",
- "filename" : "icon-small.png",
+ "filename" : "icon-29.png",
"scale" : "1x"
},
{
"size" : "29x29",
"idiom" : "ipad",
- "filename" : "icon-small@2x.png",
+ "filename" : "icon-29@2x.png",
"scale" : "2x"
},
{
@@ -147,13 +147,13 @@
{
"size" : "1024x1024",
"idiom" : "ios-marketing",
- "filename" : "icon-1025.png",
+ "filename" : "icon-1024.png",
"scale" : "1x"
},
{
"size" : "24x24",
"idiom" : "watch",
- "filename" : "AppIcon24x24@2x.png",
+ "filename" : "icon-24@2x.png",
"scale" : "2x",
"role" : "notificationCenter",
"subtype" : "38mm"
@@ -161,7 +161,7 @@
{
"size" : "27.5x27.5",
"idiom" : "watch",
- "filename" : "AppIcon27.5x27.5@2x.png",
+ "filename" : "icon-27.5@2x.png",
"scale" : "2x",
"role" : "notificationCenter",
"subtype" : "42mm"
@@ -169,21 +169,21 @@
{
"size" : "29x29",
"idiom" : "watch",
- "filename" : "AppIcon29x29@2x.png",
+ "filename" : "icon-29@2x.png",
"role" : "companionSettings",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "watch",
- "filename" : "AppIcon29x29@3x.png",
+ "filename" : "icon-29@3x.png",
"role" : "companionSettings",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "watch",
- "filename" : "AppIcon40x40@2x.png",
+ "filename" : "icon-40@2x.png",
"scale" : "2x",
"role" : "appLauncher",
"subtype" : "38mm"
@@ -191,15 +191,23 @@
{
"size" : "44x44",
"idiom" : "watch",
- "filename" : "AppIcon44x44@2x.png",
+ "filename" : "icon-44@2x.png",
"scale" : "2x",
- "role" : "longLook",
- "subtype" : "42mm"
+ "role" : "appLauncher",
+ "subtype" : "40mm"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "watch",
+ "filename" : "icon-50@2x.png",
+ "scale" : "2x",
+ "role" : "appLauncher",
+ "subtype" : "44mm"
},
{
"size" : "86x86",
"idiom" : "watch",
- "filename" : "AppIcon86x86@2x.png",
+ "filename" : "icon-86@2x.png",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "38mm"
@@ -207,12 +215,19 @@
{
"size" : "98x98",
"idiom" : "watch",
- "filename" : "AppIcon98x98@2x.png",
+ "filename" : "icon-98@2x.png",
"scale" : "2x",
"role" : "quickLook",
"subtype" : "42mm"
},
{
+ "size" : "108x108",
+ "idiom" : "watch",
+ "scale" : "2x",
+ "role" : "quickLook",
+ "subtype" : "44mm"
+ },
+ {
"size" : "1024x1024",
"idiom" : "watch-marketing",
"filename" : "icon-1024.png",
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-1024.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-1024.png
new file mode 100644
index 00000000..1b9cbb91
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-1024.png
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-1025.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-1025.png
deleted file mode 100644
index d33fd5aa..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-1025.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-20.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-20.png
new file mode 100644
index 00000000..5788eed9
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-20.png
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-24@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-24@2x.png
new file mode 100644
index 00000000..f0babf9d
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-24@2x.png
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-27.5@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-27.5@2x.png
new file mode 100644
index 00000000..78f21bb3
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-27.5@2x.png
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-29.png
index cbe03b26..cbe03b26 100644
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small.png
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-29.png
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/AppIcon29x29@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-29@2x.png
index 8e3a96d6..8e3a96d6 100644
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/AppIcon29x29@2x.png
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-29@2x.png
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-29@3x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-29@3x.png
new file mode 100644
index 00000000..c63fd776
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-29@3x.png
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-40@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-40@2x.png
index 6d07dce5..1813fa48 100644
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-40@2x.png
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-40@2x.png
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-44@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-44@2x.png
new file mode 100644
index 00000000..01c5af72
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-44@2x.png
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-86@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-86@2x.png
new file mode 100644
index 00000000..f32a034a
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-86@2x.png
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-98@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-98@2x.png
new file mode 100644
index 00000000..85ec9e36
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-98@2x.png
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@2x-1.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@2x-1.png
deleted file mode 100644
index 8e3a96d6..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@2x-1.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@2x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@2x.png
deleted file mode 100644
index 8e3a96d6..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@2x.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@3x.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@3x.png
deleted file mode 100644
index a40b6358..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/AppIcon.appiconset/icon-small@3x.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/BackgroundColor.colorset/Contents.json b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/BackgroundColor.colorset/Contents.json
new file mode 100644
index 00000000..38ce5e7c
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/BackgroundColor.colorset/Contents.json
@@ -0,0 +1,15 @@
+{
+ "colors": [
+ {
+ "idiom": "universal",
+ "color": {
+ "platform": "ios",
+ "reference": "systemBackgroundColor"
+ }
+ }
+ ],
+ "info": {
+ "author": "Xcode",
+ "version": 1
+ }
+} \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Contents.json b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Contents.json
deleted file mode 100644
index 175f378c..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Contents.json
+++ /dev/null
@@ -1,156 +0,0 @@
-{
- "images" : [
- {
- "extent" : "full-screen",
- "idiom" : "iphone",
- "subtype" : "736h",
- "filename" : "Default-736h.png",
- "minimum-system-version" : "8.0",
- "orientation" : "portrait",
- "scale" : "3x"
- },
- {
- "extent" : "full-screen",
- "idiom" : "iphone",
- "subtype" : "736h",
- "filename" : "Default-Landscape-736h.png",
- "minimum-system-version" : "8.0",
- "orientation" : "landscape",
- "scale" : "3x"
- },
- {
- "extent" : "full-screen",
- "idiom" : "iphone",
- "subtype" : "667h",
- "filename" : "Default-667h.png",
- "minimum-system-version" : "8.0",
- "orientation" : "portrait",
- "scale" : "2x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "iphone",
- "filename" : "Default@2x~iphone.png",
- "extent" : "full-screen",
- "minimum-system-version" : "7.0",
- "scale" : "2x"
- },
- {
- "extent" : "full-screen",
- "idiom" : "iphone",
- "subtype" : "retina4",
- "filename" : "Default-568h@2x~iphone.png",
- "minimum-system-version" : "7.0",
- "orientation" : "portrait",
- "scale" : "2x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "ipad",
- "filename" : "Default-Portrait~ipad.png",
- "extent" : "full-screen",
- "minimum-system-version" : "7.0",
- "scale" : "1x"
- },
- {
- "orientation" : "landscape",
- "idiom" : "ipad",
- "filename" : "Default-Landscape~ipad.png",
- "extent" : "full-screen",
- "minimum-system-version" : "7.0",
- "scale" : "1x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "ipad",
- "filename" : "Default-Portrait@2x~ipad.png",
- "extent" : "full-screen",
- "minimum-system-version" : "7.0",
- "scale" : "2x"
- },
- {
- "orientation" : "landscape",
- "idiom" : "ipad",
- "filename" : "Default-Landscape@2x~ipad.png",
- "extent" : "full-screen",
- "minimum-system-version" : "7.0",
- "scale" : "2x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "iphone",
- "filename" : "Default~iphone.png",
- "extent" : "full-screen",
- "scale" : "1x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "iphone",
- "filename" : "Default@2x~iphone.png",
- "extent" : "full-screen",
- "scale" : "2x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "iphone",
- "filename" : "Default-568h@2x~iphone.png",
- "extent" : "full-screen",
- "subtype" : "retina4",
- "scale" : "2x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "ipad",
- "extent" : "to-status-bar",
- "scale" : "1x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "ipad",
- "filename" : "Default-Portrait~ipad.png",
- "extent" : "full-screen",
- "scale" : "1x"
- },
- {
- "orientation" : "landscape",
- "idiom" : "ipad",
- "extent" : "to-status-bar",
- "scale" : "1x"
- },
- {
- "orientation" : "landscape",
- "idiom" : "ipad",
- "extent" : "full-screen",
- "scale" : "1x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "ipad",
- "extent" : "to-status-bar",
- "scale" : "2x"
- },
- {
- "orientation" : "portrait",
- "idiom" : "ipad",
- "filename" : "Default-Portrait@2x~ipad.png",
- "extent" : "full-screen",
- "scale" : "2x"
- },
- {
- "orientation" : "landscape",
- "idiom" : "ipad",
- "extent" : "to-status-bar",
- "scale" : "2x"
- },
- {
- "orientation" : "landscape",
- "idiom" : "ipad",
- "extent" : "full-screen",
- "scale" : "2x"
- }
- ],
- "info" : {
- "version" : 1,
- "author" : "xcode"
- }
-} \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-568h@2x~iphone.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-568h@2x~iphone.png
deleted file mode 100644
index 10ed683c..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-568h@2x~iphone.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-667h.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-667h.png
deleted file mode 100644
index d9bcf61d..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-667h.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-736h.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-736h.png
deleted file mode 100644
index 1fcef229..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-736h.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h.png
deleted file mode 100644
index eae0792d..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape-736h.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png
deleted file mode 100644
index 1fc8c7db..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape@2x~ipad.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png
deleted file mode 100644
index 58ea2fbd..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Landscape~ipad.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png
deleted file mode 100644
index 1570b37d..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait@2x~ipad.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png
deleted file mode 100644
index 223e75d0..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default-Portrait~ipad.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default@2x~iphone.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default@2x~iphone.png
deleted file mode 100644
index 0098dc73..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default@2x~iphone.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default~iphone.png b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default~iphone.png
deleted file mode 100644
index 42b8fdea..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchImage.launchimage/Default~iphone.png
+++ /dev/null
Binary files differ
diff --git a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchStoryboard.imageset/Contents.json b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchStoryboard.imageset/Contents.json
index a044a08d..6bed10fc 100644
--- a/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchStoryboard.imageset/Contents.json
+++ b/StoneIsland/platforms/ios/Stone Island/Images.xcassets/LaunchStoryboard.imageset/Contents.json
@@ -9,19 +9,107 @@
{
"idiom": "universal",
"scale": "1x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "1x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "1x",
"width-class": "compact"
},
{
"idiom": "universal",
"scale": "1x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "1x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "1x",
"height-class": "compact"
},
{
"idiom": "universal",
+ "scale": "1x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "1x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
"scale": "1x"
},
{
"idiom": "universal",
+ "scale": "1x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "1x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
"scale": "2x",
"width-class": "compact",
"height-class": "compact"
@@ -29,20 +117,108 @@
{
"idiom": "universal",
"scale": "2x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "2x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "2x",
"width-class": "compact"
},
{
"idiom": "universal",
"scale": "2x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "2x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "2x",
"height-class": "compact"
},
{
"idiom": "universal",
"scale": "2x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "2x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "2x",
"filename": "Default@2x~universal~anyany.png"
},
{
"idiom": "universal",
+ "scale": "2x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "2x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
"scale": "3x",
"width-class": "compact",
"height-class": "compact"
@@ -50,18 +226,106 @@
{
"idiom": "universal",
"scale": "3x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "3x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "3x",
"width-class": "compact"
},
{
"idiom": "universal",
"scale": "3x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "3x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "3x",
"height-class": "compact"
},
{
"idiom": "universal",
+ "scale": "3x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "3x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
"scale": "3x"
},
{
+ "idiom": "universal",
+ "scale": "3x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "universal",
+ "scale": "3x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
"idiom": "ipad",
"scale": "1x",
"width-class": "compact",
@@ -70,19 +334,107 @@
{
"idiom": "ipad",
"scale": "1x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
+ "scale": "1x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
+ "scale": "1x",
"width-class": "compact"
},
{
"idiom": "ipad",
"scale": "1x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
+ "scale": "1x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
+ "scale": "1x",
"height-class": "compact"
},
{
"idiom": "ipad",
+ "scale": "1x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
+ "scale": "1x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
"scale": "1x"
},
{
"idiom": "ipad",
+ "scale": "1x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
+ "scale": "1x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
"scale": "2x",
"width-class": "compact",
"height-class": "compact"
@@ -90,18 +442,106 @@
{
"idiom": "ipad",
"scale": "2x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
+ "scale": "2x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
+ "scale": "2x",
"width-class": "compact"
},
{
"idiom": "ipad",
"scale": "2x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
+ "scale": "2x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
+ "scale": "2x",
"height-class": "compact"
},
{
"idiom": "ipad",
+ "scale": "2x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
+ "scale": "2x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
"scale": "2x"
},
{
+ "idiom": "ipad",
+ "scale": "2x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "ipad",
+ "scale": "2x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
"idiom": "iphone",
"scale": "1x",
"width-class": "compact",
@@ -110,19 +550,107 @@
{
"idiom": "iphone",
"scale": "1x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "1x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "1x",
"width-class": "compact"
},
{
"idiom": "iphone",
"scale": "1x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "1x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "1x",
"height-class": "compact"
},
{
"idiom": "iphone",
+ "scale": "1x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "1x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
"scale": "1x"
},
{
"idiom": "iphone",
+ "scale": "1x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "1x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
"scale": "2x",
"width-class": "compact",
"height-class": "compact"
@@ -130,19 +658,107 @@
{
"idiom": "iphone",
"scale": "2x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "2x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "2x",
"width-class": "compact"
},
{
"idiom": "iphone",
"scale": "2x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "2x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "2x",
"height-class": "compact"
},
{
"idiom": "iphone",
+ "scale": "2x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "2x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
"scale": "2x"
},
{
"idiom": "iphone",
+ "scale": "2x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "2x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
"scale": "3x",
"width-class": "compact",
"height-class": "compact"
@@ -150,16 +766,104 @@
{
"idiom": "iphone",
"scale": "3x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "3x",
+ "width-class": "compact",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "3x",
"width-class": "compact"
},
{
"idiom": "iphone",
"scale": "3x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "3x",
+ "width-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "3x",
"height-class": "compact"
},
{
"idiom": "iphone",
+ "scale": "3x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "3x",
+ "height-class": "compact",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
"scale": "3x"
+ },
+ {
+ "idiom": "iphone",
+ "scale": "3x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "dark"
+ }
+ ]
+ },
+ {
+ "idiom": "iphone",
+ "scale": "3x",
+ "appearances": [
+ {
+ "appearance": "luminosity",
+ "value": "light"
+ }
+ ]
}
],
"info": {
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/AppDelegate+FirebasePlugin.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/AppDelegate+FirebasePlugin.h
new file mode 100644
index 00000000..461b17e4
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/AppDelegate+FirebasePlugin.h
@@ -0,0 +1,11 @@
+#import "AppDelegate.h"
+#import <GoogleSignIn/GoogleSignIn.h>
+
+@import UserNotifications;
+@import AuthenticationServices;
+
+@interface AppDelegate (FirebasePlugin) <UIApplicationDelegate, GIDSignInDelegate, ASAuthorizationControllerDelegate, ASAuthorizationControllerPresentationContextProviding>
++ (AppDelegate *) instance;
+@property (nonatomic, strong) NSNumber * _Nonnull applicationInBackground;
+@property (NS_NONATOMIC_IOSONLY, nullable, weak) id <UNUserNotificationCenterDelegate> delegate;
+@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/AppDelegate+FirebasePlugin.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/AppDelegate+FirebasePlugin.m
new file mode 100644
index 00000000..a14c6569
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/AppDelegate+FirebasePlugin.m
@@ -0,0 +1,557 @@
+#import "AppDelegate+FirebasePlugin.h"
+#import "FirebasePlugin.h"
+#import "Firebase.h"
+#import <objc/runtime.h>
+
+
+@import UserNotifications;
+@import FirebaseFirestore;
+
+// Implement UNUserNotificationCenterDelegate to receive display notification via APNS for devices running iOS 10 and above.
+// Implement FIRMessagingDelegate to receive data message via FCM for devices running iOS 10 and above.
+@interface AppDelegate () <UNUserNotificationCenterDelegate, FIRMessagingDelegate>
+@end
+
+#define kApplicationInBackgroundKey @"applicationInBackground"
+
+@implementation AppDelegate (FirebasePlugin)
+
+static AppDelegate* instance;
+
++ (AppDelegate*) instance {
+ return instance;
+}
+
+static NSDictionary* mutableUserInfo;
+static FIRAuthStateDidChangeListenerHandle authStateChangeListener;
+static bool authStateChangeListenerInitialized = false;
+static bool shouldEstablishDirectChannel = false;
+
++ (void)load {
+ Method original = class_getInstanceMethod(self, @selector(application:didFinishLaunchingWithOptions:));
+ Method swizzled = class_getInstanceMethod(self, @selector(application:swizzledDidFinishLaunchingWithOptions:));
+ method_exchangeImplementations(original, swizzled);
+}
+
+- (void)setApplicationInBackground:(NSNumber *)applicationInBackground {
+ objc_setAssociatedObject(self, kApplicationInBackgroundKey, applicationInBackground, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+}
+
+- (NSNumber *)applicationInBackground {
+ return objc_getAssociatedObject(self, kApplicationInBackgroundKey);
+}
+
+- (BOOL)application:(UIApplication *)application swizzledDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ [self application:application swizzledDidFinishLaunchingWithOptions:launchOptions];
+
+ @try{
+ instance = self;
+
+ bool isFirebaseInitializedWithPlist = false;
+ if(![FIRApp defaultApp]) {
+ // get GoogleService-Info.plist file path
+ NSString *filePath = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"];
+
+ // if file is successfully found, use it
+ if(filePath){
+ [FirebasePlugin.firebasePlugin _logMessage:@"GoogleService-Info.plist found, setup: [FIRApp configureWithOptions]"];
+ // create firebase configure options passing .plist as content
+ FIROptions *options = [[FIROptions alloc] initWithContentsOfFile:filePath];
+
+ // configure FIRApp with options
+ [FIRApp configureWithOptions:options];
+
+ isFirebaseInitializedWithPlist = true;
+ }else{
+ // no .plist found, try default App
+ [FirebasePlugin.firebasePlugin _logError:@"GoogleService-Info.plist NOT FOUND, setup: [FIRApp defaultApp]"];
+ [FIRApp configure];
+ }
+ }else{
+ // Firebase SDK has already been initialised:
+ // Assume that another call (probably from another plugin) did so with the plist
+ isFirebaseInitializedWithPlist = true;
+ }
+
+
+
+ shouldEstablishDirectChannel = [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"shouldEstablishDirectChannel"] boolValue];
+
+ // Set FCM messaging delegate
+ [FIRMessaging messaging].delegate = self;
+ [FIRMessaging messaging].shouldEstablishDirectChannel = shouldEstablishDirectChannel;
+
+ // Setup Firestore
+ [FirebasePlugin setFirestore:[FIRFirestore firestore]];
+
+ // Setup Google SignIn
+ [GIDSignIn sharedInstance].clientID = [FIRApp defaultApp].options.clientID;
+ [GIDSignIn sharedInstance].delegate = self;
+
+ authStateChangeListener = [[FIRAuth auth] addAuthStateDidChangeListener:^(FIRAuth * _Nonnull auth, FIRUser * _Nullable user) {
+ @try {
+ if(!authStateChangeListenerInitialized){
+ authStateChangeListenerInitialized = true;
+ }else{
+ [FirebasePlugin.firebasePlugin executeGlobalJavascript:[NSString stringWithFormat:@"FirebasePlugin._onAuthStateChange(%@)", (user != nil ? @"true": @"false")]];
+ }
+ }@catch (NSException *exception) {
+ [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
+ }
+ }];
+
+ // Set NSNotificationCenter observer
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(tokenRefreshNotification:)
+ name:kFIRInstanceIDTokenRefreshNotification object:nil];
+
+ self.applicationInBackground = @(YES);
+
+ }@catch (NSException *exception) {
+ [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
+ }
+
+ return YES;
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+ self.applicationInBackground = @(NO);
+ [FIRMessaging messaging].shouldEstablishDirectChannel = shouldEstablishDirectChannel;
+ [FirebasePlugin.firebasePlugin _logMessage:[NSString stringWithFormat:@"Enter foreground: FCM direct channel = %@", shouldEstablishDirectChannel ? @"true" : @"false"]];
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+ self.applicationInBackground = @(YES);
+ [FIRMessaging messaging].shouldEstablishDirectChannel = false;
+ [FirebasePlugin.firebasePlugin _logMessage:@"Enter background: FCM direct channel = false"];
+}
+
+# pragma mark - Google SignIn
+- (void)signIn:(GIDSignIn *)signIn
+didSignInForUser:(GIDGoogleUser *)user
+ withError:(NSError *)error {
+ @try{
+ CDVPluginResult* pluginResult;
+ if (error == nil) {
+ GIDAuthentication *authentication = user.authentication;
+ FIRAuthCredential *credential =
+ [FIRGoogleAuthProvider credentialWithIDToken:authentication.idToken
+ accessToken:authentication.accessToken];
+
+ int key = [[FirebasePlugin firebasePlugin] saveAuthCredential:credential];
+ NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
+ [result setValue:@"true" forKey:@"instantVerification"];
+ [result setValue:[NSNumber numberWithInt:key] forKey:@"id"];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result];
+ } else {
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:error.description];
+ }
+ if ([FirebasePlugin firebasePlugin].googleSignInCallbackId != nil) {
+ [[FirebasePlugin firebasePlugin].commandDelegate sendPluginResult:pluginResult callbackId:[FirebasePlugin firebasePlugin].googleSignInCallbackId];
+ }
+ }@catch (NSException *exception) {
+ [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
+ }
+}
+
+- (void)signIn:(GIDSignIn *)signIn
+didDisconnectWithUser:(GIDGoogleUser *)user
+ withError:(NSError *)error {
+ NSString* msg = @"Google SignIn delegate: didDisconnectWithUser";
+ if(error != nil){
+ [FirebasePlugin.firebasePlugin _logError:[NSString stringWithFormat:@"%@: %@", msg, error]];
+ }else{
+ [FirebasePlugin.firebasePlugin _logMessage:msg];
+ }
+}
+
+# pragma mark - FIRMessagingDelegate
+- (void)messaging:(FIRMessaging *)messaging didReceiveRegistrationToken:(NSString *)fcmToken {
+ [FirebasePlugin.firebasePlugin _logMessage:[NSString stringWithFormat:@"didReceiveRegistrationToken: %@", fcmToken]];
+ @try{
+ [FirebasePlugin.firebasePlugin sendToken:fcmToken];
+ }@catch (NSException *exception) {
+ [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
+ }
+}
+
+- (void)tokenRefreshNotification:(NSNotification *)notification {
+ // Note that this callback will be fired everytime a new token is generated, including the first
+ // time. So if you need to retrieve the token as soon as it is available this is where that
+ // should be done.
+ @try{
+ [[FIRInstanceID instanceID] instanceIDWithHandler:^(FIRInstanceIDResult * _Nullable result,
+ NSError * _Nullable error) {
+ @try{
+ if (error == nil) {
+ NSString *refreshedToken = result.token;
+ [FirebasePlugin.firebasePlugin _logMessage:[NSString stringWithFormat:@"tokenRefreshNotification: %@", refreshedToken]];
+ [FirebasePlugin.firebasePlugin sendToken:refreshedToken];
+ }else{
+ [FirebasePlugin.firebasePlugin _logError:[NSString stringWithFormat:@"tokenRefreshNotification: %@", error.description]];
+ }
+ }@catch (NSException *exception) {
+ [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
+ }
+}
+
+- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
+ [FIRMessaging messaging].APNSToken = deviceToken;
+ [FirebasePlugin.firebasePlugin _logMessage:[NSString stringWithFormat:@"didRegisterForRemoteNotificationsWithDeviceToken: %@", deviceToken]];
+ [FirebasePlugin.firebasePlugin sendApnsToken:[FirebasePlugin.firebasePlugin hexadecimalStringFromData:deviceToken]];
+
+ // Set UNUserNotificationCenter delegate
+ [UNUserNotificationCenter currentNotificationCenter].delegate = self;
+}
+
+//Tells the app that a remote notification arrived that indicates there is data to be fetched.
+// Called when a message arrives in the foreground and remote notifications permission has been granted
+- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
+ fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
+
+ @try{
+ [[FIRMessaging messaging] appDidReceiveMessage:userInfo];
+ mutableUserInfo = [userInfo mutableCopy];
+ NSDictionary* aps = [mutableUserInfo objectForKey:@"aps"];
+ bool isContentAvailable = false;
+ if([aps objectForKey:@"alert"] != nil){
+ isContentAvailable = [[aps objectForKey:@"content-available"] isEqualToNumber:[NSNumber numberWithInt:1]];
+ [mutableUserInfo setValue:@"notification" forKey:@"messageType"];
+ NSString* tap;
+ if([self.applicationInBackground isEqual:[NSNumber numberWithBool:YES]] && !isContentAvailable){
+ tap = @"background";
+ }
+ [mutableUserInfo setValue:tap forKey:@"tap"];
+ }else{
+ [mutableUserInfo setValue:@"data" forKey:@"messageType"];
+ }
+
+ [FirebasePlugin.firebasePlugin _logMessage:[NSString stringWithFormat:@"didReceiveRemoteNotification: %@", mutableUserInfo]];
+
+ completionHandler(UIBackgroundFetchResultNewData);
+ if([self.applicationInBackground isEqual:[NSNumber numberWithBool:YES]] && isContentAvailable){
+ [FirebasePlugin.firebasePlugin _logError:@"didReceiveRemoteNotification: omitting foreground notification as content-available:1 so system notification will be shown"];
+ }else{
+ [self processMessageForForegroundNotification:mutableUserInfo];
+ }
+ if([self.applicationInBackground isEqual:[NSNumber numberWithBool:YES]] || !isContentAvailable){
+ [FirebasePlugin.firebasePlugin sendNotification:mutableUserInfo];
+ }
+ }@catch (NSException *exception) {
+ [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
+ }
+}
+
+// Receive data messages on iOS 10+ directly from FCM (bypassing APNs) when the app is in the foreground.
+// Called when a data message is arrives in the foreground and remote notifications permission has been NOT been granted
+- (void)messaging:(FIRMessaging *)messaging didReceiveMessage:(FIRMessagingRemoteMessage *)remoteMessage {
+ @try{
+ [FirebasePlugin.firebasePlugin _logMessage:[NSString stringWithFormat:@"didReceiveMessage: %@", remoteMessage.appData]];
+
+ NSDictionary* appData = [remoteMessage.appData mutableCopy];
+ [appData setValue:@"data" forKey:@"messageType"];
+ [self processMessageForForegroundNotification:appData];
+
+ // This will allow us to handle FCM data-only push messages even if the permission for push
+ // notifications is yet missing. This will only work when the app is in the foreground.
+ [FirebasePlugin.firebasePlugin sendNotification:appData];
+ }@catch (NSException *exception) {
+ [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
+ }
+}
+
+// Scans a message for keys which indicate a notification should be shown.
+// If found, extracts relevant keys and uses then to display a local notification
+-(void)processMessageForForegroundNotification:(NSDictionary*)messageData {
+ bool showForegroundNotification = [messageData objectForKey:@"notification_foreground"];
+ if(!showForegroundNotification){
+ return;
+ }
+
+ NSString* title = nil;
+ NSString* body = nil;
+ NSString* sound = nil;
+ NSNumber* badge = nil;
+
+ // Extract APNS notification keys
+ NSDictionary* aps = [messageData objectForKey:@"aps"];
+ if([aps objectForKey:@"alert"] != nil){
+ NSDictionary* alert = [aps objectForKey:@"alert"];
+ if([alert objectForKey:@"title"] != nil){
+ title = [alert objectForKey:@"title"];
+ }
+ if([alert objectForKey:@"body"] != nil){
+ body = [alert objectForKey:@"body"];
+ }
+ if([aps objectForKey:@"sound"] != nil){
+ sound = [aps objectForKey:@"sound"];
+ }
+ if([aps objectForKey:@"badge"] != nil){
+ badge = [aps objectForKey:@"badge"];
+ }
+ }
+
+ // Extract data notification keys
+ if([messageData objectForKey:@"notification_title"] != nil){
+ title = [messageData objectForKey:@"notification_title"];
+ }
+ if([messageData objectForKey:@"notification_body"] != nil){
+ body = [messageData objectForKey:@"notification_body"];
+ }
+ if([messageData objectForKey:@"notification_ios_sound"] != nil){
+ sound = [messageData objectForKey:@"notification_ios_sound"];
+ }
+ if([messageData objectForKey:@"notification_ios_badge"] != nil){
+ badge = [messageData objectForKey:@"notification_ios_badge"];
+ }
+
+ if(title == nil || body == nil){
+ return;
+ }
+
+ [[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
+ @try{
+ if (settings.alertSetting == UNNotificationSettingEnabled) {
+ UNMutableNotificationContent *objNotificationContent = [[UNMutableNotificationContent alloc] init];
+ objNotificationContent.title = [NSString localizedUserNotificationStringForKey:title arguments:nil];
+ objNotificationContent.body = [NSString localizedUserNotificationStringForKey:body arguments:nil];
+
+ NSDictionary* alert = [[NSDictionary alloc] initWithObjectsAndKeys:
+ title, @"title",
+ body, @"body"
+ , nil];
+ NSMutableDictionary* aps = [[NSMutableDictionary alloc] initWithObjectsAndKeys:
+ alert, @"alert",
+ nil];
+
+ if(![sound isKindOfClass:[NSString class]] || [sound isEqualToString:@"default"]){
+ objNotificationContent.sound = [UNNotificationSound defaultSound];
+ [aps setValue:sound forKey:@"sound"];
+ }else if(sound != nil){
+ objNotificationContent.sound = [UNNotificationSound soundNamed:sound];
+ [aps setValue:sound forKey:@"sound"];
+ }
+
+ if(badge != nil){
+ [aps setValue:badge forKey:@"badge"];
+ }
+
+ NSString* messageType = @"data";
+ if([mutableUserInfo objectForKey:@"messageType"] != nil){
+ messageType = [mutableUserInfo objectForKey:@"messageType"];
+ }
+
+ NSDictionary* userInfo = [[NSDictionary alloc] initWithObjectsAndKeys:
+ @"true", @"notification_foreground",
+ messageType, @"messageType",
+ aps, @"aps"
+ , nil];
+
+ objNotificationContent.userInfo = userInfo;
+
+ UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:0.1f repeats:NO];
+ UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:@"local_notification" content:objNotificationContent trigger:trigger];
+ [[UNUserNotificationCenter currentNotificationCenter] addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) {
+ if (!error) {
+ [FirebasePlugin.firebasePlugin _logMessage:@"Local Notification succeeded"];
+ } else {
+ [FirebasePlugin.firebasePlugin _logError:[NSString stringWithFormat:@"Local Notification failed: %@", error.description]];
+ }
+ }];
+ }else{
+ [FirebasePlugin.firebasePlugin _logError:@"processMessageForForegroundNotification: cannot show notification as permission denied"];
+ }
+ }@catch (NSException *exception) {
+ [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
+ }
+ }];
+}
+
+- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
+ [FirebasePlugin.firebasePlugin _logError:[NSString stringWithFormat:@"didFailToRegisterForRemoteNotificationsWithError: %@", error.description]];
+}
+
+// Asks the delegate how to handle a notification that arrived while the app was running in the foreground
+// Called when an APS notification arrives when app is in foreground
+- (void)userNotificationCenter:(UNUserNotificationCenter *)center
+ willPresentNotification:(UNNotification *)notification
+ withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler {
+
+ @try{
+
+ if (![notification.request.trigger isKindOfClass:UNPushNotificationTrigger.class] && ![notification.request.trigger isKindOfClass:UNTimeIntervalNotificationTrigger.class]){
+ [FirebasePlugin.firebasePlugin _logError:@"willPresentNotification: aborting as not a supported UNNotificationTrigger"];
+ return;
+ }
+
+ [[FIRMessaging messaging] appDidReceiveMessage:notification.request.content.userInfo];
+
+ mutableUserInfo = [notification.request.content.userInfo mutableCopy];
+
+ NSString* messageType = [mutableUserInfo objectForKey:@"messageType"];
+ if(![messageType isEqualToString:@"data"]){
+ [mutableUserInfo setValue:@"notification" forKey:@"messageType"];
+ }
+
+ // Print full message.
+ [FirebasePlugin.firebasePlugin _logMessage:[NSString stringWithFormat:@"willPresentNotification: %@", mutableUserInfo]];
+
+
+ NSDictionary* aps = [mutableUserInfo objectForKey:@"aps"];
+ bool isContentAvailable = [[aps objectForKey:@"content-available"] isEqualToNumber:[NSNumber numberWithInt:1]];
+ if(isContentAvailable){
+ [FirebasePlugin.firebasePlugin _logError:@"willPresentNotification: aborting as content-available:1 so system notification will be shown"];
+ return;
+ }
+
+ bool showForegroundNotification = [mutableUserInfo objectForKey:@"notification_foreground"];
+ bool hasAlert = [aps objectForKey:@"alert"] != nil;
+ bool hasBadge = [aps objectForKey:@"badge"] != nil;
+ bool hasSound = [aps objectForKey:@"sound"] != nil;
+
+ if(showForegroundNotification){
+ [FirebasePlugin.firebasePlugin _logMessage:[NSString stringWithFormat:@"willPresentNotification: foreground notification alert=%@, badge=%@, sound=%@", hasAlert ? @"YES" : @"NO", hasBadge ? @"YES" : @"NO", hasSound ? @"YES" : @"NO"]];
+ if(hasAlert && hasBadge && hasSound){
+ completionHandler(UNNotificationPresentationOptionAlert + UNNotificationPresentationOptionBadge + UNNotificationPresentationOptionSound);
+ }else if(hasAlert && hasBadge){
+ completionHandler(UNNotificationPresentationOptionAlert + UNNotificationPresentationOptionBadge);
+ }else if(hasAlert && hasSound){
+ completionHandler(UNNotificationPresentationOptionAlert + UNNotificationPresentationOptionSound);
+ }else if(hasBadge && hasSound){
+ completionHandler(UNNotificationPresentationOptionBadge + UNNotificationPresentationOptionSound);
+ }else if(hasAlert){
+ completionHandler(UNNotificationPresentationOptionAlert);
+ }else if(hasBadge){
+ completionHandler(UNNotificationPresentationOptionBadge);
+ }else if(hasSound){
+ completionHandler(UNNotificationPresentationOptionSound);
+ }
+ }else{
+ [FirebasePlugin.firebasePlugin _logMessage:@"willPresentNotification: foreground notification not set"];
+ }
+
+ if(![messageType isEqualToString:@"data"]){
+ [FirebasePlugin.firebasePlugin sendNotification:mutableUserInfo];
+ }
+
+ }@catch (NSException *exception) {
+ [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
+ }
+}
+
+// Asks the delegate to process the user's response to a delivered notification.
+// Called when user taps on system notification
+- (void) userNotificationCenter:(UNUserNotificationCenter *)center
+ didReceiveNotificationResponse:(UNNotificationResponse *)response
+ withCompletionHandler:(void (^)(void))completionHandler
+{
+ @try{
+
+ if (![response.notification.request.trigger isKindOfClass:UNPushNotificationTrigger.class] && ![response.notification.request.trigger isKindOfClass:UNTimeIntervalNotificationTrigger.class]){
+ [FirebasePlugin.firebasePlugin _logMessage:@"didReceiveNotificationResponse: aborting as not a supported UNNotificationTrigger"];
+ return;
+ }
+
+ [[FIRMessaging messaging] appDidReceiveMessage:response.notification.request.content.userInfo];
+
+ mutableUserInfo = [response.notification.request.content.userInfo mutableCopy];
+
+ NSString* tap;
+ if([self.applicationInBackground isEqual:[NSNumber numberWithBool:YES]]){
+ tap = @"background";
+ }else{
+ tap = @"foreground";
+
+ }
+ [mutableUserInfo setValue:tap forKey:@"tap"];
+ if([mutableUserInfo objectForKey:@"messageType"] == nil){
+ [mutableUserInfo setValue:@"notification" forKey:@"messageType"];
+ }
+
+ // Dynamic Actions
+ if (response.actionIdentifier && ![response.actionIdentifier isEqual:UNNotificationDefaultActionIdentifier]) {
+ [mutableUserInfo setValue:response.actionIdentifier forKey:@"action"];
+ }
+
+ // Print full message.
+ [FirebasePlugin.firebasePlugin _logInfo:[NSString stringWithFormat:@"didReceiveNotificationResponse: %@", mutableUserInfo]];
+
+ [FirebasePlugin.firebasePlugin sendNotification:mutableUserInfo];
+
+ completionHandler();
+
+ }@catch (NSException *exception) {
+ [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
+ }
+}
+
+// Receive data message on iOS 10 devices.
+- (void)applicationReceivedRemoteMessage:(FIRMessagingRemoteMessage *)remoteMessage {
+ // Print full message
+ [FirebasePlugin.firebasePlugin _logInfo:[NSString stringWithFormat:@"applicationReceivedRemoteMessage: %@", [remoteMessage appData]]];
+}
+
+// Apple Sign In
+- (void)authorizationController:(ASAuthorizationController *)controller
+ didCompleteWithAuthorization:(ASAuthorization *)authorization API_AVAILABLE(ios(13.0)) {
+ @try{
+ CDVPluginResult* pluginResult;
+ NSString* errorMessage = nil;
+ FIROAuthCredential *credential;
+
+ if ([authorization.credential isKindOfClass:[ASAuthorizationAppleIDCredential class]]) {
+ ASAuthorizationAppleIDCredential *appleIDCredential = authorization.credential;
+ NSString *rawNonce = [FirebasePlugin appleSignInNonce];
+ if(rawNonce == nil){
+ errorMessage = @"Invalid state: A login callback was received, but no login request was sent.";
+ }else if (appleIDCredential.identityToken == nil) {
+ errorMessage = @"Unable to fetch identity token.";
+ }else{
+ NSString *idToken = [[NSString alloc] initWithData:appleIDCredential.identityToken
+ encoding:NSUTF8StringEncoding];
+ if (idToken == nil) {
+ errorMessage = [NSString stringWithFormat:@"Unable to serialize id token from data: %@", appleIDCredential.identityToken];
+ }else{
+ // Initialize a Firebase credential.
+ credential = [FIROAuthProvider credentialWithProviderID:@"apple.com"
+ IDToken:idToken
+ rawNonce:rawNonce];
+
+ int key = [[FirebasePlugin firebasePlugin] saveAuthCredential:credential];
+ NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
+ [result setValue:@"true" forKey:@"instantVerification"];
+ [result setValue:[NSNumber numberWithInt:key] forKey:@"id"];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result];
+ }
+ }
+ if(errorMessage != nil){
+ [FirebasePlugin.firebasePlugin _logError:errorMessage];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errorMessage];
+ }
+ if ([FirebasePlugin firebasePlugin].appleSignInCallbackId != nil) {
+ [[FirebasePlugin firebasePlugin].commandDelegate sendPluginResult:pluginResult callbackId:[FirebasePlugin firebasePlugin].appleSignInCallbackId];
+ }
+ }
+ }@catch (NSException *exception) {
+ [FirebasePlugin.firebasePlugin handlePluginExceptionWithoutContext:exception];
+ }
+}
+
+- (void)authorizationController:(ASAuthorizationController *)controller
+ didCompleteWithError:(NSError *)error API_AVAILABLE(ios(13.0)) {
+ NSString* errorMessage = [NSString stringWithFormat:@"Sign in with Apple errored: %@", error];
+ [FirebasePlugin.firebasePlugin _logError:errorMessage];
+ if ([FirebasePlugin firebasePlugin].appleSignInCallbackId != nil) {
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errorMessage];
+ [[FirebasePlugin firebasePlugin].commandDelegate sendPluginResult:pluginResult callbackId:[FirebasePlugin firebasePlugin].appleSignInCallbackId];
+ }
+}
+
+- (nonnull ASPresentationAnchor)presentationAnchorForAuthorizationController:(nonnull ASAuthorizationController *)controller API_AVAILABLE(ios(13.0)){
+ return self.viewController.view.window;
+}
+
+@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePlugin.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePlugin.h
new file mode 100644
index 00000000..2a65108d
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePlugin.h
@@ -0,0 +1,119 @@
+#import <Cordova/CDV.h>
+#import "AppDelegate.h"
+#import "Firebase.h"
+@import FirebaseFirestore;
+
+@interface FirebasePlugin : CDVPlugin
+
+- (void)setAutoInitEnabled:(CDVInvokedUrlCommand*)command;
+- (void)isAutoInitEnabled:(CDVInvokedUrlCommand*)command;
+
+// Authentication
+- (void)verifyPhoneNumber:(CDVInvokedUrlCommand*)command;
+- (void)createUserWithEmailAndPassword:(CDVInvokedUrlCommand*)command;
+- (void)signInUserWithEmailAndPassword:(CDVInvokedUrlCommand*)command;
+- (void)signInUserWithCustomToken:(CDVInvokedUrlCommand*)command;
+- (void)signInUserAnonymously:(CDVInvokedUrlCommand*)command;
+- (void)authenticateUserWithGoogle:(CDVInvokedUrlCommand*)command;
+- (void)authenticateUserWithApple:(CDVInvokedUrlCommand*)command;
+- (void)signInWithCredential:(CDVInvokedUrlCommand*)command;
+- (void)linkUserWithCredential:(CDVInvokedUrlCommand*)command;
+- (void)reauthenticateWithCredential:(CDVInvokedUrlCommand*)command;
+- (void)isUserSignedIn:(CDVInvokedUrlCommand*)command;
+- (void)signOutUser:(CDVInvokedUrlCommand*)command;
+- (void)getCurrentUser:(CDVInvokedUrlCommand*)command;
+- (void)reloadCurrentUser:(CDVInvokedUrlCommand*)command;
+- (void)updateUserProfile:(CDVInvokedUrlCommand*)command;
+- (void)updateUserEmail:(CDVInvokedUrlCommand*)command;
+- (void)sendUserEmailVerification:(CDVInvokedUrlCommand*)command;
+- (void)updateUserPassword:(CDVInvokedUrlCommand*)command;
+- (void)sendUserPasswordResetEmail:(CDVInvokedUrlCommand*)command;
+- (void)deleteUser:(CDVInvokedUrlCommand*)command;
+
+// Remote notifications
+- (void)getId:(CDVInvokedUrlCommand*)command;
+- (void)getToken:(CDVInvokedUrlCommand*)command;
+- (void)getAPNSToken:(CDVInvokedUrlCommand*)command;
+- (NSString *)hexadecimalStringFromData:(NSData *)data;
+- (void)grantPermission:(CDVInvokedUrlCommand*)command;
+- (void)hasPermission:(CDVInvokedUrlCommand*)command;
+- (void)setBadgeNumber:(CDVInvokedUrlCommand*)command;
+- (void)getBadgeNumber:(CDVInvokedUrlCommand*)command;
+- (void)subscribe:(CDVInvokedUrlCommand*)command;
+- (void)unsubscribe:(CDVInvokedUrlCommand*)command;
+- (void)unregister:(CDVInvokedUrlCommand*)command;
+- (void)onMessageReceived:(CDVInvokedUrlCommand*)command;
+- (void)onTokenRefresh:(CDVInvokedUrlCommand*)command;
+- (void)onApnsTokenReceived:(CDVInvokedUrlCommand *)command;
+- (void)sendNotification:(NSDictionary*)userInfo;
+- (void)sendToken:(NSString*)token;
+- (void)sendApnsToken:(NSString*)token;
+- (void)clearAllNotifications:(CDVInvokedUrlCommand *)command;
+
+// Analytics
+- (void)setAnalyticsCollectionEnabled:(CDVInvokedUrlCommand*)command;
+- (void)isAnalyticsCollectionEnabled:(CDVInvokedUrlCommand*)command;
+- (void)logEvent:(CDVInvokedUrlCommand*)command;
+- (void)setScreenName:(CDVInvokedUrlCommand*)command;
+- (void)setUserId:(CDVInvokedUrlCommand*)command;
+- (void)setUserProperty:(CDVInvokedUrlCommand*)command;
+
+// Crashlytics
+- (void)setCrashlyticsCollectionEnabled:(CDVInvokedUrlCommand*)command;
+- (void)isCrashlyticsCollectionEnabled:(CDVInvokedUrlCommand*)command;
+- (void)logError:(CDVInvokedUrlCommand*)command;
+- (void)logMessage:(CDVInvokedUrlCommand*)command;
+- (void)sendCrash:(CDVInvokedUrlCommand*)command;
+- (void)setCrashlyticsUserId:(CDVInvokedUrlCommand*)command;
+
+// Remote config
+- (void)fetch:(CDVInvokedUrlCommand*)command;
+- (void)activateFetched:(CDVInvokedUrlCommand*)command;
+- (void)getValue:(CDVInvokedUrlCommand*)command;
+- (void)getInfo:(CDVInvokedUrlCommand*)command;
+
+// Performance
+- (void)setPerformanceCollectionEnabled:(CDVInvokedUrlCommand*)command;
+- (void)isPerformanceCollectionEnabled:(CDVInvokedUrlCommand*)command;
+- (void)startTrace:(CDVInvokedUrlCommand*)command;
+- (void)incrementCounter:(CDVInvokedUrlCommand*)command;
+- (void)stopTrace:(CDVInvokedUrlCommand*)command;
+
+// Firestore
+- (void)addDocumentToFirestoreCollection:(CDVInvokedUrlCommand*)command;
+- (void)setDocumentInFirestoreCollection:(CDVInvokedUrlCommand*)command;
+- (void)updateDocumentInFirestoreCollection:(CDVInvokedUrlCommand*)command;
+- (void)deleteDocumentFromFirestoreCollection:(CDVInvokedUrlCommand*)command;
+- (void)documentExistsInFirestoreCollection:(CDVInvokedUrlCommand*)command;
+- (void)fetchDocumentInFirestoreCollection:(CDVInvokedUrlCommand*)command;
+- (void)fetchFirestoreCollection:(CDVInvokedUrlCommand*)command;
+
+
+// Internals
++ (FirebasePlugin *) firebasePlugin;
++ (NSString*) appleSignInNonce;
++ (void) setFirestore:(FIRFirestore*) firestoreInstance;
+- (void) handlePluginExceptionWithContext: (NSException*) exception :(CDVInvokedUrlCommand*)command;
+- (void) handlePluginExceptionWithoutContext: (NSException*) exception;
+- (void) _logError: (NSString*)msg;
+- (void) _logInfo: (NSString*)msg;
+- (void) _logMessage: (NSString*)msg;
+- (BOOL) _shouldEnableCrashlytics;
+- (int) saveAuthCredential: (FIRAuthCredential *) authCredential;
+- (void)executeGlobalJavascript: (NSString*)jsString;
+
+- (void)createChannel:(CDVInvokedUrlCommand *)command;
+- (void)setDefaultChannel:(CDVInvokedUrlCommand *)command;
+- (void)deleteChannel:(CDVInvokedUrlCommand *)command;
+- (void)listChannels:(CDVInvokedUrlCommand *)command;
+
+@property (nonatomic, copy) NSString *notificationCallbackId;
+@property (nonatomic, copy) NSString *tokenRefreshCallbackId;
+@property (nonatomic, copy) NSString *apnsTokenRefreshCallbackId;
+@property (nonatomic, copy) NSString *googleSignInCallbackId;
+@property (nonatomic, copy) NSString *appleSignInCallbackId;
+
+@property (nonatomic, retain) NSMutableArray *notificationStack;
+@property (nonatomic, readwrite) NSMutableDictionary* traces;
+
+@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePlugin.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePlugin.m
new file mode 100644
index 00000000..e72514c0
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePlugin.m
@@ -0,0 +1,1757 @@
+#import "FirebasePlugin.h"
+#import "FirebasePluginMessageReceiverManager.h"
+#import "AppDelegate+FirebasePlugin.h"
+#import <Cordova/CDV.h>
+#import "AppDelegate.h"
+#import <GoogleSignIn/GoogleSignIn.h>
+@import FirebaseInstanceID;
+@import FirebaseMessaging;
+@import FirebaseAnalytics;
+@import FirebaseRemoteConfig;
+@import FirebasePerformance;
+@import FirebaseAuth;
+@import UserNotifications;
+@import CommonCrypto;
+@import AuthenticationServices;
+
+@implementation FirebasePlugin
+
+@synthesize notificationCallbackId;
+@synthesize tokenRefreshCallbackId;
+@synthesize apnsTokenRefreshCallbackId;
+@synthesize googleSignInCallbackId;
+@synthesize appleSignInCallbackId;
+@synthesize notificationStack;
+@synthesize traces;
+
+static NSString*const LOG_TAG = @"FirebasePlugin[native]";
+static NSInteger const kNotificationStackSize = 10;
+static NSString*const FIREBASE_CRASHLYTICS_COLLECTION_ENABLED = @"FIREBASE_CRASHLYTICS_COLLECTION_ENABLED"; //preference
+static NSString*const FirebaseCrashlyticsCollectionEnabled = @"FirebaseCrashlyticsCollectionEnabled"; //plist
+static NSString*const FIREBASE_ANALYTICS_COLLECTION_ENABLED = @"FIREBASE_ANALYTICS_COLLECTION_ENABLED";
+static NSString*const FIREBASE_PERFORMANCE_COLLECTION_ENABLED = @"FIREBASE_PERFORMANCE_COLLECTION_ENABLED";
+
+static FirebasePlugin* firebasePlugin;
+static BOOL registeredForRemoteNotifications = NO;
+static NSMutableDictionary* authCredentials;
+static NSString* currentNonce; // used for Apple Sign In
+static FIRFirestore* firestore;
+static NSUserDefaults* preferences;
+static NSDictionary* googlePlist;
+
+
++ (FirebasePlugin*) firebasePlugin {
+ return firebasePlugin;
+}
+
++ (NSString*) appleSignInNonce {
+ return currentNonce;
+}
+
++ (void) setFirestore:(FIRFirestore*) firestoreInstance{
+ firestore = firestoreInstance;
+}
+
+// @override abstract
+- (void)pluginInitialize {
+ NSLog(@"Starting Firebase plugin");
+ firebasePlugin = self;
+
+ @try {
+ preferences = [NSUserDefaults standardUserDefaults];
+ googlePlist = [NSMutableDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"]];
+
+ if([self getGooglePlistFlagWithDefaultValue:FirebaseCrashlyticsCollectionEnabled defaultValue:YES]){
+ [self setPreferenceFlag:FIREBASE_CRASHLYTICS_COLLECTION_ENABLED flag:YES];
+ }
+
+ if([self getGooglePlistFlagWithDefaultValue:FIREBASE_ANALYTICS_COLLECTION_ENABLED defaultValue:YES]){
+ [self setPreferenceFlag:FIREBASE_ANALYTICS_COLLECTION_ENABLED flag:YES];
+ }
+
+ if([self getGooglePlistFlagWithDefaultValue:FIREBASE_PERFORMANCE_COLLECTION_ENABLED defaultValue:YES]){
+ [self setPreferenceFlag:FIREBASE_PERFORMANCE_COLLECTION_ENABLED flag:YES];
+ }
+
+ // Set actionable categories if pn-actions.json exist in bundle
+ [self setActionableNotifications];
+
+ // Check for permission and register for remote notifications if granted
+ [self _hasPermission:^(BOOL result) {}];
+
+ [GIDSignIn sharedInstance].presentingViewController = self.viewController;
+
+ authCredentials = [[NSMutableDictionary alloc] init];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithoutContext:exception];
+ }
+}
+
+
+// Dynamic actions from pn-actions.json
+- (void)setActionableNotifications {
+
+ // Parse JSON
+ NSString *path = [[NSBundle mainBundle] pathForResource:@"pn-actions" ofType:@"json"];
+ NSData *data = [NSData dataWithContentsOfFile:path];
+ NSDictionary *dict = [NSJSONSerialization JSONObjectWithData:data options:kNilOptions error:nil];
+
+ // Assign actions for categories
+ NSMutableSet *categories = [[NSMutableSet alloc] init];
+ NSArray *actionsArray = [dict objectForKey:@"PushNotificationActions"];
+ for (NSDictionary *item in actionsArray) {
+ NSMutableArray *buttons = [NSMutableArray new];
+ NSString *category = [item objectForKey:@"category"];
+
+ NSArray *actions = [item objectForKey:@"actions"];
+ for (NSDictionary *action in actions) {
+ NSString *actionId = [action objectForKey:@"id"];
+ NSString *actionTitle = [action objectForKey:@"title"];
+
+ [buttons addObject:[UNNotificationAction actionWithIdentifier:actionId
+ title:NSLocalizedString(actionTitle, nil) options:UNNotificationActionOptionNone]];
+ }
+
+ [categories addObject:[UNNotificationCategory categoryWithIdentifier:category
+ actions:buttons intentIdentifiers:@[] options:UNNotificationCategoryOptionNone]];
+ }
+
+ // Initialize categories
+ [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:categories];
+}
+
+// @override abstract
+- (void)handleOpenURL:(NSNotification*)notification{
+ NSURL* url = [notification object];
+ [[GIDSignIn sharedInstance] handleURL:url];
+}
+
+- (void)setAutoInitEnabled:(CDVInvokedUrlCommand *)command {
+ @try {
+ bool enabled = [[command.arguments objectAtIndex:0] boolValue];
+ [self runOnMainThread:^{
+ @try {
+ [FIRMessaging messaging].autoInitEnabled = enabled;
+
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)isAutoInitEnabled:(CDVInvokedUrlCommand *)command {
+ @try {
+
+ [self runOnMainThread:^{
+ @try {
+ bool enabled =[FIRMessaging messaging].isAutoInitEnabled;
+
+ CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:enabled];
+ [self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+/*
+ * Remote notifications
+ */
+
+- (void)getId:(CDVInvokedUrlCommand *)command {
+ __block CDVPluginResult *pluginResult;
+
+ FIRInstanceIDHandler handler = ^(NSString *_Nullable instID, NSError *_Nullable error) {
+ @try {
+ [self handleStringResultWithPotentialError:error command:command result:instID];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ };
+
+ @try {
+ [[FIRInstanceID instanceID] getIDWithHandler:handler];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)getToken:(CDVInvokedUrlCommand *)command {
+ @try {
+ [[FIRInstanceID instanceID] instanceIDWithHandler:^(FIRInstanceIDResult * _Nullable result,
+ NSError * _Nullable error) {
+ NSString* token = nil;
+ if (error == nil && result != nil && result.token != nil) {
+ token = result.token;
+ }
+ [self handleStringResultWithPotentialError:error command:command result:token];
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)getAPNSToken:(CDVInvokedUrlCommand *)command {
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:[self getAPNSToken]];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
+- (NSString *)getAPNSToken {
+ NSString* hexToken = nil;
+ NSData* apnsToken = [FIRMessaging messaging].APNSToken;
+ if (apnsToken) {
+#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
+ // [deviceToken description] Starting with iOS 13 device token is like "{length = 32, bytes = 0xd3d997af 967d1f43 b405374a 13394d2f ... 28f10282 14af515f }"
+ hexToken = [self hexadecimalStringFromData:apnsToken];
+#else
+ hexToken = [[apnsToken.description componentsSeparatedByCharactersInSet:[[NSCharacterSet alphanumericCharacterSet]invertedSet]]componentsJoinedByString:@""];
+#endif
+ }
+ return hexToken;
+}
+
+- (NSString *)hexadecimalStringFromData:(NSData *)data
+{
+ NSUInteger dataLength = data.length;
+ if (dataLength == 0) {
+ return nil;
+ }
+
+ const unsigned char *dataBuffer = data.bytes;
+ NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)];
+ for (int i = 0; i < dataLength; ++i) {
+ [hexString appendFormat:@"%02x", dataBuffer[i]];
+ }
+ return [hexString copy];
+}
+
+- (void)hasPermission:(CDVInvokedUrlCommand *)command {
+ @try {
+ [self _hasPermission:^(BOOL enabled) {
+ CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:enabled];
+ [self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+-(void)_hasPermission:(void (^)(BOOL result))completeBlock {
+ @try {
+ [[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
+ @try {
+ BOOL enabled = NO;
+ if (settings.alertSetting == UNNotificationSettingEnabled) {
+ enabled = YES;
+ [self registerForRemoteNotifications];
+ }
+ NSLog(@"_hasPermission: %@", enabled ? @"YES" : @"NO");
+ completeBlock(enabled);
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithoutContext:exception];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithoutContext:exception];
+ }
+}
+
+- (void)grantPermission:(CDVInvokedUrlCommand *)command {
+ NSLog(@"grantPermission");
+ @try {
+ [self _hasPermission:^(BOOL enabled) {
+ @try {
+ if(enabled){
+ NSString* message = @"Permission is already granted - call hasPermission() to check before calling grantPermission()";
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:message];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }else{
+ [UNUserNotificationCenter currentNotificationCenter].delegate = (id<UNUserNotificationCenterDelegate> _Nullable) self;
+ UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert|UNAuthorizationOptionSound|UNAuthorizationOptionBadge;
+ [[UNUserNotificationCenter currentNotificationCenter]
+ requestAuthorizationWithOptions:authOptions
+ completionHandler:^(BOOL granted, NSError * _Nullable error) {
+ @try {
+ NSLog(@"requestAuthorizationWithOptions: granted=%@", granted ? @"YES" : @"NO");
+ if (error == nil && granted) {
+ [self registerForRemoteNotifications];
+ }
+ [self handleBoolResultWithPotentialError:error command:command result:granted];
+
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }
+ ];
+ }
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)registerForRemoteNotifications {
+ NSLog(@"registerForRemoteNotifications");
+ if(registeredForRemoteNotifications) return;
+
+ [self runOnMainThread:^{
+ @try {
+ [[UIApplication sharedApplication] registerForRemoteNotifications];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithoutContext:exception];
+ }
+ registeredForRemoteNotifications = YES;
+ }];
+}
+
+- (void)setBadgeNumber:(CDVInvokedUrlCommand *)command {
+ @try {
+ int number = [[command.arguments objectAtIndex:0] intValue];
+ [self runOnMainThread:^{
+ @try {
+ [[UIApplication sharedApplication] setApplicationIconBadgeNumber:number];
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)getBadgeNumber:(CDVInvokedUrlCommand *)command {
+ [self runOnMainThread:^{
+ @try {
+ long badge = [[UIApplication sharedApplication] applicationIconBadgeNumber];
+
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDouble:badge];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)subscribe:(CDVInvokedUrlCommand *)command {
+ @try {
+ NSString* topic = [NSString stringWithFormat:@"%@", [command.arguments objectAtIndex:0]];
+
+ [[FIRMessaging messaging] subscribeToTopic: topic completion:^(NSError * _Nullable error) {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ }];
+
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)unsubscribe:(CDVInvokedUrlCommand *)command {
+ @try {
+ NSString* topic = [NSString stringWithFormat:@"%@", [command.arguments objectAtIndex:0]];
+
+ [[FIRMessaging messaging] unsubscribeFromTopic: topic completion:^(NSError * _Nullable error) {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ }];
+
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)unregister:(CDVInvokedUrlCommand *)command {
+ @try {
+ [[FIRInstanceID instanceID] deleteIDWithHandler:^void(NSError *_Nullable error) {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+
+
+- (void)onMessageReceived:(CDVInvokedUrlCommand *)command {
+ @try {
+ self.notificationCallbackId = command.callbackId;
+
+ if (self.notificationStack != nil && [self.notificationStack count]) {
+ for (NSDictionary *userInfo in self.notificationStack) {
+ [self sendNotification:userInfo];
+ }
+ [self.notificationStack removeAllObjects];
+ }
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)onTokenRefresh:(CDVInvokedUrlCommand *)command {
+ self.tokenRefreshCallbackId = command.callbackId;
+ @try {
+ [[FIRInstanceID instanceID] instanceIDWithHandler:^(FIRInstanceIDResult * _Nullable result,
+ NSError * _Nullable error) {
+ @try {
+ if (result.token != nil && error == nil) {
+ [self sendToken:result.token];
+ }else{
+ [self handleStringResultWithPotentialError:error command:command result:result.token];
+ }
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)onApnsTokenReceived:(CDVInvokedUrlCommand *)command {
+ self.apnsTokenRefreshCallbackId = command.callbackId;
+ @try {
+ NSString* apnsToken = [self getAPNSToken];
+ if(apnsToken != nil){
+ [self sendApnsToken:apnsToken];
+ }
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)sendNotification:(NSDictionary *)userInfo {
+ @try {
+ if([FirebasePluginMessageReceiverManager sendNotification:userInfo]){
+ [self _logMessage:@"Message handled by custom receiver"];
+ return;
+ }
+ if (self.notificationCallbackId != nil) {
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:userInfo];
+ [pluginResult setKeepCallbackAsBool:YES];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:self.notificationCallbackId];
+ } else {
+ if (!self.notificationStack) {
+ self.notificationStack = [[NSMutableArray alloc] init];
+ }
+
+ // stack notifications until a callback has been registered
+ [self.notificationStack addObject:userInfo];
+
+ if ([self.notificationStack count] >= kNotificationStackSize) {
+ [self.notificationStack removeLastObject];
+ }
+ }
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :self.commandDelegate];
+ }
+}
+
+- (void)sendToken:(NSString *)token {
+ @try {
+ if (self.tokenRefreshCallbackId != nil) {
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:token];
+ [pluginResult setKeepCallbackAsBool:YES];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:self.tokenRefreshCallbackId];
+ }
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :self.commandDelegate];
+ }
+}
+
+- (void)sendApnsToken:(NSString *)token {
+ @try {
+ if (self.apnsTokenRefreshCallbackId != nil) {
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:token];
+ [pluginResult setKeepCallbackAsBool:YES];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:self.apnsTokenRefreshCallbackId];
+ }
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :self.commandDelegate];
+ }
+}
+
+- (void)clearAllNotifications:(CDVInvokedUrlCommand *)command {
+ [self runOnMainThread:^{
+ @try {
+ [[UIApplication sharedApplication] setApplicationIconBadgeNumber:1];
+ [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
+
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+/*
+ * Authentication
+ */
+- (void)verifyPhoneNumber:(CDVInvokedUrlCommand *)command {
+ NSString* number = [command.arguments objectAtIndex:0];
+
+ @try {
+ [[FIRPhoneAuthProvider provider]
+ verifyPhoneNumber:number
+ UIDelegate:nil
+ completion:^(NSString *_Nullable verificationID, NSError *_Nullable error) {
+
+ @try {
+ CDVPluginResult* pluginResult;
+ if (error) {
+ // Verification code not sent.
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:error.description];
+ } else {
+ // Successful.
+ NSMutableDictionary* result = [[NSMutableDictionary alloc] init];
+ [result setValue:@"false" forKey:@"instantVerification"];
+ [result setValue:verificationID forKey:@"verificationId"];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result];
+ }
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)createUserWithEmailAndPassword:(CDVInvokedUrlCommand*)command {
+ @try {
+ NSString* email = [command.arguments objectAtIndex:0];
+ NSString* password = [command.arguments objectAtIndex:1];
+ [[FIRAuth auth] createUserWithEmail:email
+ password:password
+ completion:^(FIRAuthDataResult * _Nullable authResult,
+ NSError * _Nullable error) {
+ @try {
+ [self handleAuthResult:authResult error:error command:command];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)signInUserWithEmailAndPassword:(CDVInvokedUrlCommand*)command {
+ @try {
+ NSString* email = [command.arguments objectAtIndex:0];
+ NSString* password = [command.arguments objectAtIndex:1];
+ [[FIRAuth auth] signInWithEmail:email
+ password:password
+ completion:^(FIRAuthDataResult * _Nullable authResult,
+ NSError * _Nullable error) {
+ @try {
+ [self handleAuthResult:authResult error:error command:command];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)signInUserWithCustomToken:(CDVInvokedUrlCommand*)command {
+ @try {
+ NSString* customToken = [command.arguments objectAtIndex:0];
+ [[FIRAuth auth] signInWithCustomToken:customToken
+ completion:^(FIRAuthDataResult * _Nullable authResult,
+ NSError * _Nullable error) {
+ @try {
+ [self handleAuthResult:authResult error:error command:command];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)signInUserAnonymously:(CDVInvokedUrlCommand*)command {
+ @try {
+ [[FIRAuth auth] signInAnonymouslyWithCompletion:^(FIRAuthDataResult * _Nullable authResult,
+ NSError * _Nullable error) {
+ @try {
+ [self handleAuthResult:authResult error:error command:command];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)authenticateUserWithGoogle:(CDVInvokedUrlCommand*)command{
+ @try {
+ self.googleSignInCallbackId = command.callbackId;
+ [[GIDSignIn sharedInstance] signIn];
+
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT];
+ [pluginResult setKeepCallbackAsBool:YES];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)authenticateUserWithApple:(CDVInvokedUrlCommand*)command{
+ @try {
+ CDVPluginResult *pluginResult;
+ if (@available(iOS 13.0, *)) {
+ self.appleSignInCallbackId = command.callbackId;
+ [self startSignInWithAppleFlow];
+
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT];
+ [pluginResult setKeepCallbackAsBool:YES];
+ } else {
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"OS version is too low - Apple Sign In requires iOS 13.0+"];
+ }
+
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)signInWithCredential:(CDVInvokedUrlCommand*)command {
+ @try {
+ FIRAuthCredential* credential = [self obtainAuthCredential:[command.arguments objectAtIndex:0] command:command];
+ if(credential == nil) return;
+
+ [[FIRAuth auth] signInWithCredential:credential
+ completion:^(FIRAuthDataResult * _Nullable authResult,
+ NSError * _Nullable error) {
+ [self handleAuthResult:authResult error:error command:command];
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)reauthenticateWithCredential:(CDVInvokedUrlCommand*)command{
+ @try {
+ FIRUser* user = [FIRAuth auth].currentUser;
+ if(!user){
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No user is currently signed"] callbackId:command.callbackId];
+ return;
+ }
+
+ FIRAuthCredential* credential = [self obtainAuthCredential:[command.arguments objectAtIndex:0] command:command];
+ if(credential == nil) return;
+
+ [user reauthenticateWithCredential:credential completion:^(FIRAuthDataResult * _Nullable authResult, NSError * _Nullable error) {
+ [self handleAuthResult:authResult error:error command:command];
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)linkUserWithCredential:(CDVInvokedUrlCommand*)command {
+ @try {
+ FIRAuthCredential* credential = [self obtainAuthCredential:[command.arguments objectAtIndex:0] command:command];
+ if(credential == nil) return;
+
+ [[FIRAuth auth].currentUser linkWithCredential:credential
+ completion:^(FIRAuthDataResult * _Nullable authResult,
+ NSError * _Nullable error) {
+ [self handleAuthResult:authResult error:error command:command];
+ }];
+
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)isUserSignedIn:(CDVInvokedUrlCommand*)command {
+ @try {
+ bool isSignedIn = [FIRAuth auth].currentUser ? true : false;
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:isSignedIn] callbackId:command.callbackId];
+
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)signOutUser:(CDVInvokedUrlCommand*)command {
+ @try {
+ bool isSignedIn = [FIRAuth auth].currentUser ? true : false;
+ if(!isSignedIn){
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No user is currently signed"] callbackId:command.callbackId];
+ return;
+ }
+
+ // Sign out of Google
+ if([[GIDSignIn sharedInstance] currentUser] != nil){
+ [[GIDSignIn sharedInstance] signOut];
+ }
+
+ // Sign out of Firebase
+ NSError *signOutError;
+ BOOL status = [[FIRAuth auth] signOut:&signOutError];
+ if (!status) {
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:[NSString stringWithFormat:@"Error signing out: %@", signOutError]] callbackId:command.callbackId];
+ }else{
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK] callbackId:command.callbackId];
+ }
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)getCurrentUser:(CDVInvokedUrlCommand *)command {
+
+ @try {
+ FIRUser* user = [FIRAuth auth].currentUser;
+ if(!user){
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No user is currently signed"] callbackId:command.callbackId];
+ return;
+ }
+ [self extractAndReturnUserInfo:command];
+
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)reloadCurrentUser:(CDVInvokedUrlCommand *)command {
+
+ @try {
+ FIRUser* user = [FIRAuth auth].currentUser;
+ if(!user){
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No user is currently signed"] callbackId:command.callbackId];
+ return;
+ }
+ [user reloadWithCompletion:^(NSError * _Nullable error) {
+ if (error != nil) {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ }else {
+ [self extractAndReturnUserInfo:command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void) extractAndReturnUserInfo:(CDVInvokedUrlCommand *)command {
+ FIRUser* user = [FIRAuth auth].currentUser;
+ NSMutableDictionary* userInfo = [NSMutableDictionary new];
+ [userInfo setValue:user.displayName forKey:@"name"];
+ [userInfo setValue:user.email forKey:@"email"];
+ [userInfo setValue:@(user.isEmailVerified ? true : false) forKey:@"emailIsVerified"];
+ [userInfo setValue:user.phoneNumber forKey:@"phoneNumber"];
+ [userInfo setValue:user.photoURL ? user.photoURL.absoluteString : nil forKey:@"photoUrl"];
+ [userInfo setValue:user.uid forKey:@"uid"];
+ [userInfo setValue:@(user.isAnonymous ? true : false) forKey:@"isAnonymous"];
+ [user getIDTokenWithCompletion:^(NSString * _Nullable token, NSError * _Nullable error) {
+ [userInfo setValue:token forKey:@"idToken"];
+ [user getIDTokenResultWithCompletion:^(FIRAuthTokenResult * _Nullable tokenResult, NSError * _Nullable error) {
+ [userInfo setValue:tokenResult.signInProvider forKey:@"providerId"];
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:userInfo] callbackId:command.callbackId];
+ }];
+ }];
+}
+
+- (void)updateUserProfile:(CDVInvokedUrlCommand*)command {
+ @try {
+ FIRUser* user = [FIRAuth auth].currentUser;
+ if(!user){
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No user is currently signed"] callbackId:command.callbackId];
+ return;
+ }
+
+ NSDictionary* profile = [command.arguments objectAtIndex:0];
+
+ FIRUserProfileChangeRequest* changeRequest = [user profileChangeRequest];
+ if([profile objectForKey:@"name"] != nil){
+ changeRequest.displayName = [profile objectForKey:@"name"];
+ }
+ if([profile objectForKey:@"photoUri"] != nil){
+ changeRequest.photoURL = [NSURL URLWithString:[profile objectForKey:@"photoUri"]];
+ }
+
+ [changeRequest commitChangesWithCompletion:^(NSError *_Nullable error) {
+ @try {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)updateUserEmail:(CDVInvokedUrlCommand*)command {
+ @try {
+ FIRUser* user = [FIRAuth auth].currentUser;
+ if(!user){
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No user is currently signed"] callbackId:command.callbackId];
+ return;
+ }
+
+ NSString* email = [command.arguments objectAtIndex:0];
+ [user updateEmail:email completion:^(NSError *_Nullable error) {
+ @try {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)sendUserEmailVerification:(CDVInvokedUrlCommand*)command{
+ @try {
+ FIRUser* user = [FIRAuth auth].currentUser;
+ if(!user){
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No user is currently signed"] callbackId:command.callbackId];
+ return;
+ }
+
+ [user sendEmailVerificationWithCompletion:^(NSError *_Nullable error) {
+ @try {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)updateUserPassword:(CDVInvokedUrlCommand*)command{
+ @try {
+ FIRUser* user = [FIRAuth auth].currentUser;
+ if(!user){
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No user is currently signed"] callbackId:command.callbackId];
+ return;
+ }
+
+ NSString* password = [command.arguments objectAtIndex:0];
+ [user updatePassword:password completion:^(NSError *_Nullable error) {
+ @try {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)sendUserPasswordResetEmail:(CDVInvokedUrlCommand*)command{
+ @try {
+ NSString* email = [command.arguments objectAtIndex:0];
+ [[FIRAuth auth] sendPasswordResetWithEmail:email completion:^(NSError *_Nullable error) {
+ @try {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)deleteUser:(CDVInvokedUrlCommand*)command{
+ @try {
+ FIRUser* user = [FIRAuth auth].currentUser;
+ if(!user){
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"No user is currently signed"] callbackId:command.callbackId];
+ return;
+ }
+
+ [user deleteWithCompletion:^(NSError *_Nullable error) {
+ @try {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)startSignInWithAppleFlow API_AVAILABLE(ios(13.0)){
+ NSString *nonce = [self randomNonce:32];
+ currentNonce = nonce;
+ ASAuthorizationAppleIDProvider *appleIDProvider = [[ASAuthorizationAppleIDProvider alloc] init];
+ ASAuthorizationAppleIDRequest *request = [appleIDProvider createRequest];
+ request.requestedScopes = @[ASAuthorizationScopeFullName, ASAuthorizationScopeEmail];
+ request.nonce = [self stringBySha256HashingString:nonce];
+
+ ASAuthorizationController *authorizationController =
+ [[ASAuthorizationController alloc] initWithAuthorizationRequests:@[request]];
+ authorizationController.delegate = [AppDelegate instance];
+ authorizationController.presentationContextProvider = [AppDelegate instance];
+ [authorizationController performRequests];
+}
+
+- (NSString *)stringBySha256HashingString:(NSString *)input {
+ const char *string = [input UTF8String];
+ unsigned char result[CC_SHA256_DIGEST_LENGTH];
+ CC_SHA256(string, (CC_LONG)strlen(string), result);
+
+ NSMutableString *hashed = [NSMutableString stringWithCapacity:CC_SHA256_DIGEST_LENGTH * 2];
+ for (NSInteger i = 0; i < CC_SHA256_DIGEST_LENGTH; i++) {
+ [hashed appendFormat:@"%02x", result[i]];
+ }
+ return hashed;
+}
+
+// Generates random nonce for Apple Sign In
+- (NSString *)randomNonce:(NSInteger)length {
+ NSAssert(length > 0, @"Expected nonce to have positive length");
+ NSString *characterSet = @"0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._";
+ NSMutableString *result = [NSMutableString string];
+ NSInteger remainingLength = length;
+
+ while (remainingLength > 0) {
+ NSMutableArray *randoms = [NSMutableArray arrayWithCapacity:16];
+ for (NSInteger i = 0; i < 16; i++) {
+ uint8_t random = 0;
+ int errorCode = SecRandomCopyBytes(kSecRandomDefault, 1, &random);
+ NSAssert(errorCode == errSecSuccess, @"Unable to generate nonce: OSStatus %i", errorCode);
+
+ [randoms addObject:@(random)];
+ }
+
+ for (NSNumber *random in randoms) {
+ if (remainingLength == 0) {
+ break;
+ }
+
+ if (random.unsignedIntValue < characterSet.length) {
+ unichar character = [characterSet characterAtIndex:random.unsignedIntValue];
+ [result appendFormat:@"%C", character];
+ remainingLength--;
+ }
+ }
+ }
+
+ return result;
+}
+
+/*
+ * Analytics
+ */
+- (void)setAnalyticsCollectionEnabled:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ BOOL enabled = [[command argumentAtIndex:0] boolValue];
+ CDVPluginResult* pluginResult;
+ [FIRAnalytics setAnalyticsCollectionEnabled:enabled];
+ [self setPreferenceFlag:FIREBASE_ANALYTICS_COLLECTION_ENABLED flag:enabled];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)isAnalyticsCollectionEnabled:(CDVInvokedUrlCommand*)command{
+ [self.commandDelegate runInBackground:^{
+ @try {
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:[self getPreferenceFlag:FIREBASE_ANALYTICS_COLLECTION_ENABLED]];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)logEvent:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* name = [command.arguments objectAtIndex:0];
+ NSDictionary *parameters = [command argumentAtIndex:1];
+
+ [FIRAnalytics logEventWithName:name parameters:parameters];
+
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)setScreenName:(CDVInvokedUrlCommand *)command {
+ @try {
+ NSString* name = [command.arguments objectAtIndex:0];
+
+ [FIRAnalytics setScreenName:name screenClass:NULL];
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (void)setUserId:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* id = [command.arguments objectAtIndex:0];
+
+ [FIRAnalytics setUserID:id];
+
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)setUserProperty:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* name = [command.arguments objectAtIndex:0];
+ NSString* value = [command.arguments objectAtIndex:1];
+
+ [FIRAnalytics setUserPropertyString:value forName:name];
+
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+/*
+ * Crashlytics
+ */
+
+- (void)setCrashlyticsCollectionEnabled:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ BOOL enabled = [[command argumentAtIndex:0] boolValue];
+ CDVPluginResult* pluginResult;
+ [[FIRCrashlytics crashlytics] setCrashlyticsCollectionEnabled:enabled];
+ [self setPreferenceFlag:FIREBASE_CRASHLYTICS_COLLECTION_ENABLED flag:enabled];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)isCrashlyticsCollectionEnabled:(CDVInvokedUrlCommand*)command{
+ [self.commandDelegate runInBackground:^{
+ @try {
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:[self isCrashlyticsEnabled]];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+-(BOOL)isCrashlyticsEnabled{
+ return [self getPreferenceFlag:FIREBASE_CRASHLYTICS_COLLECTION_ENABLED];
+}
+
+- (void)logError:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ NSString* errorMessage = [command.arguments objectAtIndex:0];
+
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ @try {
+ if(![self isCrashlyticsEnabled]){
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Cannot log error - Crashlytics collection is disabled"];
+ }
+ // We can optionally be passed a stack trace from stackTrace.js which we'll put in userInfo.
+ else if ([command.arguments count] > 1) {
+ NSArray* stackFrames = [command.arguments objectAtIndex:1];
+
+ NSString* message = errorMessage;
+ NSString* name = @"Uncaught Javascript exception";
+ NSMutableArray *customFrames = [[NSMutableArray alloc] init];
+ FIRExceptionModel *exceptionModel = [FIRExceptionModel exceptionModelWithName:name reason:message];
+
+ for (NSDictionary* stackFrame in stackFrames) {
+ FIRStackFrame *customFrame = [FIRStackFrame stackFrameWithSymbol:stackFrame[@"functionName"] file:stackFrame[@"fileName"] line:(uint32_t) [stackFrame[@"lineNumber"] intValue]];
+ [customFrames addObject:customFrame];
+ }
+ exceptionModel.stackTrace = customFrames;
+ [[FIRCrashlytics crashlytics] recordExceptionModel:exceptionModel];
+ }else{
+ //TODO detect and handle non-stack userInfo and pass to recordError
+ NSMutableDictionary* userInfo = [[NSMutableDictionary alloc] init];
+ NSError *error = [NSError errorWithDomain:errorMessage code:0 userInfo:userInfo];
+ [[FIRCrashlytics crashlytics] recordError:error];
+ }
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ } @catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+
+ }];
+}
+
+- (void)logMessage:(CDVInvokedUrlCommand*)command{
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* message = [command argumentAtIndex:0 withDefault:@""];
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ if(![self isCrashlyticsEnabled]){
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Cannot log message - Crashlytics collection is disabled"];
+ }else if(message){
+ [[FIRCrashlytics crashlytics] logWithFormat:@"%@", message];
+ }
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)sendCrash:(CDVInvokedUrlCommand*)command{
+ assert(NO);
+}
+
+- (void)setCrashlyticsUserId:(CDVInvokedUrlCommand *)command {
+ @try {
+ NSString* userId = [command.arguments objectAtIndex:0];
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ if(![self isCrashlyticsEnabled]){
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Cannot set user ID - Crashlytics collection is disabled"];
+ }else{
+ [[FIRCrashlytics crashlytics] setUserID:userId];
+ }
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+/*
+ * Remote config
+ */
+- (void)fetch:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ FIRRemoteConfig* remoteConfig = [FIRRemoteConfig remoteConfig];
+
+ if ([command.arguments count] > 0) {
+ int expirationDuration = [[command.arguments objectAtIndex:0] intValue];
+
+ [remoteConfig fetchWithExpirationDuration:expirationDuration completionHandler:^(FIRRemoteConfigFetchStatus status, NSError * _Nullable error) {
+ if (status == FIRRemoteConfigFetchStatusSuccess && error == nil){
+ [self sendPluginSuccess:command];
+ }else if (error != nil) {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ } else {
+ [self sendPluginError:command];
+ }
+ }];
+ } else {
+ [remoteConfig fetchWithCompletionHandler:^(FIRRemoteConfigFetchStatus status, NSError * _Nullable error) {
+ if (status == FIRRemoteConfigFetchStatusSuccess && error == nil){
+ [self sendPluginSuccess:command];
+ }else if (error != nil) {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ } else {
+ [self sendPluginError:command];
+ }
+ }];
+ }
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)activateFetched:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ FIRRemoteConfig* remoteConfig = [FIRRemoteConfig remoteConfig];
+ [remoteConfig activateWithCompletion:^(BOOL changed, NSError* _Nullable error) {
+ [self handleBoolResultWithPotentialError:error command:command result:true];
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)getValue:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* key = [command.arguments objectAtIndex:0];
+ FIRRemoteConfig* remoteConfig = [FIRRemoteConfig remoteConfig];
+ NSString* value = remoteConfig[key].stringValue;
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:value];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)getInfo:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ FIRRemoteConfig* remoteConfig = [FIRRemoteConfig remoteConfig];
+ NSInteger minimumFetchInterval = remoteConfig.configSettings.minimumFetchInterval;
+ NSInteger fetchTimeout = remoteConfig.configSettings.fetchTimeout;
+ NSDate* lastFetchTime = remoteConfig.lastFetchTime;
+ FIRRemoteConfigFetchStatus lastFetchStatus = remoteConfig.lastFetchStatus;
+ // isDeveloperModeEnabled is deprecated new recommnded way to check is minimumFetchInterval == 0
+ BOOL isDeveloperModeEnabled = minimumFetchInterval == 0 ? true : false;
+
+ NSDictionary* configSettings = @{
+ @"developerModeEnabled": [NSNumber numberWithBool:isDeveloperModeEnabled],
+ @"minimumFetchInterval": [NSNumber numberWithInteger:minimumFetchInterval],
+ @"fetchTimeout": [NSNumber numberWithInteger:fetchTimeout],
+ };
+
+ NSDictionary* infoObject = @{
+ @"configSettings": configSettings,
+ @"fetchTimeMillis": (lastFetchTime ? [NSNumber numberWithInteger:(lastFetchTime.timeIntervalSince1970 * 1000)] : [NSNull null]),
+ @"lastFetchStatus": [NSNumber numberWithInteger:(lastFetchStatus)],
+ };
+
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:infoObject];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+/*
+ * Performance
+ */
+- (void)setPerformanceCollectionEnabled:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ BOOL enabled = [[command argumentAtIndex:0] boolValue];
+ CDVPluginResult* pluginResult;
+ [[FIRPerformance sharedInstance] setDataCollectionEnabled:enabled];
+ [self setPreferenceFlag:FIREBASE_PERFORMANCE_COLLECTION_ENABLED flag:enabled];
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)isPerformanceCollectionEnabled:(CDVInvokedUrlCommand*)command{
+ [self.commandDelegate runInBackground:^{
+ @try {
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:[self getPreferenceFlag:FIREBASE_PERFORMANCE_COLLECTION_ENABLED]];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)startTrace:(CDVInvokedUrlCommand *)command {
+
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* traceName = [command.arguments objectAtIndex:0];
+ FIRTrace *trace = [self.traces objectForKey:traceName];
+
+ if ( self.traces == nil) {
+ self.traces = [NSMutableDictionary new];
+ }
+
+ if (trace == nil) {
+ trace = [FIRPerformance startTraceWithName:traceName];
+ [self.traces setObject:trace forKey:traceName ];
+
+ }
+
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)incrementCounter:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* traceName = [command.arguments objectAtIndex:0];
+ NSString* counterNamed = [command.arguments objectAtIndex:1];
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ FIRTrace *trace = (FIRTrace*)[self.traces objectForKey:traceName];
+
+ if (trace != nil) {
+ [trace incrementMetric:counterNamed byInt:1];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ } else {
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Trace not found"];
+ }
+
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)stopTrace:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* traceName = [command.arguments objectAtIndex:0];
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ FIRTrace *trace = [self.traces objectForKey:traceName];
+
+ if (trace != nil) {
+ [trace stop];
+ [self.traces removeObjectForKey:traceName];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ } else {
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Trace not found"];
+ }
+
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+/*
+* Firestore
+*/
+
+- (void)addDocumentToFirestoreCollection:(CDVInvokedUrlCommand*)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSDictionary* document = [command.arguments objectAtIndex:0];
+ NSString* collection = [command.arguments objectAtIndex:1];
+ __block FIRDocumentReference *ref =
+ [[firestore collectionWithPath:collection] addDocumentWithData:document completion:^(NSError * _Nullable error) {
+ [self handleStringResultWithPotentialError:error command:command result:ref.documentID];
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)setDocumentInFirestoreCollection:(CDVInvokedUrlCommand*)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* documentId = [command.arguments objectAtIndex:0];
+ NSDictionary* document = [command.arguments objectAtIndex:1];
+ NSString* collection = [command.arguments objectAtIndex:2];
+
+ [[[firestore collectionWithPath:collection] documentWithPath:documentId] setData:document completion:^(NSError * _Nullable error) {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)updateDocumentInFirestoreCollection:(CDVInvokedUrlCommand*)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* documentId = [command.arguments objectAtIndex:0];
+ NSDictionary* document = [command.arguments objectAtIndex:1];
+ NSString* collection = [command.arguments objectAtIndex:2];
+
+ FIRDocumentReference* docRef = [[firestore collectionWithPath:collection] documentWithPath:documentId];
+ if(docRef != nil){
+ [docRef updateData:document completion:^(NSError * _Nullable error) {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ }];
+ }else{
+ [self sendPluginErrorWithMessage:@"Document not found in collection":command];
+ }
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)deleteDocumentFromFirestoreCollection:(CDVInvokedUrlCommand*)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* documentId = [command.arguments objectAtIndex:0];
+ NSString* collection = [command.arguments objectAtIndex:1];
+
+ [[[firestore collectionWithPath:collection] documentWithPath:documentId]
+ deleteDocumentWithCompletion:^(NSError * _Nullable error) {
+ [self handleEmptyResultWithPotentialError:error command:command];
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)documentExistsInFirestoreCollection:(CDVInvokedUrlCommand*)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* documentId = [command.arguments objectAtIndex:0];
+ NSString* collection = [command.arguments objectAtIndex:1];
+
+ FIRDocumentReference* docRef = [[firestore collectionWithPath:collection] documentWithPath:documentId];
+ if(docRef != nil){
+ [docRef getDocumentWithCompletion:^(FIRDocumentSnapshot * _Nullable snapshot, NSError * _Nullable error) {
+ BOOL docExists = snapshot.data != nil;
+ [self handleBoolResultWithPotentialError:error command:command result:docExists];
+ }];
+ }else{
+ [self sendPluginErrorWithMessage:@"Collection not found":command];
+ }
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)fetchDocumentInFirestoreCollection:(CDVInvokedUrlCommand*)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* documentId = [command.arguments objectAtIndex:0];
+ NSString* collection = [command.arguments objectAtIndex:1];
+
+ FIRDocumentReference* docRef = [[firestore collectionWithPath:collection] documentWithPath:documentId];
+ if(docRef != nil){
+ [docRef getDocumentWithCompletion:^(FIRDocumentSnapshot * _Nullable snapshot, NSError * _Nullable error) {
+ if (error != nil) {
+ [self sendPluginErrorWithMessage:error.localizedDescription:command];
+ } else if(snapshot.data != nil) {
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:snapshot.data] callbackId:command.callbackId];
+ }else{
+ [self sendPluginErrorWithMessage:@"Document not found in collection":command];
+ }
+ }];
+ }else{
+ [self sendPluginErrorWithMessage:@"Collection not found":command];
+ }
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+- (void)fetchFirestoreCollection:(CDVInvokedUrlCommand*)command {
+ [self.commandDelegate runInBackground:^{
+ @try {
+ NSString* collection = [command.arguments objectAtIndex:0];
+ NSArray* filters = [command.arguments objectAtIndex:1];
+ FIRQuery* query = [firestore collectionWithPath:collection];
+
+ for (int i = 0; i < [filters count]; i++) {
+ NSArray* filter = [filters objectAtIndex:i];
+ if ([[filter objectAtIndex:0] isEqualToString:@"where"]) {
+ if ([[filter objectAtIndex:2] isEqualToString:@"=="]) {
+ query = [query queryWhereField:[filter objectAtIndex:1] isEqualTo:[filter objectAtIndex:3]];
+ }
+ if ([[filter objectAtIndex:2] isEqualToString:@"<"]) {
+ query = [query queryWhereField:[filter objectAtIndex:1] isLessThan:[filter objectAtIndex:3]];
+ }
+ if ([[filter objectAtIndex:2] isEqualToString:@">"]) {
+ query = [query queryWhereField:[filter objectAtIndex:1] isGreaterThan:[filter objectAtIndex:3]];
+ }
+ if ([[filter objectAtIndex:2] isEqualToString:@"<="]) {
+ query = [query queryWhereField:[filter objectAtIndex:1] isLessThanOrEqualTo:[filter objectAtIndex:3]];
+ }
+ if ([[filter objectAtIndex:2] isEqualToString:@">="]) {
+ query = [query queryWhereField:[filter objectAtIndex:1] isGreaterThanOrEqualTo:[filter objectAtIndex:3]];
+ }
+ if ([[filter objectAtIndex:2] isEqualToString:@"array-contains"]) {
+ query = [query queryWhereField:[filter objectAtIndex:1] arrayContains:[filter objectAtIndex:3]];
+ }
+ continue;
+ }
+ if ([[filter objectAtIndex:0] isEqualToString:@"orderBy"]) {
+ query = [query queryOrderedByField:[filter objectAtIndex:1] descending:([[filter objectAtIndex:2] isEqualToString:@"desc"])];
+ continue;
+ }
+ if ([[filter objectAtIndex:0] isEqualToString:@"startAt"]) {
+ query = [query queryStartingAtValues:[filter objectAtIndex:1]];
+ continue;
+ }
+ if ([[filter objectAtIndex:0] isEqualToString:@"endAt"]) {
+ query = [query queryEndingAtValues:[filter objectAtIndex:1]];
+ continue;
+ }
+ if ([[filter objectAtIndex:0] isEqualToString:@"limit"]) {
+ query = [query queryLimitedTo:[(NSNumber *)[filter objectAtIndex:1] integerValue]];
+ continue;
+ }
+ }
+
+ [query getDocumentsWithCompletion:^(FIRQuerySnapshot * _Nullable snapshot, NSError * _Nullable error) {
+ if (error != nil) {
+ [self sendPluginErrorWithMessage:error.localizedDescription:command];
+ } else {
+ NSMutableDictionary* documents = [[NSMutableDictionary alloc] init];;
+ for (FIRDocumentSnapshot *document in snapshot.documents) {
+ [documents setObject:document.data forKey:document.documentID];
+ }
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:documents] callbackId:command.callbackId];
+ }
+ }];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+ }];
+}
+
+/********************************/
+#pragma mark - utility functions
+/********************************/
+- (void) sendPluginSuccess:(CDVInvokedUrlCommand*)command{
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK] callbackId:command.callbackId];
+}
+
+- (void) sendPluginError:(CDVInvokedUrlCommand*)command{
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR] callbackId:command.callbackId];
+}
+
+- (void) sendPluginErrorWithMessage: (NSString*) errorMessage :(CDVInvokedUrlCommand*)command
+{
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errorMessage];
+ [self _logError:errorMessage];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
+- (void) sendPluginErrorWithError:(NSError*)error command:(CDVInvokedUrlCommand*)command{
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:error.description] callbackId:command.callbackId];
+}
+
+- (void) handleEmptyResultWithPotentialError:(NSError*) error command:(CDVInvokedUrlCommand*)command {
+ if (error) {
+ [self sendPluginErrorWithError:error command:command];
+ }else{
+ [self sendPluginSuccess:command];
+ }
+}
+
+- (void) handleStringResultWithPotentialError:(NSError*) error command:(CDVInvokedUrlCommand*)command result:(NSString*)result {
+ if (error) {
+ [self sendPluginErrorWithError:error command:command];
+ }else{
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:result] callbackId:command.callbackId];
+ }
+}
+
+- (void) handleBoolResultWithPotentialError:(NSError*) error command:(CDVInvokedUrlCommand*)command result:(BOOL)result {
+ if (error) {
+ [self sendPluginErrorWithError:error command:command];
+ }else{
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:result] callbackId:command.callbackId];
+ }
+}
+
+- (void) handlePluginExceptionWithContext: (NSException*) exception :(CDVInvokedUrlCommand*)command
+{
+ [self handlePluginExceptionWithoutContext:exception];
+ CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:exception.reason];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+}
+
+- (void) handlePluginExceptionWithoutContext: (NSException*) exception
+{
+ [self _logError:[NSString stringWithFormat:@"EXCEPTION: %@", exception.reason]];
+}
+
+- (void)executeGlobalJavascript: (NSString*)jsString
+{
+ [self.commandDelegate evalJs:jsString];
+}
+
+- (void)_logError: (NSString*)msg
+{
+ NSLog(@"%@ ERROR: %@", LOG_TAG, msg);
+ NSString* jsString = [NSString stringWithFormat:@"console.error(\"%@: %@\")", LOG_TAG, [self escapeJavascriptString:msg]];
+ [self executeGlobalJavascript:jsString];
+}
+
+- (void)_logInfo: (NSString*)msg
+{
+ NSLog(@"%@ INFO: %@", LOG_TAG, msg);
+ NSString* jsString = [NSString stringWithFormat:@"console.info(\"%@: %@\")", LOG_TAG, [self escapeJavascriptString:msg]];
+ [self executeGlobalJavascript:jsString];
+}
+
+- (void)_logMessage: (NSString*)msg
+{
+ NSLog(@"%@ LOG: %@", LOG_TAG, msg);
+ NSString* jsString = [NSString stringWithFormat:@"console.log(\"%@: %@\")", LOG_TAG, [self escapeJavascriptString:msg]];
+ [self executeGlobalJavascript:jsString];
+}
+
+- (NSString*)escapeJavascriptString: (NSString*)str
+{
+ NSString* result = [str stringByReplacingOccurrencesOfString: @"\\\"" withString: @"\""];
+ result = [result stringByReplacingOccurrencesOfString: @"\"" withString: @"\\\""];
+ result = [result stringByReplacingOccurrencesOfString: @"\n" withString: @"\\\n"];
+ return result;
+}
+
+- (void)runOnMainThread:(void (^)(void))completeBlock {
+ if (![NSThread isMainThread]) {
+ dispatch_sync(dispatch_get_main_queue(), ^{
+ @try {
+ completeBlock();
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithoutContext:exception];
+ }
+ });
+ } else {
+ @try {
+ completeBlock();
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithoutContext:exception];
+ }
+ }
+}
+
+- (FIRAuthCredential*)obtainAuthCredential:(NSDictionary*)credential command:(CDVInvokedUrlCommand *)command {
+ FIRAuthCredential* authCredential = nil;
+
+ if(credential == nil){
+ NSString* errMsg = @"credential object must be passed as first and only argument";
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errMsg] callbackId:command.callbackId];
+ return authCredential;
+ }
+
+ NSString* key = [credential objectForKey:@"id"];
+ NSString* verificationId = [credential objectForKey:@"verificationId"];
+ NSString* code = [credential objectForKey:@"code"];
+
+ if(key != nil){
+ authCredential = [authCredentials objectForKey:key];
+ if(authCredential == nil){
+ NSString* errMsg = [NSString stringWithFormat:@"no native auth credential exists for specified id '%@'", key];
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errMsg] callbackId:command.callbackId];
+ }
+ }else if(verificationId != nil && code != nil){
+ authCredential = [[FIRPhoneAuthProvider provider]
+ credentialWithVerificationID:verificationId
+ verificationCode:code];
+ }else{
+ NSString* errMsg = @"credential object must either specify the id key of an existing native auth credential or the verificationId/code keys must be specified for a phone number authentication";
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errMsg] callbackId:command.callbackId];
+ }
+
+ return authCredential;
+}
+
+- (void) handleAuthResult:(FIRAuthDataResult*) authResult error:(NSError*) error command:(CDVInvokedUrlCommand*)command {
+ @try {
+ CDVPluginResult* pluginResult;
+ if (error) {
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:error.description];
+ }else if (authResult == nil) {
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"User not signed in"];
+ }else{
+ pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ }
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }@catch (NSException *exception) {
+ [self handlePluginExceptionWithContext:exception :command];
+ }
+}
+
+- (int) saveAuthCredential: (FIRAuthCredential*) authCredential {
+ int key = -1;
+ while (key < 0 || [authCredentials objectForKey:[NSNumber numberWithInt:key]] != nil) {
+ key = arc4random_uniform(100000);
+ }
+
+ [authCredentials setObject:authCredential forKey:[NSNumber numberWithInt:key]];
+
+ return key;
+}
+
+- (void) setPreferenceFlag:(NSString*) name flag:(BOOL)flag {
+ [preferences setBool:flag forKey:name];
+ [preferences synchronize];
+}
+
+- (BOOL) getPreferenceFlag:(NSString*) name {
+ if([preferences objectForKey:name] == nil){
+ return false;
+ }
+ return [preferences boolForKey:name];
+}
+
+- (BOOL) getGooglePlistFlagWithDefaultValue:(NSString*) name defaultValue:(BOOL)defaultValue {
+ if([googlePlist objectForKey:name] == nil){
+ return defaultValue;
+ }
+ return [[googlePlist objectForKey:name] isEqualToString:@"true"];
+}
+
+
+# pragma mark - Stubs
+- (void)createChannel:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }];
+}
+
+- (void)setDefaultChannel:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }];
+}
+
+- (void)deleteChannel:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }];
+}
+
+- (void)listChannels:(CDVInvokedUrlCommand *)command {
+ [self.commandDelegate runInBackground:^{
+ CDVPluginResult *pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
+ [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
+ }];
+}
+@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiver.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiver.h
new file mode 100644
index 00000000..639de9ba
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiver.h
@@ -0,0 +1,5 @@
+#import <Foundation/Foundation.h>
+
+@interface FirebasePluginMessageReceiver : NSObject {}
+- (bool) sendNotification:(NSDictionary *)userInfo;
+@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiver.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiver.m
new file mode 100644
index 00000000..0990d8c1
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiver.m
@@ -0,0 +1,17 @@
+#import "FirebasePluginMessageReceiver.h"
+#import "FirebasePluginMessageReceiverManager.h"
+
+@implementation FirebasePluginMessageReceiver
+
+- (id) init {
+ [FirebasePluginMessageReceiverManager register:self];
+ return self;
+}
+
+// Concrete subclasses should override this and return true if they handle the received message.
+- (bool) sendNotification:(NSDictionary *)userInfo {
+ NSAssert(false, @"You cannot call sendNotification on the FirebasePluginMessageReceiver class directly. Instead, you must override it using a subclass.");
+ return false;
+}
+
+@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiverManager.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiverManager.h
new file mode 100644
index 00000000..96dac9d8
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiverManager.h
@@ -0,0 +1,6 @@
+#import "FirebasePluginMessageReceiver.h"
+
+@interface FirebasePluginMessageReceiverManager
++ (void) register:(FirebasePluginMessageReceiver *)receiver;
++ (bool) sendNotification:(NSDictionary *)userInfo;
+@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiverManager.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiverManager.m
new file mode 100644
index 00000000..7d463265
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-firebasex/FirebasePluginMessageReceiverManager.m
@@ -0,0 +1,24 @@
+#import "FirebasePluginMessageReceiverManager.h"
+
+@implementation FirebasePluginMessageReceiverManager
+
+static NSMutableArray* receivers;
+
++ (void) register:(FirebasePluginMessageReceiver*)receiver {
+ if(receivers == nil){
+ receivers = [[NSMutableArray alloc] init];
+ }
+ [receivers addObject:receiver];
+}
+
++ (bool) sendNotification:(NSDictionary *)userInfo {
+ bool handled = false;
+ for(FirebasePluginMessageReceiver* receiver in receivers){
+ bool wasHandled = [receiver sendNotification:userInfo];
+ if(wasHandled){
+ handled = true;
+ }
+ }
+ return handled;
+}
+@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-geolocation/CDVLocation.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-geolocation/CDVLocation.m
index e4b34a11..d07a8e9c 100644
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-geolocation/CDVLocation.m
+++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-geolocation/CDVLocation.m
@@ -6,9 +6,9 @@
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
-
+
http://www.apache.org/licenses/LICENSE-2.0
-
+
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -65,7 +65,7 @@
- (BOOL)isAuthorized
{
BOOL authorizationStatusClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(authorizationStatus)]; // iOS 4.2+
-
+
if (authorizationStatusClassPropertyAvailable) {
NSUInteger authStatus = [CLLocationManager authorizationStatus];
#ifdef __IPHONE_8_0
@@ -73,9 +73,9 @@
return (authStatus == kCLAuthorizationStatusAuthorizedWhenInUse) || (authStatus == kCLAuthorizationStatusAuthorizedAlways) || (authStatus == kCLAuthorizationStatusNotDetermined);
}
#endif
- return (authStatus == kCLAuthorizationStatusAuthorized) || (authStatus == kCLAuthorizationStatusNotDetermined);
+ return (authStatus == kCLAuthorizationStatusAuthorizedAlways) || (authStatus == kCLAuthorizationStatusNotDetermined);
}
-
+
// by default, assume YES (for iOS < 4.2)
return YES;
}
@@ -84,11 +84,9 @@
{
BOOL locationServicesEnabledInstancePropertyAvailable = [self.locationManager respondsToSelector:@selector(locationServicesEnabled)]; // iOS 3.x
BOOL locationServicesEnabledClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(locationServicesEnabled)]; // iOS 4.x
-
+
if (locationServicesEnabledClassPropertyAvailable) { // iOS 4.x
return [CLLocationManager locationServicesEnabled];
- } else if (locationServicesEnabledInstancePropertyAvailable) { // iOS 2.x, iOS 3.x
- return [(id)self.locationManager locationServicesEnabled];
} else {
return NO;
}
@@ -114,10 +112,10 @@
}
// PERMISSIONDENIED is only PositionError that makes sense when authorization denied
[self returnLocationError:PERMISSIONDENIED withMessage:message];
-
+
return;
}
-
+
#ifdef __IPHONE_8_0
NSUInteger code = [CLLocationManager authorizationStatus];
if (code == kCLAuthorizationStatusNotDetermined && ([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)] || [self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])) { //iOS8+
@@ -132,7 +130,7 @@
return;
}
#endif
-
+
// Tell the location manager to start notifying us of location updates. We
// first stop, and then start the updating to ensure we get at least one
// update, even if our location did not change.
@@ -159,7 +157,7 @@
if (![self isLocationServicesEnabled]) {
return;
}
-
+
[self.locationManager stopUpdatingLocation];
__locationStarted = NO;
__highAccuracyEnabled = NO;
@@ -171,14 +169,16 @@
fromLocation:(CLLocation*)oldLocation
{
CDVLocationData* cData = self.locationData;
-
+
cData.locationInfo = newLocation;
- if (self.locationData.locationCallbacks.count > 0) {
- for (NSString* callbackId in self.locationData.locationCallbacks) {
- [self returnLocationInfo:callbackId andKeepCallback:NO];
+ @synchronized (self.locationData.locationCallbacks) {
+ if (self.locationData.locationCallbacks.count > 0) {
+ for (NSString* callbackId in self.locationData.locationCallbacks) {
+ [self returnLocationInfo:callbackId andKeepCallback:NO];
+ }
+
+ [self.locationData.locationCallbacks removeAllObjects];
}
-
- [self.locationData.locationCallbacks removeAllObjects];
}
if (self.locationData.watchCallbacks.count > 0) {
for (NSString* timerId in self.locationData.watchCallbacks) {
@@ -195,7 +195,7 @@
[self.commandDelegate runInBackground:^{
NSString* callbackId = command.callbackId;
BOOL enableHighAccuracy = [[command argumentAtIndex:0] boolValue];
-
+
if ([self isLocationServicesEnabled] == NO) {
NSMutableDictionary* posError = [NSMutableDictionary dictionaryWithCapacity:2];
[posError setObject:[NSNumber numberWithInt:PERMISSIONDENIED] forKey:@"code"];
@@ -207,14 +207,18 @@
self.locationData = [[CDVLocationData alloc] init];
}
CDVLocationData* lData = self.locationData;
- if (!lData.locationCallbacks) {
- lData.locationCallbacks = [NSMutableArray arrayWithCapacity:1];
+ @synchronized (self.locationData.locationCallbacks) {
+ if (!lData.locationCallbacks) {
+ lData.locationCallbacks = [NSMutableArray arrayWithCapacity:1];
+ }
}
-
+
if (!__locationStarted || (__highAccuracyEnabled != enableHighAccuracy)) {
// add the callbackId into the array so we can call back when get data
- if (callbackId != nil) {
- [lData.locationCallbacks addObject:callbackId];
+ @synchronized (self.locationData.locationCallbacks) {
+ if (callbackId != nil) {
+ [lData.locationCallbacks addObject:callbackId];
+ }
}
// Tell the location manager to start notifying us of heading updates
[self startLocation:enableHighAccuracy];
@@ -230,19 +234,19 @@
NSString* callbackId = command.callbackId;
NSString* timerId = [command argumentAtIndex:0];
BOOL enableHighAccuracy = [[command argumentAtIndex:1] boolValue];
-
+
if (!self.locationData) {
self.locationData = [[CDVLocationData alloc] init];
}
CDVLocationData* lData = self.locationData;
-
+
if (!lData.watchCallbacks) {
lData.watchCallbacks = [NSMutableDictionary dictionaryWithCapacity:1];
}
-
+
// add the callbackId into the dictionary so we can call back whenever get data
[lData.watchCallbacks setObject:callbackId forKey:timerId];
-
+
if ([self isLocationServicesEnabled] == NO) {
NSMutableDictionary* posError = [NSMutableDictionary dictionaryWithCapacity:2];
[posError setObject:[NSNumber numberWithInt:PERMISSIONDENIED] forKey:@"code"];
@@ -260,7 +264,7 @@
- (void)clearWatch:(CDVInvokedUrlCommand*)command
{
NSString* timerId = [command argumentAtIndex:0];
-
+
if (self.locationData && self.locationData.watchCallbacks && [self.locationData.watchCallbacks objectForKey:timerId]) {
[self.locationData.watchCallbacks removeObjectForKey:timerId];
if([self.locationData.watchCallbacks count] == 0) {
@@ -278,7 +282,7 @@
{
CDVPluginResult* result = nil;
CDVLocationData* lData = self.locationData;
-
+
if (lData && !lData.locationInfo) {
// return error
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageToErrorObject:POSITIONUNAVAILABLE];
@@ -294,7 +298,7 @@
[returnInfo setObject:[NSNumber numberWithDouble:lInfo.altitude] forKey:@"altitude"];
[returnInfo setObject:[NSNumber numberWithDouble:lInfo.coordinate.latitude] forKey:@"latitude"];
[returnInfo setObject:[NSNumber numberWithDouble:lInfo.coordinate.longitude] forKey:@"longitude"];
-
+
result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:returnInfo];
[result setKeepCallbackAsBool:keepCallback];
}
@@ -306,17 +310,20 @@
- (void)returnLocationError:(NSUInteger)errorCode withMessage:(NSString*)message
{
NSMutableDictionary* posError = [NSMutableDictionary dictionaryWithCapacity:2];
-
+
[posError setObject:[NSNumber numberWithUnsignedInteger:errorCode] forKey:@"code"];
[posError setObject:message ? message:@"" forKey:@"message"];
CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:posError];
-
- for (NSString* callbackId in self.locationData.locationCallbacks) {
- [self.commandDelegate sendPluginResult:result callbackId:callbackId];
+
+
+ @synchronized (self.locationData.locationCallbacks) {
+ for (NSString* callbackId in self.locationData.locationCallbacks) {
+ [self.commandDelegate sendPluginResult:result callbackId:callbackId];
+ }
+
+ [self.locationData.locationCallbacks removeAllObjects];
}
-
- [self.locationData.locationCallbacks removeAllObjects];
-
+
for (NSString* callbackId in self.locationData.watchCallbacks) {
[self.commandDelegate sendPluginResult:result callbackId:callbackId];
}
@@ -325,7 +332,7 @@
- (void)locationManager:(CLLocationManager*)manager didFailWithError:(NSError*)error
{
NSLog(@"locationManager::didFailWithError %@", [error localizedFailureReason]);
-
+
CDVLocationData* lData = self.locationData;
if (lData && __locationStarted) {
// TODO: probably have to once over the various error codes and return one of:
@@ -338,10 +345,10 @@
}
[self returnLocationError:positionError withMessage:[error localizedDescription]];
}
-
+
if (error.code != kCLErrorLocationUnknown) {
- [self.locationManager stopUpdatingLocation];
- __locationStarted = NO;
+ [self.locationManager stopUpdatingLocation];
+ __locationStarted = NO;
}
}
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-inappbrowser/CDVInAppBrowser.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-inappbrowser/CDVInAppBrowser.h
deleted file mode 100644
index 6bb0ec16..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-inappbrowser/CDVInAppBrowser.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import <Cordova/CDVPlugin.h>
-#import <Cordova/CDVInvokedUrlCommand.h>
-#import <Cordova/CDVScreenOrientationDelegate.h>
-
-#ifdef __CORDOVA_4_0_0
- #import <Cordova/CDVUIWebViewDelegate.h>
-#else
- #import <Cordova/CDVWebViewDelegate.h>
-#endif
-
-@class CDVInAppBrowserViewController;
-
-@interface CDVInAppBrowser : CDVPlugin {
-}
-
-@property (nonatomic, retain) CDVInAppBrowserViewController* inAppBrowserViewController;
-@property (nonatomic, copy) NSString* callbackId;
-@property (nonatomic, copy) NSRegularExpression *callbackIdPattern;
-
-- (void)open:(CDVInvokedUrlCommand*)command;
-- (void)close:(CDVInvokedUrlCommand*)command;
-- (void)injectScriptCode:(CDVInvokedUrlCommand*)command;
-- (void)show:(CDVInvokedUrlCommand*)command;
-
-@end
-
-@interface CDVInAppBrowserOptions : NSObject {}
-
-@property (nonatomic, assign) BOOL location;
-@property (nonatomic, assign) BOOL toolbar;
-@property (nonatomic, copy) NSString* closebuttoncaption;
-@property (nonatomic, copy) NSString* toolbarposition;
-@property (nonatomic, assign) BOOL clearcache;
-@property (nonatomic, assign) BOOL clearsessioncache;
-
-@property (nonatomic, copy) NSString* presentationstyle;
-@property (nonatomic, copy) NSString* transitionstyle;
-
-@property (nonatomic, assign) BOOL enableviewportscale;
-@property (nonatomic, assign) BOOL mediaplaybackrequiresuseraction;
-@property (nonatomic, assign) BOOL allowinlinemediaplayback;
-@property (nonatomic, assign) BOOL keyboarddisplayrequiresuseraction;
-@property (nonatomic, assign) BOOL suppressesincrementalrendering;
-@property (nonatomic, assign) BOOL hidden;
-@property (nonatomic, assign) BOOL disallowoverscroll;
-
-+ (CDVInAppBrowserOptions*)parseOptions:(NSString*)options;
-
-@end
-
-@interface CDVInAppBrowserViewController : UIViewController <UIWebViewDelegate, CDVScreenOrientationDelegate>{
- @private
- NSString* _userAgent;
- NSString* _prevUserAgent;
- NSInteger _userAgentLockToken;
- CDVInAppBrowserOptions *_browserOptions;
-
-#ifdef __CORDOVA_4_0_0
- CDVUIWebViewDelegate* _webViewDelegate;
-#else
- CDVWebViewDelegate* _webViewDelegate;
-#endif
-
-}
-
-@property (nonatomic, strong) IBOutlet UIWebView* webView;
-@property (nonatomic, strong) IBOutlet UIBarButtonItem* closeButton;
-@property (nonatomic, strong) IBOutlet UILabel* addressLabel;
-@property (nonatomic, strong) IBOutlet UIBarButtonItem* backButton;
-@property (nonatomic, strong) IBOutlet UIBarButtonItem* forwardButton;
-@property (nonatomic, strong) IBOutlet UIActivityIndicatorView* spinner;
-@property (nonatomic, strong) IBOutlet UIToolbar* toolbar;
-
-@property (nonatomic, weak) id <CDVScreenOrientationDelegate> orientationDelegate;
-@property (nonatomic, weak) CDVInAppBrowser* navigationDelegate;
-@property (nonatomic) NSURL* currentURL;
-
-- (void)close;
-- (void)navigateTo:(NSURL*)url;
-- (void)showLocationBar:(BOOL)show;
-- (void)showToolBar:(BOOL)show : (NSString *) toolbarPosition;
-- (void)setCloseButtonTitle:(NSString*)title;
-
-- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVInAppBrowserOptions*) browserOptions;
-
-@end
-
-@interface CDVInAppBrowserNavigationController : UINavigationController
-
-@property (nonatomic, weak) id <CDVScreenOrientationDelegate> orientationDelegate;
-
-@end
-
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-inappbrowser/CDVInAppBrowser.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-inappbrowser/CDVInAppBrowser.m
deleted file mode 100644
index b342ca73..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-inappbrowser/CDVInAppBrowser.m
+++ /dev/null
@@ -1,1075 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import "CDVInAppBrowser.h"
-#import <Cordova/CDVPluginResult.h>
-#import <Cordova/CDVUserAgentUtil.h>
-
-#define kInAppBrowserTargetSelf @"_self"
-#define kInAppBrowserTargetSystem @"_system"
-#define kInAppBrowserTargetBlank @"_blank"
-
-#define kInAppBrowserToolbarBarPositionBottom @"bottom"
-#define kInAppBrowserToolbarBarPositionTop @"top"
-
-#define TOOLBAR_HEIGHT 44.0
-#define LOCATIONBAR_HEIGHT 21.0
-#define FOOTER_HEIGHT ((TOOLBAR_HEIGHT) + (LOCATIONBAR_HEIGHT))
-
-#pragma mark CDVInAppBrowser
-
-@interface CDVInAppBrowser () {
- NSInteger _previousStatusBarStyle;
-}
-@end
-
-@implementation CDVInAppBrowser
-
-- (void)pluginInitialize
-{
- _previousStatusBarStyle = -1;
- _callbackIdPattern = nil;
-}
-
-- (id)settingForKey:(NSString*)key
-{
- return [self.commandDelegate.settings objectForKey:[key lowercaseString]];
-}
-
-- (void)onReset
-{
- [self close:nil];
-}
-
-- (void)close:(CDVInvokedUrlCommand*)command
-{
- if (self.inAppBrowserViewController == nil) {
- NSLog(@"IAB.close() called but it was already closed.");
- return;
- }
- // Things are cleaned up in browserExit.
- [self.inAppBrowserViewController close];
-}
-
-- (BOOL) isSystemUrl:(NSURL*)url
-{
- if ([[url host] isEqualToString:@"itunes.apple.com"]) {
- return YES;
- }
-
- return NO;
-}
-
-- (void)open:(CDVInvokedUrlCommand*)command
-{
- CDVPluginResult* pluginResult;
-
- NSString* url = [command argumentAtIndex:0];
- NSString* target = [command argumentAtIndex:1 withDefault:kInAppBrowserTargetSelf];
- NSString* options = [command argumentAtIndex:2 withDefault:@"" andClass:[NSString class]];
-
- self.callbackId = command.callbackId;
-
- if (url != nil) {
-#ifdef __CORDOVA_4_0_0
- NSURL* baseUrl = [self.webViewEngine URL];
-#else
- NSURL* baseUrl = [self.webView.request URL];
-#endif
- NSURL* absoluteUrl = [[NSURL URLWithString:url relativeToURL:baseUrl] absoluteURL];
-
- if ([self isSystemUrl:absoluteUrl]) {
- target = kInAppBrowserTargetSystem;
- }
-
- if ([target isEqualToString:kInAppBrowserTargetSelf]) {
- [self openInCordovaWebView:absoluteUrl withOptions:options];
- } else if ([target isEqualToString:kInAppBrowserTargetSystem]) {
- [self openInSystem:absoluteUrl];
- } else { // _blank or anything else
- [self openInInAppBrowser:absoluteUrl withOptions:options];
- }
-
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- } else {
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"incorrect number of arguments"];
- }
-
- [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
-}
-
-- (void)openInInAppBrowser:(NSURL*)url withOptions:(NSString*)options
-{
- CDVInAppBrowserOptions* browserOptions = [CDVInAppBrowserOptions parseOptions:options];
-
- if (browserOptions.clearcache) {
- NSHTTPCookie *cookie;
- NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
- for (cookie in [storage cookies])
- {
- if (![cookie.domain isEqual: @".^filecookies^"]) {
- [storage deleteCookie:cookie];
- }
- }
- }
-
- if (browserOptions.clearsessioncache) {
- NSHTTPCookie *cookie;
- NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage];
- for (cookie in [storage cookies])
- {
- if (![cookie.domain isEqual: @".^filecookies^"] && cookie.isSessionOnly) {
- [storage deleteCookie:cookie];
- }
- }
- }
-
- if (self.inAppBrowserViewController == nil) {
- NSString* userAgent = [CDVUserAgentUtil originalUserAgent];
- NSString* overrideUserAgent = [self settingForKey:@"OverrideUserAgent"];
- NSString* appendUserAgent = [self settingForKey:@"AppendUserAgent"];
- if(overrideUserAgent){
- userAgent = overrideUserAgent;
- }
- if(appendUserAgent){
- userAgent = [userAgent stringByAppendingString: appendUserAgent];
- }
- self.inAppBrowserViewController = [[CDVInAppBrowserViewController alloc] initWithUserAgent:userAgent prevUserAgent:[self.commandDelegate userAgent] browserOptions: browserOptions];
- self.inAppBrowserViewController.navigationDelegate = self;
-
- if ([self.viewController conformsToProtocol:@protocol(CDVScreenOrientationDelegate)]) {
- self.inAppBrowserViewController.orientationDelegate = (UIViewController <CDVScreenOrientationDelegate>*)self.viewController;
- }
- }
-
- [self.inAppBrowserViewController showLocationBar:browserOptions.location];
- [self.inAppBrowserViewController showToolBar:browserOptions.toolbar :browserOptions.toolbarposition];
- if (browserOptions.closebuttoncaption != nil) {
- [self.inAppBrowserViewController setCloseButtonTitle:browserOptions.closebuttoncaption];
- }
- // Set Presentation Style
- UIModalPresentationStyle presentationStyle = UIModalPresentationFullScreen; // default
- if (browserOptions.presentationstyle != nil) {
- if ([[browserOptions.presentationstyle lowercaseString] isEqualToString:@"pagesheet"]) {
- presentationStyle = UIModalPresentationPageSheet;
- } else if ([[browserOptions.presentationstyle lowercaseString] isEqualToString:@"formsheet"]) {
- presentationStyle = UIModalPresentationFormSheet;
- }
- }
- self.inAppBrowserViewController.modalPresentationStyle = presentationStyle;
-
- // Set Transition Style
- UIModalTransitionStyle transitionStyle = UIModalTransitionStyleCoverVertical; // default
- if (browserOptions.transitionstyle != nil) {
- if ([[browserOptions.transitionstyle lowercaseString] isEqualToString:@"fliphorizontal"]) {
- transitionStyle = UIModalTransitionStyleFlipHorizontal;
- } else if ([[browserOptions.transitionstyle lowercaseString] isEqualToString:@"crossdissolve"]) {
- transitionStyle = UIModalTransitionStyleCrossDissolve;
- }
- }
- self.inAppBrowserViewController.modalTransitionStyle = transitionStyle;
-
- // prevent webView from bouncing
- if (browserOptions.disallowoverscroll) {
- if ([self.inAppBrowserViewController.webView respondsToSelector:@selector(scrollView)]) {
- ((UIScrollView*)[self.inAppBrowserViewController.webView scrollView]).bounces = NO;
- } else {
- for (id subview in self.inAppBrowserViewController.webView.subviews) {
- if ([[subview class] isSubclassOfClass:[UIScrollView class]]) {
- ((UIScrollView*)subview).bounces = NO;
- }
- }
- }
- }
-
- // UIWebView options
- self.inAppBrowserViewController.webView.scalesPageToFit = browserOptions.enableviewportscale;
- self.inAppBrowserViewController.webView.mediaPlaybackRequiresUserAction = browserOptions.mediaplaybackrequiresuseraction;
- self.inAppBrowserViewController.webView.allowsInlineMediaPlayback = browserOptions.allowinlinemediaplayback;
- if (IsAtLeastiOSVersion(@"6.0")) {
- self.inAppBrowserViewController.webView.keyboardDisplayRequiresUserAction = browserOptions.keyboarddisplayrequiresuseraction;
- self.inAppBrowserViewController.webView.suppressesIncrementalRendering = browserOptions.suppressesincrementalrendering;
- }
-
- [self.inAppBrowserViewController navigateTo:url];
- if (!browserOptions.hidden) {
- [self show:nil];
- }
-}
-
-- (void)show:(CDVInvokedUrlCommand*)command
-{
- if (self.inAppBrowserViewController == nil) {
- NSLog(@"Tried to show IAB after it was closed.");
- return;
- }
- if (_previousStatusBarStyle != -1) {
- NSLog(@"Tried to show IAB while already shown");
- return;
- }
-
- _previousStatusBarStyle = [UIApplication sharedApplication].statusBarStyle;
-
- __block CDVInAppBrowserNavigationController* nav = [[CDVInAppBrowserNavigationController alloc]
- initWithRootViewController:self.inAppBrowserViewController];
- nav.orientationDelegate = self.inAppBrowserViewController;
- nav.navigationBarHidden = YES;
- nav.modalPresentationStyle = self.inAppBrowserViewController.modalPresentationStyle;
-
- __weak CDVInAppBrowser* weakSelf = self;
-
- // Run later to avoid the "took a long time" log message.
- dispatch_async(dispatch_get_main_queue(), ^{
- if (weakSelf.inAppBrowserViewController != nil) {
- [weakSelf.viewController presentViewController:nav animated:YES completion:nil];
- }
- });
-}
-
-- (void)openInCordovaWebView:(NSURL*)url withOptions:(NSString*)options
-{
- NSURLRequest* request = [NSURLRequest requestWithURL:url];
-
-#ifdef __CORDOVA_4_0_0
- // the webview engine itself will filter for this according to <allow-navigation> policy
- // in config.xml for cordova-ios-4.0
- [self.webViewEngine loadRequest:request];
-#else
- if ([self.commandDelegate URLIsWhitelisted:url]) {
- [self.webView loadRequest:request];
- } else { // this assumes the InAppBrowser can be excepted from the white-list
- [self openInInAppBrowser:url withOptions:options];
- }
-#endif
-}
-
-- (void)openInSystem:(NSURL*)url
-{
- [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
- [[UIApplication sharedApplication] openURL:url];
-}
-
-// This is a helper method for the inject{Script|Style}{Code|File} API calls, which
-// provides a consistent method for injecting JavaScript code into the document.
-//
-// If a wrapper string is supplied, then the source string will be JSON-encoded (adding
-// quotes) and wrapped using string formatting. (The wrapper string should have a single
-// '%@' marker).
-//
-// If no wrapper is supplied, then the source string is executed directly.
-
-- (void)injectDeferredObject:(NSString*)source withWrapper:(NSString*)jsWrapper
-{
- // Ensure an iframe bridge is created to communicate with the CDVInAppBrowserViewController
- [self.inAppBrowserViewController.webView stringByEvaluatingJavaScriptFromString:@"(function(d){_cdvIframeBridge=d.getElementById('_cdvIframeBridge');if(!_cdvIframeBridge) {var e = _cdvIframeBridge = d.createElement('iframe');e.id='_cdvIframeBridge'; e.style.display='none';d.body.appendChild(e);}})(document)"];
-
- if (jsWrapper != nil) {
- NSData* jsonData = [NSJSONSerialization dataWithJSONObject:@[source] options:0 error:nil];
- NSString* sourceArrayString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
- if (sourceArrayString) {
- NSString* sourceString = [sourceArrayString substringWithRange:NSMakeRange(1, [sourceArrayString length] - 2)];
- NSString* jsToInject = [NSString stringWithFormat:jsWrapper, sourceString];
- [self.inAppBrowserViewController.webView stringByEvaluatingJavaScriptFromString:jsToInject];
- }
- } else {
- [self.inAppBrowserViewController.webView stringByEvaluatingJavaScriptFromString:source];
- }
-}
-
-- (void)injectScriptCode:(CDVInvokedUrlCommand*)command
-{
- NSString* jsWrapper = nil;
-
- if ((command.callbackId != nil) && ![command.callbackId isEqualToString:@"INVALID"]) {
- jsWrapper = [NSString stringWithFormat:@"_cdvIframeBridge.src='gap-iab://%@/'+encodeURIComponent(JSON.stringify([eval(%%@)]));", command.callbackId];
- }
- [self injectDeferredObject:[command argumentAtIndex:0] withWrapper:jsWrapper];
-}
-
-- (void)injectScriptFile:(CDVInvokedUrlCommand*)command
-{
- NSString* jsWrapper;
-
- if ((command.callbackId != nil) && ![command.callbackId isEqualToString:@"INVALID"]) {
- jsWrapper = [NSString stringWithFormat:@"(function(d) { var c = d.createElement('script'); c.src = %%@; c.onload = function() { _cdvIframeBridge.src='gap-iab://%@'; }; d.body.appendChild(c); })(document)", command.callbackId];
- } else {
- jsWrapper = @"(function(d) { var c = d.createElement('script'); c.src = %@; d.body.appendChild(c); })(document)";
- }
- [self injectDeferredObject:[command argumentAtIndex:0] withWrapper:jsWrapper];
-}
-
-- (void)injectStyleCode:(CDVInvokedUrlCommand*)command
-{
- NSString* jsWrapper;
-
- if ((command.callbackId != nil) && ![command.callbackId isEqualToString:@"INVALID"]) {
- jsWrapper = [NSString stringWithFormat:@"(function(d) { var c = d.createElement('style'); c.innerHTML = %%@; c.onload = function() { _cdvIframeBridge.src='gap-iab://%@'; }; d.body.appendChild(c); })(document)", command.callbackId];
- } else {
- jsWrapper = @"(function(d) { var c = d.createElement('style'); c.innerHTML = %@; d.body.appendChild(c); })(document)";
- }
- [self injectDeferredObject:[command argumentAtIndex:0] withWrapper:jsWrapper];
-}
-
-- (void)injectStyleFile:(CDVInvokedUrlCommand*)command
-{
- NSString* jsWrapper;
-
- if ((command.callbackId != nil) && ![command.callbackId isEqualToString:@"INVALID"]) {
- jsWrapper = [NSString stringWithFormat:@"(function(d) { var c = d.createElement('link'); c.rel='stylesheet'; c.type='text/css'; c.href = %%@; c.onload = function() { _cdvIframeBridge.src='gap-iab://%@'; }; d.body.appendChild(c); })(document)", command.callbackId];
- } else {
- jsWrapper = @"(function(d) { var c = d.createElement('link'); c.rel='stylesheet', c.type='text/css'; c.href = %@; d.body.appendChild(c); })(document)";
- }
- [self injectDeferredObject:[command argumentAtIndex:0] withWrapper:jsWrapper];
-}
-
-- (BOOL)isValidCallbackId:(NSString *)callbackId
-{
- NSError *err = nil;
- // Initialize on first use
- if (self.callbackIdPattern == nil) {
- self.callbackIdPattern = [NSRegularExpression regularExpressionWithPattern:@"^InAppBrowser[0-9]{1,10}$" options:0 error:&err];
- if (err != nil) {
- // Couldn't initialize Regex; No is safer than Yes.
- return NO;
- }
- }
- if ([self.callbackIdPattern firstMatchInString:callbackId options:0 range:NSMakeRange(0, [callbackId length])]) {
- return YES;
- }
- return NO;
-}
-
-/**
- * The iframe bridge provided for the InAppBrowser is capable of executing any oustanding callback belonging
- * to the InAppBrowser plugin. Care has been taken that other callbacks cannot be triggered, and that no
- * other code execution is possible.
- *
- * To trigger the bridge, the iframe (or any other resource) should attempt to load a url of the form:
- *
- * gap-iab://<callbackId>/<arguments>
- *
- * where <callbackId> is the string id of the callback to trigger (something like "InAppBrowser0123456789")
- *
- * If present, the path component of the special gap-iab:// url is expected to be a URL-escaped JSON-encoded
- * value to pass to the callback. [NSURL path] should take care of the URL-unescaping, and a JSON_EXCEPTION
- * is returned if the JSON is invalid.
- */
-- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
-{
- NSURL* url = request.URL;
- BOOL isTopLevelNavigation = [request.URL isEqual:[request mainDocumentURL]];
-
- // See if the url uses the 'gap-iab' protocol. If so, the host should be the id of a callback to execute,
- // and the path, if present, should be a JSON-encoded value to pass to the callback.
- if ([[url scheme] isEqualToString:@"gap-iab"]) {
- NSString* scriptCallbackId = [url host];
- CDVPluginResult* pluginResult = nil;
-
- if ([self isValidCallbackId:scriptCallbackId]) {
- NSString* scriptResult = [url path];
- NSError* __autoreleasing error = nil;
-
- // The message should be a JSON-encoded array of the result of the script which executed.
- if ((scriptResult != nil) && ([scriptResult length] > 1)) {
- scriptResult = [scriptResult substringFromIndex:1];
- NSData* decodedResult = [NSJSONSerialization JSONObjectWithData:[scriptResult dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:&error];
- if ((error == nil) && [decodedResult isKindOfClass:[NSArray class]]) {
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:(NSArray*)decodedResult];
- } else {
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION];
- }
- } else {
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsArray:@[]];
- }
- [self.commandDelegate sendPluginResult:pluginResult callbackId:scriptCallbackId];
- return NO;
- }
- }
- //if is an app store link, let the system handle it, otherwise it fails to load it
- else if ([[ url scheme] isEqualToString:@"itms-appss"] || [[ url scheme] isEqualToString:@"itms-apps"]) {
- [theWebView stopLoading];
- [self openInSystem:url];
- return NO;
- }
- else if ((self.callbackId != nil) && isTopLevelNavigation) {
- // Send a loadstart event for each top-level navigation (includes redirects).
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
- messageAsDictionary:@{@"type":@"loadstart", @"url":[url absoluteString]}];
- [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
-
- [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
- }
-
- return YES;
-}
-
-- (void)webViewDidStartLoad:(UIWebView*)theWebView
-{
-}
-
-- (void)webViewDidFinishLoad:(UIWebView*)theWebView
-{
- if (self.callbackId != nil) {
- // TODO: It would be more useful to return the URL the page is actually on (e.g. if it's been redirected).
- NSString* url = [self.inAppBrowserViewController.currentURL absoluteString];
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
- messageAsDictionary:@{@"type":@"loadstop", @"url":url}];
- [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
-
- [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
- }
-}
-
-- (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
-{
- if (self.callbackId != nil) {
- NSString* url = [self.inAppBrowserViewController.currentURL absoluteString];
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR
- messageAsDictionary:@{@"type":@"loaderror", @"url":url, @"code": [NSNumber numberWithInteger:error.code], @"message": error.localizedDescription}];
- [pluginResult setKeepCallback:[NSNumber numberWithBool:YES]];
-
- [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
- }
-}
-
-- (void)browserExit
-{
- if (self.callbackId != nil) {
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
- messageAsDictionary:@{@"type":@"exit"}];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
- self.callbackId = nil;
- }
- // Set navigationDelegate to nil to ensure no callbacks are received from it.
- self.inAppBrowserViewController.navigationDelegate = nil;
- // Don't recycle the ViewController since it may be consuming a lot of memory.
- // Also - this is required for the PDF/User-Agent bug work-around.
- self.inAppBrowserViewController = nil;
-
- if (IsAtLeastiOSVersion(@"7.0")) {
- if (_previousStatusBarStyle != -1) {
- [[UIApplication sharedApplication] setStatusBarStyle:_previousStatusBarStyle];
- }
- }
-
- _previousStatusBarStyle = -1; // this value was reset before reapplying it. caused statusbar to stay black on ios7
-}
-
-@end
-
-#pragma mark CDVInAppBrowserViewController
-
-@implementation CDVInAppBrowserViewController
-
-@synthesize currentURL;
-
-- (id)initWithUserAgent:(NSString*)userAgent prevUserAgent:(NSString*)prevUserAgent browserOptions: (CDVInAppBrowserOptions*) browserOptions
-{
- self = [super init];
- if (self != nil) {
- _userAgent = userAgent;
- _prevUserAgent = prevUserAgent;
- _browserOptions = browserOptions;
-#ifdef __CORDOVA_4_0_0
- _webViewDelegate = [[CDVUIWebViewDelegate alloc] initWithDelegate:self];
-#else
- _webViewDelegate = [[CDVWebViewDelegate alloc] initWithDelegate:self];
-#endif
-
- [self createViews];
- }
-
- return self;
-}
-
-// Prevent crashes on closing windows
--(void)dealloc {
- self.webView.delegate = nil;
-}
-
-- (void)createViews
-{
- // We create the views in code for primarily for ease of upgrades and not requiring an external .xib to be included
-
- CGRect webViewBounds = self.view.bounds;
- BOOL toolbarIsAtBottom = ![_browserOptions.toolbarposition isEqualToString:kInAppBrowserToolbarBarPositionTop];
- webViewBounds.size.height -= _browserOptions.location ? FOOTER_HEIGHT : TOOLBAR_HEIGHT;
- self.webView = [[UIWebView alloc] initWithFrame:webViewBounds];
-
- self.webView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
-
- [self.view addSubview:self.webView];
- [self.view sendSubviewToBack:self.webView];
-
- self.webView.delegate = _webViewDelegate;
- self.webView.backgroundColor = [UIColor whiteColor];
-
- self.webView.clearsContextBeforeDrawing = YES;
- self.webView.clipsToBounds = YES;
- self.webView.contentMode = UIViewContentModeScaleToFill;
- self.webView.multipleTouchEnabled = YES;
- self.webView.opaque = YES;
- self.webView.scalesPageToFit = NO;
- self.webView.userInteractionEnabled = YES;
-
- self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
- self.spinner.alpha = 1.000;
- self.spinner.autoresizesSubviews = YES;
- self.spinner.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin);
- self.spinner.clearsContextBeforeDrawing = NO;
- self.spinner.clipsToBounds = NO;
- self.spinner.contentMode = UIViewContentModeScaleToFill;
- self.spinner.frame = CGRectMake(CGRectGetMidX(self.webView.frame), CGRectGetMidY(self.webView.frame), 20.0, 20.0);
- self.spinner.hidden = NO;
- self.spinner.hidesWhenStopped = YES;
- self.spinner.multipleTouchEnabled = NO;
- self.spinner.opaque = NO;
- self.spinner.userInteractionEnabled = NO;
- [self.spinner stopAnimating];
-
- self.closeButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(close)];
- self.closeButton.enabled = YES;
-
- UIBarButtonItem* flexibleSpaceButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
-
- UIBarButtonItem* fixedSpaceButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:nil action:nil];
- fixedSpaceButton.width = 20;
-
- float toolbarY = toolbarIsAtBottom ? self.view.bounds.size.height - TOOLBAR_HEIGHT : 0.0;
- CGRect toolbarFrame = CGRectMake(0.0, toolbarY, self.view.bounds.size.width, TOOLBAR_HEIGHT);
-
- self.toolbar = [[UIToolbar alloc] initWithFrame:toolbarFrame];
- self.toolbar.alpha = 1.000;
- self.toolbar.autoresizesSubviews = YES;
- self.toolbar.autoresizingMask = toolbarIsAtBottom ? (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin) : UIViewAutoresizingFlexibleWidth;
- self.toolbar.barStyle = UIBarStyleBlackOpaque;
- self.toolbar.clearsContextBeforeDrawing = NO;
- self.toolbar.clipsToBounds = NO;
- self.toolbar.contentMode = UIViewContentModeScaleToFill;
- self.toolbar.hidden = NO;
- self.toolbar.multipleTouchEnabled = NO;
- self.toolbar.opaque = NO;
- self.toolbar.userInteractionEnabled = YES;
-
- CGFloat labelInset = 5.0;
- float locationBarY = toolbarIsAtBottom ? self.view.bounds.size.height - FOOTER_HEIGHT : self.view.bounds.size.height - LOCATIONBAR_HEIGHT;
-
- self.addressLabel = [[UILabel alloc] initWithFrame:CGRectMake(labelInset, locationBarY, self.view.bounds.size.width - labelInset, LOCATIONBAR_HEIGHT)];
- self.addressLabel.adjustsFontSizeToFitWidth = NO;
- self.addressLabel.alpha = 1.000;
- self.addressLabel.autoresizesSubviews = YES;
- self.addressLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin;
- self.addressLabel.backgroundColor = [UIColor clearColor];
- self.addressLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
- self.addressLabel.clearsContextBeforeDrawing = YES;
- self.addressLabel.clipsToBounds = YES;
- self.addressLabel.contentMode = UIViewContentModeScaleToFill;
- self.addressLabel.enabled = YES;
- self.addressLabel.hidden = NO;
- self.addressLabel.lineBreakMode = NSLineBreakByTruncatingTail;
-
- if ([self.addressLabel respondsToSelector:NSSelectorFromString(@"setMinimumScaleFactor:")]) {
- [self.addressLabel setValue:@(10.0/[UIFont labelFontSize]) forKey:@"minimumScaleFactor"];
- } else if ([self.addressLabel respondsToSelector:NSSelectorFromString(@"setMinimumFontSize:")]) {
- [self.addressLabel setValue:@(10.0) forKey:@"minimumFontSize"];
- }
-
- self.addressLabel.multipleTouchEnabled = NO;
- self.addressLabel.numberOfLines = 1;
- self.addressLabel.opaque = NO;
- self.addressLabel.shadowOffset = CGSizeMake(0.0, -1.0);
- self.addressLabel.text = NSLocalizedString(@"Loading...", nil);
- self.addressLabel.textAlignment = NSTextAlignmentLeft;
- self.addressLabel.textColor = [UIColor colorWithWhite:1.000 alpha:1.000];
- self.addressLabel.userInteractionEnabled = NO;
-
- NSString* frontArrowString = NSLocalizedString(@"â–º", nil); // create arrow from Unicode char
- self.forwardButton = [[UIBarButtonItem alloc] initWithTitle:frontArrowString style:UIBarButtonItemStylePlain target:self action:@selector(goForward:)];
- self.forwardButton.enabled = YES;
- self.forwardButton.imageInsets = UIEdgeInsetsZero;
-
- NSString* backArrowString = NSLocalizedString(@"â—„", nil); // create arrow from Unicode char
- self.backButton = [[UIBarButtonItem alloc] initWithTitle:backArrowString style:UIBarButtonItemStylePlain target:self action:@selector(goBack:)];
- self.backButton.enabled = YES;
- self.backButton.imageInsets = UIEdgeInsetsZero;
-
- [self.toolbar setItems:@[self.closeButton, flexibleSpaceButton, self.backButton, fixedSpaceButton, self.forwardButton]];
-
- self.view.backgroundColor = [UIColor grayColor];
- [self.view addSubview:self.toolbar];
- [self.view addSubview:self.addressLabel];
- [self.view addSubview:self.spinner];
-}
-
-- (void) setWebViewFrame : (CGRect) frame {
- NSLog(@"Setting the WebView's frame to %@", NSStringFromCGRect(frame));
- [self.webView setFrame:frame];
-}
-
-- (void)setCloseButtonTitle:(NSString*)title
-{
- // the advantage of using UIBarButtonSystemItemDone is the system will localize it for you automatically
- // but, if you want to set this yourself, knock yourself out (we can't set the title for a system Done button, so we have to create a new one)
- self.closeButton = nil;
- self.closeButton = [[UIBarButtonItem alloc] initWithTitle:title style:UIBarButtonItemStyleBordered target:self action:@selector(close)];
- self.closeButton.enabled = YES;
- self.closeButton.tintColor = [UIColor colorWithRed:60.0 / 255.0 green:136.0 / 255.0 blue:230.0 / 255.0 alpha:1];
-
- NSMutableArray* items = [self.toolbar.items mutableCopy];
- [items replaceObjectAtIndex:0 withObject:self.closeButton];
- [self.toolbar setItems:items];
-}
-
-- (void)showLocationBar:(BOOL)show
-{
- CGRect locationbarFrame = self.addressLabel.frame;
-
- BOOL toolbarVisible = !self.toolbar.hidden;
-
- // prevent double show/hide
- if (show == !(self.addressLabel.hidden)) {
- return;
- }
-
- if (show) {
- self.addressLabel.hidden = NO;
-
- if (toolbarVisible) {
- // toolBar at the bottom, leave as is
- // put locationBar on top of the toolBar
-
- CGRect webViewBounds = self.view.bounds;
- webViewBounds.size.height -= FOOTER_HEIGHT;
- [self setWebViewFrame:webViewBounds];
-
- locationbarFrame.origin.y = webViewBounds.size.height;
- self.addressLabel.frame = locationbarFrame;
- } else {
- // no toolBar, so put locationBar at the bottom
-
- CGRect webViewBounds = self.view.bounds;
- webViewBounds.size.height -= LOCATIONBAR_HEIGHT;
- [self setWebViewFrame:webViewBounds];
-
- locationbarFrame.origin.y = webViewBounds.size.height;
- self.addressLabel.frame = locationbarFrame;
- }
- } else {
- self.addressLabel.hidden = YES;
-
- if (toolbarVisible) {
- // locationBar is on top of toolBar, hide locationBar
-
- // webView take up whole height less toolBar height
- CGRect webViewBounds = self.view.bounds;
- webViewBounds.size.height -= TOOLBAR_HEIGHT;
- [self setWebViewFrame:webViewBounds];
- } else {
- // no toolBar, expand webView to screen dimensions
- [self setWebViewFrame:self.view.bounds];
- }
- }
-}
-
-- (void)showToolBar:(BOOL)show : (NSString *) toolbarPosition
-{
- CGRect toolbarFrame = self.toolbar.frame;
- CGRect locationbarFrame = self.addressLabel.frame;
-
- BOOL locationbarVisible = !self.addressLabel.hidden;
-
- // prevent double show/hide
- if (show == !(self.toolbar.hidden)) {
- return;
- }
-
- if (show) {
- self.toolbar.hidden = NO;
- CGRect webViewBounds = self.view.bounds;
-
- if (locationbarVisible) {
- // locationBar at the bottom, move locationBar up
- // put toolBar at the bottom
- webViewBounds.size.height -= FOOTER_HEIGHT;
- locationbarFrame.origin.y = webViewBounds.size.height;
- self.addressLabel.frame = locationbarFrame;
- self.toolbar.frame = toolbarFrame;
- } else {
- // no locationBar, so put toolBar at the bottom
- CGRect webViewBounds = self.view.bounds;
- webViewBounds.size.height -= TOOLBAR_HEIGHT;
- self.toolbar.frame = toolbarFrame;
- }
-
- if ([toolbarPosition isEqualToString:kInAppBrowserToolbarBarPositionTop]) {
- toolbarFrame.origin.y = 0;
- webViewBounds.origin.y += toolbarFrame.size.height;
- [self setWebViewFrame:webViewBounds];
- } else {
- toolbarFrame.origin.y = (webViewBounds.size.height + LOCATIONBAR_HEIGHT);
- }
- [self setWebViewFrame:webViewBounds];
-
- } else {
- self.toolbar.hidden = YES;
-
- if (locationbarVisible) {
- // locationBar is on top of toolBar, hide toolBar
- // put locationBar at the bottom
-
- // webView take up whole height less locationBar height
- CGRect webViewBounds = self.view.bounds;
- webViewBounds.size.height -= LOCATIONBAR_HEIGHT;
- [self setWebViewFrame:webViewBounds];
-
- // move locationBar down
- locationbarFrame.origin.y = webViewBounds.size.height;
- self.addressLabel.frame = locationbarFrame;
- } else {
- // no locationBar, expand webView to screen dimensions
- [self setWebViewFrame:self.view.bounds];
- }
- }
-}
-
-- (void)viewDidLoad
-{
- [super viewDidLoad];
-}
-
-- (void)viewDidUnload
-{
- [self.webView loadHTMLString:nil baseURL:nil];
- [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
- [super viewDidUnload];
-}
-
-- (UIStatusBarStyle)preferredStatusBarStyle
-{
- return UIStatusBarStyleDefault;
-}
-
-- (BOOL)prefersStatusBarHidden {
- return NO;
-}
-
-- (void)close
-{
- [CDVUserAgentUtil releaseLock:&_userAgentLockToken];
- self.currentURL = nil;
-
- if ((self.navigationDelegate != nil) && [self.navigationDelegate respondsToSelector:@selector(browserExit)]) {
- [self.navigationDelegate browserExit];
- }
-
- __weak UIViewController* weakSelf = self;
-
- // Run later to avoid the "took a long time" log message.
- dispatch_async(dispatch_get_main_queue(), ^{
- if ([weakSelf respondsToSelector:@selector(presentingViewController)]) {
- [[weakSelf presentingViewController] dismissViewControllerAnimated:YES completion:nil];
- } else {
- [[weakSelf parentViewController] dismissViewControllerAnimated:YES completion:nil];
- }
- });
-}
-
-- (void)navigateTo:(NSURL*)url
-{
- NSURLRequest* request = [NSURLRequest requestWithURL:url];
-
- if (_userAgentLockToken != 0) {
- [self.webView loadRequest:request];
- } else {
- __weak CDVInAppBrowserViewController* weakSelf = self;
- [CDVUserAgentUtil acquireLock:^(NSInteger lockToken) {
- _userAgentLockToken = lockToken;
- [CDVUserAgentUtil setUserAgent:_userAgent lockToken:lockToken];
- [weakSelf.webView loadRequest:request];
- }];
- }
-}
-
-- (void)goBack:(id)sender
-{
- [self.webView goBack];
-}
-
-- (void)goForward:(id)sender
-{
- [self.webView goForward];
-}
-
-- (void)viewWillAppear:(BOOL)animated
-{
- if (IsAtLeastiOSVersion(@"7.0")) {
- [[UIApplication sharedApplication] setStatusBarStyle:[self preferredStatusBarStyle]];
- }
- [self rePositionViews];
-
- [super viewWillAppear:animated];
-}
-
-//
-// On iOS 7 the status bar is part of the view's dimensions, therefore it's height has to be taken into account.
-// The height of it could be hardcoded as 20 pixels, but that would assume that the upcoming releases of iOS won't
-// change that value.
-//
-- (float) getStatusBarOffset {
- CGRect statusBarFrame = [[UIApplication sharedApplication] statusBarFrame];
- float statusBarOffset = IsAtLeastiOSVersion(@"7.0") ? MIN(statusBarFrame.size.width, statusBarFrame.size.height) : 0.0;
- return statusBarOffset;
-}
-
-- (void) rePositionViews {
- if ([_browserOptions.toolbarposition isEqualToString:kInAppBrowserToolbarBarPositionTop]) {
- [self.webView setFrame:CGRectMake(self.webView.frame.origin.x, TOOLBAR_HEIGHT, self.webView.frame.size.width, self.webView.frame.size.height)];
- [self.toolbar setFrame:CGRectMake(self.toolbar.frame.origin.x, [self getStatusBarOffset], self.toolbar.frame.size.width, self.toolbar.frame.size.height)];
- }
-}
-
-#pragma mark UIWebViewDelegate
-
-- (void)webViewDidStartLoad:(UIWebView*)theWebView
-{
- // loading url, start spinner, update back/forward
-
- self.addressLabel.text = NSLocalizedString(@"Loading...", nil);
- self.backButton.enabled = theWebView.canGoBack;
- self.forwardButton.enabled = theWebView.canGoForward;
-
- [self.spinner startAnimating];
-
- return [self.navigationDelegate webViewDidStartLoad:theWebView];
-}
-
-- (BOOL)webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType
-{
- BOOL isTopLevelNavigation = [request.URL isEqual:[request mainDocumentURL]];
-
- if (isTopLevelNavigation) {
- self.currentURL = request.URL;
- }
- return [self.navigationDelegate webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType];
-}
-
-- (void)webViewDidFinishLoad:(UIWebView*)theWebView
-{
- // update url, stop spinner, update back/forward
-
- self.addressLabel.text = [self.currentURL absoluteString];
- self.backButton.enabled = theWebView.canGoBack;
- self.forwardButton.enabled = theWebView.canGoForward;
-
- [self.spinner stopAnimating];
-
- // Work around a bug where the first time a PDF is opened, all UIWebViews
- // reload their User-Agent from NSUserDefaults.
- // This work-around makes the following assumptions:
- // 1. The app has only a single Cordova Webview. If not, then the app should
- // take it upon themselves to load a PDF in the background as a part of
- // their start-up flow.
- // 2. That the PDF does not require any additional network requests. We change
- // the user-agent here back to that of the CDVViewController, so requests
- // from it must pass through its white-list. This *does* break PDFs that
- // contain links to other remote PDF/websites.
- // More info at https://issues.apache.org/jira/browse/CB-2225
- BOOL isPDF = [@"true" isEqualToString :[theWebView stringByEvaluatingJavaScriptFromString:@"document.body==null"]];
- if (isPDF) {
- [CDVUserAgentUtil setUserAgent:_prevUserAgent lockToken:_userAgentLockToken];
- }
-
- [self.navigationDelegate webViewDidFinishLoad:theWebView];
-}
-
-- (void)webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error
-{
- // log fail message, stop spinner, update back/forward
- NSLog(@"webView:didFailLoadWithError - %ld: %@", (long)error.code, [error localizedDescription]);
-
- self.backButton.enabled = theWebView.canGoBack;
- self.forwardButton.enabled = theWebView.canGoForward;
- [self.spinner stopAnimating];
-
- self.addressLabel.text = NSLocalizedString(@"Load Error", nil);
-
- [self.navigationDelegate webView:theWebView didFailLoadWithError:error];
-}
-
-#pragma mark CDVScreenOrientationDelegate
-
-- (BOOL)shouldAutorotate
-{
- if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotate)]) {
- return [self.orientationDelegate shouldAutorotate];
- }
- return YES;
-}
-
-- (NSUInteger)supportedInterfaceOrientations
-{
- if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(supportedInterfaceOrientations)]) {
- return [self.orientationDelegate supportedInterfaceOrientations];
- }
-
- return 1 << UIInterfaceOrientationPortrait;
-}
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
-{
- if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)]) {
- return [self.orientationDelegate shouldAutorotateToInterfaceOrientation:interfaceOrientation];
- }
-
- return YES;
-}
-
-@end
-
-@implementation CDVInAppBrowserOptions
-
-- (id)init
-{
- if (self = [super init]) {
- // default values
- self.location = YES;
- self.toolbar = YES;
- self.closebuttoncaption = nil;
- self.toolbarposition = kInAppBrowserToolbarBarPositionBottom;
- self.clearcache = NO;
- self.clearsessioncache = NO;
-
- self.enableviewportscale = NO;
- self.mediaplaybackrequiresuseraction = NO;
- self.allowinlinemediaplayback = NO;
- self.keyboarddisplayrequiresuseraction = YES;
- self.suppressesincrementalrendering = NO;
- self.hidden = NO;
- self.disallowoverscroll = NO;
- }
-
- return self;
-}
-
-+ (CDVInAppBrowserOptions*)parseOptions:(NSString*)options
-{
- CDVInAppBrowserOptions* obj = [[CDVInAppBrowserOptions alloc] init];
-
- // NOTE: this parsing does not handle quotes within values
- NSArray* pairs = [options componentsSeparatedByString:@","];
-
- // parse keys and values, set the properties
- for (NSString* pair in pairs) {
- NSArray* keyvalue = [pair componentsSeparatedByString:@"="];
-
- if ([keyvalue count] == 2) {
- NSString* key = [[keyvalue objectAtIndex:0] lowercaseString];
- NSString* value = [keyvalue objectAtIndex:1];
- NSString* value_lc = [value lowercaseString];
-
- BOOL isBoolean = [value_lc isEqualToString:@"yes"] || [value_lc isEqualToString:@"no"];
- NSNumberFormatter* numberFormatter = [[NSNumberFormatter alloc] init];
- [numberFormatter setAllowsFloats:YES];
- BOOL isNumber = [numberFormatter numberFromString:value_lc] != nil;
-
- // set the property according to the key name
- if ([obj respondsToSelector:NSSelectorFromString(key)]) {
- if (isNumber) {
- [obj setValue:[numberFormatter numberFromString:value_lc] forKey:key];
- } else if (isBoolean) {
- [obj setValue:[NSNumber numberWithBool:[value_lc isEqualToString:@"yes"]] forKey:key];
- } else {
- [obj setValue:value forKey:key];
- }
- }
- }
- }
-
- return obj;
-}
-
-@end
-
-@implementation CDVInAppBrowserNavigationController : UINavigationController
-
-- (void) dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion {
- if ( self.presentedViewController) {
- [super dismissViewControllerAnimated:flag completion:completion];
- }
-}
-
-- (void) viewDidLoad {
-
- CGRect frame = [UIApplication sharedApplication].statusBarFrame;
-
- // simplified from: http://stackoverflow.com/a/25669695/219684
-
- UIToolbar* bgToolbar = [[UIToolbar alloc] initWithFrame:[self invertFrameIfNeeded:frame]];
- bgToolbar.barStyle = UIBarStyleDefault;
- [bgToolbar setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
- [self.view addSubview:bgToolbar];
-
- [super viewDidLoad];
-}
-
-- (CGRect) invertFrameIfNeeded:(CGRect)rect {
- // We need to invert since on iOS 7 frames are always in Portrait context
- if (!IsAtLeastiOSVersion(@"8.0")) {
- if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) {
- CGFloat temp = rect.size.width;
- rect.size.width = rect.size.height;
- rect.size.height = temp;
- }
- rect.origin = CGPointZero;
- }
- return rect;
-}
-
-#pragma mark CDVScreenOrientationDelegate
-
-- (BOOL)shouldAutorotate
-{
- if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotate)]) {
- return [self.orientationDelegate shouldAutorotate];
- }
- return YES;
-}
-
-- (NSUInteger)supportedInterfaceOrientations
-{
- if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(supportedInterfaceOrientations)]) {
- return [self.orientationDelegate supportedInterfaceOrientations];
- }
-
- return 1 << UIInterfaceOrientationPortrait;
-}
-
-- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
-{
- if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)]) {
- return [self.orientationDelegate shouldAutorotateToInterfaceOrientation:interfaceOrientation];
- }
-
- return YES;
-}
-
-
-@end
-
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-ionic-keyboard/CDVIonicKeyboard.h
index a948ea31..aae6766a 100644
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.h
+++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-ionic-keyboard/CDVIonicKeyboard.h
@@ -17,12 +17,8 @@
under the License.
*/
-#import <Cordova/CDVViewController.h>
-
-@interface CDVViewController (SplashScreen)
-
-@property (nonatomic, assign) BOOL enabledAutorotation;
-@property (nonatomic, readonly) BOOL shouldAutorotateDefaultValue;
+#import <Cordova/CDVPlugin.h>
+@interface CDVIonicKeyboard : CDVPlugin
@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-ionic-keyboard/CDVIonicKeyboard.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-ionic-keyboard/CDVIonicKeyboard.m
new file mode 100644
index 00000000..e4615a84
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-ionic-keyboard/CDVIonicKeyboard.m
@@ -0,0 +1,411 @@
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
+
+#import "CDVIonicKeyboard.h"
+#import <Cordova/CDVAvailability.h>
+#import <Cordova/NSDictionary+CordovaPreferences.h>
+#import <objc/runtime.h>
+
+typedef enum : NSUInteger {
+ ResizeNone,
+ ResizeNative,
+ ResizeBody,
+ ResizeIonic,
+} ResizePolicy;
+
+#ifndef __CORDOVA_3_2_0
+#warning "The keyboard plugin is only supported in Cordova 3.2 or greater, it may not work properly in an older version. If you do use this plugin in an older version, make sure the HideKeyboardFormAccessoryBar and KeyboardShrinksView preference values are false."
+#endif
+
+@interface CDVIonicKeyboard () <UIScrollViewDelegate>
+
+@property (readwrite, assign, nonatomic) BOOL disableScroll;
+@property (readwrite, assign, nonatomic) BOOL hideFormAccessoryBar;
+@property (readwrite, assign, nonatomic) BOOL keyboardIsVisible;
+@property (nonatomic, readwrite) ResizePolicy keyboardResizes;
+@property (readwrite, assign, nonatomic) NSString* keyboardStyle;
+@property (nonatomic, readwrite) BOOL isWK;
+@property (nonatomic, readwrite) int paddingBottom;
+
+@end
+
+@implementation CDVIonicKeyboard
+
+NSTimer *hideTimer;
+
+- (id)settingForKey:(NSString *)key
+{
+ return [self.commandDelegate.settings objectForKey:[key lowercaseString]];
+}
+
+#pragma mark Initialize
+
+NSString* UIClassString;
+NSString* WKClassString;
+NSString* UITraitsClassString;
+
+- (void)pluginInitialize
+{
+ UIClassString = [@[@"UI", @"Web", @"Browser", @"View"] componentsJoinedByString:@""];
+ WKClassString = [@[@"WK", @"Content", @"View"] componentsJoinedByString:@""];
+ UITraitsClassString = [@[@"UI", @"Text", @"Input", @"Traits"] componentsJoinedByString:@""];
+
+ NSDictionary *settings = self.commandDelegate.settings;
+
+ self.disableScroll = ![settings cordovaBoolSettingForKey:@"ScrollEnabled" defaultValue:NO];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarDidChangeFrame:) name: UIApplicationDidChangeStatusBarFrameNotification object:nil];
+
+ self.keyboardResizes = ResizeNative;
+ BOOL doesResize = [settings cordovaBoolSettingForKey:@"KeyboardResize" defaultValue:YES];
+ if (!doesResize) {
+ self.keyboardResizes = ResizeNone;
+ NSLog(@"CDVIonicKeyboard: no resize");
+
+ } else {
+ NSString *resizeMode = [settings cordovaSettingForKey:@"KeyboardResizeMode"];
+ if (resizeMode) {
+ if ([resizeMode isEqualToString:@"ionic"]) {
+ self.keyboardResizes = ResizeIonic;
+ } else if ([resizeMode isEqualToString:@"body"]) {
+ self.keyboardResizes = ResizeBody;
+ }
+ }
+ NSLog(@"CDVIonicKeyboard: resize mode %lu", (unsigned long)self.keyboardResizes);
+ }
+ self.hideFormAccessoryBar = [settings cordovaBoolSettingForKey:@"HideKeyboardFormAccessoryBar" defaultValue:YES];
+
+ NSString *keyboardStyle = [settings cordovaSettingForKey:@"KeyboardStyle"];
+ if (keyboardStyle) {
+ [self setKeyboardStyle:keyboardStyle];
+ }
+
+ if ([settings cordovaBoolSettingForKey:@"KeyboardAppearanceDark" defaultValue:NO]) {
+ [self setKeyboardStyle:@"dark"];
+ }
+
+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
+
+ [nc addObserver:self selector:@selector(onKeyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
+ [nc addObserver:self selector:@selector(onKeyboardDidHide:) name:UIKeyboardDidHideNotification object:nil];
+ [nc addObserver:self selector:@selector(onKeyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
+ [nc addObserver:self selector:@selector(onKeyboardDidShow:) name:UIKeyboardDidShowNotification object:nil];
+
+ // Prevent WKWebView to resize window
+ BOOL isWK = self.isWK = [self.webView isKindOfClass:NSClassFromString(@"WKWebView")];
+ if (!isWK) {
+ NSLog(@"CDVIonicKeyboard: WARNING!!: Keyboard plugin works better with WK");
+ }
+
+ if (isWK) {
+ [nc removeObserver:self.webView name:UIKeyboardWillHideNotification object:nil];
+ [nc removeObserver:self.webView name:UIKeyboardWillShowNotification object:nil];
+ [nc removeObserver:self.webView name:UIKeyboardWillChangeFrameNotification object:nil];
+ [nc removeObserver:self.webView name:UIKeyboardDidChangeFrameNotification object:nil];
+ }
+}
+
+-(void)statusBarDidChangeFrame:(NSNotification*)notification
+{
+ [self _updateFrame];
+}
+
+
+#pragma mark Keyboard events
+
+- (void)resetScrollView
+{
+ UIScrollView *scrollView = [self.webView scrollView];
+ [scrollView setContentInset:UIEdgeInsetsZero];
+}
+
+- (void)onKeyboardWillHide:(NSNotification *)sender
+{
+ if (self.isWK) {
+ [self setKeyboardHeight:0 delay:0.01];
+ [self resetScrollView];
+ }
+ hideTimer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(fireOnHiding) userInfo:nil repeats:NO];
+}
+
+- (void)fireOnHiding {
+ [self.commandDelegate evalJs:@"Keyboard.fireOnHiding();"];
+}
+
+- (void)onKeyboardWillShow:(NSNotification *)note
+{
+ if (hideTimer != nil) {
+ [hideTimer invalidate];
+ }
+ CGRect rect = [[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
+ double height = rect.size.height;
+
+ if (self.isWK) {
+ double duration = [[note.userInfo valueForKey:UIKeyboardAnimationDurationUserInfoKey] doubleValue];
+ [self setKeyboardHeight:height delay:duration+0.2];
+ [self resetScrollView];
+ }
+
+ [self setKeyboardStyle:self.keyboardStyle];
+
+ NSString *js = [NSString stringWithFormat:@"Keyboard.fireOnShowing(%d);", (int)height];
+ [self.commandDelegate evalJs:js];
+}
+
+- (void)onKeyboardDidShow:(NSNotification *)note
+{
+ CGRect rect = [[note.userInfo valueForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
+ double height = rect.size.height;
+
+ if (self.isWK) {
+ [self resetScrollView];
+ }
+
+ NSString *js = [NSString stringWithFormat:@"Keyboard.fireOnShow(%d);", (int)height];
+ [self.commandDelegate evalJs:js];
+}
+
+- (void)onKeyboardDidHide:(NSNotification *)sender
+{
+ [self.commandDelegate evalJs:@"Keyboard.fireOnHide();"];
+ [self resetScrollView];
+}
+
+- (void)setKeyboardHeight:(int)height delay:(NSTimeInterval)delay
+{
+ if (self.keyboardResizes != ResizeNone) {
+ [self setPaddingBottom: height delay:delay];
+ }
+}
+
+- (void)setPaddingBottom:(int)paddingBottom delay:(NSTimeInterval)delay
+{
+ if (self.paddingBottom == paddingBottom) {
+ return;
+ }
+
+ self.paddingBottom = paddingBottom;
+
+ __weak CDVIonicKeyboard* weakSelf = self;
+ SEL action = @selector(_updateFrame);
+ [NSObject cancelPreviousPerformRequestsWithTarget:weakSelf selector:action object:nil];
+ if (delay == 0) {
+ [self _updateFrame];
+ } else {
+ [weakSelf performSelector:action withObject:nil afterDelay:delay];
+ }
+}
+
+- (void)_updateFrame
+{
+ CGSize statusBarSize = [[UIApplication sharedApplication] statusBarFrame].size;
+ int statusBarHeight = MIN(statusBarSize.width, statusBarSize.height);
+
+ int _paddingBottom = (int)self.paddingBottom;
+
+ if (statusBarHeight == 40) {
+ _paddingBottom = _paddingBottom + 20;
+ }
+ NSLog(@"CDVIonicKeyboard: updating frame");
+ // NOTE: to handle split screen correctly, the application's window bounds must be used as opposed to the screen's bounds.
+ CGRect f = [[[[UIApplication sharedApplication] delegate] window] bounds];
+ CGRect wf = self.webView.frame;
+ switch (self.keyboardResizes) {
+ case ResizeBody:
+ {
+ NSString *js = [NSString stringWithFormat:@"Keyboard.fireOnResize(%d, %d, document.body);",
+ _paddingBottom, (int)f.size.height];
+ [self.commandDelegate evalJs:js];
+ break;
+ }
+ case ResizeIonic:
+ {
+ NSString *js = [NSString stringWithFormat:@"Keyboard.fireOnResize(%d, %d, document.querySelector('ion-app'));",
+ _paddingBottom, (int)f.size.height];
+ [self.commandDelegate evalJs:js];
+ break;
+ }
+ case ResizeNative:
+ {
+ [self.webView setFrame:CGRectMake(wf.origin.x, wf.origin.y, f.size.width - wf.origin.x, f.size.height - wf.origin.y - self.paddingBottom)];
+ break;
+ }
+ default:
+ break;
+ }
+ [self resetScrollView];
+}
+
+#pragma mark Keyboard Style
+
+ - (void)setKeyboardStyle:(NSString*)style
+{
+ IMP newImp = [style isEqualToString:@"dark"] ? imp_implementationWithBlock(^(id _s) {
+ return UIKeyboardAppearanceDark;
+ }) : imp_implementationWithBlock(^(id _s) {
+ return UIKeyboardAppearanceLight;
+ });
+
+ if (self.isWK) {
+ for (NSString* classString in @[WKClassString, UITraitsClassString]) {
+ Class c = NSClassFromString(classString);
+ Method m = class_getInstanceMethod(c, @selector(keyboardAppearance));
+
+ if (m != NULL) {
+ method_setImplementation(m, newImp);
+ } else {
+ class_addMethod(c, @selector(keyboardAppearance), newImp, "l@:");
+ }
+ }
+ }
+ else {
+ for (NSString* classString in @[UIClassString, UITraitsClassString]) {
+ Class c = NSClassFromString(classString);
+ Method m = class_getInstanceMethod(c, @selector(keyboardAppearance));
+
+ if (m != NULL) {
+ method_setImplementation(m, newImp);
+ } else {
+ class_addMethod(c, @selector(keyboardAppearance), newImp, "l@:");
+ }
+ }
+ }
+
+ _keyboardStyle = style;
+}
+
+#pragma mark HideFormAccessoryBar
+
+static IMP UIOriginalImp;
+static IMP WKOriginalImp;
+
+- (void)setHideFormAccessoryBar:(BOOL)hideFormAccessoryBar
+{
+ if (hideFormAccessoryBar == _hideFormAccessoryBar) {
+ return;
+ }
+
+ Method UIMethod = class_getInstanceMethod(NSClassFromString(UIClassString), @selector(inputAccessoryView));
+ Method WKMethod = class_getInstanceMethod(NSClassFromString(WKClassString), @selector(inputAccessoryView));
+
+ if (hideFormAccessoryBar) {
+ UIOriginalImp = method_getImplementation(UIMethod);
+ WKOriginalImp = method_getImplementation(WKMethod);
+
+ IMP newImp = imp_implementationWithBlock(^(id _s) {
+ return nil;
+ });
+
+ method_setImplementation(UIMethod, newImp);
+ method_setImplementation(WKMethod, newImp);
+ } else {
+ method_setImplementation(UIMethod, UIOriginalImp);
+ method_setImplementation(WKMethod, WKOriginalImp);
+ }
+
+ _hideFormAccessoryBar = hideFormAccessoryBar;
+}
+
+#pragma mark scroll
+
+- (void)setDisableScroll:(BOOL)disableScroll {
+ if (disableScroll == _disableScroll) {
+ return;
+ }
+ if (disableScroll) {
+ self.webView.scrollView.scrollEnabled = NO;
+ self.webView.scrollView.delegate = self;
+ }
+ else {
+ self.webView.scrollView.scrollEnabled = YES;
+ self.webView.scrollView.delegate = nil;
+ }
+ _disableScroll = disableScroll;
+}
+
+- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
+ [scrollView setContentOffset: CGPointZero];
+}
+
+#pragma mark Plugin interface
+
+- (void)hideFormAccessoryBar:(CDVInvokedUrlCommand *)command
+{
+ if (command.arguments.count > 0) {
+ id value = [command.arguments objectAtIndex:0];
+ if (!([value isKindOfClass:[NSNumber class]])) {
+ value = [NSNumber numberWithBool:NO];
+ }
+
+ self.hideFormAccessoryBar = [value boolValue];
+ }
+
+ [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.hideFormAccessoryBar]
+ callbackId:command.callbackId];
+}
+
+- (void)hide:(CDVInvokedUrlCommand *)command
+{
+ [self.webView endEditing:YES];
+}
+
+- (void)setResizeMode:(CDVInvokedUrlCommand *)command
+{
+ NSString * mode = [command.arguments objectAtIndex:0];
+ if ([mode isEqualToString:@"ionic"]) {
+ self.keyboardResizes = ResizeIonic;
+ } else if ([mode isEqualToString:@"body"]) {
+ self.keyboardResizes = ResizeBody;
+ } else if ([mode isEqualToString:@"native"]) {
+ self.keyboardResizes = ResizeNative;
+ } else {
+ self.keyboardResizes = ResizeNone;
+ }
+}
+
+- (void)keyboardStyle:(CDVInvokedUrlCommand*)command
+{
+ id value = [command.arguments objectAtIndex:0];
+ if ([value isKindOfClass:[NSString class]]) {
+ value = [(NSString*)value lowercaseString];
+ } else {
+ value = @"light";
+ }
+
+ self.keyboardStyle = value;
+}
+
+- (void)disableScroll:(CDVInvokedUrlCommand*)command {
+ if (!command.arguments || ![command.arguments count]){
+ return;
+ }
+ id value = [command.arguments objectAtIndex:0];
+ if (value != [NSNull null]) {
+ self.disableScroll = [value boolValue];
+ }
+}
+
+#pragma mark dealloc
+
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVConnection.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVConnection.h
deleted file mode 100644
index 8add0279..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVConnection.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import <Cordova/CDVPlugin.h>
-#import "CDVReachability.h"
-
-@interface CDVConnection : CDVPlugin {
- NSString* type;
- NSString* _callbackId;
-
- CDVReachability* internetReach;
-}
-
-@property (copy) NSString* connectionType;
-@property (strong) CDVReachability* internetReach;
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVConnection.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVConnection.m
deleted file mode 100644
index 6715322a..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVConnection.m
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-#import <CoreTelephony/CTTelephonyNetworkInfo.h>
-
-#import "CDVConnection.h"
-#import "CDVReachability.h"
-
-@interface CDVConnection (PrivateMethods)
-- (void)updateOnlineStatus;
-- (void)sendPluginResult;
-@end
-
-@implementation CDVConnection
-
-@synthesize connectionType, internetReach;
-
-- (void)getConnectionInfo:(CDVInvokedUrlCommand*)command
-{
- _callbackId = command.callbackId;
- [self sendPluginResult];
-}
-
-- (void)sendPluginResult
-{
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:self.connectionType];
-
- [result setKeepCallbackAsBool:YES];
- [self.commandDelegate sendPluginResult:result callbackId:_callbackId];
-}
-
-- (NSString*)w3cConnectionTypeFor:(CDVReachability*)reachability
-{
- NetworkStatus networkStatus = [reachability currentReachabilityStatus];
-
- switch (networkStatus) {
- case NotReachable:
- return @"none";
-
- case ReachableViaWWAN:
- {
- BOOL isConnectionRequired = [reachability connectionRequired];
- if (isConnectionRequired) {
- return @"none";
- } else {
- if ([[[UIDevice currentDevice] systemVersion] compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending) {
- CTTelephonyNetworkInfo *telephonyInfo = [CTTelephonyNetworkInfo new];
- if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyGPRS]) {
- return @"2g";
- } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyEdge]) {
- return @"2g";
- } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyWCDMA]) {
- return @"3g";
- } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSDPA]) {
- return @"3g";
- } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSUPA]) {
- return @"3g";
- } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMA1x]) {
- return @"3g";
- } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORev0]) {
- return @"3g";
- } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevA]) {
- return @"3g";
- } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevB]) {
- return @"3g";
- } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyeHRPD]) {
- return @"3g";
- } else if ([telephonyInfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyLTE]) {
- return @"4g";
- }
- }
- return @"cellular";
- }
- }
- case ReachableViaWiFi:
- return @"wifi";
-
- default:
- return @"unknown";
- }
-}
-
-- (BOOL)isCellularConnection:(NSString*)theConnectionType
-{
- return [theConnectionType isEqualToString:@"2g"] ||
- [theConnectionType isEqualToString:@"3g"] ||
- [theConnectionType isEqualToString:@"4g"] ||
- [theConnectionType isEqualToString:@"cellular"];
-}
-
-- (void)updateReachability:(CDVReachability*)reachability
-{
- if (reachability) {
- // check whether the connection type has changed
- NSString* newConnectionType = [self w3cConnectionTypeFor:reachability];
- if ([newConnectionType isEqualToString:self.connectionType]) { // the same as before, remove dupes
- return;
- } else {
- self.connectionType = [self w3cConnectionTypeFor:reachability];
- }
- }
- [self sendPluginResult];
-}
-
-- (void)updateConnectionType:(NSNotification*)note
-{
- CDVReachability* curReach = [note object];
-
- if ((curReach != nil) && [curReach isKindOfClass:[CDVReachability class]]) {
- [self updateReachability:curReach];
- }
-}
-
-- (void)onPause
-{
- [self.internetReach stopNotifier];
-}
-
-- (void)onResume
-{
- [self.internetReach startNotifier];
- [self updateReachability:self.internetReach];
-}
-
-- (void)pluginInitialize
-{
- self.connectionType = @"none";
- self.internetReach = [CDVReachability reachabilityForInternetConnection];
- self.connectionType = [self w3cConnectionTypeFor:self.internetReach];
- [self.internetReach startNotifier];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateConnectionType:)
- name:kReachabilityChangedNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateConnectionType:)
- name:CTRadioAccessTechnologyDidChangeNotification object:nil];
- if (UIApplicationDidEnterBackgroundNotification && UIApplicationWillEnterForegroundNotification) {
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume) name:UIApplicationWillEnterForegroundNotification object:nil];
- }
-}
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVReachability.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVReachability.h
deleted file mode 100644
index 01a95c35..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVReachability.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
-
- File: Reachability.h
- Abstract: Basic demonstration of how to use the SystemConfiguration Reachability APIs.
- Version: 2.2
-
- Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
- ("Apple") in consideration of your agreement to the following terms, and your
- use, installation, modification or redistribution of this Apple software
- constitutes acceptance of these terms. If you do not agree with these terms,
- please do not use, install, modify or redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and subject
- to these terms, Apple grants you a personal, non-exclusive license, under
- Apple's copyrights in this original Apple software (the "Apple Software"), to
- use, reproduce, modify and redistribute the Apple Software, with or without
- modifications, in source and/or binary forms; provided that if you redistribute
- the Apple Software in its entirety and without modifications, you must retain
- this notice and the following text and disclaimers in all such redistributions
- of the Apple Software.
- Neither the name, trademarks, service marks or logos of Apple Inc. may be used
- to endorse or promote products derived from the Apple Software without specific
- prior written permission from Apple. Except as expressly stated in this notice,
- no other rights or licenses, express or implied, are granted by Apple herein,
- including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be
- incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
- WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
- WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
- COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
- DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
- CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
- APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Copyright (C) 2010 Apple Inc. All Rights Reserved.
-
-*/
-
-#import <Foundation/Foundation.h>
-#import <SystemConfiguration/SystemConfiguration.h>
-#import <netinet/in.h>
-
-typedef enum {
- NotReachable = 0,
- ReachableViaWWAN, // this value has been swapped with ReachableViaWiFi for Cordova backwards compat. reasons
- ReachableViaWiFi // this value has been swapped with ReachableViaWWAN for Cordova backwards compat. reasons
-} NetworkStatus;
-#define kReachabilityChangedNotification @"kNetworkReachabilityChangedNotification"
-
-@interface CDVReachability : NSObject
-{
- BOOL localWiFiRef;
- SCNetworkReachabilityRef reachabilityRef;
-}
-
-// reachabilityWithHostName- Use to check the reachability of a particular host name.
-+ (CDVReachability*)reachabilityWithHostName:(NSString*)hostName;
-
-// reachabilityWithAddress- Use to check the reachability of a particular IP address.
-+ (CDVReachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
-
-// reachabilityForInternetConnection- checks whether the default route is available.
-// Should be used by applications that do not connect to a particular host
-+ (CDVReachability*)reachabilityForInternetConnection;
-
-// reachabilityForLocalWiFi- checks whether a local wifi connection is available.
-+ (CDVReachability*)reachabilityForLocalWiFi;
-
-// Start listening for reachability notifications on the current run loop
-- (BOOL)startNotifier;
-- (void)stopNotifier;
-
-- (NetworkStatus)currentReachabilityStatus;
-// WWAN may be available, but not active until a connection has been established.
-// WiFi may require a connection for VPN on Demand.
-- (BOOL)connectionRequired;
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVReachability.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVReachability.m
deleted file mode 100644
index 1399867e..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-network-information/CDVReachability.m
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
-
- File: Reachability.m
- Abstract: Basic demonstration of how to use the SystemConfiguration Reachability APIs.
- Version: 2.2
-
- Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple Inc.
- ("Apple") in consideration of your agreement to the following terms, and your
- use, installation, modification or redistribution of this Apple software
- constitutes acceptance of these terms. If you do not agree with these terms,
- please do not use, install, modify or redistribute this Apple software.
-
- In consideration of your agreement to abide by the following terms, and subject
- to these terms, Apple grants you a personal, non-exclusive license, under
- Apple's copyrights in this original Apple software (the "Apple Software"), to
- use, reproduce, modify and redistribute the Apple Software, with or without
- modifications, in source and/or binary forms; provided that if you redistribute
- the Apple Software in its entirety and without modifications, you must retain
- this notice and the following text and disclaimers in all such redistributions
- of the Apple Software.
- Neither the name, trademarks, service marks or logos of Apple Inc. may be used
- to endorse or promote products derived from the Apple Software without specific
- prior written permission from Apple. Except as expressly stated in this notice,
- no other rights or licenses, express or implied, are granted by Apple herein,
- including but not limited to any patent rights that may be infringed by your
- derivative works or by other works in which the Apple Software may be
- incorporated.
-
- The Apple Software is provided by Apple on an "AS IS" basis. APPLE MAKES NO
- WARRANTIES, EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION THE IMPLIED
- WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- PURPOSE, REGARDING THE APPLE SOFTWARE OR ITS USE AND OPERATION ALONE OR IN
- COMBINATION WITH YOUR PRODUCTS.
-
- IN NO EVENT SHALL APPLE BE LIABLE FOR ANY SPECIAL, INDIRECT, INCIDENTAL OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
- GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- ARISING IN ANY WAY OUT OF THE USE, REPRODUCTION, MODIFICATION AND/OR
- DISTRIBUTION OF THE APPLE SOFTWARE, HOWEVER CAUSED AND WHETHER UNDER THEORY OF
- CONTRACT, TORT (INCLUDING NEGLIGENCE), STRICT LIABILITY OR OTHERWISE, EVEN IF
- APPLE HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- Copyright (C) 2010 Apple Inc. All Rights Reserved.
-
-*/
-
-#import <sys/socket.h>
-#import <netinet/in.h>
-#import <netinet6/in6.h>
-#import <arpa/inet.h>
-#import <ifaddrs.h>
-#import <netdb.h>
-
-#import <CoreFoundation/CoreFoundation.h>
-
-#import "CDVReachability.h"
-
-#define kShouldPrintReachabilityFlags 0
-
-static void CDVPrintReachabilityFlags(SCNetworkReachabilityFlags flags, const char* comment)
-{
-#if kShouldPrintReachabilityFlags
- NSLog(@"Reachability Flag Status: %c%c %c%c%c%c%c%c%c %s\n",
- (flags & kSCNetworkReachabilityFlagsIsWWAN) ? 'W' : '-',
- (flags & kSCNetworkReachabilityFlagsReachable) ? 'R' : '-',
-
- (flags & kSCNetworkReachabilityFlagsTransientConnection) ? 't' : '-',
- (flags & kSCNetworkReachabilityFlagsConnectionRequired) ? 'c' : '-',
- (flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) ? 'C' : '-',
- (flags & kSCNetworkReachabilityFlagsInterventionRequired) ? 'i' : '-',
- (flags & kSCNetworkReachabilityFlagsConnectionOnDemand) ? 'D' : '-',
- (flags & kSCNetworkReachabilityFlagsIsLocalAddress) ? 'l' : '-',
- (flags & kSCNetworkReachabilityFlagsIsDirect) ? 'd' : '-',
- comment
- );
-#endif
-}
-
-@implementation CDVReachability
-
-static void CDVReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void* info)
-{
-#pragma unused (target, flags)
- // NSCAssert(info != NULL, @"info was NULL in ReachabilityCallback");
- // NSCAssert([(NSObject*) info isKindOfClass: [Reachability class]], @"info was wrong class in ReachabilityCallback");
-
- // Converted the asserts above to conditionals, with safe return from the function
- if (info == NULL) {
- NSLog(@"info was NULL in ReachabilityCallback");
- return;
- }
-
- if (![(__bridge NSObject*)info isKindOfClass :[CDVReachability class]]) {
- NSLog(@"info was wrong class in ReachabilityCallback");
- return;
- }
-
- // We're on the main RunLoop, so an NSAutoreleasePool is not necessary, but is added defensively
- // in case someon uses the Reachability object in a different thread.
- @autoreleasepool {
- CDVReachability* noteObject = (__bridge CDVReachability*)info;
- // Post a notification to notify the client that the network reachability changed.
- [[NSNotificationCenter defaultCenter] postNotificationName:kReachabilityChangedNotification object:noteObject];
- }
-}
-
-- (BOOL)startNotifier
-{
- BOOL retVal = NO;
- SCNetworkReachabilityContext context = {0, (__bridge void*)(self), NULL, NULL, NULL};
-
- if (SCNetworkReachabilitySetCallback(reachabilityRef, CDVReachabilityCallback, &context)) {
- if (SCNetworkReachabilityScheduleWithRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode)) {
- retVal = YES;
- }
- }
- return retVal;
-}
-
-- (void)stopNotifier
-{
- if (reachabilityRef != NULL) {
- SCNetworkReachabilityUnscheduleFromRunLoop(reachabilityRef, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
- }
-}
-
-- (void)dealloc
-{
- [self stopNotifier];
- if (reachabilityRef != NULL) {
- CFRelease(reachabilityRef);
- }
-}
-
-+ (CDVReachability*)reachabilityWithHostName:(NSString*)hostName;
-{
- CDVReachability* retVal = NULL;
- SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, [hostName UTF8String]);
- if (reachability != NULL) {
- retVal = [[self alloc] init];
- if (retVal != NULL) {
- retVal->reachabilityRef = reachability;
- retVal->localWiFiRef = NO;
- }
- else {
- CFRelease(reachability);
- }
- }
- return retVal;
-}
-
-+ (CDVReachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
-{
- SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
- CDVReachability* retVal = NULL;
- if (reachability != NULL) {
- retVal = [[self alloc] init];
- if (retVal != NULL) {
- retVal->reachabilityRef = reachability;
- retVal->localWiFiRef = NO;
- }
- else {
- CFRelease(reachability);
- }
- }
- return retVal;
-}
-
-+ (CDVReachability*)reachabilityForInternetConnection;
-{
- struct sockaddr_in zeroAddress;
- bzero(&zeroAddress, sizeof(zeroAddress));
- zeroAddress.sin_len = sizeof(zeroAddress);
- zeroAddress.sin_family = AF_INET;
- return [self reachabilityWithAddress:&zeroAddress];
-}
-
-+ (CDVReachability*)reachabilityForLocalWiFi;
-{
- struct sockaddr_in localWifiAddress;
- bzero(&localWifiAddress, sizeof(localWifiAddress));
- localWifiAddress.sin_len = sizeof(localWifiAddress);
- localWifiAddress.sin_family = AF_INET;
- // IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
- localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
- CDVReachability* retVal = [self reachabilityWithAddress:&localWifiAddress];
- if (retVal != NULL) {
- retVal->localWiFiRef = YES;
- }
- return retVal;
-}
-
-#pragma mark Network Flag Handling
-
-- (NetworkStatus)localWiFiStatusForFlags:(SCNetworkReachabilityFlags)flags
-{
- CDVPrintReachabilityFlags(flags, "localWiFiStatusForFlags");
-
- BOOL retVal = NotReachable;
- if ((flags & kSCNetworkReachabilityFlagsReachable) && (flags & kSCNetworkReachabilityFlagsIsDirect)) {
- retVal = ReachableViaWiFi;
- }
- return retVal;
-}
-
-- (NetworkStatus)networkStatusForFlags:(SCNetworkReachabilityFlags)flags
-{
- CDVPrintReachabilityFlags(flags, "networkStatusForFlags");
- if ((flags & kSCNetworkReachabilityFlagsReachable) == 0) {
- // if target host is not reachable
- return NotReachable;
- }
-
- NetworkStatus retVal = NotReachable;
-
- if ((flags & kSCNetworkReachabilityFlagsConnectionRequired) == 0) {
- // if target host is reachable and no connection is required
- // then we'll assume (for now) that your on Wi-Fi
- retVal = ReachableViaWiFi;
- }
-
- if ((((flags & kSCNetworkReachabilityFlagsConnectionOnDemand) != 0) ||
- ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0))) {
- // ... and the connection is on-demand (or on-traffic) if the
- // calling application is using the CFSocketStream or higher APIs
-
- if ((flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0) {
- // ... and no [user] intervention is needed
- retVal = ReachableViaWiFi;
- }
- }
-
- if ((flags & kSCNetworkReachabilityFlagsIsWWAN) == kSCNetworkReachabilityFlagsIsWWAN) {
- // ... but WWAN connections are OK if the calling application
- // is using the CFNetwork (CFSocketStream?) APIs.
- retVal = ReachableViaWWAN;
- }
- return retVal;
-}
-
-- (BOOL)connectionRequired;
-{
- NSAssert(reachabilityRef != NULL, @"connectionRequired called with NULL reachabilityRef");
- SCNetworkReachabilityFlags flags;
- if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
- return flags & kSCNetworkReachabilityFlagsConnectionRequired;
- }
- return NO;
-}
-
-- (NetworkStatus)currentReachabilityStatus
-{
- NSAssert(reachabilityRef != NULL, @"currentNetworkStatus called with NULL reachabilityRef");
- NetworkStatus retVal = NotReachable;
- SCNetworkReachabilityFlags flags;
- if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
- if (localWiFiRef) {
- retVal = [self localWiFiStatusForFlags:flags];
- } else {
- retVal = [self networkStatusForFlags:flags];
- }
- }
- return retVal;
-}
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.h
deleted file mode 100644
index ec5d6022..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import <Foundation/Foundation.h>
-#import <Cordova/CDVPlugin.h>
-
-typedef struct {
- BOOL iPhone;
- BOOL iPad;
- BOOL iPhone4;
- BOOL iPhone5;
- BOOL iPhone6;
- BOOL iPhone6Plus;
- BOOL retina;
-
-} CDV_iOSDevice;
-
-@interface CDVSplashScreen : CDVPlugin {
- UIActivityIndicatorView* _activityView;
- UIImageView* _imageView;
- NSString* _curImageName;
- BOOL _visible;
- BOOL _destroyed;
-}
-
-- (void)show:(CDVInvokedUrlCommand*)command;
-- (void)hide:(CDVInvokedUrlCommand*)command;
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.m
deleted file mode 100644
index ab97055a..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVSplashScreen.m
+++ /dev/null
@@ -1,506 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import "CDVSplashScreen.h"
-#import <Cordova/CDVViewController.h>
-#import <Cordova/CDVScreenOrientationDelegate.h>
-#import "CDVViewController+SplashScreen.h"
-
-#define kSplashScreenDurationDefault 3000.0f
-#define kFadeDurationDefault 500.0f
-
-
-@implementation CDVSplashScreen
-
-- (void)pluginInitialize
-{
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad) name:CDVPageDidLoadNotification object:nil];
-
- [self setVisible:YES];
-}
-
-- (void)show:(CDVInvokedUrlCommand*)command
-{
- [self setVisible:YES];
-}
-
-- (void)hide:(CDVInvokedUrlCommand*)command
-{
- [self setVisible:NO andForce:YES];
-}
-
-- (void)pageDidLoad
-{
- id autoHideSplashScreenValue = [self.commandDelegate.settings objectForKey:[@"AutoHideSplashScreen" lowercaseString]];
-
- // if value is missing, default to yes
- if ((autoHideSplashScreenValue == nil) || [autoHideSplashScreenValue boolValue]) {
- [self setVisible:NO];
- }
-}
-
-- (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NSDictionary*)change context:(void*)context
-{
- [self updateImage];
-}
-
-- (void)createViews
-{
- /*
- * The Activity View is the top spinning throbber in the status/battery bar. We init it with the default Grey Style.
- *
- * whiteLarge = UIActivityIndicatorViewStyleWhiteLarge
- * white = UIActivityIndicatorViewStyleWhite
- * gray = UIActivityIndicatorViewStyleGray
- *
- */
-
- // Determine whether rotation should be enabled for this device
- // Per iOS HIG, landscape is only supported on iPad and iPhone 6+
- CDV_iOSDevice device = [self getCurrentDevice];
- BOOL autorotateValue = (device.iPad || device.iPhone6Plus) ?
- [(CDVViewController *)self.viewController shouldAutorotateDefaultValue] :
- NO;
-
- [(CDVViewController *)self.viewController setEnabledAutorotation:autorotateValue];
-
- NSString* topActivityIndicator = [self.commandDelegate.settings objectForKey:[@"TopActivityIndicator" lowercaseString]];
- UIActivityIndicatorViewStyle topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;
-
- if ([topActivityIndicator isEqualToString:@"whiteLarge"])
- {
- topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhiteLarge;
- }
- else if ([topActivityIndicator isEqualToString:@"white"])
- {
- topActivityIndicatorStyle = UIActivityIndicatorViewStyleWhite;
- }
- else if ([topActivityIndicator isEqualToString:@"gray"])
- {
- topActivityIndicatorStyle = UIActivityIndicatorViewStyleGray;
- }
-
- UIView* parentView = self.viewController.view;
- parentView.userInteractionEnabled = NO; // disable user interaction while splashscreen is shown
- _activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:topActivityIndicatorStyle];
- _activityView.center = CGPointMake(parentView.bounds.size.width / 2, parentView.bounds.size.height / 2);
- _activityView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleLeftMargin
- | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleRightMargin;
- [_activityView startAnimating];
-
- // Set the frame & image later.
- _imageView = [[UIImageView alloc] init];
- [parentView addSubview:_imageView];
-
- id showSplashScreenSpinnerValue = [self.commandDelegate.settings objectForKey:[@"ShowSplashScreenSpinner" lowercaseString]];
- // backwards compatibility - if key is missing, default to true
- if ((showSplashScreenSpinnerValue == nil) || [showSplashScreenSpinnerValue boolValue])
- {
- [parentView addSubview:_activityView];
- }
-
- // Frame is required when launching in portrait mode.
- // Bounds for landscape since it captures the rotation.
- [parentView addObserver:self forKeyPath:@"frame" options:0 context:nil];
- [parentView addObserver:self forKeyPath:@"bounds" options:0 context:nil];
-
- [self updateImage];
- _destroyed = NO;
-}
-
-- (void)hideViews
-{
- [_imageView setAlpha:0];
- [_activityView setAlpha:0];
-}
-
-- (void)destroyViews
-{
- _destroyed = YES;
- [(CDVViewController *)self.viewController setEnabledAutorotation:[(CDVViewController *)self.viewController shouldAutorotateDefaultValue]];
-
- [_imageView removeFromSuperview];
- [_activityView removeFromSuperview];
- _imageView = nil;
- _activityView = nil;
- _curImageName = nil;
-
- self.viewController.view.userInteractionEnabled = YES; // re-enable user interaction upon completion
- @try {
- [self.viewController.view removeObserver:self forKeyPath:@"frame"];
- [self.viewController.view removeObserver:self forKeyPath:@"bounds"];
- }
- @catch (NSException *exception) {
- // When reloading the page from a remotely connected Safari, there
- // are no observers, so the removeObserver method throws an exception,
- // that we can safely ignore.
- // Alternatively we can check whether there are observers before calling removeObserver
- }
-}
-
-- (CDV_iOSDevice) getCurrentDevice
-{
- CDV_iOSDevice device;
-
- UIScreen* mainScreen = [UIScreen mainScreen];
- CGFloat mainScreenHeight = mainScreen.bounds.size.height;
- CGFloat mainScreenWidth = mainScreen.bounds.size.width;
-
- int limit = MAX(mainScreenHeight,mainScreenWidth);
-
- device.iPad = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad);
- device.iPhone = (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone);
- device.retina = ([mainScreen scale] == 2.0);
- device.iPhone4 = (device.iPhone && limit == 480.0);
- device.iPhone5 = (device.iPhone && limit == 568.0);
- // note these below is not a true device detect, for example if you are on an
- // iPhone 6/6+ but the app is scaled it will prob set iPhone5 as true, but
- // this is appropriate for detecting the runtime screen environment
- device.iPhone6 = (device.iPhone && limit == 667.0);
- device.iPhone6Plus = (device.iPhone && limit == 736.0);
-
- return device;
-}
-
-- (BOOL) isUsingCDVLaunchScreen {
- NSString* launchStoryboardName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchStoryboardName"];
- if (launchStoryboardName) {
- return ([launchStoryboardName isEqualToString:@"CDVLaunchScreen"]);
- } else {
- return NO;
- }
-}
-
-- (NSString*)getImageName:(UIInterfaceOrientation)currentOrientation delegate:(id<CDVScreenOrientationDelegate>)orientationDelegate device:(CDV_iOSDevice)device
-{
- // Use UILaunchImageFile if specified in plist. Otherwise, use Default.
- NSString* imageName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UILaunchImageFile"];
-
- // detect if we are using CB-9762 Launch Storyboard; if so, return the associated image instead
- if ([self isUsingCDVLaunchScreen]) {
- imageName = @"LaunchStoryboard";
- return imageName;
- }
-
- NSUInteger supportedOrientations = [orientationDelegate supportedInterfaceOrientations];
-
- // Checks to see if the developer has locked the orientation to use only one of Portrait or Landscape
- BOOL supportsLandscape = (supportedOrientations & UIInterfaceOrientationMaskLandscape);
- BOOL supportsPortrait = (supportedOrientations & UIInterfaceOrientationMaskPortrait || supportedOrientations & UIInterfaceOrientationMaskPortraitUpsideDown);
- // this means there are no mixed orientations in there
- BOOL isOrientationLocked = !(supportsPortrait && supportsLandscape);
-
- if (imageName)
- {
- imageName = [imageName stringByDeletingPathExtension];
- }
- else
- {
- imageName = @"Default";
- }
-
- // Add Asset Catalog specific prefixes
- if ([imageName isEqualToString:@"LaunchImage"])
- {
- if (device.iPhone4 || device.iPhone5 || device.iPad) {
- imageName = [imageName stringByAppendingString:@"-700"];
- } else if(device.iPhone6) {
- imageName = [imageName stringByAppendingString:@"-800"];
- } else if(device.iPhone6Plus) {
- imageName = [imageName stringByAppendingString:@"-800"];
- if (currentOrientation == UIInterfaceOrientationPortrait || currentOrientation == UIInterfaceOrientationPortraitUpsideDown)
- {
- imageName = [imageName stringByAppendingString:@"-Portrait"];
- }
- }
- }
-
- if (device.iPhone5)
- { // does not support landscape
- imageName = [imageName stringByAppendingString:@"-568h"];
- }
- else if (device.iPhone6)
- { // does not support landscape
- imageName = [imageName stringByAppendingString:@"-667h"];
- }
- else if (device.iPhone6Plus)
- { // supports landscape
- if (isOrientationLocked)
- {
- imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"")];
- }
- else
- {
- switch (currentOrientation)
- {
- case UIInterfaceOrientationLandscapeLeft:
- case UIInterfaceOrientationLandscapeRight:
- imageName = [imageName stringByAppendingString:@"-Landscape"];
- break;
- default:
- break;
- }
- }
- imageName = [imageName stringByAppendingString:@"-736h"];
-
- }
- else if (device.iPad)
- { // supports landscape
- if (isOrientationLocked)
- {
- imageName = [imageName stringByAppendingString:(supportsLandscape ? @"-Landscape" : @"-Portrait")];
- }
- else
- {
- switch (currentOrientation)
- {
- case UIInterfaceOrientationLandscapeLeft:
- case UIInterfaceOrientationLandscapeRight:
- imageName = [imageName stringByAppendingString:@"-Landscape"];
- break;
-
- case UIInterfaceOrientationPortrait:
- case UIInterfaceOrientationPortraitUpsideDown:
- default:
- imageName = [imageName stringByAppendingString:@"-Portrait"];
- break;
- }
- }
- }
-
- return imageName;
-}
-
-- (UIInterfaceOrientation)getCurrentOrientation
-{
- UIInterfaceOrientation iOrientation = [UIApplication sharedApplication].statusBarOrientation;
- UIDeviceOrientation dOrientation = [UIDevice currentDevice].orientation;
-
- bool landscape;
-
- if (dOrientation == UIDeviceOrientationUnknown || dOrientation == UIDeviceOrientationFaceUp || dOrientation == UIDeviceOrientationFaceDown) {
- // If the device is laying down, use the UIInterfaceOrientation based on the status bar.
- landscape = UIInterfaceOrientationIsLandscape(iOrientation);
- } else {
- // If the device is not laying down, use UIDeviceOrientation.
- landscape = UIDeviceOrientationIsLandscape(dOrientation);
-
- // There's a bug in iOS!!!! http://openradar.appspot.com/7216046
- // So values needs to be reversed for landscape!
- if (dOrientation == UIDeviceOrientationLandscapeLeft)
- {
- iOrientation = UIInterfaceOrientationLandscapeRight;
- }
- else if (dOrientation == UIDeviceOrientationLandscapeRight)
- {
- iOrientation = UIInterfaceOrientationLandscapeLeft;
- }
- else if (dOrientation == UIDeviceOrientationPortrait)
- {
- iOrientation = UIInterfaceOrientationPortrait;
- }
- else if (dOrientation == UIDeviceOrientationPortraitUpsideDown)
- {
- iOrientation = UIInterfaceOrientationPortraitUpsideDown;
- }
- }
-
- return iOrientation;
-}
-
-// Sets the view's frame and image.
-- (void)updateImage
-{
- NSString* imageName = [self getImageName:[self getCurrentOrientation] delegate:(id<CDVScreenOrientationDelegate>)self.viewController device:[self getCurrentDevice]];
-
- if (![imageName isEqualToString:_curImageName])
- {
- UIImage* img = [UIImage imageNamed:imageName];
- _imageView.image = img;
- _curImageName = imageName;
- }
-
- // Check that splash screen's image exists before updating bounds
- if (_imageView.image)
- {
- [self updateBounds];
- }
- else
- {
- NSLog(@"WARNING: The splashscreen image named %@ was not found", imageName);
- }
-}
-
-- (void)updateBounds
-{
- if ([self isUsingCDVLaunchScreen]) {
- // CB-9762's launch screen expects the image to fill the screen and be scaled using AspectFill.
- CGSize viewportSize = [UIApplication sharedApplication].delegate.window.bounds.size;
- _imageView.frame = CGRectMake(0, 0, viewportSize.width, viewportSize.height);
- _imageView.contentMode = UIViewContentModeScaleAspectFill;
- return;
- }
-
- UIImage* img = _imageView.image;
- CGRect imgBounds = (img) ? CGRectMake(0, 0, img.size.width, img.size.height) : CGRectZero;
-
- CGSize screenSize = [self.viewController.view convertRect:[UIScreen mainScreen].bounds fromView:nil].size;
- UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
- CGAffineTransform imgTransform = CGAffineTransformIdentity;
-
- /* If and only if an iPhone application is landscape-only as per
- * UISupportedInterfaceOrientations, the view controller's orientation is
- * landscape. In this case the image must be rotated in order to appear
- * correctly.
- */
- CDV_iOSDevice device = [self getCurrentDevice];
- if (UIInterfaceOrientationIsLandscape(orientation) && !device.iPhone6Plus && !device.iPad)
- {
- imgTransform = CGAffineTransformMakeRotation(M_PI / 2);
- imgBounds.size = CGSizeMake(imgBounds.size.height, imgBounds.size.width);
- }
-
- // There's a special case when the image is the size of the screen.
- if (CGSizeEqualToSize(screenSize, imgBounds.size))
- {
- CGRect statusFrame = [self.viewController.view convertRect:[UIApplication sharedApplication].statusBarFrame fromView:nil];
- if (!(IsAtLeastiOSVersion(@"7.0")))
- {
- imgBounds.origin.y -= statusFrame.size.height;
- }
- }
- else if (imgBounds.size.width > 0)
- {
- CGRect viewBounds = self.viewController.view.bounds;
- CGFloat imgAspect = imgBounds.size.width / imgBounds.size.height;
- CGFloat viewAspect = viewBounds.size.width / viewBounds.size.height;
- // This matches the behaviour of the native splash screen.
- CGFloat ratio;
- if (viewAspect > imgAspect)
- {
- ratio = viewBounds.size.width / imgBounds.size.width;
- }
- else
- {
- ratio = viewBounds.size.height / imgBounds.size.height;
- }
- imgBounds.size.height *= ratio;
- imgBounds.size.width *= ratio;
- }
-
- _imageView.transform = imgTransform;
- _imageView.frame = imgBounds;
-}
-
-- (void)setVisible:(BOOL)visible
-{
- [self setVisible:visible andForce:NO];
-}
-
-- (void)setVisible:(BOOL)visible andForce:(BOOL)force
-{
- if (visible != _visible || force)
- {
- _visible = visible;
-
- id fadeSplashScreenValue = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreen" lowercaseString]];
- id fadeSplashScreenDuration = [self.commandDelegate.settings objectForKey:[@"FadeSplashScreenDuration" lowercaseString]];
-
- float fadeDuration = fadeSplashScreenDuration == nil ? kFadeDurationDefault : [fadeSplashScreenDuration floatValue];
-
- id splashDurationString = [self.commandDelegate.settings objectForKey: [@"SplashScreenDelay" lowercaseString]];
- float splashDuration = splashDurationString == nil ? kSplashScreenDurationDefault : [splashDurationString floatValue];
-
- id autoHideSplashScreenValue = [self.commandDelegate.settings objectForKey:[@"AutoHideSplashScreen" lowercaseString]];
- BOOL autoHideSplashScreen = true;
-
- if (autoHideSplashScreenValue != nil) {
- autoHideSplashScreen = [autoHideSplashScreenValue boolValue];
- }
-
- if (!autoHideSplashScreen) {
- // CB-10412 SplashScreenDelay does not make sense if the splashscreen is hidden manually
- splashDuration = 0;
- }
-
-
- if (fadeSplashScreenValue == nil)
- {
- fadeSplashScreenValue = @"true";
- }
-
- if (![fadeSplashScreenValue boolValue])
- {
- fadeDuration = 0;
- }
- else if (fadeDuration < 30)
- {
- // [CB-9750] This value used to be in decimal seconds, so we will assume that if someone specifies 10
- // they mean 10 seconds, and not the meaningless 10ms
- fadeDuration *= 1000;
- }
-
- if (_visible)
- {
- if (_imageView == nil)
- {
- [self createViews];
- }
- }
- else if (fadeDuration == 0 && splashDuration == 0)
- {
- [self destroyViews];
- }
- else
- {
- __weak __typeof(self) weakSelf = self;
- float effectiveSplashDuration;
-
- // [CB-10562] AutoHideSplashScreen may be "true" but we should still be able to hide the splashscreen manually.
- if (!autoHideSplashScreen || force) {
- effectiveSplashDuration = (fadeDuration) / 1000;
- } else {
- effectiveSplashDuration = (splashDuration - fadeDuration) / 1000;
- }
-
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (uint64_t) effectiveSplashDuration * NSEC_PER_SEC), dispatch_get_main_queue(), CFBridgingRelease(CFBridgingRetain(^(void) {
- if (!_destroyed) {
- [UIView transitionWithView:self.viewController.view
- duration:(fadeDuration / 1000)
- options:UIViewAnimationOptionTransitionNone
- animations:^(void) {
- [weakSelf hideViews];
- }
- completion:^(BOOL finished) {
- // Always destroy views, otherwise you could have an
- // invisible splashscreen that is overlayed over your active views
- // which causes that no touch events are passed
- if (!_destroyed) {
- [weakSelf destroyViews];
- // TODO: It might also be nice to have a js event happen here -jm
- }
- }
- ];
- }
- })));
- }
- }
-}
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.m
deleted file mode 100644
index e483def6..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-splashscreen/CDVViewController+SplashScreen.m
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import "CDVViewController+SplashScreen.h"
-#import <objc/runtime.h>
-
-@implementation CDVViewController (SplashScreen)
-
-@dynamic enabledAutorotation;
-
-- (void)setEnabledAutorotation:(BOOL)value
-{
- objc_setAssociatedObject(self,
- @selector(enabledAutorotation),
- [NSNumber numberWithBool:value],
- OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-- (BOOL)enabledAutorotation
-{
- NSNumber *number = (NSNumber *)objc_getAssociatedObject(self, @selector(enabledAutorotation));
-
- // Defaulting to YES to correspond parent CDVViewController behavior
- if (number == nil)
- {
- return YES;
- }
-
- return [number boolValue];
-}
-
-+ (void)load
-{
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- Class class = [self class];
-
- SEL originalSelector = @selector(shouldAutorotate);
- SEL swizzledSelector = @selector(splash_shouldAutorotate);
-
- Method originalMethod = class_getInstanceMethod(class, originalSelector);
- Method swizzledMethod = class_getInstanceMethod(class, swizzledSelector);
-
- BOOL didAddMethod = class_addMethod(class,
- originalSelector,
- method_getImplementation(swizzledMethod),
- method_getTypeEncoding(swizzledMethod));
-
- if (didAddMethod) {
- class_replaceMethod(class,
- swizzledSelector,
- method_getImplementation(originalMethod),
- method_getTypeEncoding(originalMethod));
- } else {
- method_exchangeImplementations(originalMethod, swizzledMethod);
- }
- });
-}
-
-#pragma mark - Method Swizzling
-
-- (BOOL)splash_shouldAutorotate
-{
- return self.enabledAutorotation;
-}
-
-
-- (BOOL)shouldAutorotateDefaultValue
-{
- return [self splash_shouldAutorotate];
-}
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-statusbar/CDVStatusBar.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-statusbar/CDVStatusBar.h
deleted file mode 100644
index 0be08cc3..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-statusbar/CDVStatusBar.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-#import <Cordova/CDVPlugin.h>
-#import <Cordova/CDVInvokedUrlCommand.h>
-
-@interface CDVStatusBar : CDVPlugin {
- @protected
- BOOL _statusBarOverlaysWebView;
- UIView* _statusBarBackgroundView;
- BOOL _uiviewControllerBasedStatusBarAppearance;
- UIColor* _statusBarBackgroundColor;
- NSString* _eventsCallbackId;
-}
-
-@property (atomic, assign) BOOL statusBarOverlaysWebView;
-@property (atomic, assign) BOOL statusBarVisible;
-
-- (void) overlaysWebView:(CDVInvokedUrlCommand*)command;
-
-- (void) styleDefault:(CDVInvokedUrlCommand*)command;
-- (void) styleLightContent:(CDVInvokedUrlCommand*)command;
-- (void) styleBlackTranslucent:(CDVInvokedUrlCommand*)command;
-- (void) styleBlackOpaque:(CDVInvokedUrlCommand*)command;
-
-- (void) backgroundColorByName:(CDVInvokedUrlCommand*)command;
-- (void) backgroundColorByHexString:(CDVInvokedUrlCommand*)command;
-
-- (void) hide:(CDVInvokedUrlCommand*)command;
-- (void) show:(CDVInvokedUrlCommand*)command;
-
-- (void) _ready:(CDVInvokedUrlCommand*)command;
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-statusbar/CDVStatusBar.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-statusbar/CDVStatusBar.m
deleted file mode 100644
index 58fbc296..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-statusbar/CDVStatusBar.m
+++ /dev/null
@@ -1,501 +0,0 @@
-/*
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- */
-
-/*
- NOTE: plugman/cordova cli should have already installed this,
- but you need the value UIViewControllerBasedStatusBarAppearance
- in your Info.plist as well to set the styles in iOS 7
- */
-
-#import "CDVStatusBar.h"
-#import <objc/runtime.h>
-#import <Cordova/CDVViewController.h>
-
-static const void *kHideStatusBar = &kHideStatusBar;
-static const void *kStatusBarStyle = &kStatusBarStyle;
-
-@interface CDVViewController (StatusBar)
-
-@property (nonatomic, retain) id sb_hideStatusBar;
-@property (nonatomic, retain) id sb_statusBarStyle;
-
-@end
-
-@implementation CDVViewController (StatusBar)
-
-@dynamic sb_hideStatusBar;
-@dynamic sb_statusBarStyle;
-
-- (id)sb_hideStatusBar {
- return objc_getAssociatedObject(self, kHideStatusBar);
-}
-
-- (void)setSb_hideStatusBar:(id)newHideStatusBar {
- objc_setAssociatedObject(self, kHideStatusBar, newHideStatusBar, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-- (id)sb_statusBarStyle {
- return objc_getAssociatedObject(self, kStatusBarStyle);
-}
-
-- (void)setSb_statusBarStyle:(id)newStatusBarStyle {
- objc_setAssociatedObject(self, kStatusBarStyle, newStatusBarStyle, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-- (BOOL) prefersStatusBarHidden {
- return [self.sb_hideStatusBar boolValue];
-}
-
-- (UIStatusBarStyle)preferredStatusBarStyle
-{
- return (UIStatusBarStyle)[self.sb_statusBarStyle intValue];
-}
-
-@end
-
-
-@interface CDVStatusBar () <UIScrollViewDelegate>
-- (void)fireTappedEvent;
-- (void)updateIsVisible:(BOOL)visible;
-@end
-
-@implementation CDVStatusBar
-
-- (id)settingForKey:(NSString*)key
-{
- return [self.commandDelegate.settings objectForKey:[key lowercaseString]];
-}
-
-- (void)observeValueForKeyPath:(NSString*)keyPath ofObject:(id)object change:(NSDictionary*)change context:(void*)context
-{
- if ([keyPath isEqual:@"statusBarHidden"]) {
- NSNumber* newValue = [change objectForKey:NSKeyValueChangeNewKey];
- [self updateIsVisible:![newValue boolValue]];
- }
-}
-
--(void)cordovaViewWillAppear:(NSNotification*)notification
-{
- [self resizeWebView];
-}
-
--(void)statusBarDidChangeFrame:(NSNotification*)notification
-{
- //add a small delay for iOS 7 ( 0.1 seconds )
- __weak CDVStatusBar* weakSelf = self;
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
- [weakSelf resizeWebView];
- });
-}
-
-- (void)pluginInitialize
-{
- BOOL isiOS7 = (IsAtLeastiOSVersion(@"7.0"));
-
- // init
- NSNumber* uiviewControllerBasedStatusBarAppearance = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIViewControllerBasedStatusBarAppearance"];
- _uiviewControllerBasedStatusBarAppearance = (uiviewControllerBasedStatusBarAppearance == nil || [uiviewControllerBasedStatusBarAppearance boolValue]) && isiOS7;
-
- // observe the statusBarHidden property
- [[UIApplication sharedApplication] addObserver:self forKeyPath:@"statusBarHidden" options:NSKeyValueObservingOptionNew context:NULL];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(statusBarDidChangeFrame:) name: UIApplicationDidChangeStatusBarFrameNotification object:nil];
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(cordovaViewWillAppear:) name: @"CDVViewWillAppearNotification" object:nil];
-
- _statusBarOverlaysWebView = YES; // default
-
- [self initializeStatusBarBackgroundView];
-
- self.viewController.view.autoresizesSubviews = YES;
-
- NSString* setting;
-
- setting = @"StatusBarBackgroundColor";
- if ([self settingForKey:setting]) {
- [self _backgroundColorByHexString:[self settingForKey:setting]];
- }
-
- setting = @"StatusBarStyle";
- if ([self settingForKey:setting]) {
- [self setStatusBarStyle:[self settingForKey:setting]];
- }
-
- // blank scroll view to intercept status bar taps
- self.webView.scrollView.scrollsToTop = NO;
- UIScrollView *fakeScrollView = [[UIScrollView alloc] initWithFrame:UIScreen.mainScreen.bounds];
- fakeScrollView.delegate = self;
- fakeScrollView.scrollsToTop = YES;
- [self.viewController.view addSubview:fakeScrollView]; // Add scrollview to the view heirarchy so that it will begin accepting status bar taps
- [self.viewController.view sendSubviewToBack:fakeScrollView]; // Send it to the very back of the view heirarchy
- fakeScrollView.contentSize = CGSizeMake(UIScreen.mainScreen.bounds.size.width, UIScreen.mainScreen.bounds.size.height * 2.0f); // Make the scroll view longer than the screen itself
- fakeScrollView.contentOffset = CGPointMake(0.0f, UIScreen.mainScreen.bounds.size.height); // Scroll down so a tap will take scroll view back to the top
-
- _statusBarVisible = ![UIApplication sharedApplication].isStatusBarHidden;
-}
-
-- (void)onReset {
- _eventsCallbackId = nil;
-}
-
-- (void)fireTappedEvent {
- if (_eventsCallbackId == nil) {
- return;
- }
- NSDictionary* payload = @{@"type": @"tap"};
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:payload];
- [result setKeepCallbackAsBool:YES];
- [self.commandDelegate sendPluginResult:result callbackId:_eventsCallbackId];
-}
-
-- (void)updateIsVisible:(BOOL)visible {
- if (_eventsCallbackId == nil) {
- return;
- }
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:visible];
- [result setKeepCallbackAsBool:YES];
- [self.commandDelegate sendPluginResult:result callbackId:_eventsCallbackId];
-}
-
-- (void) _ready:(CDVInvokedUrlCommand*)command
-{
- _eventsCallbackId = command.callbackId;
- [self updateIsVisible:![UIApplication sharedApplication].statusBarHidden];
- NSString* setting = @"StatusBarOverlaysWebView";
- if ([self settingForKey:setting]) {
- self.statusBarOverlaysWebView = [(NSNumber*)[self settingForKey:setting] boolValue];
- if (self.statusBarOverlaysWebView) {
- [self resizeWebView];
- }
- }
-}
-
-- (void) initializeStatusBarBackgroundView
-{
- CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
-
- if ([[UIApplication sharedApplication]statusBarOrientation] == UIInterfaceOrientationPortraitUpsideDown &&
- statusBarFrame.size.height + statusBarFrame.origin.y == [self.viewController.view.window bounds].size.height) {
-
- // When started in upside-down orientation on iOS 7, status bar will be bound to lower edge of the
- // screen (statusBarFrame.origin.y will be somewhere around screen height). In this case we need to
- // correct frame's coordinates
- statusBarFrame.origin.y = 0;
- }
-
- statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
-
- _statusBarBackgroundView = [[UIView alloc] initWithFrame:statusBarFrame];
- _statusBarBackgroundView.backgroundColor = _statusBarBackgroundColor;
- _statusBarBackgroundView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleBottomMargin);
- _statusBarBackgroundView.autoresizesSubviews = YES;
-}
-
-- (CGRect) invertFrameIfNeeded:(CGRect)rect {
- // landscape is where (width > height). On iOS < 8, we need to invert since frames are
- // always in Portrait context. Do not run this on ios 8 or above to avoid breaking ipad pro multitask layout
- if (!IsAtLeastiOSVersion(@"8.0") && UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) {
- CGFloat temp = rect.size.width;
- rect.size.width = rect.size.height;
- rect.size.height = temp;
- rect.origin = CGPointZero;
- }
-
- return rect;
-}
-
-- (void) setStatusBarOverlaysWebView:(BOOL)statusBarOverlaysWebView
-{
- // we only care about the latest iOS version or a change in setting
- if (!IsAtLeastiOSVersion(@"7.0") || statusBarOverlaysWebView == _statusBarOverlaysWebView) {
- return;
- }
-
- _statusBarOverlaysWebView = statusBarOverlaysWebView;
-
- [self resizeWebView];
-
- if (statusBarOverlaysWebView) {
-
- [_statusBarBackgroundView removeFromSuperview];
-
- } else {
-
- [self initializeStatusBarBackgroundView];
- [self.webView.superview addSubview:_statusBarBackgroundView];
-
- }
-
-}
-
-- (BOOL) statusBarOverlaysWebView
-{
- return _statusBarOverlaysWebView;
-}
-
-- (void) overlaysWebView:(CDVInvokedUrlCommand*)command
-{
- id value = [command argumentAtIndex:0];
- if (!([value isKindOfClass:[NSNumber class]])) {
- value = [NSNumber numberWithBool:YES];
- }
-
- self.statusBarOverlaysWebView = [value boolValue];
-}
-
-- (void) refreshStatusBarAppearance
-{
- SEL sel = NSSelectorFromString(@"setNeedsStatusBarAppearanceUpdate");
- if ([self.viewController respondsToSelector:sel]) {
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
- [self.viewController performSelector:sel withObject:nil];
-#pragma clang diagnostic pop
- }
-}
-
-- (void) setStyleForStatusBar:(UIStatusBarStyle)style
-{
- if (_uiviewControllerBasedStatusBarAppearance) {
- CDVViewController* vc = (CDVViewController*)self.viewController;
- vc.sb_statusBarStyle = [NSNumber numberWithInt:style];
- [self refreshStatusBarAppearance];
-
- } else {
- [[UIApplication sharedApplication] setStatusBarStyle:style];
- }
-}
-
-- (void) setStatusBarStyle:(NSString*)statusBarStyle
-{
- // default, lightContent, blackTranslucent, blackOpaque
- NSString* lcStatusBarStyle = [statusBarStyle lowercaseString];
-
- if ([lcStatusBarStyle isEqualToString:@"default"]) {
- [self styleDefault:nil];
- } else if ([lcStatusBarStyle isEqualToString:@"lightcontent"]) {
- [self styleLightContent:nil];
- } else if ([lcStatusBarStyle isEqualToString:@"blacktranslucent"]) {
- [self styleBlackTranslucent:nil];
- } else if ([lcStatusBarStyle isEqualToString:@"blackopaque"]) {
- [self styleBlackOpaque:nil];
- }
-}
-
-- (void) styleDefault:(CDVInvokedUrlCommand*)command
-{
- [self setStyleForStatusBar:UIStatusBarStyleDefault];
-}
-
-- (void) styleLightContent:(CDVInvokedUrlCommand*)command
-{
- [self setStyleForStatusBar:UIStatusBarStyleLightContent];
-}
-
-- (void) styleBlackTranslucent:(CDVInvokedUrlCommand*)command
-{
- #if __IPHONE_OS_VERSION_MAX_ALLOWED < 70000
- # define TRANSLUCENT_STYLE UIStatusBarStyleBlackTranslucent
- #else
- # define TRANSLUCENT_STYLE UIStatusBarStyleLightContent
- #endif
- [self setStyleForStatusBar:TRANSLUCENT_STYLE];
-}
-
-- (void) styleBlackOpaque:(CDVInvokedUrlCommand*)command
-{
- #if __IPHONE_OS_VERSION_MAX_ALLOWED < 70000
- # define OPAQUE_STYLE UIStatusBarStyleBlackOpaque
- #else
- # define OPAQUE_STYLE UIStatusBarStyleLightContent
- #endif
- [self setStyleForStatusBar:OPAQUE_STYLE];
-}
-
-- (void) backgroundColorByName:(CDVInvokedUrlCommand*)command
-{
- id value = [command argumentAtIndex:0];
- if (!([value isKindOfClass:[NSString class]])) {
- value = @"black";
- }
-
- SEL selector = NSSelectorFromString([value stringByAppendingString:@"Color"]);
- if ([UIColor respondsToSelector:selector]) {
- _statusBarBackgroundView.backgroundColor = [UIColor performSelector:selector];
- }
-}
-
-- (void) _backgroundColorByHexString:(NSString*)hexString
-{
- unsigned int rgbValue = 0;
- NSScanner* scanner = [NSScanner scannerWithString:hexString];
- [scanner setScanLocation:1];
- [scanner scanHexInt:&rgbValue];
-
- _statusBarBackgroundColor = [UIColor colorWithRed:((rgbValue & 0xFF0000) >> 16)/255.0 green:((rgbValue & 0xFF00) >> 8)/255.0 blue:(rgbValue & 0xFF)/255.0 alpha:1.0];
- _statusBarBackgroundView.backgroundColor = _statusBarBackgroundColor;
-}
-
-- (void) backgroundColorByHexString:(CDVInvokedUrlCommand*)command
-{
- NSString* value = [command argumentAtIndex:0];
- if (!([value isKindOfClass:[NSString class]])) {
- value = @"#000000";
- }
-
- if (![value hasPrefix:@"#"] || [value length] < 7) {
- return;
- }
-
- [self _backgroundColorByHexString:value];
-}
-
-- (void) hideStatusBar
-{
- if (_uiviewControllerBasedStatusBarAppearance) {
- CDVViewController* vc = (CDVViewController*)self.viewController;
- vc.sb_hideStatusBar = [NSNumber numberWithBool:YES];
- [self refreshStatusBarAppearance];
-
- } else {
- UIApplication* app = [UIApplication sharedApplication];
- [app setStatusBarHidden:YES];
- }
-}
-
-- (void) hide:(CDVInvokedUrlCommand*)command
-{
- _statusBarVisible = NO;
- UIApplication* app = [UIApplication sharedApplication];
-
- if (!app.isStatusBarHidden)
- {
-
- [self hideStatusBar];
-
- if (IsAtLeastiOSVersion(@"7.0")) {
- [_statusBarBackgroundView removeFromSuperview];
- }
-
- [self resizeWebView];
-
- _statusBarBackgroundView.hidden = YES;
- }
-}
-
-- (void) showStatusBar
-{
- if (_uiviewControllerBasedStatusBarAppearance) {
- CDVViewController* vc = (CDVViewController*)self.viewController;
- vc.sb_hideStatusBar = [NSNumber numberWithBool:NO];
- [self refreshStatusBarAppearance];
-
- } else {
- UIApplication* app = [UIApplication sharedApplication];
- [app setStatusBarHidden:NO];
- }
-}
-
-- (void) show:(CDVInvokedUrlCommand*)command
-{
- _statusBarVisible = YES;
- UIApplication* app = [UIApplication sharedApplication];
-
- if (app.isStatusBarHidden)
- {
- BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
-
- [self showStatusBar];
- [self resizeWebView];
-
- if (isIOS7) {
-
- if (!self.statusBarOverlaysWebView) {
-
- // there is a possibility that when the statusbar was hidden, it was in a different orientation
- // from the current one. Therefore we need to expand the statusBarBackgroundView as well to the
- // statusBar's current size
- CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
- statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
- CGRect sbBgFrame = _statusBarBackgroundView.frame;
- sbBgFrame.size = statusBarFrame.size;
- _statusBarBackgroundView.frame = sbBgFrame;
- [self.webView.superview addSubview:_statusBarBackgroundView];
-
- }
-
- }
-
- _statusBarBackgroundView.hidden = NO;
- }
-}
-
--(void)resizeWebView
-{
- BOOL isIOS7 = (IsAtLeastiOSVersion(@"7.0"));
-
- if (isIOS7) {
- CGRect bounds = [self.viewController.view.window bounds];
- if (CGRectEqualToRect(bounds, CGRectZero)) {
- bounds = [[UIScreen mainScreen] bounds];
- }
- bounds = [self invertFrameIfNeeded:bounds];
-
- self.viewController.view.frame = bounds;
-
- self.webView.frame = bounds;
-
- CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
- statusBarFrame = [self invertFrameIfNeeded:statusBarFrame];
- CGRect frame = self.webView.frame;
- CGFloat height = statusBarFrame.size.height;
-
- if (!self.statusBarOverlaysWebView) {
- if (_statusBarVisible) {
- // CB-10158 If a full screen video is playing the status bar height will be 0, set it to 20 if _statusBarVisible
- frame.origin.y = height > 0 ? height: 20;
- }
- } else {
- // Even if overlay is used, we want to handle in-call/recording/hotspot larger status bar
- frame.origin.y = height >= 20 ? height - 20 : 0;
- }
- frame.size.height -= frame.origin.y;
- self.webView.frame = frame;
- } else {
- CGRect bounds = [[UIScreen mainScreen] applicationFrame];
- self.viewController.view.frame = bounds;
- }
-}
-
-- (void) dealloc
-{
- [[UIApplication sharedApplication] removeObserver:self forKeyPath:@"statusBarHidden"];
- [[NSNotificationCenter defaultCenter]removeObserver:self name:UIApplicationDidChangeStatusBarOrientationNotification object:nil];
-}
-
-
-#pragma mark - UIScrollViewDelegate
-
-- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView
-{
- [self fireTappedEvent];
- return NO;
-}
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/NSString+URLEncoding.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/NSString+URLEncoding.h
deleted file mode 100644
index d7da331d..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/NSString+URLEncoding.h
+++ /dev/null
@@ -1,5 +0,0 @@
-#import <Foundation/Foundation.h>
-
-@interface NSString (URLEncoding)
-@property (readonly) NSString *URLEncodedString;
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/NSString+URLEncoding.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/NSString+URLEncoding.m
deleted file mode 100644
index b737626c..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/NSString+URLEncoding.m
+++ /dev/null
@@ -1,30 +0,0 @@
-#import "NSString+URLEncoding.h"
-
-@implementation NSString (URLEncoding)
-- (NSString*)URLEncodedString
-{
- NSString* result = (NSString *)CFBridgingRelease(
- CFURLCreateStringByAddingPercentEscapes(
- kCFAllocatorDefault,
- (CFStringRef)self,
- CFSTR("#%"), // don't escape these
- NULL, // allow escaping these
- kCFStringEncodingUTF8
- )
- );
-
- // we may have a URL with more than one '#' now - which iOS doesn't allow, so escape all but the first one
- NSArray *parts = [result componentsSeparatedByString:@"#"];
- NSString *finalResult = parts[0];
- for (int i=1; i<parts.count; i++) {
- NSString *part = [parts objectAtIndex:i];
- if (i==1) {
- finalResult = [finalResult stringByAppendingString:@"#"];
- } else {
- finalResult = [finalResult stringByAppendingString:@"%23"];
- }
- finalResult = [finalResult stringByAppendingString:part];
- }
- return finalResult;
-}
-@end \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/SocialSharing.h b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/SocialSharing.h
deleted file mode 100644
index 0c731450..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/SocialSharing.h
+++ /dev/null
@@ -1,28 +0,0 @@
-#import <Cordova/CDV.h>
-#import <MessageUI/MFMailComposeViewController.h>
-
-@interface SocialSharing : CDVPlugin <UIPopoverControllerDelegate, MFMailComposeViewControllerDelegate, UIDocumentInteractionControllerDelegate>
-
-@property (nonatomic, strong) MFMailComposeViewController *globalMailComposer;
-@property (nonatomic, strong) UIDocumentInteractionController * documentInteractionController;
-@property (retain) NSString * tempStoredFile;
-@property (retain) CDVInvokedUrlCommand * command;
-
-- (void)available:(CDVInvokedUrlCommand*)command;
-- (void)setIPadPopupCoordinates:(CDVInvokedUrlCommand*)command;
-- (void)share:(CDVInvokedUrlCommand*)command;
-- (void)shareWithOptions:(CDVInvokedUrlCommand*)command;
-- (void)canShareVia:(CDVInvokedUrlCommand*)command;
-- (void)canShareViaEmail:(CDVInvokedUrlCommand*)command;
-- (void)shareVia:(CDVInvokedUrlCommand*)command;
-- (void)shareViaTwitter:(CDVInvokedUrlCommand*)command;
-- (void)shareViaFacebook:(CDVInvokedUrlCommand*)command;
-- (void)shareViaFacebookWithPasteMessageHint:(CDVInvokedUrlCommand*)command;
-- (void)shareViaWhatsApp:(CDVInvokedUrlCommand*)command;
-- (void)shareViaSMS:(CDVInvokedUrlCommand*)command;
-- (void)shareViaEmail:(CDVInvokedUrlCommand*)command;
-- (void)shareViaInstagram:(CDVInvokedUrlCommand*)command;
-
-- (void)saveToPhotoAlbum:(CDVInvokedUrlCommand*)command;
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/SocialSharing.m b/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/SocialSharing.m
deleted file mode 100644
index 014925bd..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/cordova-plugin-x-socialsharing/SocialSharing.m
+++ /dev/null
@@ -1,772 +0,0 @@
-#import "SocialSharing.h"
-#import "NSString+URLEncoding.h"
-#import <Cordova/CDV.h>
-#import <Social/Social.h>
-#import <Foundation/NSException.h>
-#import <MessageUI/MFMessageComposeViewController.h>
-#import <MessageUI/MFMailComposeViewController.h>
-#import <MobileCoreServices/MobileCoreServices.h>
-
-static NSString *const kShareOptionMessage = @"message";
-static NSString *const kShareOptionSubject = @"subject";
-static NSString *const kShareOptionFiles = @"files";
-static NSString *const kShareOptionUrl = @"url";
-
-@implementation SocialSharing {
- UIPopoverController *_popover;
- NSString *_popupCoordinates;
-}
-
-- (void)pluginInitialize {
- if ([self isEmailAvailable]) {
- [self cycleTheGlobalMailComposer];
- }
-}
-
-- (void)available:(CDVInvokedUrlCommand*)command {
- BOOL avail = NO;
- if (NSClassFromString(@"UIActivityViewController")) {
- avail = YES;
- }
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:avail];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
-}
-
-- (NSString*)getIPadPopupCoordinates {
- if (_popupCoordinates != nil) {
- return _popupCoordinates;
- }
- if ([self.webView respondsToSelector:@selector(stringByEvaluatingJavaScriptFromString:)]) {
- return [(UIWebView*)self.webView stringByEvaluatingJavaScriptFromString:@"window.plugins.socialsharing.iPadPopupCoordinates();"];
- } else {
- // prolly a wkwebview, ignoring for now
- return nil;
- }
-}
-
-- (void)setIPadPopupCoordinates:(CDVInvokedUrlCommand*)command {
- _popupCoordinates = [command.arguments objectAtIndex:0];
-}
-
-- (CGRect)getPopupRectFromIPadPopupCoordinates:(NSArray*)comps {
- CGRect rect = CGRectZero;
- if ([comps count] == 4) {
- rect = CGRectMake([[comps objectAtIndex:0] integerValue], [[comps objectAtIndex:1] integerValue], [[comps objectAtIndex:2] integerValue], [[comps objectAtIndex:3] integerValue]);
- }
- return rect;
-}
-
-- (void)share:(CDVInvokedUrlCommand*)command {
- [self shareInternal:command
- withOptions:@{
- kShareOptionMessage: [command.arguments objectAtIndex:0],
- kShareOptionSubject: [command.arguments objectAtIndex:1],
- kShareOptionFiles: [command.arguments objectAtIndex:2],
- kShareOptionUrl: [command.arguments objectAtIndex:3]
- }
- isBooleanResponse:YES
-];
-}
-
-- (void)shareWithOptions:(CDVInvokedUrlCommand*)command {
- NSDictionary* options = [command.arguments objectAtIndex:0];
- [self shareInternal:command
- withOptions:options
- isBooleanResponse:NO
- ];
-}
-
-- (void)shareInternal:(CDVInvokedUrlCommand*)command withOptions:(NSDictionary*)options isBooleanResponse:(BOOL)boolResponse {
- [self.commandDelegate runInBackground:^{ //avoid main thread block especially if sharing big files from url
- if (!NSClassFromString(@"UIActivityViewController")) {
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"not available"];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- return;
- }
-
- NSString *message = options[kShareOptionMessage];
- NSString *subject = options[kShareOptionSubject];
- NSArray *filenames = options[kShareOptionFiles];
- NSString *urlString = options[kShareOptionUrl];
-
- NSMutableArray *activityItems = [[NSMutableArray alloc] init];
-
- if (message != (id)[NSNull null] && message != nil) {
- [activityItems addObject:message];
- }
-
- if (filenames != (id)[NSNull null] && filenames != nil && filenames.count > 0) {
- NSMutableArray *files = [[NSMutableArray alloc] init];
- for (NSString* filename in filenames) {
- NSObject *file = [self getImage:filename];
- if (file == nil) {
- file = [self getFile:filename];
- }
- if (file != nil) {
- [files addObject:file];
- }
- }
- [activityItems addObjectsFromArray:files];
- }
-
- if (urlString != (id)[NSNull null] && urlString != nil) {
- [activityItems addObject:[NSURL URLWithString:[urlString URLEncodedString]]];
- }
-
- UIActivity *activity = [[UIActivity alloc] init];
- NSArray *applicationActivities = [[NSArray alloc] initWithObjects:activity, nil];
- UIActivityViewController *activityVC = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:applicationActivities];
- if (subject != (id)[NSNull null] && subject != nil) {
- [activityVC setValue:subject forKey:@"subject"];
- }
-
- if ([activityVC respondsToSelector:(@selector(setCompletionWithItemsHandler:))]) {
- [activityVC setCompletionWithItemsHandler:^(NSString *activityType, BOOL completed, NSArray * returnedItems, NSError * activityError) {
- [self cleanupStoredFiles];
- if (boolResponse) {
- [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:completed]
- callbackId:command.callbackId];
- } else {
- NSDictionary * result = @{@"completed":@(completed), @"app":activityType == nil ? @"" : activityType};
- [self.commandDelegate sendPluginResult:[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result]
- callbackId:command.callbackId];
- }
- }];
- } else {
- // let's suppress this warning otherwise folks will start opening issues while it's not relevant
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- [activityVC setCompletionHandler:^(NSString *activityType, BOOL completed) {
- [self cleanupStoredFiles];
- NSDictionary * result = @{@"completed":@(completed), @"app":activityType};
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- }];
-#pragma GCC diagnostic warning "-Wdeprecated-declarations"
- }
-
- NSArray * socialSharingExcludeActivities = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"SocialSharingExcludeActivities"];
- if (socialSharingExcludeActivities!=nil && [socialSharingExcludeActivities count] > 0) {
- activityVC.excludedActivityTypes = socialSharingExcludeActivities;
- }
-
- dispatch_async(dispatch_get_main_queue(), ^(void){
- // iPad on iOS >= 8 needs a different approach
- if ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad) {
- NSString* iPadCoords = [self getIPadPopupCoordinates];
- if (iPadCoords != nil && ![iPadCoords isEqual:@"-1,-1,-1,-1"]) {
- NSArray *comps = [iPadCoords componentsSeparatedByString:@","];
- CGRect rect = [self getPopupRectFromIPadPopupCoordinates:comps];
- if ([activityVC respondsToSelector:@selector(popoverPresentationController)]) {
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 // iOS 8.0 supported
- activityVC.popoverPresentationController.sourceView = self.webView;
- activityVC.popoverPresentationController.sourceRect = rect;
-#endif
- } else {
- _popover = [[UIPopoverController alloc] initWithContentViewController:activityVC];
- _popover.delegate = self;
- [_popover presentPopoverFromRect:rect inView:self.webView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
- }
- } else if ([activityVC respondsToSelector:@selector(popoverPresentationController)]) {
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000 // iOS 8.0 supported
- activityVC.popoverPresentationController.sourceView = self.webView;
- // position the popup at the bottom, just like iOS < 8 did (and iPhone still does on iOS 8)
- NSArray *comps = [NSArray arrayWithObjects:
- [NSNumber numberWithInt:(self.viewController.view.frame.size.width/2)-200],
- [NSNumber numberWithInt:self.viewController.view.frame.size.height],
- [NSNumber numberWithInt:400],
- [NSNumber numberWithInt:400],
- nil];
- CGRect rect = [self getPopupRectFromIPadPopupCoordinates:comps];
- activityVC.popoverPresentationController.sourceRect = rect;
-#endif
- }
- }
- [[self getTopMostViewController] presentViewController:activityVC animated:YES completion:nil];
- });
- }];
-}
-
-- (void)shareViaTwitter:(CDVInvokedUrlCommand*)command {
- [self shareViaInternal:command type:SLServiceTypeTwitter];
-}
-
-- (void)shareViaFacebook:(CDVInvokedUrlCommand*)command {
- [self shareViaInternal:command type:SLServiceTypeFacebook];
-}
-
-- (void)shareViaFacebookWithPasteMessageHint:(CDVInvokedUrlCommand*)command {
- // If Fb app is installed a message is not prefilled.
- // When shared through the default iOS widget (iOS Settings > Facebook) the message is prefilled already.
- NSString *message = [command.arguments objectAtIndex:0];
- if (message != (id)[NSNull null]) {
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1000 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
- BOOL fbAppInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fb://"]]; // requires whitelisting on iOS9
- if (fbAppInstalled) {
- UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
- [pasteboard setValue:message forPasteboardType:@"public.text"];
- NSString *hint = [command.arguments objectAtIndex:4];
- UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:hint delegate:nil cancelButtonTitle:nil otherButtonTitles:nil];
- [alert show];
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 2800 * NSEC_PER_MSEC), dispatch_get_main_queue(), ^{
- [alert dismissWithClickedButtonIndex:-1 animated:YES];
- });
- }
- });
- }
- [self shareViaInternal:command type:SLServiceTypeFacebook];
-}
-
-- (void)shareVia:(CDVInvokedUrlCommand*)command {
- [self shareViaInternal:command type:[command.arguments objectAtIndex:4]];
-}
-
-- (void)canShareVia:(CDVInvokedUrlCommand*)command {
- NSString *via = [command.arguments objectAtIndex:4];
- CDVPluginResult * pluginResult;
- if ([@"sms" caseInsensitiveCompare:via] == NSOrderedSame && [self canShareViaSMS]) {
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- } else if ([@"email" caseInsensitiveCompare:via] == NSOrderedSame && [self isEmailAvailable]) {
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- } else if ([@"whatsapp" caseInsensitiveCompare:via] == NSOrderedSame && [self canShareViaWhatsApp]) {
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- } else if ([@"instagram" caseInsensitiveCompare:via] == NSOrderedSame && [self canShareViaInstagram]) {
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- } else if ([self isAvailableForSharing:command type:via]) {
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- } else {
- pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"not available"];
- }
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
-}
-
-- (void)canShareViaEmail:(CDVInvokedUrlCommand*)command {
- if ([self isEmailAvailable]) {
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- } else {
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"not available"];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- }
-}
-
-- (bool)isEmailAvailable {
- Class messageClass = (NSClassFromString(@"MFMailComposeViewController"));
- return messageClass != nil && [messageClass canSendMail];
-}
-
-- (bool)isAvailableForSharing:(CDVInvokedUrlCommand*)command
- type:(NSString *) type {
- // isAvailableForServiceType returns true if you pass it a type that is not
- // in the defined constants, this is probably a bug on apples part
- if(!([type isEqualToString:SLServiceTypeFacebook]
- || [type isEqualToString:SLServiceTypeTwitter]
- || [type isEqualToString:SLServiceTypeTencentWeibo]
- || [type isEqualToString:SLServiceTypeSinaWeibo])) {
- return false;
- }
- // wrapped in try-catch, because isAvailableForServiceType may crash if an invalid type is passed
- @try {
- return [SLComposeViewController isAvailableForServiceType:type];
- }
- @catch (NSException* exception) {
- return false;
- }
-}
-
-- (void)shareViaInternal:(CDVInvokedUrlCommand*)command
- type:(NSString *) type {
-
- NSString *message = [command.arguments objectAtIndex:0];
- // subject is not supported by the SLComposeViewController
- NSArray *filenames = [command.arguments objectAtIndex:2];
- NSString *urlString = [command.arguments objectAtIndex:3];
-
- // boldly invoke the target app, because the phone will display a nice message asking to configure the app
- SLComposeViewController *composeViewController = [SLComposeViewController composeViewControllerForServiceType:type];
- if (message != (id)[NSNull null]) {
- [composeViewController setInitialText:message];
- }
-
- for (NSString* filename in filenames) {
- UIImage* image = [self getImage:filename];
- if (image != nil) {
- [composeViewController addImage:image];
- }
- }
-
- if (urlString != (id)[NSNull null]) {
- [composeViewController addURL:[NSURL URLWithString:[urlString URLEncodedString]]];
- }
-
- [composeViewController setCompletionHandler:^(SLComposeViewControllerResult result) {
- if (SLComposeViewControllerResultCancelled == result) {
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"cancelled"];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- } else if ([self isAvailableForSharing:command type:type]) {
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:SLComposeViewControllerResultDone == result];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- } else {
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"not available"];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- }
- // required for iOS6 (issues #162 and #167)
- [self.viewController dismissViewControllerAnimated:YES completion:nil];
- }];
- [[self getTopMostViewController] presentViewController:composeViewController animated:YES completion:nil];
-}
-
-- (void)shareViaEmail:(CDVInvokedUrlCommand*)command {
- if ([self isEmailAvailable]) {
-
- if (TARGET_IPHONE_SIMULATOR && IsAtLeastiOSVersion(@"8.0")) {
- UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"SocialSharing plugin"
- message:@"Sharing via email is not supported on the iOS 8 simulator."
- delegate:nil
- cancelButtonTitle:@"OK"
- otherButtonTitles:nil];
- [alert show];
- return;
- }
-
- [self cycleTheGlobalMailComposer];
-
- self.globalMailComposer.mailComposeDelegate = self;
-
- if ([command.arguments objectAtIndex:0] != (id)[NSNull null]) {
- NSString *message = [command.arguments objectAtIndex:0];
- BOOL isHTML = [message rangeOfString:@"<[^>]+>" options:NSRegularExpressionSearch].location != NSNotFound;
- [self.globalMailComposer setMessageBody:message isHTML:isHTML];
- }
-
- if ([command.arguments objectAtIndex:1] != (id)[NSNull null]) {
- [self.globalMailComposer setSubject: [command.arguments objectAtIndex:1]];
- }
-
- if ([command.arguments objectAtIndex:2] != (id)[NSNull null]) {
- [self.globalMailComposer setToRecipients:[command.arguments objectAtIndex:2]];
- }
-
- if ([command.arguments objectAtIndex:3] != (id)[NSNull null]) {
- [self.globalMailComposer setCcRecipients:[command.arguments objectAtIndex:3]];
- }
-
- if ([command.arguments objectAtIndex:4] != (id)[NSNull null]) {
- [self.globalMailComposer setBccRecipients:[command.arguments objectAtIndex:4]];
- }
-
- if ([command.arguments objectAtIndex:5] != (id)[NSNull null]) {
- NSArray* attachments = [command.arguments objectAtIndex:5];
- NSFileManager* fileManager = [NSFileManager defaultManager];
- for (NSString* path in attachments) {
- NSURL *file = [self getFile:path];
- NSData* data = [fileManager contentsAtPath:file.path];
-
- 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];
- }
- }
-
- // remember the command, because we need it in the didFinishWithResult method
- _command = command;
-
- [self.commandDelegate runInBackground:^{
- [[self getTopMostViewController] presentViewController:self.globalMailComposer animated:YES completion:nil];
- }];
-
- } else {
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"not available"];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- }
-}
-
-- (UIViewController*) getTopMostViewController {
- UIViewController *presentingViewController = [[[UIApplication sharedApplication] delegate] window].rootViewController;
- while (presentingViewController.presentedViewController != nil) {
- presentingViewController = presentingViewController.presentedViewController;
- }
- return presentingViewController;
-}
-
-- (NSString*) getBasenameFromAttachmentPath:(NSString*)path {
- if ([path hasPrefix:@"base64:"]) {
- NSString* pathWithoutPrefix = [path stringByReplacingOccurrencesOfString:@"base64:" withString:@""];
- return [pathWithoutPrefix substringToIndex:[pathWithoutPrefix rangeOfString:@"//"].location];
- }
- return [path componentsSeparatedByString: @"?"][0];
-}
-
-- (NSString*) getMimeTypeFromFileExtension:(NSString*)extension {
- if (!extension) {
- return nil;
- }
- // Get the UTI from the file's extension
- CFStringRef ext = (CFStringRef)CFBridgingRetain(extension);
- CFStringRef type = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, ext, NULL);
- // Converting UTI to a mime type
- NSString *result = (NSString*)CFBridgingRelease(UTTypeCopyPreferredTagWithClass(type, kUTTagClassMIMEType));
- CFRelease(ext);
- CFRelease(type);
- return result;
-}
-
-/**
- * Delegate will be called after the mail composer did finish an action
- * to dismiss the view.
- */
-- (void) mailComposeController:(MFMailComposeViewController*)controller
- didFinishWithResult:(MFMailComposeResult)result
- error:(NSError*)error {
- bool ok = result == MFMailComposeResultSent;
- [self.globalMailComposer dismissViewControllerAnimated:YES completion:^{[self cycleTheGlobalMailComposer];}];
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:ok];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:_command.callbackId];
-}
-
--(void)cycleTheGlobalMailComposer {
- // we are cycling the damned GlobalMailComposer: http://stackoverflow.com/questions/25604552/i-have-real-misunderstanding-with-mfmailcomposeviewcontroller-in-swift-ios8-in/25604976#25604976
- self.globalMailComposer = nil;
- self.globalMailComposer = [[MFMailComposeViewController alloc] init];
-}
-
-- (bool)canShareViaSMS {
- Class messageClass = (NSClassFromString(@"MFMessageComposeViewController"));
- return messageClass != nil && [messageClass canSendText];
-}
-
-- (void)shareViaSMS:(CDVInvokedUrlCommand*)command {
- if ([self canShareViaSMS]) {
- NSDictionary* options = [command.arguments objectAtIndex:0];
- NSString *phonenumbers = [command.arguments objectAtIndex:1];
- NSString *message = [options objectForKey:@"message"];
- NSString *subject = [options objectForKey:@"subject"];
- NSString *image = [options objectForKey:@"image"];
-
- MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
- picker.messageComposeDelegate = (id) self;
- if (message != (id)[NSNull null]) {
- picker.body = message;
- }
- if (subject != (id)[NSNull null]) {
- [picker setSubject:subject];
- }
- if (image != nil && image != (id)[NSNull null]) {
- BOOL canSendAttachments = [[MFMessageComposeViewController class] respondsToSelector:@selector(canSendAttachments)];
- if (canSendAttachments) {
- NSURL *file = [self getFile:image];
- if (file != nil) {
- [picker addAttachmentURL:file withAlternateFilename:nil];
- }
- }
- }
-
- if (phonenumbers != (id)[NSNull null]) {
- [picker setRecipients:[phonenumbers componentsSeparatedByString:@","]];
- }
- // remember the command, because we need it in the didFinishWithResult method
- _command = command;
- [self.commandDelegate runInBackground:^{
- picker.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
- [[self getTopMostViewController] presentViewController:picker animated:YES completion:nil];
- }];
- } else {
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"not available"];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- }
-}
-
-// Dismisses the SMS composition interface when users taps Cancel or Send
-- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result {
- bool ok = result == MessageComposeResultSent;
- [[self getTopMostViewController] dismissViewControllerAnimated:YES completion:nil];
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:ok];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:_command.callbackId];
-}
-
-- (bool)canShareViaInstagram {
- return [[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"instagram://app"]]; // requires whitelisting on iOS9
-}
-
-- (bool)canShareViaWhatsApp {
- return [[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"whatsapp://app"]]; // requires whitelisting on iOS9
-}
-
-// this is only an internal test method for now, can be used to open a share sheet with 'Open in xx' links for tumblr, drive, dropbox, ..
-- (void)openImage:(NSString *)imageName {
- UIImage* image =[self getImage:imageName];
- if (image != nil) {
- NSString * savePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/myTempImage.jpg"];
- [UIImageJPEGRepresentation(image, 1.0) writeToFile:savePath atomically:YES];
- _documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]];
- _documentInteractionController.UTI = @""; // TODO find the scheme for google drive and create a shareViaGoogleDrive function
- [_documentInteractionController presentOpenInMenuFromRect:CGRectZero inView:self.viewController.view animated: YES];
- }
-}
-
-- (void)shareViaInstagram:(CDVInvokedUrlCommand*)command {
-
- // on iOS9 canShareVia('instagram'..) will only work if instagram:// is whitelisted.
- // If it's not, this method will ask permission to the user on iOS9 for opening the app,
- // which is of course better than Instagram sharing not working at all because you forgot to whitelist it.
- // Tradeoff: on iOS9 this method will always return true, so make sure to whitelist it and call canShareVia('instagram'..)
- if (!IsAtLeastiOSVersion(@"9.0")) {
- if (![self canShareViaInstagram]) {
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"not available"];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- return;
- }
- }
-
- NSString *message = [command.arguments objectAtIndex:0];
- // subject is not supported by the SLComposeViewController
- NSArray *filenames = [command.arguments objectAtIndex:2];
-
- // only use the first image (for now.. maybe we can share in a loop?)
- UIImage* image = nil;
- for (NSString* filename in filenames) {
- image = [self getImage:filename];
- break;
- }
-
-// NSData *imageObj = [NSData dataFromBase64String:objectAtIndex0];
- NSString *tmpDir = NSTemporaryDirectory();
- NSString *path = [tmpDir stringByAppendingPathComponent:@"instagram.igo"];
- [UIImageJPEGRepresentation(image, 1.0) writeToFile:path atomically:YES];
-
- _documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:path]];
- _documentInteractionController.delegate = self;
- _documentInteractionController.UTI = @"com.instagram.exclusivegram";
-
- if (message != (id)[NSNull null]) {
- // no longer working, so ..
- _documentInteractionController.annotation = @{@"InstagramCaption" : message};
-
- // .. we put the message on the clipboard (you app can prompt the user to paste it)
- UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
- [pasteboard setValue:message forPasteboardType:@"public.text"];
- }
-
- // remember the command for the delegate method
- _command = command;
-
- // test for #513
- dispatch_async(dispatch_get_main_queue(), ^(void){
- [_documentInteractionController presentOpenInMenuFromRect:CGRectZero inView:self.webView animated:YES];
- });
-}
-
-- (void)shareViaWhatsApp:(CDVInvokedUrlCommand*)command {
-
- // on iOS9 canShareVia('whatsapp'..) will only work if whatsapp:// is whitelisted.
- // If it's not, this method will ask permission to the user on iOS9 for opening the app,
- // which is of course better than WhatsApp sharing not working at all because you forgot to whitelist it.
- // Tradeoff: on iOS9 this method will always return true, so make sure to whitelist it and call canShareVia('whatsapp'..)
- if (!IsAtLeastiOSVersion(@"9.0")) {
- if (![self canShareViaWhatsApp]) {
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"not available"];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- return;
- }
- }
-
- NSString *message = [command.arguments objectAtIndex:0];
- // subject is not supported by the SLComposeViewController
- NSArray *filenames = [command.arguments objectAtIndex:2];
- NSString *urlString = [command.arguments objectAtIndex:3];
- NSString *abid = [command.arguments objectAtIndex:4];
-
- // only use the first image (for now.. maybe we can share in a loop?)
- UIImage* image = nil;
- for (NSString* filename in filenames) {
- image = [self getImage:filename];
- break;
- }
-
- // with WhatsApp, we can share an image OR text+url.. image wins if set
- if (image != nil) {
- NSString * savePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/whatsAppTmp.wai"];
- [UIImageJPEGRepresentation(image, 1.0) writeToFile:savePath atomically:YES];
- _documentInteractionController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:savePath]];
- _documentInteractionController.UTI = @"net.whatsapp.image";
- _documentInteractionController.delegate = self;
- _command = command;
- [_documentInteractionController presentOpenInMenuFromRect:CGRectZero inView:self.viewController.view animated: YES];
- } else {
- // append an url to a message, if both are passed
- NSString * shareString = @"";
- if (message != (id)[NSNull null]) {
- shareString = message;
- }
- if (urlString != (id)[NSNull null]) {
- if ([shareString isEqual: @""]) {
- shareString = urlString;
- } else {
- shareString = [NSString stringWithFormat:@"%@ %@", shareString, [urlString URLEncodedString]];
- }
- }
- NSString * encodedShareString = [shareString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
- // also encode the '=' character
- encodedShareString = [encodedShareString stringByReplacingOccurrencesOfString:@"=" withString:@"%3D"];
- encodedShareString = [encodedShareString stringByReplacingOccurrencesOfString:@"&" withString:@"%26"];
- NSString * abidString = @"";
- if (abid != (id)[NSNull null]) {
- abidString = [NSString stringWithFormat:@"abid=%@&", abid];
- }
- NSString * encodedShareStringForWhatsApp = [NSString stringWithFormat:@"whatsapp://send?%@text=%@", abidString, encodedShareString];
-
- NSURL *whatsappURL = [NSURL URLWithString:encodedShareStringForWhatsApp];
- [[UIApplication sharedApplication] openURL: whatsappURL];
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- }
-}
-
-- (void)saveToPhotoAlbum:(CDVInvokedUrlCommand*)command {
- self.command = command;
- NSArray *filenames = [command.arguments objectAtIndex:0];
- [self.commandDelegate runInBackground:^{
- bool shared = false;
- for (NSString* filename in filenames) {
- UIImage* image = [self getImage:filename];
- if (image != nil) {
- shared = true;
- UIImageWriteToSavedPhotosAlbum(image, self, @selector(thisImage:wasSavedToPhotoAlbumWithError:contextInfo:), nil);
- }
- }
- if (!shared) {
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"no valid image was passed"];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:self.command.callbackId];
- }
- }];
-}
-
-// called from saveToPhotoAlbum, note that we only send feedback for the first image that's being saved (not keeping the callback)
-// but since the UIImageWriteToSavedPhotosAlbum function is only called with valid images that should not be a problem
-- (void)thisImage:(UIImage *)image wasSavedToPhotoAlbumWithError:(NSError *)error contextInfo:(void*)ctxInfo {
- if (error) {
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:error.localizedDescription];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:self.command.callbackId];
- } else {
- CDVPluginResult * pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:self.command.callbackId];
- }
-}
-
--(UIImage*)getImage: (NSString *)imageName {
- UIImage *image = nil;
- if (imageName != (id)[NSNull null]) {
- if ([imageName hasPrefix:@"http"]) {
- image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imageName]]];
- } else if ([imageName hasPrefix:@"www/"]) {
- image = [UIImage imageNamed:imageName];
- } else if ([imageName hasPrefix:@"file://"]) {
- image = [UIImage imageWithData:[NSData dataWithContentsOfFile:[[NSURL URLWithString:imageName] path]]];
- } else if ([imageName hasPrefix:@"data:"]) {
- // using a base64 encoded string
- NSURL *imageURL = [NSURL URLWithString:imageName];
- NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
- image = [UIImage imageWithData:imageData];
- } else if ([imageName hasPrefix:@"assets-library://"]) {
- // use assets-library
- NSURL *imageURL = [NSURL URLWithString:imageName];
- NSData *imageData = [NSData dataWithContentsOfURL:imageURL];
- image = [UIImage imageWithData:imageData];
- } else {
- // assume anywhere else, on the local filesystem
- image = [UIImage imageWithData:[NSData dataWithContentsOfFile:imageName]];
- }
- }
- return image;
-}
-
--(NSURL*)getFile: (NSString *)fileName {
- NSURL *file = nil;
- if (fileName != (id)[NSNull null]) {
- if ([fileName hasPrefix:@"http"]) {
- NSURL *url = [NSURL URLWithString:fileName];
- NSData *fileData = [NSData dataWithContentsOfURL:url];
- NSString *name = (NSString*)[[fileName componentsSeparatedByString: @"/"] lastObject];
- file = [NSURL fileURLWithPath:[self storeInFile:[name componentsSeparatedByString: @"?"][0] fileData:fileData]];
- } else if ([fileName hasPrefix:@"www/"]) {
- NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
- NSString *fullPath = [NSString stringWithFormat:@"%@/%@", bundlePath, fileName];
- file = [NSURL fileURLWithPath:fullPath];
- } 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 {
- // assume anywhere else, on the local filesystem
- file = [NSURL fileURLWithPath:fileName];
- }
- }
- return file;
-}
-
--(NSString*) storeInFile: (NSString*) fileName
- fileData: (NSData*) fileData {
- NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
- NSString *documentsDirectory = [paths objectAtIndex:0];
- NSString *filePath = [documentsDirectory stringByAppendingPathComponent:fileName];
- [fileData writeToFile:filePath atomically:YES];
- _tempStoredFile = filePath;
- return filePath;
-}
-
-- (void) cleanupStoredFiles {
- if (_tempStoredFile != nil) {
- NSError *error;
- [[NSFileManager defaultManager]removeItemAtPath:_tempStoredFile error:&error];
- }
-}
-
-+ (NSData*) dataFromBase64String:(NSString*)aString {
- return [[NSData alloc] initWithBase64EncodedString:aString options:0];
-}
-
-#pragma mark - UIPopoverControllerDelegate methods
-
-- (void)popoverController:(UIPopoverController *)popoverController willRepositionPopoverToRect:(inout CGRect *)rect inView:(inout UIView **)view {
- NSArray *comps = [[self getIPadPopupCoordinates] componentsSeparatedByString:@","];
- CGRect newRect = [self getPopupRectFromIPadPopupCoordinates:comps];
- rect->origin = newRect.origin;
-}
-
-- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController {
- _popover = nil;
-}
-
-#pragma mark - UIDocumentInteractionControllerDelegate methods
-
-- (void) documentInteractionController: (UIDocumentInteractionController *) controller willBeginSendingToApplication: (NSString *) application {
- // note that the application actually contains the app bundle id which was picked (for whatsapp and instagram only)
- NSLog(@"SocialSharing app selected: %@", application);
-}
-
-- (void) documentInteractionControllerDidDismissOpenInMenu: (UIDocumentInteractionController *) controller {
- if (self.command != nil) {
- CDVPluginResult *result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- [self.commandDelegate sendPluginResult:result callbackId: self.command.callbackId];
- }
-}
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/ionic-plugin-keyboard/IonicKeyboard.h b/StoneIsland/platforms/ios/Stone Island/Plugins/ionic-plugin-keyboard/IonicKeyboard.h
deleted file mode 100644
index 63935dc3..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/ionic-plugin-keyboard/IonicKeyboard.h
+++ /dev/null
@@ -1,16 +0,0 @@
-#import <Cordova/CDVPlugin.h>
-#import <objc/runtime.h>
-
-@interface IonicKeyboard : CDVPlugin <UIScrollViewDelegate> {
- @protected
- id _keyboardShowObserver, _keyboardHideObserver;
- IMP wkOriginalImp, uiOriginalImp, nilImp;
- Method wkMethod, uiMethod;
-}
-
-@property (readwrite, assign) BOOL hideKeyboardAccessoryBar;
-@property (readwrite, assign) BOOL disableScroll;
-//@property (readwrite, assign) BOOL styleDark;
-
-@end
-
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/ionic-plugin-keyboard/IonicKeyboard.m b/StoneIsland/platforms/ios/Stone Island/Plugins/ionic-plugin-keyboard/IonicKeyboard.m
deleted file mode 100644
index d072ca7f..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/ionic-plugin-keyboard/IonicKeyboard.m
+++ /dev/null
@@ -1,176 +0,0 @@
-#import "IonicKeyboard.h"
-// #import "UIWebViewExtension.h"
-#import <Cordova/CDVAvailability.h>
-
-@implementation IonicKeyboard
-
-@synthesize hideKeyboardAccessoryBar = _hideKeyboardAccessoryBar;
-@synthesize disableScroll = _disableScroll;
-//@synthesize styleDark = _styleDark;
-
-- (void)pluginInitialize {
-
- Class wkClass = NSClassFromString([@[@"UI", @"Web", @"Browser", @"View"] componentsJoinedByString:@""]);
- wkMethod = class_getInstanceMethod(wkClass, @selector(inputAccessoryView));
- wkOriginalImp = method_getImplementation(wkMethod);
- Class uiClass = NSClassFromString([@[@"WK", @"Content", @"View"] componentsJoinedByString:@""]);
- uiMethod = class_getInstanceMethod(uiClass, @selector(inputAccessoryView));
- uiOriginalImp = method_getImplementation(uiMethod);
- nilImp = imp_implementationWithBlock(^(id _s) {
- return nil;
- });
-
- //set defaults
- self.hideKeyboardAccessoryBar = YES;
- self.disableScroll = NO;
- //self.styleDark = NO;
-
- NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
- __weak IonicKeyboard* weakSelf = self;
- _keyboardShowObserver = [nc addObserverForName:UIKeyboardWillShowNotification
- object:nil
- queue:[NSOperationQueue mainQueue]
- usingBlock:^(NSNotification* notification) {
-
- CGRect keyboardFrame = [notification.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
- keyboardFrame = [self.viewController.view convertRect:keyboardFrame fromView:nil];
-
- [weakSelf.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.plugins.Keyboard.isVisible = true; cordova.fireWindowEvent('native.keyboardshow', { 'keyboardHeight': %@ }); ", [@(keyboardFrame.size.height) stringValue]]];
-
- //deprecated
- [weakSelf.commandDelegate evalJs:[NSString stringWithFormat:@"cordova.fireWindowEvent('native.showkeyboard', { 'keyboardHeight': %@ }); ", [@(keyboardFrame.size.height) stringValue]]];
- }];
-
- _keyboardHideObserver = [nc addObserverForName:UIKeyboardWillHideNotification
- object:nil
- queue:[NSOperationQueue mainQueue]
- usingBlock:^(NSNotification* notification) {
- [weakSelf.commandDelegate evalJs:@"cordova.plugins.Keyboard.isVisible = false; cordova.fireWindowEvent('native.keyboardhide'); "];
-
- //deprecated
- [weakSelf.commandDelegate evalJs:@"cordova.fireWindowEvent('native.hidekeyboard'); "];
- }];
-}
-
-- (BOOL)disableScroll {
- return _disableScroll;
-}
-
-- (void)setDisableScroll:(BOOL)disableScroll {
- if (disableScroll == _disableScroll) {
- return;
- }
- if (disableScroll) {
- self.webView.scrollView.scrollEnabled = NO;
- self.webView.scrollView.delegate = self;
- }
- else {
- self.webView.scrollView.scrollEnabled = YES;
- self.webView.scrollView.delegate = nil;
- }
-
- _disableScroll = disableScroll;
-}
-
-//keyboard swizzling inspired by:
-//https://github.com/cjpearson/cordova-plugin-keyboard/
-
-- (BOOL)hideKeyboardAccessoryBar {
- return _hideKeyboardAccessoryBar;
-}
-
-- (void)setHideKeyboardAccessoryBar:(BOOL)hideKeyboardAccessoryBar {
- if (hideKeyboardAccessoryBar == _hideKeyboardAccessoryBar) {
- return;
- }
-
- if (hideKeyboardAccessoryBar) {
- method_setImplementation(wkMethod, nilImp);
- method_setImplementation(uiMethod, nilImp);
- } else {
- method_setImplementation(wkMethod, wkOriginalImp);
- method_setImplementation(uiMethod, uiOriginalImp);
- }
-
- _hideKeyboardAccessoryBar = hideKeyboardAccessoryBar;
-}
-
-/*
-- (BOOL)styleDark {
- return _styleDark;
-}
-
-- (void)setStyleDark:(BOOL)styleDark {
- if (styleDark == _styleDark) {
- return;
- }
- if (styleDark) {
- self.webView.styleDark = YES;
- }
- else {
- self.webView.styleDark = NO;
- }
-
- _styleDark = styleDark;
-}
-*/
-
-
-/* ------------------------------------------------------------- */
-
-- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
- [scrollView setContentOffset: CGPointZero];
-}
-
-/* ------------------------------------------------------------- */
-
-- (void)dealloc {
- NSNotificationCenter* nc = [NSNotificationCenter defaultCenter];
-
- [nc removeObserver:self name:UIKeyboardWillShowNotification object:nil];
- [nc removeObserver:self name:UIKeyboardWillHideNotification object:nil];
-}
-
-/* ------------------------------------------------------------- */
-
-- (void) disableScroll:(CDVInvokedUrlCommand*)command {
- if (!command.arguments || ![command.arguments count]){
- return;
- }
- id value = [command.arguments objectAtIndex:0];
- if (value != [NSNull null]) {
- self.disableScroll = [value boolValue];
- }
-}
-
-- (void) hideKeyboardAccessoryBar:(CDVInvokedUrlCommand*)command {
- if (!command.arguments || ![command.arguments count]){
- return;
- }
- id value = [command.arguments objectAtIndex:0];
- if (value != [NSNull null]) {
- self.hideKeyboardAccessoryBar = [value boolValue];
- }
-}
-
-- (void) close:(CDVInvokedUrlCommand*)command {
- [self.webView endEditing:YES];
-}
-
-- (void) show:(CDVInvokedUrlCommand*)command {
- NSLog(@"Showing keyboard not supported in iOS due to platform limitations.");
-}
-
-/*
-- (void) styleDark:(CDVInvokedUrlCommand*)command {
- if (!command.arguments || ![command.arguments count]){
- return;
- }
- id value = [command.arguments objectAtIndex:0];
-
- self.styleDark = [value boolValue];
-}
-*/
-
-@end
-
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-mobile-accessibility/CDVMobileAccessibility.h b/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-mobile-accessibility/CDVMobileAccessibility.h
deleted file mode 100644
index 662abbea..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-mobile-accessibility/CDVMobileAccessibility.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-#import <Cordova/CDVPlugin.h>
-
-static const int BASE_UI_FONT_TEXT_STYLE_BODY_POINT_SIZE = 16;
-
-@interface CDVMobileAccessibility : CDVPlugin {
- NSString* callbackId;
- NSString* commandCallbackId;
- BOOL boldTextEnabled;
- BOOL closedCaptioningEnabled;
- BOOL darkerSystemColorsEnabled;
- BOOL grayscaleEnabled;
- BOOL guidedAccessEnabled;
- BOOL invertColorsEnabled;
- BOOL monoAudioEnabled;
- BOOL reduceMotionEnabled;
- BOOL reduceTransparencyEnabled;
- BOOL speakScreenEnabled;
- BOOL speakSelectionEnabled;
- BOOL switchControlRunning;
- BOOL voiceOverRunning;
-}
-
-@property (strong) NSString* callbackId;
-@property (strong) NSString* commandCallbackId;
-@property BOOL boldTextEnabled;
-@property BOOL closedCaptioningEnabled;
-@property BOOL darkerSystemColorsEnabled;
-@property BOOL grayscaleEnabled;
-@property BOOL guidedAccessEnabled;
-@property BOOL invertColorsEnabled;
-@property BOOL monoAudioEnabled;
-@property BOOL reduceMotionEnabled;
-@property BOOL reduceTransparencyEnabled;
-@property BOOL speakScreenEnabled;
-@property BOOL speakSelectionEnabled;
-@property BOOL switchControlRunning;
-@property BOOL voiceOverRunning;
-@property double mFontScale;
-
-
-- (void) isBoldTextEnabled:(CDVInvokedUrlCommand*)command;
-- (void) isClosedCaptioningEnabled:(CDVInvokedUrlCommand*)command;
-- (void) isDarkerSystemColorsEnabled:(CDVInvokedUrlCommand*)command;
-- (void) isGrayscaleEnabled:(CDVInvokedUrlCommand*)command;
-- (void) isGuidedAccessEnabled:(CDVInvokedUrlCommand*)command;
-- (void) isInvertColorsEnabled:(CDVInvokedUrlCommand*)command;
-- (void) isMonoAudioEnabled:(CDVInvokedUrlCommand*)command;
-- (void) isReduceMotionEnabled:(CDVInvokedUrlCommand*)command;
-- (void) isReduceTransparencyEnabled:(CDVInvokedUrlCommand*)command;
-- (void) isScreenReaderRunning:(CDVInvokedUrlCommand*)command;
-- (void) isSpeakScreenEnabled:(CDVInvokedUrlCommand*)command;
-- (void) isSpeakSelectionEnabled:(CDVInvokedUrlCommand*)command;
-- (void) isSwitchControlRunning:(CDVInvokedUrlCommand*)command;
-- (void) getTextZoom:(CDVInvokedUrlCommand*)command;
-- (void) setTextZoom:(CDVInvokedUrlCommand*)command;
-- (void) updateTextZoom:(CDVInvokedUrlCommand*)command;
-- (void) postNotification:(CDVInvokedUrlCommand*)command;
-- (void) start:(CDVInvokedUrlCommand*)command;
-- (void) stop:(CDVInvokedUrlCommand*)command;
-
-@end \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-mobile-accessibility/CDVMobileAccessibility.m b/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-mobile-accessibility/CDVMobileAccessibility.m
deleted file mode 100644
index ad8da029..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-mobile-accessibility/CDVMobileAccessibility.m
+++ /dev/null
@@ -1,511 +0,0 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-#import "CDVMobileAccessibility.h"
-#import <Cordova/CDVAvailability.h>
-#import <MediaAccessibility/MediaAccessibility.h>
-
-@interface CDVMobileAccessibility ()
- // add any property overrides
- -(double) mGetTextZoom;
- -(void) mSetTextZoom:(double)zoom;
-@end
-
-@implementation CDVMobileAccessibility
-
-@synthesize callbackId;
-@synthesize commandCallbackId;
-@synthesize boldTextEnabled;
-@synthesize closedCaptioningEnabled;
-@synthesize darkerSystemColorsEnabled;
-@synthesize grayscaleEnabled;
-@synthesize guidedAccessEnabled;
-@synthesize invertColorsEnabled;
-@synthesize monoAudioEnabled;
-@synthesize reduceMotionEnabled;
-@synthesize reduceTransparencyEnabled;
-@synthesize speakScreenEnabled;
-@synthesize speakSelectionEnabled;
-@synthesize switchControlRunning;
-@synthesize voiceOverRunning;
-@synthesize mFontScale;
-
-#define iOS7Delta (([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 ) ? 20 : 0 )
-#define iOS8Delta (([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 ) ? 30 : 0 )
-
-// //////////////////////////////////////////////////
-
-- (id)settingForKey:(NSString*)key
-{
- return [self.commandDelegate.settings objectForKey:[key lowercaseString]];
-}
-
-- (void)pluginInitialize
-{
- // SETTINGS ////////////////////////
-
- NSString* setting = nil;
-
- setting = @"YourConfigXmlSettingHere";
- if ([self settingForKey:setting]) {
- // set your setting, other init here
- }
-
- mFontScale = 1;
-
-
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil];
-
-}
-
-// //////////////////////////////////////////////////
-
-- (void)dealloc
-{
- [self stop:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
-}
-
-- (void)onReset
-{
- [self stop:nil];
-}
-
-- (void) onPause {
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidEnterBackgroundNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResume) name:UIApplicationWillEnterForegroundNotification object:nil];
-}
-
-- (void)onResume
-{
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillEnterForegroundNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onPause) name:UIApplicationDidEnterBackgroundNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onApplicationDidBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil];
-}
-
-- (void)onApplicationDidBecomeActive
-{
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
- [self performSelector:@selector(sendMobileAccessibilityStatusChangedCallback) withObject:nil afterDelay:0.1 ];
-}
-
-// //////////////////////////////////////////////////
-
-#pragma Plugin interface
-
-- (void)isBoldTextEnabled:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- if (iOS8Delta) {
- self.boldTextEnabled = UIAccessibilityIsBoldTextEnabled();
- } else {
- self.boldTextEnabled = false;
- }
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.boldTextEnabled];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
-- (void)isClosedCaptioningEnabled:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- self.closedCaptioningEnabled = [self getClosedCaptioningEnabledStatus];
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.closedCaptioningEnabled];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
-- (void)isDarkerSystemColorsEnabled:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- if (iOS8Delta) {
- self.darkerSystemColorsEnabled = UIAccessibilityDarkerSystemColorsEnabled();
- } else {
- self.darkerSystemColorsEnabled = false;
- }
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.darkerSystemColorsEnabled];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
-- (void)isGrayscaleEnabled:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- if (iOS8Delta) {
- self.grayscaleEnabled = UIAccessibilityIsGrayscaleEnabled();
- } else {
- self.grayscaleEnabled = false;
- }
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.grayscaleEnabled];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
-- (void)isGuidedAccessEnabled:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- self.guidedAccessEnabled = UIAccessibilityIsGuidedAccessEnabled();
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.guidedAccessEnabled];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
-- (void)isInvertColorsEnabled:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- self.invertColorsEnabled = UIAccessibilityIsInvertColorsEnabled();
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.invertColorsEnabled];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
-- (void)isMonoAudioEnabled:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- self.monoAudioEnabled = UIAccessibilityIsMonoAudioEnabled();
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.monoAudioEnabled];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
-- (void)isReduceMotionEnabled:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- if (iOS8Delta) {
- self.reduceMotionEnabled = UIAccessibilityIsReduceMotionEnabled();
- } else {
- self.reduceMotionEnabled = false;
- }
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.reduceMotionEnabled];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
-- (void)isReduceTransparencyEnabled:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- if (iOS8Delta) {
- self.reduceTransparencyEnabled = UIAccessibilityIsReduceTransparencyEnabled();
- } else {
- self.reduceTransparencyEnabled = false;
- }
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.reduceTransparencyEnabled];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
-- (void)isScreenReaderRunning:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- self.voiceOverRunning = UIAccessibilityIsVoiceOverRunning();
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.voiceOverRunning];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
-- (void)isSpeakScreenEnabled:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- if (iOS8Delta) {
- self.speakScreenEnabled = UIAccessibilityIsSpeakScreenEnabled();
- } else {
- self.speakScreenEnabled = false;
- }
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.speakScreenEnabled];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
-- (void)isSpeakSelectionEnabled:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- if (iOS8Delta) {
- self.speakSelectionEnabled = UIAccessibilityIsSpeakSelectionEnabled();
- } else {
- self.speakSelectionEnabled = false;
- }
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.speakSelectionEnabled];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
-- (void)isSwitchControlRunning:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- if (iOS8Delta) {
- self.switchControlRunning = UIAccessibilityIsSwitchControlRunning();
- } else {
- self.switchControlRunning = false;
- }
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsBool:self.switchControlRunning];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
--(double) mGetFontScale
-{
- double fontScale = 1;
- if (iOS7Delta) {
- fontScale = [[UIFont preferredFontForTextStyle:UIFontTextStyleBody] pointSize] / BASE_UI_FONT_TEXT_STYLE_BODY_POINT_SIZE;
- }
- return fontScale;
-}
-
--(double) mGetTextZoom
-{
- double zoom = round(mFontScale * 100);
- // NSLog(@"mGetTextZoom %f%%", zoom);
- return zoom;
-}
-
-- (void) getTextZoom:(CDVInvokedUrlCommand *)command
-{
- double zoom = [self mGetTextZoom];
- [self.commandDelegate runInBackground:^{
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDouble: zoom];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
-}
-
--(void) mSetTextZoom:(double)zoom
-{
- // NSLog(@"mSetTextZoom %f%%'", zoom);
- mFontScale = zoom/100;
- if (iOS7Delta) {
- NSString *jsString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '%f%%'", zoom];
- [self.commandDelegate evalJs:jsString];
- }
-}
-
-- (void) setTextZoom:(CDVInvokedUrlCommand *)command
-{
- if (command != nil && [command.arguments count] > 0) {
- double zoom = [[command.arguments objectAtIndex:0] doubleValue];
- [self mSetTextZoom:zoom];
-
- [self.commandDelegate runInBackground:^{
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDouble:zoom];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
- }
-}
-
-- (void)updateTextZoom:(CDVInvokedUrlCommand *)command
-{
- float fontScale = [self mGetFontScale];
- if (fontScale != mFontScale) {
- mFontScale = fontScale;
- }
- double zoom = [self mGetTextZoom];
- // NSLog(@"updateTextZoom %d%%'", zoom);
- [self mSetTextZoom:zoom];
-
- if (command != nil && command.callbackId != nil) {
- [self.commandDelegate runInBackground:^{
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDouble:zoom];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }];
- }
-}
-
-- (void)postNotification:(CDVInvokedUrlCommand *)command
-{
- CDVPluginResult* result = nil;
- uint32_t notificationType = [[command.arguments objectAtIndex:0] intValue];
- NSString* notificationString = [command.arguments count] > 1 ? [command.arguments objectAtIndex:1] : @"";
-
- if (notificationString == nil) {
- notificationString = @"";
- }
- if (UIAccessibilityIsVoiceOverRunning() &&
- [self isValidNotificationType:notificationType]) {
- [self.commandDelegate runInBackground:^{
- if (notificationType == UIAccessibilityAnnouncementNotification) {
- self.commandCallbackId = command.callbackId;
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityAnnouncementDidFinish:) name:UIAccessibilityAnnouncementDidFinishNotification object:nil];
- }
-
- UIAccessibilityPostNotification(notificationType, notificationString);
-
- if (notificationType != UIAccessibilityAnnouncementNotification) {
- NSMutableDictionary* data = [NSMutableDictionary dictionaryWithCapacity:2];
- [data setObject:notificationString forKey:@"stringValue"];
- [data setObject:@"true" forKey:@"wasSuccessful"];
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:data];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }
- }];
- } else {
- result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR];
- [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
- }
-}
-
-- (BOOL)isValidNotificationType:(uint32_t)notificationType
-{
- return (notificationType == UIAccessibilityScreenChangedNotification
- || notificationType == UIAccessibilityLayoutChangedNotification
- || notificationType == UIAccessibilityAnnouncementNotification
- || notificationType == UIAccessibilityPageScrolledNotification);
-}
-
-- (void)mobileAccessibilityAnnouncementDidFinish:(NSNotification *)dict
-{
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityAnnouncementDidFinishNotification object:nil];
-
- NSString* valueSpoken = [[dict userInfo] objectForKey:UIAccessibilityAnnouncementKeyStringValue];
- NSString* wasSuccessful = [[dict userInfo] objectForKey:UIAccessibilityAnnouncementKeyWasSuccessful];
-
- NSMutableDictionary* data = [NSMutableDictionary dictionaryWithCapacity:2];
- [data setObject:valueSpoken forKey:@"stringValue"];
- [data setObject:wasSuccessful forKey:@"wasSuccessful"];
-
- if (self.commandCallbackId) {
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:data];
- [self.commandDelegate sendPluginResult:result callbackId:self.commandCallbackId];
- self.commandCallbackId = nil;
- }
-}
-
-- (BOOL)getClosedCaptioningEnabledStatus
-{
- BOOL status = false;
- if (&MACaptionAppearanceGetDisplayType) {
- status = (MACaptionAppearanceGetDisplayType(kMACaptionAppearanceDomainUser) > kMACaptionAppearanceDisplayTypeAutomatic);
- } else {
- status = UIAccessibilityIsClosedCaptioningEnabled();
- }
- return status;
-}
-
-- (void)mobileAccessibilityStatusChanged:(NSNotification *)notification
-{
- [self sendMobileAccessibilityStatusChangedCallback];
-}
-
-- (void)sendMobileAccessibilityStatusChangedCallback
-{
- if (self.callbackId) {
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:[self getMobileAccessibilityStatus]];
- [result setKeepCallbackAsBool:YES];
- [self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
- }
-}
-
-/* Get the current mobile accessibility status. */
-- (NSDictionary*)getMobileAccessibilityStatus
-{
- self.boldTextEnabled = UIAccessibilityIsBoldTextEnabled();
- self.closedCaptioningEnabled = [self getClosedCaptioningEnabledStatus];
- self.darkerSystemColorsEnabled = UIAccessibilityDarkerSystemColorsEnabled();
- self.grayscaleEnabled = UIAccessibilityIsGrayscaleEnabled();
- self.guidedAccessEnabled = UIAccessibilityIsGuidedAccessEnabled();
- self.invertColorsEnabled = UIAccessibilityIsInvertColorsEnabled();
- self.monoAudioEnabled = UIAccessibilityIsMonoAudioEnabled();
- self.reduceMotionEnabled = UIAccessibilityIsReduceMotionEnabled();
- self.reduceTransparencyEnabled = UIAccessibilityIsReduceTransparencyEnabled();
- self.speakScreenEnabled = UIAccessibilityIsSpeakScreenEnabled();
- self.speakSelectionEnabled = UIAccessibilityIsSpeakSelectionEnabled();
- self.switchControlRunning = UIAccessibilityIsSwitchControlRunning();
- self.voiceOverRunning = UIAccessibilityIsVoiceOverRunning();
-
- NSMutableDictionary* mobileAccessibilityData = [NSMutableDictionary dictionaryWithCapacity:5];
- [mobileAccessibilityData setObject:[NSNumber numberWithBool:self.boldTextEnabled] forKey:@"isBoldTextEnabled"];
- [mobileAccessibilityData setObject:[NSNumber numberWithBool:self.closedCaptioningEnabled] forKey:@"isClosedCaptioningEnabled"];
- [mobileAccessibilityData setObject:[NSNumber numberWithBool:self.darkerSystemColorsEnabled] forKey:@"isDarkerSystemColorsEnabled"];
- [mobileAccessibilityData setObject:[NSNumber numberWithBool:self.grayscaleEnabled] forKey:@"isGrayscaleEnabled"];
- [mobileAccessibilityData setObject:[NSNumber numberWithBool:self.guidedAccessEnabled] forKey:@"isGuidedAccessEnabled"];
- [mobileAccessibilityData setObject:[NSNumber numberWithBool:self.invertColorsEnabled] forKey:@"isInvertColorsEnabled"];
- [mobileAccessibilityData setObject:[NSNumber numberWithBool:self.monoAudioEnabled] forKey:@"isMonoAudioEnabled"];
- [mobileAccessibilityData setObject:[NSNumber numberWithBool:self.reduceMotionEnabled] forKey:@"isReduceMotionEnabled"];
- [mobileAccessibilityData setObject:[NSNumber numberWithBool:self.reduceTransparencyEnabled] forKey:@"isReduceTransparencyEnabled"];
- [mobileAccessibilityData setObject:[NSNumber numberWithBool:self.speakScreenEnabled] forKey:@"isSpeakScreenEnabled"];
- [mobileAccessibilityData setObject:[NSNumber numberWithBool:self.speakSelectionEnabled] forKey:@"isSpeakSelectionEnabled"];
- [mobileAccessibilityData setObject:[NSNumber numberWithBool:self.switchControlRunning] forKey:@"isSwitchControlRunning"];
- [mobileAccessibilityData setObject:[NSNumber numberWithBool:self.voiceOverRunning] forKey:@"isScreenReaderRunning"];
- return mobileAccessibilityData;
-}
-
-
-/* start MobileAccessibility monitoring */
-- (void)start:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- self.callbackId = command.callbackId;
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilityClosedCaptioningStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilityGuidedAccessStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilityInvertColorsStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilityMonoAudioStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilityVoiceOverStatusChanged object:nil];
-
- if (iOS8Delta) {
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilityBoldTextStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilityDarkerSystemColorsStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilityGrayscaleStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilityReduceMotionStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilityReduceTransparencyStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilitySpeakScreenStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilitySpeakSelectionStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mobileAccessibilityStatusChanged:) name:UIAccessibilitySwitchControlStatusDidChangeNotification object:nil];
- }
-
- // Update the callback on start
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:[self getMobileAccessibilityStatus]];
- [result setKeepCallbackAsBool:YES];
- [self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
- }];
-}
-
-/* stop MobileAccessibility monitoring */
-- (void)stop:(CDVInvokedUrlCommand*)command
-{
- [self.commandDelegate runInBackground:^{
- // callback one last time to clear the callback function on JS side
- if (self.callbackId)
- {
- CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:[self getMobileAccessibilityStatus]];
- [result setKeepCallbackAsBool:NO];
- [self.commandDelegate sendPluginResult:result callbackId:self.callbackId];
- }
- self.callbackId = nil;
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityClosedCaptioningStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityGuidedAccessStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityInvertColorsStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityAnnouncementDidFinishNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityMonoAudioStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityVoiceOverStatusChanged object:nil];
-
- if (iOS8Delta) {
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityBoldTextStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityDarkerSystemColorsStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityGrayscaleStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityReduceMotionStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilityReduceTransparencyStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilitySpeakScreenStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilitySpeakSelectionStatusDidChangeNotification object:nil];
- [[NSNotificationCenter defaultCenter] removeObserver:self name:UIAccessibilitySwitchControlStatusDidChangeNotification object:nil];
- }
- }];
-}
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/AppDelegate+notification.h b/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/AppDelegate+notification.h
deleted file mode 100644
index 9970762b..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/AppDelegate+notification.h
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// AppDelegate+notification.h
-// pushtest
-//
-// Created by Robert Easterday on 10/26/12.
-//
-//
-
-#import "AppDelegate.h"
-
-@interface AppDelegate (notification)
-- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
-- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
-- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:( void (^)(UIBackgroundFetchResult))completionHandler;
-- (void)pushPluginOnApplicationDidBecomeActive:(UIApplication *)application;
-- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo completionHandler:(void(^)())completionHandler;
-- (id) getCommandInstance:(NSString*)className;
-
-@property (nonatomic, retain) NSDictionary *launchNotification;
-@property (nonatomic, retain) NSNumber *coldstart;
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/AppDelegate+notification.m b/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/AppDelegate+notification.m
deleted file mode 100644
index fc18dd79..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/AppDelegate+notification.m
+++ /dev/null
@@ -1,278 +0,0 @@
-//
-// AppDelegate+notification.m
-// pushtest
-//
-// Created by Robert Easterday on 10/26/12.
-//
-//
-
-#import "AppDelegate+notification.h"
-#import "PushPlugin.h"
-#import <objc/runtime.h>
-
-static char launchNotificationKey;
-static char coldstartKey;
-
-@implementation AppDelegate (notification)
-
-- (id) getCommandInstance:(NSString*)className
-{
- return [self.viewController getCommandInstance:className];
-}
-
-// its dangerous to override a method from within a category.
-// Instead we will use method swizzling. we set this up in the load call.
-+ (void)load
-{
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- Class class = [self class];
-
- SEL originalSelector = @selector(init);
- SEL swizzledSelector = @selector(pushPluginSwizzledInit);
-
- Method original = class_getInstanceMethod(class, originalSelector);
- Method swizzled = class_getInstanceMethod(class, swizzledSelector);
-
- BOOL didAddMethod =
- class_addMethod(class,
- originalSelector,
- method_getImplementation(swizzled),
- method_getTypeEncoding(swizzled));
-
- if (didAddMethod) {
- class_replaceMethod(class,
- swizzledSelector,
- method_getImplementation(original),
- method_getTypeEncoding(original));
- } else {
- method_exchangeImplementations(original, swizzled);
- }
- });
-}
-
-- (AppDelegate *)pushPluginSwizzledInit
-{
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(createNotificationChecker:)
- name:UIApplicationDidFinishLaunchingNotification
- object:nil];
- [[NSNotificationCenter defaultCenter]addObserver:self
- selector:@selector(pushPluginOnApplicationDidBecomeActive:)
- name:UIApplicationDidBecomeActiveNotification
- object:nil];
-
- // This actually calls the original init method over in AppDelegate. Equivilent to calling super
- // on an overrided method, this is not recursive, although it appears that way. neat huh?
- return [self pushPluginSwizzledInit];
-}
-
-// This code will be called immediately after application:didFinishLaunchingWithOptions:. We need
-// to process notifications in cold-start situations
-- (void)createNotificationChecker:(NSNotification *)notification
-{
- NSLog(@"createNotificationChecker");
- if (notification)
- {
- NSDictionary *launchOptions = [notification userInfo];
- if (launchOptions) {
- NSLog(@"coldstart");
- self.launchNotification = [launchOptions objectForKey: @"UIApplicationLaunchOptionsRemoteNotificationKey"];
- self.coldstart = [NSNumber numberWithBool:YES];
- } else {
- NSLog(@"not coldstart");
- self.coldstart = [NSNumber numberWithBool:NO];
- }
- }
-}
-
-- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
- PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];
- [pushHandler didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
-}
-
-- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
- PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];
- [pushHandler didFailToRegisterForRemoteNotificationsWithError:error];
-}
-
-- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
- NSLog(@"clicked on the shade");
- PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];
- pushHandler.notificationMessage = userInfo;
- pushHandler.isInline = NO;
- [pushHandler notificationReceived];
-}
-
-- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
- NSLog(@"didReceiveNotification with fetchCompletionHandler");
-
- // app is in the foreground so call notification callback
- if (application.applicationState == UIApplicationStateActive) {
- NSLog(@"app active");
- PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];
- pushHandler.notificationMessage = userInfo;
- pushHandler.isInline = YES;
- [pushHandler notificationReceived];
-
- completionHandler(UIBackgroundFetchResultNewData);
- }
- // app is in background or in stand by
- else {
- NSLog(@"app in-active");
-
- // do some convoluted logic to find out if this should be a silent push.
- long silent = 0;
- id aps = [userInfo objectForKey:@"aps"];
- id contentAvailable = [aps objectForKey:@"content-available"];
- if ([contentAvailable isKindOfClass:[NSString class]] && [contentAvailable isEqualToString:@"1"]) {
- silent = 1;
- } else if ([contentAvailable isKindOfClass:[NSNumber class]]) {
- silent = [contentAvailable integerValue];
- }
-
- if (silent == 1) {
- NSLog(@"this should be a silent push");
- void (^safeHandler)(UIBackgroundFetchResult) = ^(UIBackgroundFetchResult result){
- dispatch_async(dispatch_get_main_queue(), ^{
- completionHandler(result);
- });
- };
-
- PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];
-
- if (pushHandler.handlerObj == nil) {
- pushHandler.handlerObj = [NSMutableDictionary dictionaryWithCapacity:2];
- }
-
- id notId = [userInfo objectForKey:@"notId"];
- if (notId != nil) {
- NSLog(@"Push Plugin notId %@", notId);
- [pushHandler.handlerObj setObject:safeHandler forKey:notId];
- } else {
- NSLog(@"Push Plugin notId handler");
- [pushHandler.handlerObj setObject:safeHandler forKey:@"handler"];
- }
-
- pushHandler.notificationMessage = userInfo;
- pushHandler.isInline = NO;
- [pushHandler notificationReceived];
- } else {
- NSLog(@"just put it in the shade");
- //save it for later
- self.launchNotification = userInfo;
-
- completionHandler(UIBackgroundFetchResultNewData);
- }
- }
-}
-
-- (BOOL)userHasRemoteNotificationsEnabled {
- UIApplication *application = [UIApplication sharedApplication];
- if ([[UIApplication sharedApplication] respondsToSelector:@selector(registerUserNotificationSettings:)]) {
- return application.currentUserNotificationSettings.types != UIUserNotificationTypeNone;
- } else {
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
- return application.enabledRemoteNotificationTypes != UIRemoteNotificationTypeNone;
-#pragma GCC diagnostic pop
- }
-}
-
-- (void)pushPluginOnApplicationDidBecomeActive:(NSNotification *)notification {
-
- NSLog(@"active");
-
- UIApplication *application = notification.object;
-
- PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];
- if (pushHandler.clearBadge) {
- NSLog(@"PushPlugin clearing badge");
- //zero badge
- application.applicationIconBadgeNumber = 0;
- } else {
- NSLog(@"PushPlugin skip clear badge");
- }
-
- if (self.launchNotification) {
- pushHandler.isInline = NO;
- pushHandler.coldstart = [self.coldstart boolValue];
- pushHandler.notificationMessage = self.launchNotification;
- self.launchNotification = nil;
- self.coldstart = [NSNumber numberWithBool:NO];
- [pushHandler performSelectorOnMainThread:@selector(notificationReceived) withObject:pushHandler waitUntilDone:NO];
- }
-}
-
-
-- (void)application:(UIApplication *) application handleActionWithIdentifier: (NSString *) identifier
-forRemoteNotification: (NSDictionary *) notification completionHandler: (void (^)()) completionHandler {
-
- NSLog(@"Push Plugin handleActionWithIdentifier %@", identifier);
- NSMutableDictionary *userInfo = [notification mutableCopy];
- [userInfo setObject:identifier forKey:@"actionCallback"];
- NSLog(@"Push Plugin userInfo %@", userInfo);
-
- if (application.applicationState == UIApplicationStateActive) {
- PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];
- pushHandler.notificationMessage = userInfo;
- pushHandler.isInline = NO;
- [pushHandler notificationReceived];
- } else {
- void (^safeHandler)() = ^(void){
- dispatch_async(dispatch_get_main_queue(), ^{
- completionHandler();
- });
- };
-
- PushPlugin *pushHandler = [self getCommandInstance:@"PushNotification"];
-
- if (pushHandler.handlerObj == nil) {
- pushHandler.handlerObj = [NSMutableDictionary dictionaryWithCapacity:2];
- }
-
- id notId = [userInfo objectForKey:@"notId"];
- if (notId != nil) {
- NSLog(@"Push Plugin notId %@", notId);
- [pushHandler.handlerObj setObject:safeHandler forKey:notId];
- } else {
- NSLog(@"Push Plugin notId handler");
- [pushHandler.handlerObj setObject:safeHandler forKey:@"handler"];
- }
-
- pushHandler.notificationMessage = userInfo;
- pushHandler.isInline = NO;
-
- [pushHandler performSelectorOnMainThread:@selector(notificationReceived) withObject:pushHandler waitUntilDone:NO];
- }
-}
-
-// The accessors use an Associative Reference since you can't define a iVar in a category
-// http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/objectivec/Chapters/ocAssociativeReferences.html
-- (NSMutableArray *)launchNotification
-{
- return objc_getAssociatedObject(self, &launchNotificationKey);
-}
-
-- (void)setLaunchNotification:(NSDictionary *)aDictionary
-{
- objc_setAssociatedObject(self, &launchNotificationKey, aDictionary, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-- (NSNumber *)coldstart
-{
- return objc_getAssociatedObject(self, &coldstartKey);
-}
-
-- (void)setColdstart:(NSNumber *)aNumber
-{
- objc_setAssociatedObject(self, &coldstartKey, aNumber, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
-}
-
-- (void)dealloc
-{
- self.launchNotification = nil; // clear the association and release the object
- self.coldstart = nil;
-}
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/PushPlugin.h b/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/PushPlugin.h
deleted file mode 100644
index 276a0080..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/PushPlugin.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- Copyright 2009-2011 Urban Airship Inc. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- 2. Redistributions in binaryform must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided withthe distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE URBAN AIRSHIP INC``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- EVENT SHALL URBAN AIRSHIP INC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import <Foundation/Foundation.h>
-#import <Cordova/CDV.h>
-#import <Cordova/CDVPlugin.h>
-
-@protocol GGLInstanceIDDelegate;
-@protocol GCMReceiverDelegate;
-@interface PushPlugin : CDVPlugin<GGLInstanceIDDelegate, GCMReceiverDelegate>
-{
- NSDictionary *notificationMessage;
- BOOL isInline;
- NSString *notificationCallbackId;
- NSString *callback;
- BOOL clearBadge;
-
- NSMutableDictionary *handlerObj;
- void (^completionHandler)(UIBackgroundFetchResult);
-
- BOOL ready;
-}
-
-@property (nonatomic, copy) NSString *callbackId;
-@property (nonatomic, copy) NSString *notificationCallbackId;
-@property (nonatomic, copy) NSString *callback;
-
-@property (nonatomic, strong) NSDictionary *notificationMessage;
-@property BOOL isInline;
-@property BOOL coldstart;
-@property BOOL clearBadge;
-@property (nonatomic, strong) NSMutableDictionary *handlerObj;
-
-- (void)init:(CDVInvokedUrlCommand*)command;
-- (void)unregister:(CDVInvokedUrlCommand*)command;
-- (void)subscribe:(CDVInvokedUrlCommand*)command;
-- (void)unsubscribe:(CDVInvokedUrlCommand*)command;
-
-- (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken;
-- (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error;
-
-- (void)setNotificationMessage:(NSDictionary *)notification;
-- (void)notificationReceived;
-
-- (void)willSendDataMessageWithID:(NSString *)messageID error:(NSError *)error;
-- (void)didSendDataMessageWithID:(NSString *)messageID;
-- (void)didDeleteMessagesOnServer;
-
-// GCM Features
-@property(nonatomic, assign) BOOL usesGCM;
-@property(nonatomic, strong) NSNumber* gcmSandbox;
-@property(nonatomic, strong) NSString *gcmSenderId;
-@property(nonatomic, strong) NSDictionary *gcmRegistrationOptions;
-@property(nonatomic, strong) void (^gcmRegistrationHandler) (NSString *registrationToken, NSError *error);
-@property(nonatomic, strong) NSString *gcmRegistrationToken;
-@property(nonatomic, strong) NSArray *gcmTopics;
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/PushPlugin.m b/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/PushPlugin.m
deleted file mode 100644
index a176b9af..00000000
--- a/StoneIsland/platforms/ios/Stone Island/Plugins/phonegap-plugin-push/PushPlugin.m
+++ /dev/null
@@ -1,677 +0,0 @@
-/*
- Copyright 2009-2011 Urban Airship Inc. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- 2. Redistributions in binaryform must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided withthe distribution.
-
- THIS SOFTWARE IS PROVIDED BY THE URBAN AIRSHIP INC``AS IS'' AND ANY EXPRESS OR
- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
- EVENT SHALL URBAN AIRSHIP INC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
- OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-// See GGLInstanceID.h
-#define GMP_NO_MODULES true
-
-#import "PushPlugin.h"
-#import "GoogleCloudMessaging.h"
-#import "GGLInstanceIDHeaders.h"
-
-@implementation PushPlugin : CDVPlugin
-
-@synthesize notificationMessage;
-@synthesize isInline;
-@synthesize coldstart;
-
-@synthesize callbackId;
-@synthesize notificationCallbackId;
-@synthesize callback;
-@synthesize clearBadge;
-@synthesize handlerObj;
-
-@synthesize usesGCM;
-@synthesize gcmSandbox;
-@synthesize gcmSenderId;
-@synthesize gcmRegistrationOptions;
-@synthesize gcmRegistrationHandler;
-@synthesize gcmRegistrationToken;
-@synthesize gcmTopics;
-
--(void)initGCMRegistrationHandler;
-{
- __weak __block PushPlugin *weakSelf = self;
- gcmRegistrationHandler = ^(NSString *registrationToken, NSError *error){
- if (registrationToken != nil) {
- NSLog(@"GCM Registration Token: %@", registrationToken);
- [weakSelf setGcmRegistrationToken: registrationToken];
-
- id topics = [weakSelf gcmTopics];
- if (topics != nil) {
- for (NSString *topic in topics) {
- NSLog(@"subscribe from topic: %@", topic);
- id pubSub = [GCMPubSub sharedInstance];
- [pubSub subscribeWithToken: [weakSelf gcmRegistrationToken]
- topic:[NSString stringWithFormat:@"/topics/%@", topic]
- options:nil
- handler:^void(NSError *error) {
- if (error) {
- if (error.code == 3001) {
- NSLog(@"Already subscribed to %@", topic);
- } else {
- NSLog(@"Failed to subscribe to topic %@: %@", topic, error);
- }
- }
- else {
- NSLog(@"Successfully subscribe to topic %@", topic);
- }
- }];
- }
- }
-
- [weakSelf registerWithToken:registrationToken];
- } else {
- NSLog(@"Registration to GCM failed with error: %@", error.localizedDescription);
- [weakSelf failWithMessage:self.callbackId withMsg:@"" withError:error];
- }
- };
-}
-
-// GCM refresh token
-// Unclear how this is testable under normal circumstances
-- (void)onTokenRefresh {
-#if !TARGET_IPHONE_SIMULATOR
- // A rotation of the registration tokens is happening, so the app needs to request a new token.
- NSLog(@"The GCM registration token needs to be changed.");
- [[GGLInstanceID sharedInstance] tokenWithAuthorizedEntity:[self gcmSenderId]
- scope:kGGLInstanceIDScopeGCM
- options:[self gcmRegistrationOptions]
- handler:[self gcmRegistrationHandler]];
-#endif
-}
-
-- (void)willSendDataMessageWithID:(NSString *)messageID error:(NSError *)error {
- NSLog(@"willSendDataMessageWithID");
- if (error) {
- // Failed to send the message.
- } else {
- // Will send message, you can save the messageID to track the message
- }
-}
-
-- (void)didSendDataMessageWithID:(NSString *)messageID {
- NSLog(@"willSendDataMessageWithID");
- // Did successfully send message identified by messageID
-}
-
-- (void)didDeleteMessagesOnServer {
- NSLog(@"didDeleteMessagesOnServer");
- // Some messages sent to this device were deleted on the GCM server before reception, likely
- // because the TTL expired. The client should notify the app server of this, so that the app
- // server can resend those messages.
-}
-
-- (void)unregister:(CDVInvokedUrlCommand*)command;
-{
- NSArray* topics = [command argumentAtIndex:0];
-
- if (topics != nil) {
- id pubSub = [GCMPubSub sharedInstance];
- for (NSString *topic in topics) {
- NSLog(@"unsubscribe from topic: %@", topic);
- [pubSub unsubscribeWithToken: [self gcmRegistrationToken]
- topic:[NSString stringWithFormat:@"/topics/%@", topic]
- options:nil
- handler:^void(NSError *error) {
- if (error) {
- NSLog(@"Failed to unsubscribe from topic %@: %@", topic, error);
- }
- else {
- NSLog(@"Successfully unsubscribe from topic %@", topic);
- }
- }];
- }
- } else {
- [[UIApplication sharedApplication] unregisterForRemoteNotifications];
- [self successWithMessage:command.callbackId withMsg:@"unregistered"];
- }
-}
-
-- (void)subscribe:(CDVInvokedUrlCommand*)command;
-{
- NSString* topic = [command argumentAtIndex:0];
-
- if (topic != nil) {
- NSLog(@"subscribe from topic: %@", topic);
- id pubSub = [GCMPubSub sharedInstance];
- [pubSub subscribeWithToken: [self gcmRegistrationToken]
- topic:[NSString stringWithFormat:@"/topics/%@", topic]
- options:nil
- handler:^void(NSError *error) {
- if (error) {
- if (error.code == 3001) {
- NSLog(@"Already subscribed to %@", topic);
- [self successWithMessage:command.callbackId withMsg:[NSString stringWithFormat:@"Already subscribed to %@", topic]];
- } else {
- NSLog(@"Failed to subscribe to topic %@: %@", topic, error);
- [self failWithMessage:command.callbackId withMsg:[NSString stringWithFormat:@"Failed to subscribe to topic %@", topic] withError:error];
- }
- }
- else {
- NSLog(@"Successfully subscribe to topic %@", topic);
- [self successWithMessage:command.callbackId withMsg:[NSString stringWithFormat:@"Successfully subscribe to topic %@", topic]];
- }
- }];
- } else {
- NSLog(@"There is no topic to subscribe");
- [self successWithMessage:command.callbackId withMsg:@"There is no topic to subscribe"];
- }
-}
-
-- (void)unsubscribe:(CDVInvokedUrlCommand*)command;
-{
- NSString* topic = [command argumentAtIndex:0];
-
- if (topic != nil) {
- NSLog(@"unsubscribe from topic: %@", topic);
- id pubSub = [GCMPubSub sharedInstance];
- [pubSub unsubscribeWithToken: [self gcmRegistrationToken]
- topic:[NSString stringWithFormat:@"/topics/%@", topic]
- options:nil
- handler:^void(NSError *error) {
- if (error) {
- NSLog(@"Failed to unsubscribe to topic %@: %@", topic, error);
- [self failWithMessage:command.callbackId withMsg:[NSString stringWithFormat:@"Failed to unsubscribe to topic %@", topic] withError:error];
- } else {
- NSLog(@"Successfully unsubscribe to topic %@", topic);
- [self successWithMessage:command.callbackId withMsg:[NSString stringWithFormat:@"Successfully unsubscribe to topic %@", topic]];
- }
- }];
- } else {
- NSLog(@"There is no topic to unsubscribe");
- [self successWithMessage:command.callbackId withMsg:@"There is no topic to unsubscribe"];
- }
-}
-
-- (void)init:(CDVInvokedUrlCommand*)command;
-{
- [self.commandDelegate runInBackground:^ {
-
- NSLog(@"Push Plugin register called");
- self.callbackId = command.callbackId;
-
- NSMutableDictionary* options = [command.arguments objectAtIndex:0];
- NSMutableDictionary* iosOptions = [options objectForKey:@"ios"];
-
- NSArray* topics = [iosOptions objectForKey:@"topics"];
- [self setGcmTopics:topics];
-
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
- UIUserNotificationType UserNotificationTypes = UIUserNotificationTypeNone;
-#endif
- UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeNone;
-
- id badgeArg = [iosOptions objectForKey:@"badge"];
- id soundArg = [iosOptions objectForKey:@"sound"];
- id alertArg = [iosOptions objectForKey:@"alert"];
- id clearBadgeArg = [iosOptions objectForKey:@"clearBadge"];
-
- if (([badgeArg isKindOfClass:[NSString class]] && [badgeArg isEqualToString:@"true"]) || [badgeArg boolValue])
- {
- notificationTypes |= UIRemoteNotificationTypeBadge;
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
- UserNotificationTypes |= UIUserNotificationTypeBadge;
-#endif
- }
-
- if (([soundArg isKindOfClass:[NSString class]] && [soundArg isEqualToString:@"true"]) || [soundArg boolValue])
- {
- notificationTypes |= UIRemoteNotificationTypeSound;
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
- UserNotificationTypes |= UIUserNotificationTypeSound;
-#endif
- }
-
- if (([alertArg isKindOfClass:[NSString class]] && [alertArg isEqualToString:@"true"]) || [alertArg boolValue])
- {
- notificationTypes |= UIRemoteNotificationTypeAlert;
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
- UserNotificationTypes |= UIUserNotificationTypeAlert;
-#endif
- }
-
- notificationTypes |= UIRemoteNotificationTypeNewsstandContentAvailability;
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
- UserNotificationTypes |= UIUserNotificationActivationModeBackground;
-#endif
-
- if (clearBadgeArg == nil || ([clearBadgeArg isKindOfClass:[NSString class]] && [clearBadgeArg isEqualToString:@"false"]) || ![clearBadgeArg boolValue]) {
- NSLog(@"PushPlugin.register: setting badge to false");
- clearBadge = NO;
- } else {
- NSLog(@"PushPlugin.register: setting badge to true");
- clearBadge = YES;
- [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
- }
- NSLog(@"PushPlugin.register: clear badge is set to %d", clearBadge);
-
- if (notificationTypes == UIRemoteNotificationTypeNone)
- NSLog(@"PushPlugin.register: Push notification type is set to none");
-
- isInline = NO;
-
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
- NSLog(@"PushPlugin.register: better button setup");
- // setup action buttons
- NSMutableSet *categories = [[NSMutableSet alloc] init];
- id categoryOptions = [iosOptions objectForKey:@"categories"];
- if (categoryOptions != nil && [categoryOptions isKindOfClass:[NSDictionary class]]) {
- for (id key in categoryOptions) {
- NSLog(@"categories: key %@", key);
- id category = [categoryOptions objectForKey:key];
-
- id yesButton = [category objectForKey:@"yes"];
- UIMutableUserNotificationAction *yesAction;
- if (yesButton != nil && [yesButton isKindOfClass:[NSDictionary class]]) {
- yesAction = [self createAction: yesButton];
- }
- id noButton = [category objectForKey:@"no"];
- UIMutableUserNotificationAction *noAction;
- if (noButton != nil && [noButton isKindOfClass:[NSDictionary class]]) {
- noAction = [self createAction: noButton];
- }
- id maybeButton = [category objectForKey:@"maybe"];
- UIMutableUserNotificationAction *maybeAction;
- if (maybeButton != nil && [maybeButton isKindOfClass:[NSDictionary class]]) {
- maybeAction = [self createAction: maybeButton];
- }
-
- // First create the category
- UIMutableUserNotificationCategory *notificationCategory = [[UIMutableUserNotificationCategory alloc] init];
-
- // Identifier to include in your push payload and local notification
- notificationCategory.identifier = key;
-
- NSMutableArray *categoryArray = [[NSMutableArray alloc] init];
- NSMutableArray *minimalCategoryArray = [[NSMutableArray alloc] init];
- if (yesButton != nil) {
- [categoryArray addObject:yesAction];
- [minimalCategoryArray addObject:yesAction];
- }
- if (noButton != nil) {
- [categoryArray addObject:noAction];
- [minimalCategoryArray addObject:noAction];
- }
- if (maybeButton != nil) {
- [categoryArray addObject:maybeAction];
- }
-
- // Add the actions to the category and set the action context
- [notificationCategory setActions:categoryArray forContext:UIUserNotificationActionContextDefault];
-
- // Set the actions to present in a minimal context
- [notificationCategory setActions:minimalCategoryArray forContext:UIUserNotificationActionContextMinimal];
-
- NSLog(@"Adding category %@", key);
- [categories addObject:notificationCategory];
- }
-
- }
-#else
- NSLog(@"PushPlugin.register: action buttons only supported on iOS8 and above");
-#endif
-
-
-#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000
- if ([[UIApplication sharedApplication]respondsToSelector:@selector(registerUserNotificationSettings:)]) {
- UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UserNotificationTypes categories:categories];
- [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
- [[UIApplication sharedApplication] registerForRemoteNotifications];
- } else {
- [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
- (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
- }
-#else
- [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
- (UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)];
-#endif
-
- // GCM options
- [self setGcmSenderId: [iosOptions objectForKey:@"senderID"]];
- NSLog(@"GCM Sender ID %@", gcmSenderId);
- if([[self gcmSenderId] length] > 0) {
- NSLog(@"Using GCM Notification");
- [self setUsesGCM: YES];
- [self initGCMRegistrationHandler];
- } else {
- NSLog(@"Using APNS Notification");
- [self setUsesGCM:NO];
- }
- id gcmSandBoxArg = [iosOptions objectForKey:@"gcmSandbox"];
-
- [self setGcmSandbox:@NO];
- if ([self usesGCM] &&
- (([gcmSandBoxArg isKindOfClass:[NSString class]] && [gcmSandBoxArg isEqualToString:@"true"]) ||
- [gcmSandBoxArg boolValue]))
- {
- NSLog(@"Using GCM Sandbox");
- [self setGcmSandbox:@YES];
- }
-
- if (notificationMessage) { // if there is a pending startup notification
- dispatch_async(dispatch_get_main_queue(), ^{
- // delay to allow JS event handlers to be setup
- [self performSelector:@selector(notificationReceived) withObject:nil afterDelay: 0.5];
- });
- }
- }];
-}
-
-- (UIMutableUserNotificationAction *)createAction:(NSDictionary *)dictionary {
-
- UIMutableUserNotificationAction *myAction = [[UIMutableUserNotificationAction alloc] init];
-
- myAction = [[UIMutableUserNotificationAction alloc] init];
- myAction.identifier = [dictionary objectForKey:@"callback"];
- myAction.title = [dictionary objectForKey:@"title"];
- id mode =[dictionary objectForKey:@"foreground"];
- if (mode == nil || ([mode isKindOfClass:[NSString class]] && [mode isEqualToString:@"false"]) || ![mode boolValue]) {
- myAction.activationMode = UIUserNotificationActivationModeBackground;
- } else {
- myAction.activationMode = UIUserNotificationActivationModeForeground;
- }
- id destructive = [dictionary objectForKey:@"destructive"];
- if (destructive == nil || ([destructive isKindOfClass:[NSString class]] && [destructive isEqualToString:@"false"]) || ![destructive boolValue]) {
- myAction.destructive = NO;
- } else {
- myAction.destructive = YES;
- }
- myAction.authenticationRequired = NO;
-
- return myAction;
-}
-
-- (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
- if (self.callbackId == nil) {
- NSLog(@"Unexpected call to didRegisterForRemoteNotificationsWithDeviceToken, ignoring: %@", deviceToken);
- return;
- }
- NSLog(@"Push Plugin register success: %@", deviceToken);
-
- NSMutableDictionary *results = [NSMutableDictionary dictionary];
- NSString *token = [[[[deviceToken description] stringByReplacingOccurrencesOfString:@"<"withString:@""]
- stringByReplacingOccurrencesOfString:@">" withString:@""]
- stringByReplacingOccurrencesOfString: @" " withString: @""];
- [results setValue:token forKey:@"deviceToken"];
-
-#if !TARGET_IPHONE_SIMULATOR
- // Get Bundle Info for Remote Registration (handy if you have more than one app)
- [results setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleDisplayName"] forKey:@"appName"];
- [results setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"] forKey:@"appVersion"];
-
- // Check what Notifications the user has turned on. We registered for all three, but they may have manually disabled some or all of them.
-#define SYSTEM_VERSION_LESS_THAN(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending)
-
- NSUInteger rntypes;
- if (!SYSTEM_VERSION_LESS_THAN(@"8.0")) {
- rntypes = [[[UIApplication sharedApplication] currentUserNotificationSettings] types];
- } else {
- rntypes = [[UIApplication sharedApplication] enabledRemoteNotificationTypes];
- }
-
- // Set the defaults to disabled unless we find otherwise...
- NSString *pushBadge = @"disabled";
- NSString *pushAlert = @"disabled";
- NSString *pushSound = @"disabled";
-
- // Check what Registered Types are turned on. This is a bit tricky since if two are enabled, and one is off, it will return a number 2... not telling you which
- // one is actually disabled. So we are literally checking to see if rnTypes matches what is turned on, instead of by number. The "tricky" part is that the
- // single notification types will only match if they are the ONLY one enabled. Likewise, when we are checking for a pair of notifications, it will only be
- // true if those two notifications are on. This is why the code is written this way
- if(rntypes & UIRemoteNotificationTypeBadge){
- pushBadge = @"enabled";
- }
- if(rntypes & UIRemoteNotificationTypeAlert) {
- pushAlert = @"enabled";
- }
- if(rntypes & UIRemoteNotificationTypeSound) {
- pushSound = @"enabled";
- }
-
- [results setValue:pushBadge forKey:@"pushBadge"];
- [results setValue:pushAlert forKey:@"pushAlert"];
- [results setValue:pushSound forKey:@"pushSound"];
-
- // Get the users Device Model, Display Name, Token & Version Number
- UIDevice *dev = [UIDevice currentDevice];
- [results setValue:dev.name forKey:@"deviceName"];
- [results setValue:dev.model forKey:@"deviceModel"];
- [results setValue:dev.systemVersion forKey:@"deviceSystemVersion"];
-
- if([self usesGCM]) {
- GGLInstanceIDConfig *instanceIDConfig = [GGLInstanceIDConfig defaultConfig];
- instanceIDConfig.delegate = self;
- [[GGLInstanceID sharedInstance] startWithConfig:instanceIDConfig];
-
- [self setGcmRegistrationOptions: @{kGGLInstanceIDRegisterAPNSOption:deviceToken,
- kGGLInstanceIDAPNSServerTypeSandboxOption:[self gcmSandbox]}];
-
- [[GGLInstanceID sharedInstance] tokenWithAuthorizedEntity:[self gcmSenderId]
- scope:kGGLInstanceIDScopeGCM
- options:[self gcmRegistrationOptions]
- handler:[self gcmRegistrationHandler]];
-
- GCMConfig *gcmConfig = [GCMConfig defaultConfig];
- gcmConfig.receiverDelegate = self;
- [[GCMService sharedInstance] startWithConfig:gcmConfig];
-
- } else {
- [self registerWithToken: token];
- }
-#endif
-}
-
-- (void)didFailToRegisterForRemoteNotificationsWithError:(NSError *)error
-{
- if (self.callbackId == nil) {
- NSLog(@"Unexpected call to didFailToRegisterForRemoteNotificationsWithError, ignoring: %@", error);
- return;
- }
- NSLog(@"Push Plugin register failed");
- [self failWithMessage:self.callbackId withMsg:@"" withError:error];
-}
-
-- (void)notificationReceived {
- NSLog(@"Notification received");
-
- if (notificationMessage && self.callbackId != nil)
- {
- NSMutableDictionary* message = [NSMutableDictionary dictionaryWithCapacity:4];
- NSMutableDictionary* additionalData = [NSMutableDictionary dictionaryWithCapacity:4];
-
-
- for (id key in notificationMessage) {
- if ([key isEqualToString:@"aps"]) {
- id aps = [notificationMessage objectForKey:@"aps"];
-
- for(id key in aps) {
- NSLog(@"Push Plugin key: %@", key);
- id value = [aps objectForKey:key];
-
- if ([key isEqualToString:@"alert"]) {
- if ([value isKindOfClass:[NSDictionary class]]) {
- for (id messageKey in value) {
- id messageValue = [value objectForKey:messageKey];
- if ([messageKey isEqualToString:@"body"]) {
- [message setObject:messageValue forKey:@"message"];
- } else if ([messageKey isEqualToString:@"title"]) {
- [message setObject:messageValue forKey:@"title"];
- } else {
- [additionalData setObject:messageValue forKey:messageKey];
- }
- }
- }
- else {
- [message setObject:value forKey:@"message"];
- }
- } else if ([key isEqualToString:@"title"]) {
- [message setObject:value forKey:@"title"];
- } else if ([key isEqualToString:@"badge"]) {
- [message setObject:value forKey:@"count"];
- } else if ([key isEqualToString:@"sound"]) {
- [message setObject:value forKey:@"sound"];
- } else if ([key isEqualToString:@"image"]) {
- [message setObject:value forKey:@"image"];
- } else {
- [additionalData setObject:value forKey:key];
- }
- }
- } else {
- [additionalData setObject:[notificationMessage objectForKey:key] forKey:key];
- }
- }
-
- if (isInline) {
- [additionalData setObject:[NSNumber numberWithBool:YES] forKey:@"foreground"];
- } else {
- [additionalData setObject:[NSNumber numberWithBool:NO] forKey:@"foreground"];
- }
-
- if (coldstart) {
- [additionalData setObject:[NSNumber numberWithBool:YES] forKey:@"coldstart"];
- } else {
- [additionalData setObject:[NSNumber numberWithBool:NO] forKey:@"coldstart"];
- }
-
- [message setObject:additionalData forKey:@"additionalData"];
-
- // send notification message
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:message];
- [pluginResult setKeepCallbackAsBool:YES];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
-
- self.coldstart = NO;
- self.notificationMessage = nil;
- }
-}
-
-- (void)setApplicationIconBadgeNumber:(CDVInvokedUrlCommand *)command
-{
- NSMutableDictionary* options = [command.arguments objectAtIndex:0];
- int badge = [[options objectForKey:@"badge"] intValue] ?: 0;
-
- [[UIApplication sharedApplication] setApplicationIconBadgeNumber:badge];
-
- NSString* message = [NSString stringWithFormat:@"app badge count set to %d", badge];
- CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
- [self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
-}
-
-- (void)getApplicationIconBadgeNumber:(CDVInvokedUrlCommand *)command
-{
- NSInteger badge = [UIApplication sharedApplication].applicationIconBadgeNumber;
-
- CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:(int)badge];
- [self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
-}
-
-- (void)clearAllNotifications:(CDVInvokedUrlCommand *)command
-{
- [[UIApplication sharedApplication] setApplicationIconBadgeNumber:0];
-
- NSString* message = [NSString stringWithFormat:@"cleared all notifications"];
- CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
- [self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
-}
-
-- (void)hasPermission:(CDVInvokedUrlCommand *)command
-{
- BOOL enabled = NO;
- id<UIApplicationDelegate> appDelegate = [UIApplication sharedApplication].delegate;
- if ([appDelegate respondsToSelector:@selector(userHasRemoteNotificationsEnabled)]) {
- enabled = [appDelegate performSelector:@selector(userHasRemoteNotificationsEnabled)];
- }
-
- NSMutableDictionary* message = [NSMutableDictionary dictionaryWithCapacity:1];
- [message setObject:[NSNumber numberWithBool:enabled] forKey:@"isEnabled"];
- CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:message];
- [self.commandDelegate sendPluginResult:commandResult callbackId:command.callbackId];
-}
-
--(void)successWithMessage:(NSString *)callbackId withMsg:(NSString *)message
-{
- if (callbackId != nil)
- {
- CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
- [self.commandDelegate sendPluginResult:commandResult callbackId:callbackId];
- }
-}
-
--(void)registerWithToken:(NSString*)token; {
- // Send result to trigger 'registration' event but keep callback
- NSMutableDictionary* message = [NSMutableDictionary dictionaryWithCapacity:1];
- [message setObject:token forKey:@"registrationId"];
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:message];
- [pluginResult setKeepCallbackAsBool:YES];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:self.callbackId];
-}
-
-
--(void)failWithMessage:(NSString *)callbackId withMsg:(NSString *)message withError:(NSError *)error
-{
- NSString *errorMessage = (error) ? [NSString stringWithFormat:@"%@ - %@", message, [error localizedDescription]] : message;
- CDVPluginResult *commandResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:errorMessage];
-
- [self.commandDelegate sendPluginResult:commandResult callbackId:callbackId];
-}
-
--(void) finish:(CDVInvokedUrlCommand*)command
-{
- NSLog(@"Push Plugin finish called");
-
- [self.commandDelegate runInBackground:^ {
- NSString* notId = [command.arguments objectAtIndex:0];
-
- dispatch_async(dispatch_get_main_queue(), ^{
- [NSTimer scheduledTimerWithTimeInterval:0.1
- target:self
- selector:@selector(stopBackgroundTask:)
- userInfo:notId
- repeats:NO];
- });
-
- CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
- [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
- }];
-}
-
--(void)stopBackgroundTask:(NSTimer*)timer
-{
- UIApplication *app = [UIApplication sharedApplication];
-
- NSLog(@"Push Plugin stopBackgroundTask called");
-
- if (handlerObj) {
- NSLog(@"Push Plugin handlerObj");
- completionHandler = [handlerObj[[timer userInfo]] copy];
- if (completionHandler) {
- NSLog(@"Push Plugin: stopBackgroundTask (remaining t: %f)", app.backgroundTimeRemaining);
- completionHandler(UIBackgroundFetchResultNewData);
- completionHandler = nil;
- }
- }
-}
-
-@end
diff --git a/StoneIsland/platforms/ios/Stone Island/Resources/GoogleService-Info.plist b/StoneIsland/platforms/ios/Stone Island/Resources/GoogleService-Info.plist
new file mode 100644
index 00000000..7328463d
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Resources/GoogleService-Info.plist
@@ -0,0 +1,42 @@
+<?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>CLIENT_ID</key>
+ <string>862307359073-di238jkcuqfvbtslfllqd996nb5cjmfv.apps.googleusercontent.com</string>
+ <key>REVERSED_CLIENT_ID</key>
+ <string>com.googleusercontent.apps.862307359073-di238jkcuqfvbtslfllqd996nb5cjmfv</string>
+ <key>API_KEY</key>
+ <string>AIzaSyBl8CpcmBGZrz2M1ejNU_00jI3PTUJsv4M</string>
+ <key>GCM_SENDER_ID</key>
+ <string>862307359073</string>
+ <key>PLIST_VERSION</key>
+ <string>1</string>
+ <key>BUNDLE_ID</key>
+ <string>us.okfoc.stoneisland</string>
+ <key>PROJECT_ID</key>
+ <string>stone-island-app</string>
+ <key>STORAGE_BUCKET</key>
+ <string>stone-island-app.appspot.com</string>
+ <key>IS_ADS_ENABLED</key>
+ <false/>
+ <key>IS_ANALYTICS_ENABLED</key>
+ <false/>
+ <key>IS_APPINVITE_ENABLED</key>
+ <true/>
+ <key>IS_GCM_ENABLED</key>
+ <true/>
+ <key>IS_SIGNIN_ENABLED</key>
+ <true/>
+ <key>GOOGLE_APP_ID</key>
+ <string>1:862307359073:ios:67ce45d9c1687415b24d20</string>
+ <key>DATABASE_URL</key>
+ <string>https://stone-island-app.firebaseio.com</string>
+ <key>FIREBASE_ANALYTICS_COLLECTION_ENABLED</key>
+ <string>true</string>
+ <key>FIREBASE_PERFORMANCE_COLLECTION_ENABLED</key>
+ <string>true</string>
+ <key>FirebaseCrashlyticsCollectionEnabled</key>
+ <string>true</string>
+ </dict>
+</plist> \ No newline at end of file
diff --git a/StoneIsland/platforms/ios/Stone Island/Scripts/copy-www-build-step.sh b/StoneIsland/platforms/ios/Stone Island/Scripts/copy-www-build-step.sh
new file mode 100755
index 00000000..ba0a1b47
--- /dev/null
+++ b/StoneIsland/platforms/ios/Stone Island/Scripts/copy-www-build-step.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#
+# This script copies the www directory into the Xcode project.
+#
+# This script should not be called directly.
+# It is called as a build step from Xcode.
+
+SRC_DIR="www"
+DST_DIR="$BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME"
+DST_DIR_WWW="$DST_DIR/www"
+COPY_HIDDEN=
+ORIG_IFS=$IFS
+IFS=$(echo -en "\n\b")
+
+if [[ -z "$BUILT_PRODUCTS_DIR" ]]; then
+ echo "The script is meant to be run as an Xcode build step and relies on env variables set by Xcode."
+ exit 1
+fi
+
+if [[ ! -e "$SRC_DIR" ]]; then
+ echo "error: Path does not exist: $SRC_DIR"
+ exit 2
+fi
+
+rm -rf "$DST_DIR_WWW"
+
+# Copy www dir recursively
+CODE=
+if [[ -n $COPY_HIDDEN ]]; then
+ rsync -Lra "$SRC_DIR" "$DST_DIR"
+ CODE=$?
+else
+ rsync -Lra --exclude="- .*" "$SRC_DIR" "$DST_DIR"
+ CODE=$?
+fi
+
+if [ $CODE -ne 0 ]; then
+ echo "error: Error occurred on copying www. Code $CODE"
+ exit 3
+fi
+
+# Copy the config.xml file.
+cp -f "${PROJECT_FILE_PATH%.xcodeproj}/config.xml" "$DST_DIR"
+
+IFS=$ORIG_IFS
diff --git a/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist b/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist
index 1b156765..93f3b919 100644
--- a/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist
+++ b/StoneIsland/platforms/ios/Stone Island/Stone Island-Info.plist
@@ -3,17 +3,13 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
- <string>English</string>
+ <string>en_US</string>
<key>CFBundleDisplayName</key>
<string>Stone Island</string>
<key>CFBundleExecutable</key>
- <string>${EXECUTABLE_NAME}</string>
- <key>CFBundleIcons</key>
- <dict/>
- <key>CFBundleIcons~ipad</key>
- <dict/>
+ <string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
- <string>us.okfoc.stoneisland</string>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@@ -21,45 +17,17 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>1.3.4</string>
+ <string>1.3.6</string>
<key>CFBundleSignature</key>
<string>????</string>
- <key>CFBundleURLTypes</key>
- <array>
- <dict>
- <key>CFBundleURLSchemes</key>
- <array>
- <string>stoneisland</string>
- </array>
- </dict>
- </array>
<key>CFBundleVersion</key>
- <string>1.3.4</string>
- <key>GCM_SENDER_ID</key>
- <string>85075801930</string>
- <key>IS_GCM_ENABLED</key>
- <true/>
+ <string>1.3.6</string>
<key>LSRequiresIPhoneOS</key>
<true/>
- <key>NSAppTransportSecurity</key>
- <dict>
- <key>NSAllowsArbitraryLoads</key>
- <true/>
- </dict>
- <key>NSLocationWhenInUseUsageDescription</key>
- <string>Stone Island needs to serve content based on your location.</string>
<key>NSMainNibFile</key>
<string/>
<key>NSMainNibFile~ipad</key>
<string/>
- <key>UIBackgroundModes</key>
- <array>
- <string>remote-notification</string>
- </array>
- <key>UIInterfaceOrientation</key>
- <array>
- <string>UIInterfaceOrientationPortrait</string>
- </array>
<key>UILaunchStoryboardName</key>
<string>CDVLaunchScreen</string>
<key>UIRequiresFullScreen</key>
@@ -74,6 +42,26 @@
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
+ <key>NSAppTransportSecurity</key>
+ <dict>
+ <key>NSAllowsArbitraryLoads</key>
+ <true/>
+ </dict>
+ <key>UIInterfaceOrientation</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ </array>
+ <key>CFBundleURLTypes</key>
+ <array>
+ <dict>
+ <key>CFBundleURLSchemes</key>
+ <array>
+ <string>stoneisland</string>
+ </array>
+ </dict>
+ </array>
+ <key>NSLocationWhenInUseUsageDescription</key>
+ <string>Stone Island needs to serve content based on your location.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Stone Island needs to serve content based on your location.</string>
<key>NSLocationAlwaysUsageDescription</key>
diff --git a/StoneIsland/platforms/ios/Stone Island/config.xml b/StoneIsland/platforms/ios/Stone Island/config.xml
index c521691a..b59ed354 100755..100644
--- a/StoneIsland/platforms/ios/Stone Island/config.xml
+++ b/StoneIsland/platforms/ios/Stone Island/config.xml
@@ -1,5 +1,11 @@
<?xml version='1.0' encoding='utf-8'?>
-<widget android-versionCode="6134" id="us.okfoc.stoneisland" version="1.3.4" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+<widget id="us.okfoc.stoneisland" version="1.3.6" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
+ <feature name="CDVWebViewEngine">
+ <param name="ios-package" value="CDVWebViewEngine" />
+ </feature>
+ <feature name="LaunchScreen">
+ <param name="ios-package" value="CDVLaunchScreen" />
+ </feature>
<feature name="LocalStorage">
<param name="ios-package" value="CDVLocalStorage" />
</feature>
@@ -25,38 +31,18 @@
<feature name="Notification">
<param name="ios-package" value="CDVNotification" />
</feature>
- <feature name="Geolocation">
- <param name="ios-package" value="CDVLocation" />
- </feature>
- <feature name="InAppBrowser">
- <param name="ios-package" value="CDVInAppBrowser" />
- </feature>
- <feature name="NetworkStatus">
- <param name="ios-package" value="CDVConnection" />
- </feature>
- <feature name="SplashScreen">
- <param name="ios-package" value="CDVSplashScreen" />
- <param name="onload" value="true" />
- </feature>
- <feature name="StatusBar">
- <param name="ios-package" value="CDVStatusBar" />
+ <feature name="FirebasePlugin">
+ <param name="ios-package" value="FirebasePlugin" />
<param name="onload" value="true" />
</feature>
- <feature name="SocialSharing">
- <param name="ios-package" value="SocialSharing" />
- <param name="onload" value="true" />
- </feature>
- <feature name="Keyboard">
- <param name="ios-package" onload="true" value="IonicKeyboard" />
- </feature>
- <feature name="PushNotification">
- <param name="ios-package" value="PushPlugin" />
+ <feature name="CDVIonicKeyboard">
+ <param name="ios-package" onload="true" value="CDVIonicKeyboard" />
</feature>
<feature name="Sim">
<param name="ios-package" value="Sim" />
</feature>
- <feature name="MobileAccessibility">
- <param name="ios-package" onload="true" value="CDVMobileAccessibility" />
+ <feature name="Geolocation">
+ <param name="ios-package" value="CDVLocation" />
</feature>
<name>Stone Island</name>
<description>
@@ -99,7 +85,7 @@
<preference name="DisallowOverscroll" value="true" />
<preference name="EnableViewportScale" value="true" />
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
- <preference name="MediaPlaybackRequiresUserAction" value="false" />
+ <preference name="MediaTypesRequiringUserActionForPlayback" value="none" />
<preference name="SuppressesIncrementalRendering" value="true" />
<preference name="SuppressesLongPressGesture" value="false" />
<preference name="Suppresses3DTouchGesture" value="false" />
@@ -107,12 +93,12 @@
<preference name="PageLength" value="0" />
<preference name="PaginationBreakingMode" value="page" />
<preference name="PaginationMode" value="unpaginated" />
- <preference name="StatusBarOverlaysWebView" value="false" />
- <preference name="StatusBarStyle" value="default" />
<preference name="TopActivityIndicator" value="white" />
<preference name="HideKeyboardFormAccessoryBar" value="false" />
<preference name="orientation" value="portrait" />
+ <preference name="StatusBarOverlaysWebView" value="false" />
<preference name="StatusBarBackgroundColor" value="#ffffff" />
+ <preference name="StatusBarStyle" value="default" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="AutoHideSplashScreen" value="true" />
diff --git a/StoneIsland/platforms/ios/Stone Island/main.m b/StoneIsland/platforms/ios/Stone Island/main.m
index 7b59c4de..2c0b35c3 100644
--- a/StoneIsland/platforms/ios/Stone Island/main.m
+++ b/StoneIsland/platforms/ios/Stone Island/main.m
@@ -1,4 +1,4 @@
- /*
+/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
@@ -29,7 +29,7 @@
int main(int argc, char* argv[])
{
@autoreleasepool {
- int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
+ int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
return retVal;
}
}