@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.
Files changed (313) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/CHANGELOG_UNRELEASED.md +28 -0
  3. package/Jenkinsfile +84 -0
  4. package/LICENSE +21 -0
  5. package/README.md +472 -0
  6. package/azure/common-steps.yaml +5 -0
  7. package/azure-pipelines.yml +336 -0
  8. package/docs/JSDoc/MapView.html +300 -0
  9. package/docs/JSDoc/MapViewControllerImpl.html +299 -0
  10. package/docs/JSDoc/Situm.html +5257 -0
  11. package/docs/JSDoc/android_Interfaces.js.html +825 -0
  12. package/docs/JSDoc/android_situm.js.html +380 -0
  13. package/docs/JSDoc/fonts/glyphicons-halflings-regular.eot +0 -0
  14. package/docs/JSDoc/fonts/glyphicons-halflings-regular.svg +288 -0
  15. package/docs/JSDoc/fonts/glyphicons-halflings-regular.ttf +0 -0
  16. package/docs/JSDoc/fonts/glyphicons-halflings-regular.woff +0 -0
  17. package/docs/JSDoc/fonts/glyphicons-halflings-regular.woff2 +0 -0
  18. package/docs/JSDoc/global.html +7538 -0
  19. package/docs/JSDoc/img/toast-ui.png +0 -0
  20. package/docs/JSDoc/index.html +90 -0
  21. package/docs/JSDoc/map-view-controller.js.html +307 -0
  22. package/docs/JSDoc/map-view.js.html +172 -0
  23. package/docs/JSDoc/scripts/jquery.min.js +2 -0
  24. package/docs/JSDoc/scripts/linenumber.js +30 -0
  25. package/docs/JSDoc/scripts/prettify/Apache-License-2.0.txt +202 -0
  26. package/docs/JSDoc/scripts/prettify/lang-css.js +2 -0
  27. package/docs/JSDoc/scripts/prettify/prettify.js +28 -0
  28. package/docs/JSDoc/scripts/tui-doc.js +200 -0
  29. package/docs/JSDoc/styles/bootstrap.min.css +6 -0
  30. package/docs/JSDoc/styles/custom.css +23 -0
  31. package/docs/JSDoc/styles/prettify-jsdoc.css +111 -0
  32. package/docs/JSDoc/styles/prettify-tomorrow.css +132 -0
  33. package/docs/JSDoc/styles/tui-doc.css +485 -0
  34. package/docs/conf.json +28 -0
  35. package/docs/getting-started.md +298 -0
  36. package/docs/imagotype-SITUM-transparent-90.png +0 -0
  37. package/docs/static/styles/custom.css +23 -0
  38. package/package.json +60 -0
  39. package/plugin.xml +102 -0
  40. package/scripts/update_changelog.sh +22 -0
  41. package/src/android/app/build.gradle +51 -0
  42. package/src/android/app/proguard-rules.pro +21 -0
  43. package/src/android/app/src/main/AndroidManifest.xml +11 -0
  44. package/src/android/app/src/main/java/es/situm/plugin/DateUtils.java +15 -0
  45. package/src/android/app/src/main/java/es/situm/plugin/PluginHelper.java +919 -0
  46. package/src/android/app/src/main/java/es/situm/plugin/SitumMapper.java +968 -0
  47. package/src/android/app/src/main/java/es/situm/plugin/SitumPlugin.java +109 -0
  48. package/src/android/app/src/main/res/drawable/ic_launcher_background.xml +170 -0
  49. package/src/android/app/src/main/res/drawable-v24/ic_launcher_foreground.xml +34 -0
  50. package/src/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
  51. package/src/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +5 -0
  52. package/src/android/app/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  53. package/src/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png +0 -0
  54. package/src/android/app/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  55. package/src/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png +0 -0
  56. package/src/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  57. package/src/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png +0 -0
  58. package/src/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  59. package/src/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png +0 -0
  60. package/src/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  61. package/src/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png +0 -0
  62. package/src/android/app/src/main/res/values/colors.xml +6 -0
  63. package/src/android/app/src/main/res/values/strings.xml +3 -0
  64. package/src/android/app/src/main/res/values/styles.xml +11 -0
  65. package/src/android/app/src/test/java/es/situm/plugin/PluginHelperTest.java +27 -0
  66. package/src/android/app/src/test/java/es/situm/plugin/SitumMapperTest.java +1485 -0
  67. package/src/android/app/src/test/java/es/situm/plugin/angle/AngleCreator.java +46 -0
  68. package/src/android/app/src/test/java/es/situm/plugin/bounds/BoundsCreator.java +50 -0
  69. package/src/android/app/src/test/java/es/situm/plugin/building/BuildingCreator.java +76 -0
  70. package/src/android/app/src/test/java/es/situm/plugin/cartesianCoordinate/CartesianCoordinateCreator.java +31 -0
  71. package/src/android/app/src/test/java/es/situm/plugin/circle/CircleCreator.java +41 -0
  72. package/src/android/app/src/test/java/es/situm/plugin/coordinate/CoordinateCreator.java +32 -0
  73. package/src/android/app/src/test/java/es/situm/plugin/dimensions/DimensionsCreator.java +31 -0
  74. package/src/android/app/src/test/java/es/situm/plugin/directionsRequest/DirectionsRequestCreator.java +105 -0
  75. package/src/android/app/src/test/java/es/situm/plugin/event/EventCreator.java +108 -0
  76. package/src/android/app/src/test/java/es/situm/plugin/floor/FloorCreator.java +58 -0
  77. package/src/android/app/src/test/java/es/situm/plugin/indication/IndicationCreator.java +40 -0
  78. package/src/android/app/src/test/java/es/situm/plugin/location/LocationCreator.java +197 -0
  79. package/src/android/app/src/test/java/es/situm/plugin/locationRequest/LocationRequestCreator.java +45 -0
  80. package/src/android/app/src/test/java/es/situm/plugin/locationStatus/LocationStatusCreator.java +211 -0
  81. package/src/android/app/src/test/java/es/situm/plugin/navigationProgress/NavigationProgressCreator.java +154 -0
  82. package/src/android/app/src/test/java/es/situm/plugin/poi/PoiCreator.java +126 -0
  83. package/src/android/app/src/test/java/es/situm/plugin/poiCategory/PoiCategoryCreator.java +38 -0
  84. package/src/android/app/src/test/java/es/situm/plugin/point/PointCreator.java +200 -0
  85. package/src/android/app/src/test/java/es/situm/plugin/route/RouteCreator.java +142 -0
  86. package/src/android/app/src/test/java/es/situm/plugin/routeStep/RouteStepCreator.java +173 -0
  87. package/src/android/app/src/test/java/es/situm/plugin/situmConversionArea/SitumConversionAreaCreator.java +35 -0
  88. package/src/android/build.gradle +31 -0
  89. package/src/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  90. package/src/android/gradle/wrapper/gradle-wrapper.properties +6 -0
  91. package/src/android/gradle.properties +16 -0
  92. package/src/android/gradlew +172 -0
  93. package/src/android/gradlew.bat +84 -0
  94. package/src/android/settings.gradle +3 -0
  95. package/src/android/situm.gradle +19 -0
  96. package/src/ios/Classes/Private/CDVDebug.h +25 -0
  97. package/src/ios/Classes/Private/CDVJSON_private.h +31 -0
  98. package/src/ios/Classes/Private/CDVJSON_private.m +99 -0
  99. package/src/ios/Classes/Private/CDVPlugin+Private.h +24 -0
  100. package/src/ios/Classes/Private/CDVPlugins/CDVGestureHandler/CDVGestureHandler.h +26 -0
  101. package/src/ios/Classes/Private/CDVPlugins/CDVGestureHandler/CDVGestureHandler.m +70 -0
  102. package/src/ios/Classes/Private/CDVPlugins/CDVHandleOpenURL/CDVHandleOpenURL.h +27 -0
  103. package/src/ios/Classes/Private/CDVPlugins/CDVHandleOpenURL/CDVHandleOpenURL.m +86 -0
  104. package/src/ios/Classes/Private/CDVPlugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.h +34 -0
  105. package/src/ios/Classes/Private/CDVPlugins/CDVIntentAndNavigationFilter/CDVIntentAndNavigationFilter.m +153 -0
  106. package/src/ios/Classes/Private/CDVPlugins/CDVLocalStorage/CDVLocalStorage.h +50 -0
  107. package/src/ios/Classes/Private/CDVPlugins/CDVLocalStorage/CDVLocalStorage.m +487 -0
  108. package/src/ios/Classes/Private/CDVPlugins/CDVLogger/CDVLogger.h +26 -0
  109. package/src/ios/Classes/Private/CDVPlugins/CDVLogger/CDVLogger.m +37 -0
  110. package/src/ios/Classes/Private/CDVPlugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.h +41 -0
  111. package/src/ios/Classes/Private/CDVPlugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m +399 -0
  112. package/src/ios/Classes/Private/CDVPlugins/CDVUIWebViewEngine/CDVUIWebViewEngine.h +27 -0
  113. package/src/ios/Classes/Private/CDVPlugins/CDVUIWebViewEngine/CDVUIWebViewEngine.m +202 -0
  114. package/src/ios/Classes/Private/CDVPlugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.h +29 -0
  115. package/src/ios/Classes/Private/CDVPlugins/CDVUIWebViewEngine/CDVUIWebViewNavigationDelegate.m +153 -0
  116. package/src/ios/Classes/Public/CDV.h +32 -0
  117. package/src/ios/Classes/Public/CDVAppDelegate.h +28 -0
  118. package/src/ios/Classes/Public/CDVAppDelegate.m +118 -0
  119. package/src/ios/Classes/Public/CDVAvailability.h +111 -0
  120. package/src/ios/Classes/Public/CDVAvailabilityDeprecated.h +26 -0
  121. package/src/ios/Classes/Public/CDVCommandDelegate.h +51 -0
  122. package/src/ios/Classes/Public/CDVCommandDelegateImpl.h +36 -0
  123. package/src/ios/Classes/Public/CDVCommandDelegateImpl.m +186 -0
  124. package/src/ios/Classes/Public/CDVCommandQueue.h +39 -0
  125. package/src/ios/Classes/Public/CDVCommandQueue.m +194 -0
  126. package/src/ios/Classes/Public/CDVConfigParser.h +30 -0
  127. package/src/ios/Classes/Public/CDVConfigParser.m +81 -0
  128. package/src/ios/Classes/Public/CDVInvokedUrlCommand.h +52 -0
  129. package/src/ios/Classes/Public/CDVInvokedUrlCommand.m +116 -0
  130. package/src/ios/Classes/Public/CDVPlugin+Resources.h +39 -0
  131. package/src/ios/Classes/Public/CDVPlugin+Resources.m +38 -0
  132. package/src/ios/Classes/Public/CDVPlugin.h +85 -0
  133. package/src/ios/Classes/Public/CDVPlugin.m +202 -0
  134. package/src/ios/Classes/Public/CDVPluginResult.h +66 -0
  135. package/src/ios/Classes/Public/CDVPluginResult.m +186 -0
  136. package/src/ios/Classes/Public/CDVScreenOrientationDelegate.h +33 -0
  137. package/src/ios/Classes/Public/CDVTimer.h +27 -0
  138. package/src/ios/Classes/Public/CDVTimer.m +123 -0
  139. package/src/ios/Classes/Public/CDVURLProtocol.h +27 -0
  140. package/src/ios/Classes/Public/CDVURLProtocol.m +113 -0
  141. package/src/ios/Classes/Public/CDVUserAgentUtil.h +27 -0
  142. package/src/ios/Classes/Public/CDVUserAgentUtil.m +124 -0
  143. package/src/ios/Classes/Public/CDVViewController.h +92 -0
  144. package/src/ios/Classes/Public/CDVViewController.m +821 -0
  145. package/src/ios/Classes/Public/CDVWebViewEngineProtocol.h +42 -0
  146. package/src/ios/Classes/Public/CDVWhitelist.h +34 -0
  147. package/src/ios/Classes/Public/CDVWhitelist.m +285 -0
  148. package/src/ios/Classes/Public/NSDictionary+CordovaPreferences.h +35 -0
  149. package/src/ios/Classes/Public/NSDictionary+CordovaPreferences.m +63 -0
  150. package/src/ios/Classes/Public/NSMutableArray+QueueAdditions.h +29 -0
  151. package/src/ios/Classes/Public/NSMutableArray+QueueAdditions.m +58 -0
  152. package/src/ios/Cordova/Cordova.h +51 -0
  153. package/src/ios/Cordova/Info.plist +24 -0
  154. package/src/ios/Podfile +5 -0
  155. package/src/ios/SitumCordovaPlugin.xcodeproj/project.pbxproj +1324 -0
  156. package/src/ios/SitumCordovaPlugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  157. package/src/ios/SitumCordovaPlugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  158. package/src/ios/SitumCordovaPlugin.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings +8 -0
  159. package/src/ios/SitumCordovaPlugin.xcodeproj/xcshareddata/xcschemes/CordovaLib.xcscheme +100 -0
  160. package/src/ios/SitumCordovaPlugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
  161. package/src/ios/SitumCordovaPlugin_Prefix.pch +22 -0
  162. package/src/ios/VERSION +1 -0
  163. package/src/ios/cordova.js +2432 -0
  164. package/src/ios/situmcordovaplugin/AppDelegate.h +22 -0
  165. package/src/ios/situmcordovaplugin/AppDelegate.m +98 -0
  166. package/src/ios/situmcordovaplugin/Assets.xcassets/AppIcon.appiconset/Contents.json +98 -0
  167. package/src/ios/situmcordovaplugin/Base.lproj/LaunchScreen.storyboard +25 -0
  168. package/src/ios/situmcordovaplugin/Base.lproj/Main.storyboard +24 -0
  169. package/src/ios/situmcordovaplugin/Constants.h +14 -0
  170. package/src/ios/situmcordovaplugin/Constants.m +14 -0
  171. package/src/ios/situmcordovaplugin/Info.plist +45 -0
  172. package/src/ios/situmcordovaplugin/SITUtils.h +7 -0
  173. package/src/ios/situmcordovaplugin/SITUtils.m +13 -0
  174. package/src/ios/situmcordovaplugin/SitumLocationWrapper.h +109 -0
  175. package/src/ios/situmcordovaplugin/SitumLocationWrapper.m +983 -0
  176. package/src/ios/situmcordovaplugin/SitumPlugin.h +41 -0
  177. package/src/ios/situmcordovaplugin/SitumPlugin.m +752 -0
  178. package/src/ios/situmcordovaplugin/ViewController.h +15 -0
  179. package/src/ios/situmcordovaplugin/ViewController.m +29 -0
  180. package/src/ios/situmcordovaplugin/main.m +16 -0
  181. package/src/ios/situmcordovaplugin/situmcordovaplugin.xcdatamodeld/.xccurrentversion +8 -0
  182. package/src/ios/situmcordovaplugin/situmcordovaplugin.xcdatamodeld/situmcordovaplugin.xcdatamodel/contents +4 -0
  183. package/src/ios/situmcordovaplugintests/AngleTests.m +53 -0
  184. package/src/ios/situmcordovaplugintests/BoundTests.m +51 -0
  185. package/src/ios/situmcordovaplugintests/BuildingTests.m +41 -0
  186. package/src/ios/situmcordovaplugintests/CartesianCoordinateTests.m +42 -0
  187. package/src/ios/situmcordovaplugintests/ConversionAreaTests.m +43 -0
  188. package/src/ios/situmcordovaplugintests/CoordinateTests.m +42 -0
  189. package/src/ios/situmcordovaplugintests/DimensionTests.m +43 -0
  190. package/src/ios/situmcordovaplugintests/EventTests.m +42 -0
  191. package/src/ios/situmcordovaplugintests/FloorTests.m +52 -0
  192. package/src/ios/situmcordovaplugintests/Info.plist +38 -0
  193. package/src/ios/situmcordovaplugintests/InputTests/DirectionsRequestTest.m +108 -0
  194. package/src/ios/situmcordovaplugintests/InputTests/InputCartesianCoordinateTests.m +45 -0
  195. package/src/ios/situmcordovaplugintests/InputTests/InputCoordinateTests.m +45 -0
  196. package/src/ios/situmcordovaplugintests/InputTests/InputFloorTests.m +59 -0
  197. package/src/ios/situmcordovaplugintests/InputTests/InputIndicationTests.m +45 -0
  198. package/src/ios/situmcordovaplugintests/InputTests/InputLocationTests.m +163 -0
  199. package/src/ios/situmcordovaplugintests/InputTests/InputPoiCategoryTests.m +46 -0
  200. package/src/ios/situmcordovaplugintests/InputTests/InputPointTests.m +137 -0
  201. package/src/ios/situmcordovaplugintests/InputTests/LocationRequestTest.m +79 -0
  202. package/src/ios/situmcordovaplugintests/LocationStatusTests.m +60 -0
  203. package/src/ios/situmcordovaplugintests/LocationTests.m +114 -0
  204. package/src/ios/situmcordovaplugintests/NavigationProgressTests.m +50 -0
  205. package/src/ios/situmcordovaplugintests/PoiCategoryIconTests.m +43 -0
  206. package/src/ios/situmcordovaplugintests/PoiCategoryTests.m +42 -0
  207. package/src/ios/situmcordovaplugintests/PoiTests.m +83 -0
  208. package/src/ios/situmcordovaplugintests/PointTests.m +107 -0
  209. package/src/ios/situmcordovaplugintests/RouteStepTests.m +78 -0
  210. package/src/ios/situmcordovaplugintests/RouteTests.m +42 -0
  211. package/src/ios/situmcordovaplugintests/SitumCreatorTests.h +91 -0
  212. package/src/ios/situmcordovaplugintests/SitumCreatorTests.m +928 -0
  213. package/src/ios/situmcordovaplugintests/TestingHelper.h +48 -0
  214. package/src/ios/situmcordovaplugintests/TestingHelper.m +342 -0
  215. package/src/ios/situmcordovaplugintests/indicationTests.m +43 -0
  216. package/tests/common-resources/angle/angle1.json +6 -0
  217. package/tests/common-resources/angle/angle2.json +6 -0
  218. package/tests/common-resources/bounds/bounds1.json +18 -0
  219. package/tests/common-resources/bounds/bounds2.json +18 -0
  220. package/tests/common-resources/building/building1.json +64 -0
  221. package/tests/common-resources/cartesianCoordinate/cartesianCoordinate1.json +4 -0
  222. package/tests/common-resources/circle/circle1.json +17 -0
  223. package/tests/common-resources/coordinate/coordinate1.json +4 -0
  224. package/tests/common-resources/dimensions/dimensions1.json +4 -0
  225. package/tests/common-resources/directionsRequest/directionsRequest1.json +166 -0
  226. package/tests/common-resources/directionsRequest/directionsRequest2.json +167 -0
  227. package/tests/common-resources/directionsRequest/directionsRequest3.json +166 -0
  228. package/tests/common-resources/directionsRequest/directionsRequest4.json +166 -0
  229. package/tests/common-resources/directionsRequest/directionsRequest5.json +167 -0
  230. package/tests/common-resources/directionsRequest/directionsRequest6.json +153 -0
  231. package/tests/common-resources/events/event1.json +66 -0
  232. package/tests/common-resources/floor/floor1.json +13 -0
  233. package/tests/common-resources/floor/floor2.json +13 -0
  234. package/tests/common-resources/indication/indication1.json +10 -0
  235. package/tests/common-resources/location/location1.json +48 -0
  236. package/tests/common-resources/location/location10.json +48 -0
  237. package/tests/common-resources/location/location2.json +48 -0
  238. package/tests/common-resources/location/location3.json +48 -0
  239. package/tests/common-resources/location/location4.json +48 -0
  240. package/tests/common-resources/location/location5.json +48 -0
  241. package/tests/common-resources/location/location6.json +48 -0
  242. package/tests/common-resources/location/location7.json +48 -0
  243. package/tests/common-resources/location/location8.json +48 -0
  244. package/tests/common-resources/location/location9.json +48 -0
  245. package/tests/common-resources/locationRequest/locationRequest1.json +6 -0
  246. package/tests/common-resources/locationRequest/locationRequest2.json +32 -0
  247. package/tests/common-resources/locationRequest/locationRequest3.json +33 -0
  248. package/tests/common-resources/locationRequest/locationRequest4.json +31 -0
  249. package/tests/common-resources/locationStatus/locationStatus1.json +4 -0
  250. package/tests/common-resources/locationStatus/locationStatus10.json +4 -0
  251. package/tests/common-resources/locationStatus/locationStatus11.json +4 -0
  252. package/tests/common-resources/locationStatus/locationStatus12.json +4 -0
  253. package/tests/common-resources/locationStatus/locationStatus13.json +4 -0
  254. package/tests/common-resources/locationStatus/locationStatus2.json +4 -0
  255. package/tests/common-resources/locationStatus/locationStatus3.json +4 -0
  256. package/tests/common-resources/locationStatus/locationStatus4.json +4 -0
  257. package/tests/common-resources/locationStatus/locationStatus5.json +4 -0
  258. package/tests/common-resources/locationStatus/locationStatus6.json +4 -0
  259. package/tests/common-resources/locationStatus/locationStatus7.json +4 -0
  260. package/tests/common-resources/locationStatus/locationStatus8.json +4 -0
  261. package/tests/common-resources/locationStatus/locationStatus9.json +4 -0
  262. package/tests/common-resources/navigationProgress/navigationProgress1.json +77 -0
  263. package/tests/common-resources/navigationProgress/navigationProgress2.json +77 -0
  264. package/tests/common-resources/poi/poi1.json +35 -0
  265. package/tests/common-resources/poi/poi2.json +35 -0
  266. package/tests/common-resources/poi/poi3.json +35 -0
  267. package/tests/common-resources/poi/poi4.json +38 -0
  268. package/tests/common-resources/poi/poi5.json +35 -0
  269. package/tests/common-resources/poiCategory/poiCategory1.json +7 -0
  270. package/tests/common-resources/poiCategoryIcon/poiCategoryIcon1.json +1 -0
  271. package/tests/common-resources/poiCategoryIcon/poiCategoryIcon1.png +0 -0
  272. package/tests/common-resources/point/point1.json +14 -0
  273. package/tests/common-resources/point/point2.json +14 -0
  274. package/tests/common-resources/point/point3.json +14 -0
  275. package/tests/common-resources/point/point4.json +14 -0
  276. package/tests/common-resources/point/point5.json +14 -0
  277. package/tests/common-resources/point/point6.json +14 -0
  278. package/tests/common-resources/point/point7.json +14 -0
  279. package/tests/common-resources/point/point8.json +14 -0
  280. package/tests/common-resources/route/route1.json +530 -0
  281. package/tests/common-resources/routeStep/routeStep1.json +35 -0
  282. package/tests/common-resources/routeStep/routeStep2.json +35 -0
  283. package/tests/common-resources/routeStep/routeStep3.json +35 -0
  284. package/tests/common-resources/routeStep/routeStep4.json +35 -0
  285. package/tests/common-resources/routeStep/routeStep5.json +35 -0
  286. package/tests/common-resources/situmConversionArea/situmConversionArea1.json +19 -0
  287. package/tests/js/resources/fetchBuildings.json +176 -0
  288. package/tests/js/resources/fetchEventsFromBuilding.json +201 -0
  289. package/tests/js/resources/fetchFloorsFromBuilding.json +34 -0
  290. package/tests/js/resources/fetchIndoorPOIsFromBuilding.json +574 -0
  291. package/tests/js/resources/fetchMapFromFloor.json +3 -0
  292. package/tests/js/resources/fetchOutdoorPOIsFromBuilding.json +68 -0
  293. package/tests/js/resources/fetchPoiCategories.json +72 -0
  294. package/tests/js/resources/fetchPoiCategoryIconNormal.json +3 -0
  295. package/tests/js/resources/fetchPoiCategoryIconSelected.json +3 -0
  296. package/tests/js/resources/requestDirections.json +1167 -0
  297. package/tests/js/resources/startPositioning/0_starting.json +4 -0
  298. package/tests/js/resources/startPositioning/1_preparingPositioningModel.json +4 -0
  299. package/tests/js/resources/startPositioning/2_startingPositioning.json +4 -0
  300. package/tests/js/resources/startPositioning/3_calculating.json +4 -0
  301. package/tests/js/resources/startPositioning/4_position.json +48 -0
  302. package/tests/js/resources/startPositioning/5_position.json +48 -0
  303. package/tests/js/test.js +416 -0
  304. package/tests/scripts/clean_android_resources.sh +3 -0
  305. package/tests/scripts/clean_ios_resources.sh +3 -0
  306. package/tests/scripts/copy_android_resources.sh +3 -0
  307. package/tests/scripts/copy_ios_resources.sh +3 -0
  308. package/tests/scripts/self-destruct.sh +1 -0
  309. package/www/android/Interfaces.js +742 -0
  310. package/www/android/situm.js +296 -0
  311. package/www/ios/situm.js +99 -0
  312. package/www/map-view-controller.js +223 -0
  313. package/www/map-view.js +88 -0
