@situm/cordova 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -0
- package/CHANGELOG_UNRELEASED.md +28 -0
- package/Jenkinsfile +84 -0
- package/LICENSE +21 -0
- package/README.md +472 -0
- package/azure/common-steps.yaml +5 -0
- package/azure-pipelines.yml +336 -0
- package/docs/JSDoc/MapView.html +300 -0
- package/docs/JSDoc/MapViewControllerImpl.html +299 -0
- package/docs/JSDoc/Situm.html +5257 -0
- package/docs/JSDoc/android_Interfaces.js.html +825 -0
- package/docs/JSDoc/android_situm.js.html +380 -0
- package/docs/JSDoc/fonts/glyphicons-halflings-regular.eot +0 -0
- package/docs/JSDoc/fonts/glyphicons-halflings-regular.svg +288 -0
- package/docs/JSDoc/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/docs/JSDoc/fonts/glyphicons-halflings-regular.woff +0 -0
- package/docs/JSDoc/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/docs/JSDoc/global.html +7538 -0
- package/docs/JSDoc/img/toast-ui.png +0 -0
- package/docs/JSDoc/index.html +90 -0
- package/docs/JSDoc/map-view-controller.js.html +307 -0
- package/docs/JSDoc/map-view.js.html +172 -0
- package/docs/JSDoc/scripts/jquery.min.js +2 -0
- package/docs/JSDoc/scripts/linenumber.js +30 -0
- package/docs/JSDoc/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/docs/JSDoc/scripts/prettify/lang-css.js +2 -0
- package/docs/JSDoc/scripts/prettify/prettify.js +28 -0
- package/docs/JSDoc/scripts/tui-doc.js +200 -0
- package/docs/JSDoc/styles/bootstrap.min.css +6 -0
- package/docs/JSDoc/styles/custom.css +23 -0
- package/docs/JSDoc/styles/prettify-jsdoc.css +111 -0
- package/docs/JSDoc/styles/prettify-tomorrow.css +132 -0
- package/docs/JSDoc/styles/tui-doc.css +485 -0
- package/docs/conf.json +28 -0
- package/docs/getting-started.md +298 -0
- package/docs/imagotype-SITUM-transparent-90.png +0 -0
- package/docs/static/styles/custom.css +23 -0
- package/package.json +60 -0
- package/plugin.xml +102 -0
- package/scripts/update_changelog.sh +22 -0
- package/src/android/app/build.gradle +51 -0
- package/src/android/app/proguard-rules.pro +21 -0
- package/src/android/app/src/main/AndroidManifest.xml +11 -0
- package/src/android/app/src/main/java/es/situm/plugin/DateUtils.java +15 -0
- package/src/android/app/src/main/java/es/situm/plugin/PluginHelper.java +919 -0
- package/src/android/app/src/main/java/es/situm/plugin/SitumMapper.java +968 -0
- package/src/android/app/src/main/java/es/situm/plugin/SitumPlugin.java +109 -0
- package/src/android/app/src/main/res/drawable/ic_launcher_background.xml +170 -0
- package/src/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
- package/src/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
- package/src/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
- package/src/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
- package/src/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
- package/src/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
- package/src/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
- package/src/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
- package/src/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
- package/src/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
- package/src/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
- package/src/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
- package/src/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
- package/src/android/app/src/main/res/values/colors.xml +6 -0
- package/src/android/app/src/main/res/values/strings.xml +3 -0
- package/src/android/app/src/main/res/values/styles.xml +11 -0
- package/src/android/app/src/test/java/es/situm/plugin/PluginHelperTest.java +27 -0
- package/src/android/app/src/test/java/es/situm/plugin/SitumMapperTest.java +1485 -0
- package/src/android/app/src/test/java/es/situm/plugin/angle/AngleCreator.java +46 -0
- package/src/android/app/src/test/java/es/situm/plugin/bounds/BoundsCreator.java +50 -0
- package/src/android/app/src/test/java/es/situm/plugin/building/BuildingCreator.java +76 -0
- package/src/android/app/src/test/java/es/situm/plugin/cartesianCoordinate/CartesianCoordinateCreator.java +31 -0
- package/src/android/app/src/test/java/es/situm/plugin/circle/CircleCreator.java +41 -0
- package/src/android/app/src/test/java/es/situm/plugin/coordinate/CoordinateCreator.java +32 -0
- package/src/android/app/src/test/java/es/situm/plugin/dimensions/DimensionsCreator.java +31 -0
- package/src/android/app/src/test/java/es/situm/plugin/directionsRequest/DirectionsRequestCreator.java +105 -0
- package/src/android/app/src/test/java/es/situm/plugin/event/EventCreator.java +108 -0
- package/src/android/app/src/test/java/es/situm/plugin/floor/FloorCreator.java +58 -0
- package/src/android/app/src/test/java/es/situm/plugin/indication/IndicationCreator.java +40 -0
- package/src/android/app/src/test/java/es/situm/plugin/location/LocationCreator.java +197 -0
- package/src/android/app/src/test/java/es/situm/plugin/locationRequest/LocationRequestCreator.java +45 -0
- package/src/android/app/src/test/java/es/situm/plugin/locationStatus/LocationStatusCreator.java +211 -0
- package/src/android/app/src/test/java/es/situm/plugin/navigationProgress/NavigationProgressCreator.java +154 -0
- package/src/android/app/src/test/java/es/situm/plugin/poi/PoiCreator.java +126 -0
- package/src/android/app/src/test/java/es/situm/plugin/poiCategory/PoiCategoryCreator.java +38 -0
- package/src/android/app/src/test/java/es/situm/plugin/point/PointCreator.java +200 -0
- package/src/android/app/src/test/java/es/situm/plugin/route/RouteCreator.java +142 -0
- package/src/android/app/src/test/java/es/situm/plugin/routeStep/RouteStepCreator.java +173 -0
- package/src/android/app/src/test/java/es/situm/plugin/situmConversionArea/SitumConversionAreaCreator.java +35 -0
- package/src/android/build.gradle +31 -0
- package/src/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/src/android/gradle/wrapper/gradle-wrapper.properties +6 -0
- package/src/android/gradle.properties +16 -0
- package/src/android/gradlew +172 -0
- package/src/android/gradlew.bat +84 -0
- package/src/android/settings.gradle +3 -0
- package/src/android/situm.gradle +19 -0
- package/src/ios/Classes/Private/CDVDebug.h +25 -0
- package/src/ios/Classes/Private/CDVJSON_private.h +31 -0
- package/src/ios/Classes/Private/CDVJSON_private.m +99 -0
- package/src/ios/Classes/Private/CDVPlugin+Private.h +24 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVGestureHandler/CDVGestureHandler.h +26 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVGestureHandler/CDVGestureHandler.m +70 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVHandleOpenURL/CDVHandleOpenURL.h +27 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVHandleOpenURL/CDVHandleOpenURL.m +86 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.h +34 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.m +153 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVLocalStorage/CDVLocalStorage.h +50 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVLocalStorage/CDVLocalStorage.m +487 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVLogger/CDVLogger.h +26 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVLogger/CDVLogger.m +37 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.h +41 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m +399 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVUIWebViewEngine/CDVUIWebViewEngine.h +27 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVUIWebViewEngine/CDVUIWebViewEngine.m +202 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.h +29 -0
- package/src/ios/Classes/Private/CDVPlugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.m +153 -0
- package/src/ios/Classes/Public/CDV.h +32 -0
- package/src/ios/Classes/Public/CDVAppDelegate.h +28 -0
- package/src/ios/Classes/Public/CDVAppDelegate.m +118 -0
- package/src/ios/Classes/Public/CDVAvailability.h +111 -0
- package/src/ios/Classes/Public/CDVAvailabilityDeprecated.h +26 -0
- package/src/ios/Classes/Public/CDVCommandDelegate.h +51 -0
- package/src/ios/Classes/Public/CDVCommandDelegateImpl.h +36 -0
- package/src/ios/Classes/Public/CDVCommandDelegateImpl.m +186 -0
- package/src/ios/Classes/Public/CDVCommandQueue.h +39 -0
- package/src/ios/Classes/Public/CDVCommandQueue.m +194 -0
- package/src/ios/Classes/Public/CDVConfigParser.h +30 -0
- package/src/ios/Classes/Public/CDVConfigParser.m +81 -0
- package/src/ios/Classes/Public/CDVInvokedUrlCommand.h +52 -0
- package/src/ios/Classes/Public/CDVInvokedUrlCommand.m +116 -0
- package/src/ios/Classes/Public/CDVPlugin+Resources.h +39 -0
- package/src/ios/Classes/Public/CDVPlugin+Resources.m +38 -0
- package/src/ios/Classes/Public/CDVPlugin.h +85 -0
- package/src/ios/Classes/Public/CDVPlugin.m +202 -0
- package/src/ios/Classes/Public/CDVPluginResult.h +66 -0
- package/src/ios/Classes/Public/CDVPluginResult.m +186 -0
- package/src/ios/Classes/Public/CDVScreenOrientationDelegate.h +33 -0
- package/src/ios/Classes/Public/CDVTimer.h +27 -0
- package/src/ios/Classes/Public/CDVTimer.m +123 -0
- package/src/ios/Classes/Public/CDVURLProtocol.h +27 -0
- package/src/ios/Classes/Public/CDVURLProtocol.m +113 -0
- package/src/ios/Classes/Public/CDVUserAgentUtil.h +27 -0
- package/src/ios/Classes/Public/CDVUserAgentUtil.m +124 -0
- package/src/ios/Classes/Public/CDVViewController.h +92 -0
- package/src/ios/Classes/Public/CDVViewController.m +821 -0
- package/src/ios/Classes/Public/CDVWebViewEngineProtocol.h +42 -0
- package/src/ios/Classes/Public/CDVWhitelist.h +34 -0
- package/src/ios/Classes/Public/CDVWhitelist.m +285 -0
- package/src/ios/Classes/Public/NSDictionary+CordovaPreferences.h +35 -0
- package/src/ios/Classes/Public/NSDictionary+CordovaPreferences.m +63 -0
- package/src/ios/Classes/Public/NSMutableArray+QueueAdditions.h +29 -0
- package/src/ios/Classes/Public/NSMutableArray+QueueAdditions.m +58 -0
- package/src/ios/Cordova/Cordova.h +51 -0
- package/src/ios/Cordova/Info.plist +24 -0
- package/src/ios/Podfile +5 -0
- package/src/ios/SitumCordovaPlugin.xcodeproj/project.pbxproj +1324 -0
- package/src/ios/SitumCordovaPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/src/ios/SitumCordovaPlugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/src/ios/SitumCordovaPlugin.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
- package/src/ios/SitumCordovaPlugin.xcodeproj/xcshareddata/xcschemes/CordovaLib.xcscheme +100 -0
- package/src/ios/SitumCordovaPlugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/src/ios/SitumCordovaPlugin_Prefix.pch +22 -0
- package/src/ios/VERSION +1 -0
- package/src/ios/cordova.js +2432 -0
- package/src/ios/situmcordovaplugin/AppDelegate.h +22 -0
- package/src/ios/situmcordovaplugin/AppDelegate.m +98 -0
- package/src/ios/situmcordovaplugin/Assets.xcassets/AppIcon.appiconset/Contents.json +98 -0
- package/src/ios/situmcordovaplugin/Base.lproj/LaunchScreen.storyboard +25 -0
- package/src/ios/situmcordovaplugin/Base.lproj/Main.storyboard +24 -0
- package/src/ios/situmcordovaplugin/Constants.h +14 -0
- package/src/ios/situmcordovaplugin/Constants.m +14 -0
- package/src/ios/situmcordovaplugin/Info.plist +45 -0
- package/src/ios/situmcordovaplugin/SITUtils.h +7 -0
- package/src/ios/situmcordovaplugin/SITUtils.m +13 -0
- package/src/ios/situmcordovaplugin/SitumLocationWrapper.h +109 -0
- package/src/ios/situmcordovaplugin/SitumLocationWrapper.m +983 -0
- package/src/ios/situmcordovaplugin/SitumPlugin.h +41 -0
- package/src/ios/situmcordovaplugin/SitumPlugin.m +752 -0
- package/src/ios/situmcordovaplugin/ViewController.h +15 -0
- package/src/ios/situmcordovaplugin/ViewController.m +29 -0
- package/src/ios/situmcordovaplugin/main.m +16 -0
- package/src/ios/situmcordovaplugin/situmcordovaplugin.xcdatamodeld/.xccurrentversion +8 -0
- package/src/ios/situmcordovaplugin/situmcordovaplugin.xcdatamodeld/situmcordovaplugin.xcdatamodel/contents +4 -0
- package/src/ios/situmcordovaplugintests/AngleTests.m +53 -0
- package/src/ios/situmcordovaplugintests/BoundTests.m +51 -0
- package/src/ios/situmcordovaplugintests/BuildingTests.m +41 -0
- package/src/ios/situmcordovaplugintests/CartesianCoordinateTests.m +42 -0
- package/src/ios/situmcordovaplugintests/ConversionAreaTests.m +43 -0
- package/src/ios/situmcordovaplugintests/CoordinateTests.m +42 -0
- package/src/ios/situmcordovaplugintests/DimensionTests.m +43 -0
- package/src/ios/situmcordovaplugintests/EventTests.m +42 -0
- package/src/ios/situmcordovaplugintests/FloorTests.m +52 -0
- package/src/ios/situmcordovaplugintests/Info.plist +38 -0
- package/src/ios/situmcordovaplugintests/InputTests/DirectionsRequestTest.m +108 -0
- package/src/ios/situmcordovaplugintests/InputTests/InputCartesianCoordinateTests.m +45 -0
- package/src/ios/situmcordovaplugintests/InputTests/InputCoordinateTests.m +45 -0
- package/src/ios/situmcordovaplugintests/InputTests/InputFloorTests.m +59 -0
- package/src/ios/situmcordovaplugintests/InputTests/InputIndicationTests.m +45 -0
- package/src/ios/situmcordovaplugintests/InputTests/InputLocationTests.m +163 -0
- package/src/ios/situmcordovaplugintests/InputTests/InputPoiCategoryTests.m +46 -0
- package/src/ios/situmcordovaplugintests/InputTests/InputPointTests.m +137 -0
- package/src/ios/situmcordovaplugintests/InputTests/LocationRequestTest.m +79 -0
- package/src/ios/situmcordovaplugintests/LocationStatusTests.m +60 -0
- package/src/ios/situmcordovaplugintests/LocationTests.m +114 -0
- package/src/ios/situmcordovaplugintests/NavigationProgressTests.m +50 -0
- package/src/ios/situmcordovaplugintests/PoiCategoryIconTests.m +43 -0
- package/src/ios/situmcordovaplugintests/PoiCategoryTests.m +42 -0
- package/src/ios/situmcordovaplugintests/PoiTests.m +83 -0
- package/src/ios/situmcordovaplugintests/PointTests.m +107 -0
- package/src/ios/situmcordovaplugintests/RouteStepTests.m +78 -0
- package/src/ios/situmcordovaplugintests/RouteTests.m +42 -0
- package/src/ios/situmcordovaplugintests/SitumCreatorTests.h +91 -0
- package/src/ios/situmcordovaplugintests/SitumCreatorTests.m +928 -0
- package/src/ios/situmcordovaplugintests/TestingHelper.h +48 -0
- package/src/ios/situmcordovaplugintests/TestingHelper.m +342 -0
- package/src/ios/situmcordovaplugintests/indicationTests.m +43 -0
- package/tests/common-resources/angle/angle1.json +6 -0
- package/tests/common-resources/angle/angle2.json +6 -0
- package/tests/common-resources/bounds/bounds1.json +18 -0
- package/tests/common-resources/bounds/bounds2.json +18 -0
- package/tests/common-resources/building/building1.json +64 -0
- package/tests/common-resources/cartesianCoordinate/cartesianCoordinate1.json +4 -0
- package/tests/common-resources/circle/circle1.json +17 -0
- package/tests/common-resources/coordinate/coordinate1.json +4 -0
- package/tests/common-resources/dimensions/dimensions1.json +4 -0
- package/tests/common-resources/directionsRequest/directionsRequest1.json +166 -0
- package/tests/common-resources/directionsRequest/directionsRequest2.json +167 -0
- package/tests/common-resources/directionsRequest/directionsRequest3.json +166 -0
- package/tests/common-resources/directionsRequest/directionsRequest4.json +166 -0
- package/tests/common-resources/directionsRequest/directionsRequest5.json +167 -0
- package/tests/common-resources/directionsRequest/directionsRequest6.json +153 -0
- package/tests/common-resources/events/event1.json +66 -0
- package/tests/common-resources/floor/floor1.json +13 -0
- package/tests/common-resources/floor/floor2.json +13 -0
- package/tests/common-resources/indication/indication1.json +10 -0
- package/tests/common-resources/location/location1.json +48 -0
- package/tests/common-resources/location/location10.json +48 -0
- package/tests/common-resources/location/location2.json +48 -0
- package/tests/common-resources/location/location3.json +48 -0
- package/tests/common-resources/location/location4.json +48 -0
- package/tests/common-resources/location/location5.json +48 -0
- package/tests/common-resources/location/location6.json +48 -0
- package/tests/common-resources/location/location7.json +48 -0
- package/tests/common-resources/location/location8.json +48 -0
- package/tests/common-resources/location/location9.json +48 -0
- package/tests/common-resources/locationRequest/locationRequest1.json +6 -0
- package/tests/common-resources/locationRequest/locationRequest2.json +32 -0
- package/tests/common-resources/locationRequest/locationRequest3.json +33 -0
- package/tests/common-resources/locationRequest/locationRequest4.json +31 -0
- package/tests/common-resources/locationStatus/locationStatus1.json +4 -0
- package/tests/common-resources/locationStatus/locationStatus10.json +4 -0
- package/tests/common-resources/locationStatus/locationStatus11.json +4 -0
- package/tests/common-resources/locationStatus/locationStatus12.json +4 -0
- package/tests/common-resources/locationStatus/locationStatus13.json +4 -0
- package/tests/common-resources/locationStatus/locationStatus2.json +4 -0
- package/tests/common-resources/locationStatus/locationStatus3.json +4 -0
- package/tests/common-resources/locationStatus/locationStatus4.json +4 -0
- package/tests/common-resources/locationStatus/locationStatus5.json +4 -0
- package/tests/common-resources/locationStatus/locationStatus6.json +4 -0
- package/tests/common-resources/locationStatus/locationStatus7.json +4 -0
- package/tests/common-resources/locationStatus/locationStatus8.json +4 -0
- package/tests/common-resources/locationStatus/locationStatus9.json +4 -0
- package/tests/common-resources/navigationProgress/navigationProgress1.json +77 -0
- package/tests/common-resources/navigationProgress/navigationProgress2.json +77 -0
- package/tests/common-resources/poi/poi1.json +35 -0
- package/tests/common-resources/poi/poi2.json +35 -0
- package/tests/common-resources/poi/poi3.json +35 -0
- package/tests/common-resources/poi/poi4.json +38 -0
- package/tests/common-resources/poi/poi5.json +35 -0
- package/tests/common-resources/poiCategory/poiCategory1.json +7 -0
- package/tests/common-resources/poiCategoryIcon/poiCategoryIcon1.json +1 -0
- package/tests/common-resources/poiCategoryIcon/poiCategoryIcon1.png +0 -0
- package/tests/common-resources/point/point1.json +14 -0
- package/tests/common-resources/point/point2.json +14 -0
- package/tests/common-resources/point/point3.json +14 -0
- package/tests/common-resources/point/point4.json +14 -0
- package/tests/common-resources/point/point5.json +14 -0
- package/tests/common-resources/point/point6.json +14 -0
- package/tests/common-resources/point/point7.json +14 -0
- package/tests/common-resources/point/point8.json +14 -0
- package/tests/common-resources/route/route1.json +530 -0
- package/tests/common-resources/routeStep/routeStep1.json +35 -0
- package/tests/common-resources/routeStep/routeStep2.json +35 -0
- package/tests/common-resources/routeStep/routeStep3.json +35 -0
- package/tests/common-resources/routeStep/routeStep4.json +35 -0
- package/tests/common-resources/routeStep/routeStep5.json +35 -0
- package/tests/common-resources/situmConversionArea/situmConversionArea1.json +19 -0
- package/tests/js/resources/fetchBuildings.json +176 -0
- package/tests/js/resources/fetchEventsFromBuilding.json +201 -0
- package/tests/js/resources/fetchFloorsFromBuilding.json +34 -0
- package/tests/js/resources/fetchIndoorPOIsFromBuilding.json +574 -0
- package/tests/js/resources/fetchMapFromFloor.json +3 -0
- package/tests/js/resources/fetchOutdoorPOIsFromBuilding.json +68 -0
- package/tests/js/resources/fetchPoiCategories.json +72 -0
- package/tests/js/resources/fetchPoiCategoryIconNormal.json +3 -0
- package/tests/js/resources/fetchPoiCategoryIconSelected.json +3 -0
- package/tests/js/resources/requestDirections.json +1167 -0
- package/tests/js/resources/startPositioning/0_starting.json +4 -0
- package/tests/js/resources/startPositioning/1_preparingPositioningModel.json +4 -0
- package/tests/js/resources/startPositioning/2_startingPositioning.json +4 -0
- package/tests/js/resources/startPositioning/3_calculating.json +4 -0
- package/tests/js/resources/startPositioning/4_position.json +48 -0
- package/tests/js/resources/startPositioning/5_position.json +48 -0
- package/tests/js/test.js +416 -0
- package/tests/scripts/clean_android_resources.sh +3 -0
- package/tests/scripts/clean_ios_resources.sh +3 -0
- package/tests/scripts/copy_android_resources.sh +3 -0
- package/tests/scripts/copy_ios_resources.sh +3 -0
- package/tests/scripts/self-destruct.sh +1 -0
- package/www/android/Interfaces.js +742 -0
- package/www/android/situm.js +296 -0
- package/www/ios/situm.js +99 -0
- package/www/map-view-controller.js +223 -0
- package/www/map-view.js +88 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import "CDVCommandDelegateImpl.h"
|
|
21
|
+
#import "CDVJSON_private.h"
|
|
22
|
+
#import "CDVCommandQueue.h"
|
|
23
|
+
#import "CDVPluginResult.h"
|
|
24
|
+
#import "CDVViewController.h"
|
|
25
|
+
|
|
26
|
+
@implementation CDVCommandDelegateImpl
|
|
27
|
+
|
|
28
|
+
@synthesize urlTransformer;
|
|
29
|
+
|
|
30
|
+
- (id)initWithViewController:(CDVViewController*)viewController
|
|
31
|
+
{
|
|
32
|
+
self = [super init];
|
|
33
|
+
if (self != nil) {
|
|
34
|
+
_viewController = viewController;
|
|
35
|
+
_commandQueue = _viewController.commandQueue;
|
|
36
|
+
|
|
37
|
+
NSError* err = nil;
|
|
38
|
+
_callbackIdPattern = [NSRegularExpression regularExpressionWithPattern:@"[^A-Za-z0-9._-]" options:0 error:&err];
|
|
39
|
+
if (err != nil) {
|
|
40
|
+
// Couldn't initialize Regex
|
|
41
|
+
NSLog(@"Error: Couldn't initialize regex");
|
|
42
|
+
_callbackIdPattern = nil;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return self;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
- (NSString*)pathForResource:(NSString*)resourcepath
|
|
49
|
+
{
|
|
50
|
+
NSBundle* mainBundle = [NSBundle mainBundle];
|
|
51
|
+
NSMutableArray* directoryParts = [NSMutableArray arrayWithArray:[resourcepath componentsSeparatedByString:@"/"]];
|
|
52
|
+
NSString* filename = [directoryParts lastObject];
|
|
53
|
+
|
|
54
|
+
[directoryParts removeLastObject];
|
|
55
|
+
|
|
56
|
+
NSString* directoryPartsJoined = [directoryParts componentsJoinedByString:@"/"];
|
|
57
|
+
NSString* directoryStr = _viewController.wwwFolderName;
|
|
58
|
+
|
|
59
|
+
if ([directoryPartsJoined length] > 0) {
|
|
60
|
+
directoryStr = [NSString stringWithFormat:@"%@/%@", _viewController.wwwFolderName, [directoryParts componentsJoinedByString:@"/"]];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return [mainBundle pathForResource:filename ofType:@"" inDirectory:directoryStr];
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
- (void)flushCommandQueueWithDelayedJs
|
|
67
|
+
{
|
|
68
|
+
_delayResponses = YES;
|
|
69
|
+
[_commandQueue executePending];
|
|
70
|
+
_delayResponses = NO;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
- (void)evalJsHelper2:(NSString*)js
|
|
74
|
+
{
|
|
75
|
+
CDV_EXEC_LOG(@"Exec: evalling: %@", [js substringToIndex:MIN([js length], 160)]);
|
|
76
|
+
[_viewController.webViewEngine evaluateJavaScript:js completionHandler:^(id obj, NSError* error) {
|
|
77
|
+
// TODO: obj can be something other than string
|
|
78
|
+
if ([obj isKindOfClass:[NSString class]]) {
|
|
79
|
+
NSString* commandsJSON = (NSString*)obj;
|
|
80
|
+
if ([commandsJSON length] > 0) {
|
|
81
|
+
CDV_EXEC_LOG(@"Exec: Retrieved new exec messages by chaining.");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
[_commandQueue enqueueCommandBatch:commandsJSON];
|
|
85
|
+
[_commandQueue executePending];
|
|
86
|
+
}
|
|
87
|
+
}];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
- (void)evalJsHelper:(NSString*)js
|
|
91
|
+
{
|
|
92
|
+
// Cycle the run-loop before executing the JS.
|
|
93
|
+
// For _delayResponses -
|
|
94
|
+
// This ensures that we don't eval JS during the middle of an existing JS
|
|
95
|
+
// function (possible since UIWebViewDelegate callbacks can be synchronous).
|
|
96
|
+
// For !isMainThread -
|
|
97
|
+
// It's a hard error to eval on the non-UI thread.
|
|
98
|
+
// For !_commandQueue.currentlyExecuting -
|
|
99
|
+
// This works around a bug where sometimes alerts() within callbacks can cause
|
|
100
|
+
// dead-lock.
|
|
101
|
+
// If the commandQueue is currently executing, then we know that it is safe to
|
|
102
|
+
// execute the callback immediately.
|
|
103
|
+
// Using (dispatch_get_main_queue()) does *not* fix deadlocks for some reason,
|
|
104
|
+
// but performSelectorOnMainThread: does.
|
|
105
|
+
if (_delayResponses || ![NSThread isMainThread] || !_commandQueue.currentlyExecuting) {
|
|
106
|
+
[self performSelectorOnMainThread:@selector(evalJsHelper2:) withObject:js waitUntilDone:NO];
|
|
107
|
+
} else {
|
|
108
|
+
[self evalJsHelper2:js];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
- (BOOL)isValidCallbackId:(NSString*)callbackId
|
|
113
|
+
{
|
|
114
|
+
if ((callbackId == nil) || (_callbackIdPattern == nil)) {
|
|
115
|
+
return NO;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Disallow if too long or if any invalid characters were found.
|
|
119
|
+
if (([callbackId length] > 100) || [_callbackIdPattern firstMatchInString:callbackId options:0 range:NSMakeRange(0, [callbackId length])]) {
|
|
120
|
+
return NO;
|
|
121
|
+
}
|
|
122
|
+
return YES;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
- (void)sendPluginResult:(CDVPluginResult*)result callbackId:(NSString*)callbackId
|
|
126
|
+
{
|
|
127
|
+
CDV_EXEC_LOG(@"Exec(%@): Sending result. Status=%@", callbackId, result.status);
|
|
128
|
+
// This occurs when there is are no win/fail callbacks for the call.
|
|
129
|
+
if ([@"INVALID" isEqualToString:callbackId]) {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
// This occurs when the callback id is malformed.
|
|
133
|
+
if (![self isValidCallbackId:callbackId]) {
|
|
134
|
+
NSLog(@"Invalid callback id received by sendPluginResult");
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
int status = [result.status intValue];
|
|
138
|
+
BOOL keepCallback = [result.keepCallback boolValue];
|
|
139
|
+
NSString* argumentsAsJSON = [result argumentsAsJSON];
|
|
140
|
+
BOOL debug = NO;
|
|
141
|
+
|
|
142
|
+
#ifdef DEBUG
|
|
143
|
+
debug = YES;
|
|
144
|
+
#endif
|
|
145
|
+
|
|
146
|
+
NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d, %d)", callbackId, status, argumentsAsJSON, keepCallback, debug];
|
|
147
|
+
|
|
148
|
+
[self evalJsHelper:js];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
- (void)evalJs:(NSString*)js
|
|
152
|
+
{
|
|
153
|
+
[self evalJs:js scheduledOnRunLoop:YES];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
- (void)evalJs:(NSString*)js scheduledOnRunLoop:(BOOL)scheduledOnRunLoop
|
|
157
|
+
{
|
|
158
|
+
js = [NSString stringWithFormat:@"try{cordova.require('cordova/exec').nativeEvalAndFetch(function(){%@})}catch(e){console.log('exception nativeEvalAndFetch : '+e);};", js];
|
|
159
|
+
if (scheduledOnRunLoop) {
|
|
160
|
+
[self evalJsHelper:js];
|
|
161
|
+
} else {
|
|
162
|
+
[self evalJsHelper2:js];
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
- (id)getCommandInstance:(NSString*)pluginName
|
|
167
|
+
{
|
|
168
|
+
return [_viewController getCommandInstance:pluginName];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
- (void)runInBackground:(void (^)(void))block
|
|
172
|
+
{
|
|
173
|
+
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), block);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
- (NSString*)userAgent
|
|
177
|
+
{
|
|
178
|
+
return [_viewController userAgent];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
- (NSDictionary*)settings
|
|
182
|
+
{
|
|
183
|
+
return _viewController.settings;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
21
|
+
|
|
22
|
+
@class CDVInvokedUrlCommand;
|
|
23
|
+
@class CDVViewController;
|
|
24
|
+
|
|
25
|
+
@interface CDVCommandQueue : NSObject
|
|
26
|
+
|
|
27
|
+
@property (nonatomic, readonly) BOOL currentlyExecuting;
|
|
28
|
+
|
|
29
|
+
- (id)initWithViewController:(CDVViewController*)viewController;
|
|
30
|
+
- (void)dispose;
|
|
31
|
+
|
|
32
|
+
- (void)resetRequestId;
|
|
33
|
+
- (void)enqueueCommandBatch:(NSString*)batchJSON;
|
|
34
|
+
|
|
35
|
+
- (void)fetchCommandsFromJs;
|
|
36
|
+
- (void)executePending;
|
|
37
|
+
- (BOOL)execute:(CDVInvokedUrlCommand*)command;
|
|
38
|
+
|
|
39
|
+
@end
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#include <objc/message.h>
|
|
21
|
+
#import "CDVCommandQueue.h"
|
|
22
|
+
#import "CDVViewController.h"
|
|
23
|
+
#import "CDVCommandDelegateImpl.h"
|
|
24
|
+
#import "CDVJSON_private.h"
|
|
25
|
+
#import "CDVDebug.h"
|
|
26
|
+
|
|
27
|
+
// Parse JS on the main thread if it's shorter than this.
|
|
28
|
+
static const NSInteger JSON_SIZE_FOR_MAIN_THREAD = 4 * 1024; // Chosen arbitrarily.
|
|
29
|
+
// Execute multiple commands in one go until this many seconds have passed.
|
|
30
|
+
static const double MAX_EXECUTION_TIME = .008; // Half of a 60fps frame.
|
|
31
|
+
|
|
32
|
+
@interface CDVCommandQueue () {
|
|
33
|
+
NSInteger _lastCommandQueueFlushRequestId;
|
|
34
|
+
__weak CDVViewController* _viewController;
|
|
35
|
+
NSMutableArray* _queue;
|
|
36
|
+
NSTimeInterval _startExecutionTime;
|
|
37
|
+
}
|
|
38
|
+
@end
|
|
39
|
+
|
|
40
|
+
@implementation CDVCommandQueue
|
|
41
|
+
|
|
42
|
+
- (BOOL)currentlyExecuting
|
|
43
|
+
{
|
|
44
|
+
return _startExecutionTime > 0;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
- (id)initWithViewController:(CDVViewController*)viewController
|
|
48
|
+
{
|
|
49
|
+
self = [super init];
|
|
50
|
+
if (self != nil) {
|
|
51
|
+
_viewController = viewController;
|
|
52
|
+
_queue = [[NSMutableArray alloc] init];
|
|
53
|
+
}
|
|
54
|
+
return self;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
- (void)dispose
|
|
58
|
+
{
|
|
59
|
+
// TODO(agrieve): Make this a zeroing weak ref once we drop support for 4.3.
|
|
60
|
+
_viewController = nil;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
- (void)resetRequestId
|
|
64
|
+
{
|
|
65
|
+
_lastCommandQueueFlushRequestId = 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
- (void)enqueueCommandBatch:(NSString*)batchJSON
|
|
69
|
+
{
|
|
70
|
+
if ([batchJSON length] > 0) {
|
|
71
|
+
NSMutableArray* commandBatchHolder = [[NSMutableArray alloc] init];
|
|
72
|
+
[_queue addObject:commandBatchHolder];
|
|
73
|
+
if ([batchJSON length] < JSON_SIZE_FOR_MAIN_THREAD) {
|
|
74
|
+
[commandBatchHolder addObject:[batchJSON cdv_JSONObject]];
|
|
75
|
+
} else {
|
|
76
|
+
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^() {
|
|
77
|
+
NSMutableArray* result = [batchJSON cdv_JSONObject];
|
|
78
|
+
@synchronized(commandBatchHolder) {
|
|
79
|
+
[commandBatchHolder addObject:result];
|
|
80
|
+
}
|
|
81
|
+
[self performSelectorOnMainThread:@selector(executePending) withObject:nil waitUntilDone:NO];
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
- (void)fetchCommandsFromJs
|
|
88
|
+
{
|
|
89
|
+
__weak CDVCommandQueue* weakSelf = self;
|
|
90
|
+
NSString* js = @"cordova.require('cordova/exec').nativeFetchMessages()";
|
|
91
|
+
|
|
92
|
+
[_viewController.webViewEngine evaluateJavaScript:js
|
|
93
|
+
completionHandler:^(id obj, NSError* error) {
|
|
94
|
+
if ((error == nil) && [obj isKindOfClass:[NSString class]]) {
|
|
95
|
+
NSString* queuedCommandsJSON = (NSString*)obj;
|
|
96
|
+
CDV_EXEC_LOG(@"Exec: Flushed JS->native queue (hadCommands=%d).", [queuedCommandsJSON length] > 0);
|
|
97
|
+
[weakSelf enqueueCommandBatch:queuedCommandsJSON];
|
|
98
|
+
// this has to be called here now, because fetchCommandsFromJs is now async (previously: synchronous)
|
|
99
|
+
[self executePending];
|
|
100
|
+
}
|
|
101
|
+
}];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
- (void)executePending
|
|
105
|
+
{
|
|
106
|
+
// Make us re-entrant-safe.
|
|
107
|
+
if (_startExecutionTime > 0) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
@try {
|
|
111
|
+
_startExecutionTime = [NSDate timeIntervalSinceReferenceDate];
|
|
112
|
+
|
|
113
|
+
while ([_queue count] > 0) {
|
|
114
|
+
NSMutableArray* commandBatchHolder = _queue[0];
|
|
115
|
+
NSMutableArray* commandBatch = nil;
|
|
116
|
+
@synchronized(commandBatchHolder) {
|
|
117
|
+
// If the next-up command is still being decoded, wait for it.
|
|
118
|
+
if ([commandBatchHolder count] == 0) {
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
commandBatch = commandBatchHolder[0];
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
while ([commandBatch count] > 0) {
|
|
125
|
+
@autoreleasepool {
|
|
126
|
+
// Execute the commands one-at-a-time.
|
|
127
|
+
NSArray* jsonEntry = [commandBatch cdv_dequeue];
|
|
128
|
+
if ([commandBatch count] == 0) {
|
|
129
|
+
[_queue removeObjectAtIndex:0];
|
|
130
|
+
}
|
|
131
|
+
CDVInvokedUrlCommand* command = [CDVInvokedUrlCommand commandFromJson:jsonEntry];
|
|
132
|
+
CDV_EXEC_LOG(@"Exec(%@): Calling %@.%@", command.callbackId, command.className, command.methodName);
|
|
133
|
+
|
|
134
|
+
if (![self execute:command]) {
|
|
135
|
+
#ifdef DEBUG
|
|
136
|
+
NSString* commandJson = [jsonEntry cdv_JSONString];
|
|
137
|
+
static NSUInteger maxLogLength = 1024;
|
|
138
|
+
NSString* commandString = ([commandJson length] > maxLogLength) ?
|
|
139
|
+
[NSString stringWithFormat : @"%@[...]", [commandJson substringToIndex:maxLogLength]] :
|
|
140
|
+
commandJson;
|
|
141
|
+
|
|
142
|
+
DLog(@"FAILED pluginJSON = %@", commandString);
|
|
143
|
+
#endif
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Yield if we're taking too long.
|
|
148
|
+
if (([_queue count] > 0) && ([NSDate timeIntervalSinceReferenceDate] - _startExecutionTime > MAX_EXECUTION_TIME)) {
|
|
149
|
+
[self performSelector:@selector(executePending) withObject:nil afterDelay:0];
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
} @finally
|
|
155
|
+
{
|
|
156
|
+
_startExecutionTime = 0;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
- (BOOL)execute:(CDVInvokedUrlCommand*)command
|
|
161
|
+
{
|
|
162
|
+
if ((command.className == nil) || (command.methodName == nil)) {
|
|
163
|
+
NSLog(@"ERROR: Classname and/or methodName not found for command.");
|
|
164
|
+
return NO;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Fetch an instance of this class
|
|
168
|
+
CDVPlugin* obj = [_viewController.commandDelegate getCommandInstance:command.className];
|
|
169
|
+
|
|
170
|
+
if (!([obj isKindOfClass:[CDVPlugin class]])) {
|
|
171
|
+
NSLog(@"ERROR: Plugin '%@' not found, or is not a CDVPlugin. Check your plugin mapping in config.xml.", command.className);
|
|
172
|
+
return NO;
|
|
173
|
+
}
|
|
174
|
+
BOOL retVal = YES;
|
|
175
|
+
double started = [[NSDate date] timeIntervalSince1970] * 1000.0;
|
|
176
|
+
// Find the proper selector to call.
|
|
177
|
+
NSString* methodName = [NSString stringWithFormat:@"%@:", command.methodName];
|
|
178
|
+
SEL normalSelector = NSSelectorFromString(methodName);
|
|
179
|
+
if ([obj respondsToSelector:normalSelector]) {
|
|
180
|
+
// [obj performSelector:normalSelector withObject:command];
|
|
181
|
+
((void (*)(id, SEL, id))objc_msgSend)(obj, normalSelector, command);
|
|
182
|
+
} else {
|
|
183
|
+
// There's no method to call, so throw an error.
|
|
184
|
+
NSLog(@"ERROR: Method '%@' not defined in Plugin '%@'", methodName, command.className);
|
|
185
|
+
retVal = NO;
|
|
186
|
+
}
|
|
187
|
+
double elapsed = [[NSDate date] timeIntervalSince1970] * 1000.0 - started;
|
|
188
|
+
if (elapsed > 10) {
|
|
189
|
+
NSLog(@"THREAD WARNING: ['%@'] took '%f' ms. Plugin should use a background thread.", command.className, elapsed);
|
|
190
|
+
}
|
|
191
|
+
return retVal;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
@end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
@interface CDVConfigParser : NSObject <NSXMLParserDelegate>
|
|
21
|
+
{
|
|
22
|
+
NSString* featureName;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@property (nonatomic, readonly, strong) NSMutableDictionary* pluginsDict;
|
|
26
|
+
@property (nonatomic, readonly, strong) NSMutableDictionary* settings;
|
|
27
|
+
@property (nonatomic, readonly, strong) NSMutableArray* startupPluginNames;
|
|
28
|
+
@property (nonatomic, readonly, strong) NSString* startPage;
|
|
29
|
+
|
|
30
|
+
@end
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import "CDVConfigParser.h"
|
|
21
|
+
|
|
22
|
+
@interface CDVConfigParser ()
|
|
23
|
+
|
|
24
|
+
@property (nonatomic, readwrite, strong) NSMutableDictionary* pluginsDict;
|
|
25
|
+
@property (nonatomic, readwrite, strong) NSMutableDictionary* settings;
|
|
26
|
+
@property (nonatomic, readwrite, strong) NSMutableArray* startupPluginNames;
|
|
27
|
+
@property (nonatomic, readwrite, strong) NSString* startPage;
|
|
28
|
+
|
|
29
|
+
@end
|
|
30
|
+
|
|
31
|
+
@implementation CDVConfigParser
|
|
32
|
+
|
|
33
|
+
@synthesize pluginsDict, settings, startPage, startupPluginNames;
|
|
34
|
+
|
|
35
|
+
- (id)init
|
|
36
|
+
{
|
|
37
|
+
self = [super init];
|
|
38
|
+
if (self != nil) {
|
|
39
|
+
self.pluginsDict = [[NSMutableDictionary alloc] initWithCapacity:30];
|
|
40
|
+
self.settings = [[NSMutableDictionary alloc] initWithCapacity:30];
|
|
41
|
+
self.startupPluginNames = [[NSMutableArray alloc] initWithCapacity:8];
|
|
42
|
+
featureName = nil;
|
|
43
|
+
}
|
|
44
|
+
return self;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
- (void)parser:(NSXMLParser*)parser didStartElement:(NSString*)elementName namespaceURI:(NSString*)namespaceURI qualifiedName:(NSString*)qualifiedName attributes:(NSDictionary*)attributeDict
|
|
48
|
+
{
|
|
49
|
+
if ([elementName isEqualToString:@"preference"]) {
|
|
50
|
+
settings[[attributeDict[@"name"] lowercaseString]] = attributeDict[@"value"];
|
|
51
|
+
} else if ([elementName isEqualToString:@"feature"]) { // store feature name to use with correct parameter set
|
|
52
|
+
featureName = [attributeDict[@"name"] lowercaseString];
|
|
53
|
+
} else if ((featureName != nil) && [elementName isEqualToString:@"param"]) {
|
|
54
|
+
NSString* paramName = [attributeDict[@"name"] lowercaseString];
|
|
55
|
+
id value = attributeDict[@"value"];
|
|
56
|
+
if ([paramName isEqualToString:@"ios-package"]) {
|
|
57
|
+
pluginsDict[featureName] = value;
|
|
58
|
+
}
|
|
59
|
+
BOOL paramIsOnload = ([paramName isEqualToString:@"onload"] && [@"true" isEqualToString : value]);
|
|
60
|
+
BOOL attribIsOnload = [@"true" isEqualToString :[attributeDict[@"onload"] lowercaseString]];
|
|
61
|
+
if (paramIsOnload || attribIsOnload) {
|
|
62
|
+
[self.startupPluginNames addObject:featureName];
|
|
63
|
+
}
|
|
64
|
+
} else if ([elementName isEqualToString:@"content"]) {
|
|
65
|
+
self.startPage = attributeDict[@"src"];
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
- (void)parser:(NSXMLParser*)parser didEndElement:(NSString*)elementName namespaceURI:(NSString*)namespaceURI qualifiedName:(NSString*)qualifiedName
|
|
70
|
+
{
|
|
71
|
+
if ([elementName isEqualToString:@"feature"]) { // no longer handling a feature so release
|
|
72
|
+
featureName = nil;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
- (void)parser:(NSXMLParser*)parser parseErrorOccurred:(NSError*)parseError
|
|
77
|
+
{
|
|
78
|
+
NSAssert(NO, @"config.xml parse error line %ld col %ld", (long)[parser lineNumber], (long)[parser columnNumber]);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one
|
|
3
|
+
or more contributor license agreements. See the NOTICE file
|
|
4
|
+
distributed with this work for additional information
|
|
5
|
+
regarding copyright ownership. The ASF licenses this file
|
|
6
|
+
to you under the Apache License, Version 2.0 (the
|
|
7
|
+
"License"); you may not use this file except in compliance
|
|
8
|
+
with the License. You may obtain a copy of the License at
|
|
9
|
+
|
|
10
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
|
|
12
|
+
Unless required by applicable law or agreed to in writing,
|
|
13
|
+
software distributed under the License is distributed on an
|
|
14
|
+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
KIND, either express or implied. See the License for the
|
|
16
|
+
specific language governing permissions and limitations
|
|
17
|
+
under the License.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#import <Foundation/Foundation.h>
|
|
21
|
+
|
|
22
|
+
@interface CDVInvokedUrlCommand : NSObject {
|
|
23
|
+
NSString* _callbackId;
|
|
24
|
+
NSString* _className;
|
|
25
|
+
NSString* _methodName;
|
|
26
|
+
NSArray* _arguments;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
@property (nonatomic, readonly) NSArray* arguments;
|
|
30
|
+
@property (nonatomic, readonly) NSString* callbackId;
|
|
31
|
+
@property (nonatomic, readonly) NSString* className;
|
|
32
|
+
@property (nonatomic, readonly) NSString* methodName;
|
|
33
|
+
|
|
34
|
+
+ (CDVInvokedUrlCommand*)commandFromJson:(NSArray*)jsonEntry;
|
|
35
|
+
|
|
36
|
+
- (id)initWithArguments:(NSArray*)arguments
|
|
37
|
+
callbackId:(NSString*)callbackId
|
|
38
|
+
className:(NSString*)className
|
|
39
|
+
methodName:(NSString*)methodName;
|
|
40
|
+
|
|
41
|
+
- (id)initFromJson:(NSArray*)jsonEntry;
|
|
42
|
+
|
|
43
|
+
// Returns the argument at the given index.
|
|
44
|
+
// If index >= the number of arguments, returns nil.
|
|
45
|
+
// If the argument at the given index is NSNull, returns nil.
|
|
46
|
+
- (id)argumentAtIndex:(NSUInteger)index;
|
|
47
|
+
// Same as above, but returns defaultValue instead of nil.
|
|
48
|
+
- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue;
|
|
49
|
+
// Same as above, but returns defaultValue instead of nil, and if the argument is not of the expected class, returns defaultValue
|
|
50
|
+
- (id)argumentAtIndex:(NSUInteger)index withDefault:(id)defaultValue andClass:(Class)aClass;
|
|
51
|
+
|
|
52
|
+
@end
|