@@ -0,0 +1,487 @@
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 "CDVLocalStorage.h"
21
+ #import "CDV.h"
22
+
23
+ @interface CDVLocalStorage ()
24
+
25
+ @property (nonatomic, readwrite, strong) NSMutableArray* backupInfo; // array of CDVBackupInfo objects
26
+ @property (nonatomic, readwrite, weak) id <UIWebViewDelegate> webviewDelegate;
27
+
28
+ @end
29
+
30
+ @implementation CDVLocalStorage
31
+
32
+ @synthesize backupInfo, webviewDelegate;
33
+
34
+ - (void)pluginInitialize
35
+ {
36
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onResignActive)
37
+ name:UIApplicationWillResignActiveNotification object:nil];
38
+ BOOL cloudBackup = [@"cloud" isEqualToString : self.commandDelegate.settings[[@"BackupWebStorage" lowercaseString]]];
39
+
40
+ self.backupInfo = [[self class] createBackupInfoWithCloudBackup:cloudBackup];
41
+ }
42
+
43
+ #pragma mark -
44
+ #pragma mark Plugin interface methods
45
+
46
+ + (NSMutableArray*)createBackupInfoWithTargetDir:(NSString*)targetDir backupDir:(NSString*)backupDir targetDirNests:(BOOL)targetDirNests backupDirNests:(BOOL)backupDirNests rename:(BOOL)rename
47
+ {
48
+ /*
49
+ This "helper" does so much work and has so many options it would probably be clearer to refactor the whole thing.
50
+ Basically, there are three database locations:
51
+
52
+ 1. "Normal" dir -- LIB/<nested dires WebKit/LocalStorage etc>/<normal filenames>
53
+ 2. "Caches" dir -- LIB/Caches/<normal filenames>
54
+ 3. "Backup" dir -- DOC/Backups/<renamed filenames>
55
+
56
+ And between these three, there are various migration paths, most of which only consider 2 of the 3, which is why this helper is based on 2 locations and has a notion of "direction".
57
+ */
58
+ NSMutableArray* backupInfo = [NSMutableArray arrayWithCapacity:3];
59
+
60
+ NSString* original;
61
+ NSString* backup;
62
+ CDVBackupInfo* backupItem;
63
+
64
+ // ////////// LOCALSTORAGE
65
+
66
+ original = [targetDir stringByAppendingPathComponent:targetDirNests ? @"WebKit/LocalStorage/file__0.localstorage":@"file__0.localstorage"];
67
+ backup = [backupDir stringByAppendingPathComponent:(backupDirNests ? @"WebKit/LocalStorage" : @"")];
68
+ backup = [backup stringByAppendingPathComponent:(rename ? @"localstorage.appdata.db" : @"file__0.localstorage")];
69
+
70
+ backupItem = [[CDVBackupInfo alloc] init];
71
+ backupItem.backup = backup;
72
+ backupItem.original = original;
73
+ backupItem.label = @"localStorage database";
74
+
75
+ [backupInfo addObject:backupItem];
76
+
77
+ // ////////// WEBSQL MAIN DB
78
+
79
+ original = [targetDir stringByAppendingPathComponent:targetDirNests ? @"WebKit/LocalStorage/Databases.db":@"Databases.db"];
80
+ backup = [backupDir stringByAppendingPathComponent:(backupDirNests ? @"WebKit/LocalStorage" : @"")];
81
+ backup = [backup stringByAppendingPathComponent:(rename ? @"websqlmain.appdata.db" : @"Databases.db")];
82
+
83
+ backupItem = [[CDVBackupInfo alloc] init];
84
+ backupItem.backup = backup;
85
+ backupItem.original = original;
86
+ backupItem.label = @"websql main database";
87
+
88
+ [backupInfo addObject:backupItem];
89
+
90
+ // ////////// WEBSQL DATABASES
91
+
92
+ original = [targetDir stringByAppendingPathComponent:targetDirNests ? @"WebKit/LocalStorage/file__0":@"file__0"];
93
+ backup = [backupDir stringByAppendingPathComponent:(backupDirNests ? @"WebKit/LocalStorage" : @"")];
94
+ backup = [backup stringByAppendingPathComponent:(rename ? @"websqldbs.appdata.db" : @"file__0")];
95
+
96
+ backupItem = [[CDVBackupInfo alloc] init];
97
+ backupItem.backup = backup;
98
+ backupItem.original = original;
99
+ backupItem.label = @"websql databases";
100
+
101
+ [backupInfo addObject:backupItem];
102
+
103
+ return backupInfo;
104
+ }
105
+
106
+ + (NSMutableArray*)createBackupInfoWithCloudBackup:(BOOL)cloudBackup
107
+ {
108
+ // create backup info from backup folder to caches folder
109
+ NSString* appLibraryFolder = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
110
+ NSString* appDocumentsFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
111
+ NSString* cacheFolder = [appLibraryFolder stringByAppendingPathComponent:@"Caches"];
112
+ NSString* backupsFolder = [appDocumentsFolder stringByAppendingPathComponent:@"Backups"];
113
+
114
+ // create the backups folder, if needed
115
+ [[NSFileManager defaultManager] createDirectoryAtPath:backupsFolder withIntermediateDirectories:YES attributes:nil error:nil];
116
+
117
+ [self addSkipBackupAttributeToItemAtURL:[NSURL fileURLWithPath:backupsFolder] skip:!cloudBackup];
118
+
119
+ return [self createBackupInfoWithTargetDir:cacheFolder backupDir:backupsFolder targetDirNests:NO backupDirNests:NO rename:YES];
120
+ }
121
+
122
+ + (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL*)URL skip:(BOOL)skip
123
+ {
124
+ NSError* error = nil;
125
+ BOOL success = [URL setResourceValue:[NSNumber numberWithBool:skip] forKey:NSURLIsExcludedFromBackupKey error:&error];
126
+
127
+ if (!success) {
128
+ NSLog(@"Error excluding %@ from backup %@", [URL lastPathComponent], error);
129
+ }
130
+ return success;
131
+ }
132
+
133
+ + (BOOL)copyFrom:(NSString*)src to:(NSString*)dest error:(NSError* __autoreleasing*)error
134
+ {
135
+ NSFileManager* fileManager = [NSFileManager defaultManager];
136
+
137
+ if (![fileManager fileExistsAtPath:src]) {
138
+ NSString* errorString = [NSString stringWithFormat:@"%@ file does not exist.", src];
139
+ if (error != NULL) {
140
+ (*error) = [NSError errorWithDomain:kCDVLocalStorageErrorDomain
141
+ code:kCDVLocalStorageFileOperationError
142
+ userInfo:[NSDictionary dictionaryWithObject:errorString
143
+ forKey:NSLocalizedDescriptionKey]];
144
+ }
145
+ return NO;
146
+ }
147
+
148
+ // generate unique filepath in temp directory
149
+ CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault);
150
+ CFStringRef uuidString = CFUUIDCreateString(kCFAllocatorDefault, uuidRef);
151
+ NSString* tempBackup = [[NSTemporaryDirectory() stringByAppendingPathComponent:(__bridge NSString*)uuidString] stringByAppendingPathExtension:@"bak"];
152
+ CFRelease(uuidString);
153
+ CFRelease(uuidRef);
154
+
155
+ BOOL destExists = [fileManager fileExistsAtPath:dest];
156
+
157
+ // backup the dest
158
+ if (destExists && ![fileManager copyItemAtPath:dest toPath:tempBackup error:error]) {
159
+ return NO;
160
+ }
161
+
162
+ // remove the dest
163
+ if (destExists && ![fileManager removeItemAtPath:dest error:error]) {
164
+ return NO;
165
+ }
166
+
167
+ // create path to dest
168
+ if (!destExists && ![fileManager createDirectoryAtPath:[dest stringByDeletingLastPathComponent] withIntermediateDirectories:YES attributes:nil error:error]) {
169
+ return NO;
170
+ }
171
+
172
+ // copy src to dest
173
+ if ([fileManager copyItemAtPath:src toPath:dest error:error]) {
174
+ // success - cleanup - delete the backup to the dest
175
+ if ([fileManager fileExistsAtPath:tempBackup]) {
176
+ [fileManager removeItemAtPath:tempBackup error:error];
177
+ }
178
+ return YES;
179
+ } else {
180
+ // failure - we restore the temp backup file to dest
181
+ [fileManager copyItemAtPath:tempBackup toPath:dest error:error];
182
+ // cleanup - delete the backup to the dest
183
+ if ([fileManager fileExistsAtPath:tempBackup]) {
184
+ [fileManager removeItemAtPath:tempBackup error:error];
185
+ }
186
+ return NO;
187
+ }
188
+ }
189
+
190
+ - (BOOL)shouldBackup
191
+ {
192
+ for (CDVBackupInfo* info in self.backupInfo) {
193
+ if ([info shouldBackup]) {
194
+ return YES;
195
+ }
196
+ }
197
+
198
+ return NO;
199
+ }
200
+
201
+ - (BOOL)shouldRestore
202
+ {
203
+ for (CDVBackupInfo* info in self.backupInfo) {
204
+ if ([info shouldRestore]) {
205
+ return YES;
206
+ }
207
+ }
208
+
209
+ return NO;
210
+ }
211
+
212
+ /* copy from webkitDbLocation to persistentDbLocation */
213
+ - (void)backup:(CDVInvokedUrlCommand*)command
214
+ {
215
+ NSString* callbackId = command.callbackId;
216
+
217
+ NSError* __autoreleasing error = nil;
218
+ CDVPluginResult* result = nil;
219
+ NSString* message = nil;
220
+
221
+ for (CDVBackupInfo* info in self.backupInfo) {
222
+ if ([info shouldBackup]) {
223
+ [[self class] copyFrom:info.original to:info.backup error:&error];
224
+
225
+ if (callbackId) {
226
+ if (error == nil) {
227
+ message = [NSString stringWithFormat:@"Backed up: %@", info.label];
228
+ NSLog(@"%@", message);
229
+
230
+ result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
231
+ [self.commandDelegate sendPluginResult:result callbackId:callbackId];
232
+ } else {
233
+ message = [NSString stringWithFormat:@"Error in CDVLocalStorage (%@) backup: %@", info.label, [error localizedDescription]];
234
+ NSLog(@"%@", message);
235
+
236
+ result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:message];
237
+ [self.commandDelegate sendPluginResult:result callbackId:callbackId];
238
+ }
239
+ }
240
+ }
241
+ }
242
+ }
243
+
244
+ /* copy from persistentDbLocation to webkitDbLocation */
245
+ - (void)restore:(CDVInvokedUrlCommand*)command
246
+ {
247
+ NSError* __autoreleasing error = nil;
248
+ CDVPluginResult* result = nil;
249
+ NSString* message = nil;
250
+
251
+ for (CDVBackupInfo* info in self.backupInfo) {
252
+ if ([info shouldRestore]) {
253
+ [[self class] copyFrom:info.backup to:info.original error:&error];
254
+
255
+ if (error == nil) {
256
+ message = [NSString stringWithFormat:@"Restored: %@", info.label];
257
+ NSLog(@"%@", message);
258
+
259
+ result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:message];
260
+ [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
261
+ } else {
262
+ message = [NSString stringWithFormat:@"Error in CDVLocalStorage (%@) restore: %@", info.label, [error localizedDescription]];
263
+ NSLog(@"%@", message);
264
+
265
+ result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:message];
266
+ [self.commandDelegate sendPluginResult:result callbackId:command.callbackId];
267
+ }
268
+ }
269
+ }
270
+ }
271
+
272
+ + (void)__fixupDatabaseLocationsWithBackupType:(NSString*)backupType
273
+ {
274
+ [self __verifyAndFixDatabaseLocations];
275
+ [self __restoreLegacyDatabaseLocationsWithBackupType:backupType];
276
+ }
277
+
278
+ + (void)__verifyAndFixDatabaseLocations
279
+ {
280
+ NSBundle* mainBundle = [NSBundle mainBundle];
281
+ NSString* bundlePath = [[mainBundle bundlePath] stringByDeletingLastPathComponent];
282
+ NSString* bundleIdentifier = [[mainBundle infoDictionary] objectForKey:@"CFBundleIdentifier"];
283
+ NSString* appPlistPath = [bundlePath stringByAppendingPathComponent:[NSString stringWithFormat:@"Library/Preferences/%@.plist", bundleIdentifier]];
284
+
285
+ NSMutableDictionary* appPlistDict = [NSMutableDictionary dictionaryWithContentsOfFile:appPlistPath];
286
+ BOOL modified = [[self class] __verifyAndFixDatabaseLocationsWithAppPlistDict:appPlistDict
287
+ bundlePath:bundlePath
288
+ fileManager:[NSFileManager defaultManager]];
289
+
290
+ if (modified) {
291
+ BOOL ok = [appPlistDict writeToFile:appPlistPath atomically:YES];
292
+ [[NSUserDefaults standardUserDefaults] synchronize];
293
+ NSLog(@"Fix applied for database locations?: %@", ok ? @"YES" : @"NO");
294
+ }
295
+ }
296
+
297
+ + (BOOL)__verifyAndFixDatabaseLocationsWithAppPlistDict:(NSMutableDictionary*)appPlistDict
298
+ bundlePath:(NSString*)bundlePath
299
+ fileManager:(NSFileManager*)fileManager
300
+ {
301
+ NSString* libraryCaches = @"Library/Caches";
302
+ NSString* libraryWebKit = @"Library/WebKit";
303
+
304
+ NSArray* keysToCheck = [NSArray arrayWithObjects:
305
+ @"WebKitLocalStorageDatabasePathPreferenceKey",
306
+ @"WebDatabaseDirectory",
307
+ nil];
308
+
309
+ BOOL dirty = NO;
310
+
311
+ for (NSString* key in keysToCheck) {
312
+ NSString* value = [appPlistDict objectForKey:key];
313
+ // verify key exists, and path is in app bundle, if not - fix
314
+ if ((value != nil) && ![value hasPrefix:bundlePath]) {
315
+ // the pathSuffix to use may be wrong - OTA upgrades from < 5.1 to 5.1 do keep the old path Library/WebKit,
316
+ // while Xcode synced ones do change the storage location to Library/Caches
317
+ NSString* newBundlePath = [bundlePath stringByAppendingPathComponent:libraryCaches];
318
+ if (![fileManager fileExistsAtPath:newBundlePath]) {
319
+ newBundlePath = [bundlePath stringByAppendingPathComponent:libraryWebKit];
320
+ }
321
+ [appPlistDict setValue:newBundlePath forKey:key];
322
+ dirty = YES;
323
+ }
324
+ }
325
+
326
+ return dirty;
327
+ }
328
+
329
+ + (void)__restoreLegacyDatabaseLocationsWithBackupType:(NSString*)backupType
330
+ {
331
+ // on iOS 6, if you toggle between cloud/local backup, you must move database locations. Default upgrade from iOS5.1 to iOS6 is like a toggle from local to cloud.
332
+ NSString* appLibraryFolder = [NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES) objectAtIndex:0];
333
+ NSString* appDocumentsFolder = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
334
+
335
+ NSMutableArray* backupInfo = [NSMutableArray arrayWithCapacity:0];
336
+
337
+ if ([backupType isEqualToString:@"cloud"]) {
338
+ #ifdef DEBUG
339
+ NSLog(@"\n\nStarted backup to iCloud! Please be careful."
340
+ "\nYour application might be rejected by Apple if you store too much data."
341
+ "\nFor more information please read \"iOS Data Storage Guidelines\" at:"
342
+ "\nhttps://developer.apple.com/icloud/documentation/data-storage/"
343
+ "\nTo disable web storage backup to iCloud, set the BackupWebStorage preference to \"local\" in the Cordova config.xml file\n\n");
344
+ #endif
345
+ // We would like to restore old backups/caches databases to the new destination (nested in lib folder)
346
+ [backupInfo addObjectsFromArray:[self createBackupInfoWithTargetDir:appLibraryFolder backupDir:[appDocumentsFolder stringByAppendingPathComponent:@"Backups"] targetDirNests:YES backupDirNests:NO rename:YES]];
347
+ [backupInfo addObjectsFromArray:[self createBackupInfoWithTargetDir:appLibraryFolder backupDir:[appLibraryFolder stringByAppendingPathComponent:@"Caches"] targetDirNests:YES backupDirNests:NO rename:NO]];
348
+ } else {
349
+ // For ios6 local backups we also want to restore from Backups dir -- but we don't need to do that here, since the plugin will do that itself.
350
+ [backupInfo addObjectsFromArray:[self createBackupInfoWithTargetDir:[appLibraryFolder stringByAppendingPathComponent:@"Caches"] backupDir:appLibraryFolder targetDirNests:NO backupDirNests:YES rename:NO]];
351
+ }
352
+
353
+ NSFileManager* manager = [NSFileManager defaultManager];
354
+
355
+ for (CDVBackupInfo* info in backupInfo) {
356
+ if ([manager fileExistsAtPath:info.backup]) {
357
+ if ([info shouldRestore]) {
358
+ NSLog(@"Restoring old webstorage backup. From: '%@' To: '%@'.", info.backup, info.original);
359
+ [self copyFrom:info.backup to:info.original error:nil];
360
+ }
361
+ NSLog(@"Removing old webstorage backup: '%@'.", info.backup);
362
+ [manager removeItemAtPath:info.backup error:nil];
363
+ }
364
+ }
365
+
366
+ [[NSUserDefaults standardUserDefaults] setBool:[backupType isEqualToString:@"cloud"] forKey:@"WebKitStoreWebDataForBackup"];
367
+ }
368
+
369
+ #pragma mark -
370
+ #pragma mark Notification handlers
371
+
372
+ - (void)onResignActive
373
+ {
374
+ UIDevice* device = [UIDevice currentDevice];
375
+ NSNumber* exitsOnSuspend = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIApplicationExitsOnSuspend"];
376
+
377
+ BOOL isMultitaskingSupported = [device respondsToSelector:@selector(isMultitaskingSupported)] && [device isMultitaskingSupported];
378
+
379
+ if (exitsOnSuspend == nil) { // if it's missing, it should be NO (i.e. multi-tasking on by default)
380
+ exitsOnSuspend = [NSNumber numberWithBool:NO];
381
+ }
382
+
383
+ if (exitsOnSuspend) {
384
+ [self backup:nil];
385
+ } else if (isMultitaskingSupported) {
386
+ __block UIBackgroundTaskIdentifier backgroundTaskID = UIBackgroundTaskInvalid;
387
+
388
+ backgroundTaskID = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
389
+ [[UIApplication sharedApplication] endBackgroundTask:backgroundTaskID];
390
+ backgroundTaskID = UIBackgroundTaskInvalid;
391
+ NSLog(@"Background task to backup WebSQL/LocalStorage expired.");
392
+ }];
393
+ CDVLocalStorage __weak* weakSelf = self;
394
+ [self.commandDelegate runInBackground:^{
395
+ [weakSelf backup:nil];
396
+
397
+ [[UIApplication sharedApplication] endBackgroundTask:backgroundTaskID];
398
+ backgroundTaskID = UIBackgroundTaskInvalid;
399
+ }];
400
+ }
401
+ }
402
+
403
+ - (void)onAppTerminate
404
+ {
405
+ [self onResignActive];
406
+ }
407
+
408
+ - (void)onReset
409
+ {
410
+ [self restore:nil];
411
+ }
412
+
413
+ @end
414
+
415
+ #pragma mark -
416
+ #pragma mark CDVBackupInfo implementation
417
+
418
+ @implementation CDVBackupInfo
419
+
420
+ @synthesize original, backup, label;
421
+
422
+ - (BOOL)file:(NSString*)aPath isNewerThanFile:(NSString*)bPath
423
+ {
424
+ NSFileManager* fileManager = [NSFileManager defaultManager];
425
+ NSError* __autoreleasing error = nil;
426
+
427
+ NSDictionary* aPathAttribs = [fileManager attributesOfItemAtPath:aPath error:&error];
428
+ NSDictionary* bPathAttribs = [fileManager attributesOfItemAtPath:bPath error:&error];
429
+
430
+ NSDate* aPathModDate = [aPathAttribs objectForKey:NSFileModificationDate];
431
+ NSDate* bPathModDate = [bPathAttribs objectForKey:NSFileModificationDate];
432
+
433
+ if ((nil == aPathModDate) && (nil == bPathModDate)) {
434
+ return NO;
435
+ }
436
+
437
+ return [aPathModDate compare:bPathModDate] == NSOrderedDescending || bPathModDate == nil;
438
+ }
439
+
440
+ - (BOOL)item:(NSString*)aPath isNewerThanItem:(NSString*)bPath
441
+ {
442
+ NSFileManager* fileManager = [NSFileManager defaultManager];
443
+
444
+ BOOL aPathIsDir = NO, bPathIsDir = NO;
445
+ BOOL aPathExists = [fileManager fileExistsAtPath:aPath isDirectory:&aPathIsDir];
446
+
447
+ [fileManager fileExistsAtPath:bPath isDirectory:&bPathIsDir];
448
+
449
+ if (!aPathExists) {
450
+ return NO;
451
+ }
452
+
453
+ if (!(aPathIsDir && bPathIsDir)) { // just a file
454
+ return [self file:aPath isNewerThanFile:bPath];
455
+ }
456
+
457
+ // essentially we want rsync here, but have to settle for our poor man's implementation
458
+ // we get the files in aPath, and see if it is newer than the file in bPath
459
+ // (it is newer if it doesn't exist in bPath) if we encounter the FIRST file that is newer,
460
+ // we return YES
461
+ NSDirectoryEnumerator* directoryEnumerator = [fileManager enumeratorAtPath:aPath];
462
+ NSString* path;
463
+
464
+ while ((path = [directoryEnumerator nextObject])) {
465
+ NSString* aPathFile = [aPath stringByAppendingPathComponent:path];
466
+ NSString* bPathFile = [bPath stringByAppendingPathComponent:path];
467
+
468
+ BOOL isNewer = [self file:aPathFile isNewerThanFile:bPathFile];
469
+ if (isNewer) {
470
+ return YES;
471
+ }
472
+ }
473
+
474
+ return NO;
475
+ }
476
+
477
+ - (BOOL)shouldBackup
478
+ {
479
+ return [self item:self.original isNewerThanItem:self.backup];
480
+ }
481
+
482
+ - (BOOL)shouldRestore
483
+ {
484
+ return [self item:self.backup isNewerThanItem:self.original];
485
+ }
486
+
487
+ @end
@@ -0,0 +1,26 @@
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 "CDVPlugin.h"
21
+
22
+ @interface CDVLogger : CDVPlugin
23
+
24
+ - (void)logLevel:(CDVInvokedUrlCommand*)command;
25
+
26
+ @end
@@ -0,0 +1,37 @@
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 "CDVLogger.h"
21
+
22
+ @implementation CDVLogger
23
+
24
+ /* log a message */
25
+ - (void)logLevel:(CDVInvokedUrlCommand*)command
26
+ {
27
+ id level = [command argumentAtIndex:0];
28
+ id message = [command argumentAtIndex:1];
29
+
30
+ if ([level isEqualToString:@"LOG"]) {
31
+ NSLog(@"%@", message);
32
+ } else {
33
+ NSLog(@"%@: %@", level, message);
34
+ }
35
+ }
36
+
37
+ @end
@@ -0,0 +1,41 @@
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 <UIKit/UIKit.h>
21
+ #import "CDVAvailability.h"
22
+
23
+ /**
24
+ * Distinguishes top-level navigations from sub-frame navigations.
25
+ * shouldStartLoadWithRequest is called for every request, but didStartLoad
26
+ * and didFinishLoad is called only for top-level navigations.
27
+ * Relevant bug: CB-2389
28
+ */
29
+ @interface CDVUIWebViewDelegate : NSObject <UIWebViewDelegate>{
30
+ __weak NSObject <UIWebViewDelegate>* _delegate;
31
+ NSInteger _loadCount;
32
+ NSInteger _state;
33
+ NSInteger _curLoadToken;
34
+ NSInteger _loadStartPollCount;
35
+ }
36
+
37
+ - (id)initWithDelegate:(NSObject <UIWebViewDelegate>*)delegate;
38
+
39
+ - (BOOL)request:(NSURLRequest*)newRequest isEqualToRequestAfterStrippingFragments:(NSURLRequest*)originalRequest;
40
+
41
+ @end