@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,2432 @@
1
+ // Platform: ios
2
+ // 9e8e1b716252c4a08abcd31a13013b868d6f4141
3
+ /*
4
+ Licensed to the Apache Software Foundation (ASF) under one
5
+ or more contributor license agreements. See the NOTICE file
6
+ distributed with this work for additional information
7
+ regarding copyright ownership. The ASF licenses this file
8
+ to you under the Apache License, Version 2.0 (the
9
+ "License"); you may not use this file except in compliance
10
+ with the License. You may obtain a copy of the License at
11
+
12
+ http://www.apache.org/licenses/LICENSE-2.0
13
+
14
+ Unless required by applicable law or agreed to in writing,
15
+ software distributed under the License is distributed on an
16
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
+ KIND, either express or implied. See the License for the
18
+ specific language governing permissions and limitations
19
+ under the License.
20
+ */
21
+ ;(function() {
22
+ var PLATFORM_VERSION_BUILD_LABEL = '5.0.0-dev';
23
+ // file: src/scripts/require.js
24
+
25
+ /* jshint -W079 */
26
+ /* jshint -W020 */
27
+
28
+ var require;
29
+ var define;
30
+
31
+ (function () {
32
+ var modules = {};
33
+ // Stack of moduleIds currently being built.
34
+ var requireStack = [];
35
+ // Map of module ID -> index into requireStack of modules currently being built.
36
+ var inProgressModules = {};
37
+ var SEPARATOR = '.';
38
+
39
+ function build (module) {
40
+ var factory = module.factory;
41
+ var localRequire = function (id) {
42
+ var resultantId = id;
43
+ // Its a relative path, so lop off the last portion and add the id (minus "./")
44
+ if (id.charAt(0) === '.') {
45
+ resultantId = module.id.slice(0, module.id.lastIndexOf(SEPARATOR)) + SEPARATOR + id.slice(2);
46
+ }
47
+ return require(resultantId);
48
+ };
49
+ module.exports = {};
50
+ delete module.factory;
51
+ factory(localRequire, module.exports, module);
52
+ return module.exports;
53
+ }
54
+
55
+ require = function (id) {
56
+ if (!modules[id]) {
57
+ throw 'module ' + id + ' not found';
58
+ } else if (id in inProgressModules) {
59
+ var cycle = requireStack.slice(inProgressModules[id]).join('->') + '->' + id;
60
+ throw 'Cycle in require graph: ' + cycle;
61
+ }
62
+ if (modules[id].factory) {
63
+ try {
64
+ inProgressModules[id] = requireStack.length;
65
+ requireStack.push(id);
66
+ return build(modules[id]);
67
+ } finally {
68
+ delete inProgressModules[id];
69
+ requireStack.pop();
70
+ }
71
+ }
72
+ return modules[id].exports;
73
+ };
74
+
75
+ define = function (id, factory) {
76
+ if (modules[id]) {
77
+ throw 'module ' + id + ' already defined';
78
+ }
79
+
80
+ modules[id] = {
81
+ id: id,
82
+ factory: factory
83
+ };
84
+ };
85
+
86
+ define.remove = function (id) {
87
+ delete modules[id];
88
+ };
89
+
90
+ define.moduleMap = modules;
91
+ })();
92
+
93
+ // Export for use in node
94
+ if (typeof module === 'object' && typeof require === 'function') {
95
+ module.exports.require = require;
96
+ module.exports.define = define;
97
+ }
98
+
99
+ // file: src/cordova.js
100
+ define("cordova", function(require, exports, module) {
101
+
102
+ // Workaround for Windows 10 in hosted environment case
103
+ // http://www.w3.org/html/wg/drafts/html/master/browsers.html#named-access-on-the-window-object
104
+ if (window.cordova && !(window.cordova instanceof HTMLElement)) { // eslint-disable-line no-undef
105
+ throw new Error('cordova already defined');
106
+ }
107
+
108
+ var channel = require('cordova/channel');
109
+ var platform = require('cordova/platform');
110
+
111
+ /**
112
+ * Intercept calls to addEventListener + removeEventListener and handle deviceready,
113
+ * resume, and pause events.
114
+ */
115
+ var m_document_addEventListener = document.addEventListener;
116
+ var m_document_removeEventListener = document.removeEventListener;
117
+ var m_window_addEventListener = window.addEventListener;
118
+ var m_window_removeEventListener = window.removeEventListener;
119
+
120
+ /**
121
+ * Houses custom event handlers to intercept on document + window event listeners.
122
+ */
123
+ var documentEventHandlers = {};
124
+ var windowEventHandlers = {};
125
+
126
+ document.addEventListener = function (evt, handler, capture) {
127
+ var e = evt.toLowerCase();
128
+ if (typeof documentEventHandlers[e] !== 'undefined') {
129
+ documentEventHandlers[e].subscribe(handler);
130
+ } else {
131
+ m_document_addEventListener.call(document, evt, handler, capture);
132
+ }
133
+ };
134
+
135
+ window.addEventListener = function (evt, handler, capture) {
136
+ var e = evt.toLowerCase();
137
+ if (typeof windowEventHandlers[e] !== 'undefined') {
138
+ windowEventHandlers[e].subscribe(handler);
139
+ } else {
140
+ m_window_addEventListener.call(window, evt, handler, capture);
141
+ }
142
+ };
143
+
144
+ document.removeEventListener = function (evt, handler, capture) {
145
+ var e = evt.toLowerCase();
146
+ // If unsubscribing from an event that is handled by a plugin
147
+ if (typeof documentEventHandlers[e] !== 'undefined') {
148
+ documentEventHandlers[e].unsubscribe(handler);
149
+ } else {
150
+ m_document_removeEventListener.call(document, evt, handler, capture);
151
+ }
152
+ };
153
+
154
+ window.removeEventListener = function (evt, handler, capture) {
155
+ var e = evt.toLowerCase();
156
+ // If unsubscribing from an event that is handled by a plugin
157
+ if (typeof windowEventHandlers[e] !== 'undefined') {
158
+ windowEventHandlers[e].unsubscribe(handler);
159
+ } else {
160
+ m_window_removeEventListener.call(window, evt, handler, capture);
161
+ }
162
+ };
163
+
164
+ function createEvent (type, data) {
165
+ var event = document.createEvent('Events');
166
+ event.initEvent(type, false, false);
167
+ if (data) {
168
+ for (var i in data) {
169
+ if (data.hasOwnProperty(i)) {
170
+ event[i] = data[i];
171
+ }
172
+ }
173
+ }
174
+ return event;
175
+ }
176
+
177
+ /* eslint-disable no-undef */
178
+ var cordova = {
179
+ define: define,
180
+ require: require,
181
+ version: PLATFORM_VERSION_BUILD_LABEL,
182
+ platformVersion: PLATFORM_VERSION_BUILD_LABEL,
183
+ platformId: platform.id,
184
+
185
+ /* eslint-enable no-undef */
186
+
187
+ /**
188
+ * Methods to add/remove your own addEventListener hijacking on document + window.
189
+ */
190
+ addWindowEventHandler: function (event) {
191
+ return (windowEventHandlers[event] = channel.create(event));
192
+ },
193
+ addStickyDocumentEventHandler: function (event) {
194
+ return (documentEventHandlers[event] = channel.createSticky(event));
195
+ },
196
+ addDocumentEventHandler: function (event) {
197
+ return (documentEventHandlers[event] = channel.create(event));
198
+ },
199
+ removeWindowEventHandler: function (event) {
200
+ delete windowEventHandlers[event];
201
+ },
202
+ removeDocumentEventHandler: function (event) {
203
+ delete documentEventHandlers[event];
204
+ },
205
+ /**
206
+ * Retrieve original event handlers that were replaced by Cordova
207
+ *
208
+ * @return object
209
+ */
210
+ getOriginalHandlers: function () {
211
+ return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener},
212
+ 'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}};
213
+ },
214
+ /**
215
+ * Method to fire event from native code
216
+ * bNoDetach is required for events which cause an exception which needs to be caught in native code
217
+ */
218
+ fireDocumentEvent: function (type, data, bNoDetach) {
219
+ var evt = createEvent(type, data);
220
+ if (typeof documentEventHandlers[type] !== 'undefined') {
221
+ if (bNoDetach) {
222
+ documentEventHandlers[type].fire(evt);
223
+ } else {
224
+ setTimeout(function () {
225
+ // Fire deviceready on listeners that were registered before cordova.js was loaded.
226
+ if (type === 'deviceready') {
227
+ document.dispatchEvent(evt);
228
+ }
229
+ documentEventHandlers[type].fire(evt);
230
+ }, 0);
231
+ }
232
+ } else {
233
+ document.dispatchEvent(evt);
234
+ }
235
+ },
236
+ fireWindowEvent: function (type, data) {
237
+ var evt = createEvent(type, data);
238
+ if (typeof windowEventHandlers[type] !== 'undefined') {
239
+ setTimeout(function () {
240
+ windowEventHandlers[type].fire(evt);
241
+ }, 0);
242
+ } else {
243
+ window.dispatchEvent(evt);
244
+ }
245
+ },
246
+
247
+ /**
248
+ * Plugin callback mechanism.
249
+ */
250
+ // Randomize the starting callbackId to avoid collisions after refreshing or navigating.
251
+ // This way, it's very unlikely that any new callback would get the same callbackId as an old callback.
252
+ callbackId: Math.floor(Math.random() * 2000000000),
253
+ callbacks: {},
254
+ callbackStatus: {
255
+ NO_RESULT: 0,
256
+ OK: 1,
257
+ CLASS_NOT_FOUND_EXCEPTION: 2,
258
+ ILLEGAL_ACCESS_EXCEPTION: 3,
259
+ INSTANTIATION_EXCEPTION: 4,
260
+ MALFORMED_URL_EXCEPTION: 5,
261
+ IO_EXCEPTION: 6,
262
+ INVALID_ACTION: 7,
263
+ JSON_EXCEPTION: 8,
264
+ ERROR: 9
265
+ },
266
+
267
+ /**
268
+ * Called by native code when returning successful result from an action.
269
+ */
270
+ callbackSuccess: function (callbackId, args) {
271
+ cordova.callbackFromNative(callbackId, true, args.status, [args.message], args.keepCallback);
272
+ },
273
+
274
+ /**
275
+ * Called by native code when returning error result from an action.
276
+ */
277
+ callbackError: function (callbackId, args) {
278
+ // TODO: Deprecate callbackSuccess and callbackError in favour of callbackFromNative.
279
+ // Derive success from status.
280
+ cordova.callbackFromNative(callbackId, false, args.status, [args.message], args.keepCallback);
281
+ },
282
+
283
+ /**
284
+ * Called by native code when returning the result from an action.
285
+ */
286
+ callbackFromNative: function (callbackId, isSuccess, status, args, keepCallback) {
287
+ try {
288
+ var callback = cordova.callbacks[callbackId];
289
+ if (callback) {
290
+ if (isSuccess && status === cordova.callbackStatus.OK) {
291
+ callback.success && callback.success.apply(null, args);
292
+ } else if (!isSuccess) {
293
+ callback.fail && callback.fail.apply(null, args);
294
+ }
295
+ /*
296
+ else
297
+ Note, this case is intentionally not caught.
298
+ this can happen if isSuccess is true, but callbackStatus is NO_RESULT
299
+ which is used to remove a callback from the list without calling the callbacks
300
+ typically keepCallback is false in this case
301
+ */
302
+ // Clear callback if not expecting any more results
303
+ if (!keepCallback) {
304
+ delete cordova.callbacks[callbackId];
305
+ }
306
+ }
307
+ } catch (err) {
308
+ var msg = 'Error in ' + (isSuccess ? 'Success' : 'Error') + ' callbackId: ' + callbackId + ' : ' + err;
309
+ console && console.log && console.log(msg);
310
+ console && console.log && err.stack && console.log(err.stack);
311
+ cordova.fireWindowEvent('cordovacallbackerror', { 'message': msg });
312
+ throw err;
313
+ }
314
+ },
315
+ addConstructor: function (func) {
316
+ channel.onCordovaReady.subscribe(function () {
317
+ try {
318
+ func();
319
+ } catch (e) {
320
+ console.log('Failed to run constructor: ' + e);
321
+ }
322
+ });
323
+ }
324
+ };
325
+
326
+ module.exports = cordova;
327
+
328
+ });
329
+
330
+ // file: src/common/argscheck.js
331
+ define("cordova/argscheck", function(require, exports, module) {
332
+
333
+ var utils = require('cordova/utils');
334
+
335
+ var moduleExports = module.exports;
336
+
337
+ var typeMap = {
338
+ 'A': 'Array',
339
+ 'D': 'Date',
340
+ 'N': 'Number',
341
+ 'S': 'String',
342
+ 'F': 'Function',
343
+ 'O': 'Object'
344
+ };
345
+
346
+ function extractParamName (callee, argIndex) {
347
+ return (/.*?\((.*?)\)/).exec(callee)[1].split(', ')[argIndex];
348
+ }
349
+
350
+ function checkArgs (spec, functionName, args, opt_callee) {
351
+ if (!moduleExports.enableChecks) {
352
+ return;
353
+ }
354
+ var errMsg = null;
355
+ var typeName;
356
+ for (var i = 0; i < spec.length; ++i) {
357
+ var c = spec.charAt(i);
358
+ var cUpper = c.toUpperCase();
359
+ var arg = args[i];
360
+ // Asterix means allow anything.
361
+ if (c === '*') {
362
+ continue;
363
+ }
364
+ typeName = utils.typeName(arg);
365
+ if ((arg === null || arg === undefined) && c === cUpper) {
366
+ continue;
367
+ }
368
+ if (typeName !== typeMap[cUpper]) {
369
+ errMsg = 'Expected ' + typeMap[cUpper];
370
+ break;
371
+ }
372
+ }
373
+ if (errMsg) {
374
+ errMsg += ', but got ' + typeName + '.';
375
+ errMsg = 'Wrong type for parameter "' + extractParamName(opt_callee || args.callee, i) + '" of ' + functionName + ': ' + errMsg;
376
+ // Don't log when running unit tests.
377
+ if (typeof jasmine === 'undefined') {
378
+ console.error(errMsg);
379
+ }
380
+ throw TypeError(errMsg);
381
+ }
382
+ }
383
+
384
+ function getValue (value, defaultValue) {
385
+ return value === undefined ? defaultValue : value;
386
+ }
387
+
388
+ moduleExports.checkArgs = checkArgs;
389
+ moduleExports.getValue = getValue;
390
+ moduleExports.enableChecks = true;
391
+
392
+ });
393
+
394
+ // file: src/common/base64.js
395
+ define("cordova/base64", function(require, exports, module) {
396
+
397
+ var base64 = exports;
398
+
399
+ base64.fromArrayBuffer = function (arrayBuffer) {
400
+ var array = new Uint8Array(arrayBuffer);
401
+ return uint8ToBase64(array);
402
+ };
403
+
404
+ base64.toArrayBuffer = function (str) {
405
+ var decodedStr = typeof atob !== 'undefined' ? atob(str) : Buffer.from(str, 'base64').toString('binary'); // eslint-disable-line no-undef
406
+ var arrayBuffer = new ArrayBuffer(decodedStr.length);
407
+ var array = new Uint8Array(arrayBuffer);
408
+ for (var i = 0, len = decodedStr.length; i < len; i++) {
409
+ array[i] = decodedStr.charCodeAt(i);
410
+ }
411
+ return arrayBuffer;
412
+ };
413
+
414
+ // ------------------------------------------------------------------------------
415
+
416
+ /* This code is based on the performance tests at http://jsperf.com/b64tests
417
+ * This 12-bit-at-a-time algorithm was the best performing version on all
418
+ * platforms tested.
419
+ */
420
+
421
+ var b64_6bit = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
422
+ var b64_12bit;
423
+
424
+ var b64_12bitTable = function () {
425
+ b64_12bit = [];
426
+ for (var i = 0; i < 64; i++) {
427
+ for (var j = 0; j < 64; j++) {
428
+ b64_12bit[i * 64 + j] = b64_6bit[i] + b64_6bit[j];
429
+ }
430
+ }
431
+ b64_12bitTable = function () { return b64_12bit; };
432
+ return b64_12bit;
433
+ };
434
+
435
+ function uint8ToBase64 (rawData) {
436
+ var numBytes = rawData.byteLength;
437
+ var output = '';
438
+ var segment;
439
+ var table = b64_12bitTable();
440
+ for (var i = 0; i < numBytes - 2; i += 3) {
441
+ segment = (rawData[i] << 16) + (rawData[i + 1] << 8) + rawData[i + 2];
442
+ output += table[segment >> 12];
443
+ output += table[segment & 0xfff];
444
+ }
445
+ if (numBytes - i === 2) {
446
+ segment = (rawData[i] << 16) + (rawData[i + 1] << 8);
447
+ output += table[segment >> 12];
448
+ output += b64_6bit[(segment & 0xfff) >> 6];
449
+ output += '=';
450
+ } else if (numBytes - i === 1) {
451
+ segment = (rawData[i] << 16);
452
+ output += table[segment >> 12];
453
+ output += '==';
454
+ }
455
+ return output;
456
+ }
457
+
458
+ });
459
+
460
+ // file: src/common/builder.js
461
+ define("cordova/builder", function(require, exports, module) {
462
+
463
+ var utils = require('cordova/utils');
464
+
465
+ function each (objects, func, context) {
466
+ for (var prop in objects) {
467
+ if (objects.hasOwnProperty(prop)) {
468
+ func.apply(context, [objects[prop], prop]);
469
+ }
470
+ }
471
+ }
472
+
473
+ function clobber (obj, key, value) {
474
+ exports.replaceHookForTesting(obj, key);
475
+ var needsProperty = false;
476
+ try {
477
+ obj[key] = value;
478
+ } catch (e) {
479
+ needsProperty = true;
480
+ }
481
+ // Getters can only be overridden by getters.
482
+ if (needsProperty || obj[key] !== value) {
483
+ utils.defineGetter(obj, key, function () {
484
+ return value;
485
+ });
486
+ }
487
+ }
488
+
489
+ function assignOrWrapInDeprecateGetter (obj, key, value, message) {
490
+ if (message) {
491
+ utils.defineGetter(obj, key, function () {
492
+ console.log(message);
493
+ delete obj[key];
494
+ clobber(obj, key, value);
495
+ return value;
496
+ });
497
+ } else {
498
+ clobber(obj, key, value);
499
+ }
500
+ }
501
+
502
+ function include (parent, objects, clobber, merge) {
503
+ each(objects, function (obj, key) {
504
+ try {
505
+ var result = obj.path ? require(obj.path) : {};
506
+
507
+ if (clobber) {
508
+ // Clobber if it doesn't exist.
509
+ if (typeof parent[key] === 'undefined') {
510
+ assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
511
+ } else if (typeof obj.path !== 'undefined') {
512
+ // If merging, merge properties onto parent, otherwise, clobber.
513
+ if (merge) {
514
+ recursiveMerge(parent[key], result);
515
+ } else {
516
+ assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
517
+ }
518
+ }
519
+ result = parent[key];
520
+ } else {
521
+ // Overwrite if not currently defined.
522
+ if (typeof parent[key] === 'undefined') {
523
+ assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
524
+ } else {
525
+ // Set result to what already exists, so we can build children into it if they exist.
526
+ result = parent[key];
527
+ }
528
+ }
529
+
530
+ if (obj.children) {
531
+ include(result, obj.children, clobber, merge);
532
+ }
533
+ } catch (e) {
534
+ utils.alert('Exception building Cordova JS globals: ' + e + ' for key "' + key + '"');
535
+ }
536
+ });
537
+ }
538
+
539
+ /**
540
+ * Merge properties from one object onto another recursively. Properties from
541
+ * the src object will overwrite existing target property.
542
+ *
543
+ * @param target Object to merge properties into.
544
+ * @param src Object to merge properties from.
545
+ */
546
+ function recursiveMerge (target, src) {
547
+ for (var prop in src) {
548
+ if (src.hasOwnProperty(prop)) {
549
+ if (target.prototype && target.prototype.constructor === target) {
550
+ // If the target object is a constructor override off prototype.
551
+ clobber(target.prototype, prop, src[prop]);
552
+ } else {
553
+ if (typeof src[prop] === 'object' && typeof target[prop] === 'object') {
554
+ recursiveMerge(target[prop], src[prop]);
555
+ } else {
556
+ clobber(target, prop, src[prop]);
557
+ }
558
+ }
559
+ }
560
+ }
561
+ }
562
+
563
+ exports.buildIntoButDoNotClobber = function (objects, target) {
564
+ include(target, objects, false, false);
565
+ };
566
+ exports.buildIntoAndClobber = function (objects, target) {
567
+ include(target, objects, true, false);
568
+ };
569
+ exports.buildIntoAndMerge = function (objects, target) {
570
+ include(target, objects, true, true);
571
+ };
572
+ exports.recursiveMerge = recursiveMerge;
573
+ exports.assignOrWrapInDeprecateGetter = assignOrWrapInDeprecateGetter;
574
+ exports.replaceHookForTesting = function () {};
575
+
576
+ });
577
+
578
+ // file: src/common/channel.js
579
+ define("cordova/channel", function(require, exports, module) {
580
+
581
+ var utils = require('cordova/utils');
582
+ var nextGuid = 1;
583
+
584
+ /**
585
+ * Custom pub-sub "channel" that can have functions subscribed to it
586
+ * This object is used to define and control firing of events for
587
+ * cordova initialization, as well as for custom events thereafter.
588
+ *
589
+ * The order of events during page load and Cordova startup is as follows:
590
+ *
591
+ * onDOMContentLoaded* Internal event that is received when the web page is loaded and parsed.
592
+ * onNativeReady* Internal event that indicates the Cordova native side is ready.
593
+ * onCordovaReady* Internal event fired when all Cordova JavaScript objects have been created.
594
+ * onDeviceReady* User event fired to indicate that Cordova is ready
595
+ * onResume User event fired to indicate a start/resume lifecycle event
596
+ * onPause User event fired to indicate a pause lifecycle event
597
+ *
598
+ * The events marked with an * are sticky. Once they have fired, they will stay in the fired state.
599
+ * All listeners that subscribe after the event is fired will be executed right away.
600
+ *
601
+ * The only Cordova events that user code should register for are:
602
+ * deviceready Cordova native code is initialized and Cordova APIs can be called from JavaScript
603
+ * pause App has moved to background
604
+ * resume App has returned to foreground
605
+ *
606
+ * Listeners can be registered as:
607
+ * document.addEventListener("deviceready", myDeviceReadyListener, false);
608
+ * document.addEventListener("resume", myResumeListener, false);
609
+ * document.addEventListener("pause", myPauseListener, false);
610
+ *
611
+ * The DOM lifecycle events should be used for saving and restoring state
612
+ * window.onload
613
+ * window.onunload
614
+ *
615
+ */
616
+
617
+ /**
618
+ * Channel
619
+ * @constructor
620
+ * @param type String the channel name
621
+ */
622
+ var Channel = function (type, sticky) {
623
+ this.type = type;
624
+ // Map of guid -> function.
625
+ this.handlers = {};
626
+ // 0 = Non-sticky, 1 = Sticky non-fired, 2 = Sticky fired.
627
+ this.state = sticky ? 1 : 0;
628
+ // Used in sticky mode to remember args passed to fire().
629
+ this.fireArgs = null;
630
+ // Used by onHasSubscribersChange to know if there are any listeners.
631
+ this.numHandlers = 0;
632
+ // Function that is called when the first listener is subscribed, or when
633
+ // the last listener is unsubscribed.
634
+ this.onHasSubscribersChange = null;
635
+ };
636
+ var channel = {
637
+ /**
638
+ * Calls the provided function only after all of the channels specified
639
+ * have been fired. All channels must be sticky channels.
640
+ */
641
+ join: function (h, c) {
642
+ var len = c.length;
643
+ var i = len;
644
+ var f = function () {
645
+ if (!(--i)) h();
646
+ };
647
+ for (var j = 0; j < len; j++) {
648
+ if (c[j].state === 0) {
649
+ throw Error('Can only use join with sticky channels.');
650
+ }
651
+ c[j].subscribe(f);
652
+ }
653
+ if (!len) h();
654
+ },
655
+ /* eslint-disable no-return-assign */
656
+ create: function (type) {
657
+ return channel[type] = new Channel(type, false);
658
+ },
659
+ createSticky: function (type) {
660
+ return channel[type] = new Channel(type, true);
661
+ },
662
+ /* eslint-enable no-return-assign */
663
+ /**
664
+ * cordova Channels that must fire before "deviceready" is fired.
665
+ */
666
+ deviceReadyChannelsArray: [],
667
+ deviceReadyChannelsMap: {},
668
+
669
+ /**
670
+ * Indicate that a feature needs to be initialized before it is ready to be used.
671
+ * This holds up Cordova's "deviceready" event until the feature has been initialized
672
+ * and Cordova.initComplete(feature) is called.
673
+ *
674
+ * @param feature {String} The unique feature name
675
+ */
676
+ waitForInitialization: function (feature) {
677
+ if (feature) {
678
+ var c = channel[feature] || this.createSticky(feature);
679
+ this.deviceReadyChannelsMap[feature] = c;
680
+ this.deviceReadyChannelsArray.push(c);
681
+ }
682
+ },
683
+
684
+ /**
685
+ * Indicate that initialization code has completed and the feature is ready to be used.
686
+ *
687
+ * @param feature {String} The unique feature name
688
+ */
689
+ initializationComplete: function (feature) {
690
+ var c = this.deviceReadyChannelsMap[feature];
691
+ if (c) {
692
+ c.fire();
693
+ }
694
+ }
695
+ };
696
+
697
+ function checkSubscriptionArgument (argument) {
698
+ if (typeof argument !== 'function' && typeof argument.handleEvent !== 'function') {
699
+ throw new Error(
700
+ 'Must provide a function or an EventListener object ' +
701
+ 'implementing the handleEvent interface.'
702
+ );
703
+ }
704
+ }
705
+
706
+ /**
707
+ * Subscribes the given function to the channel. Any time that
708
+ * Channel.fire is called so too will the function.
709
+ * Optionally specify an execution context for the function
710
+ * and a guid that can be used to stop subscribing to the channel.
711
+ * Returns the guid.
712
+ */
713
+ Channel.prototype.subscribe = function (eventListenerOrFunction, eventListener) {
714
+ checkSubscriptionArgument(eventListenerOrFunction);
715
+ var handleEvent, guid;
716
+
717
+ if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
718
+ // Received an EventListener object implementing the handleEvent interface
719
+ handleEvent = eventListenerOrFunction.handleEvent;
720
+ eventListener = eventListenerOrFunction;
721
+ } else {
722
+ // Received a function to handle event
723
+ handleEvent = eventListenerOrFunction;
724
+ }
725
+
726
+ if (this.state === 2) {
727
+ handleEvent.apply(eventListener || this, this.fireArgs);
728
+ return;
729
+ }
730
+
731
+ guid = eventListenerOrFunction.observer_guid;
732
+ if (typeof eventListener === 'object') {
733
+ handleEvent = utils.close(eventListener, handleEvent);
734
+ }
735
+
736
+ if (!guid) {
737
+ // First time any channel has seen this subscriber
738
+ guid = '' + nextGuid++;
739
+ }
740
+ handleEvent.observer_guid = guid;
741
+ eventListenerOrFunction.observer_guid = guid;
742
+
743
+ // Don't add the same handler more than once.
744
+ if (!this.handlers[guid]) {
745
+ this.handlers[guid] = handleEvent;
746
+ this.numHandlers++;
747
+ if (this.numHandlers === 1) {
748
+ this.onHasSubscribersChange && this.onHasSubscribersChange();
749
+ }
750
+ }
751
+ };
752
+
753
+ /**
754
+ * Unsubscribes the function with the given guid from the channel.
755
+ */
756
+ Channel.prototype.unsubscribe = function (eventListenerOrFunction) {
757
+ checkSubscriptionArgument(eventListenerOrFunction);
758
+ var handleEvent, guid, handler;
759
+
760
+ if (eventListenerOrFunction && typeof eventListenerOrFunction === 'object') {
761
+ // Received an EventListener object implementing the handleEvent interface
762
+ handleEvent = eventListenerOrFunction.handleEvent;
763
+ } else {
764
+ // Received a function to handle event
765
+ handleEvent = eventListenerOrFunction;
766
+ }
767
+
768
+ guid = handleEvent.observer_guid;
769
+ handler = this.handlers[guid];
770
+ if (handler) {
771
+ delete this.handlers[guid];
772
+ this.numHandlers--;
773
+ if (this.numHandlers === 0) {
774
+ this.onHasSubscribersChange && this.onHasSubscribersChange();
775
+ }
776
+ }
777
+ };
778
+
779
+ /**
780
+ * Calls all functions subscribed to this channel.
781
+ */
782
+ Channel.prototype.fire = function (e) {
783
+ var fail = false; // eslint-disable-line no-unused-vars
784
+ var fireArgs = Array.prototype.slice.call(arguments);
785
+ // Apply stickiness.
786
+ if (this.state === 1) {
787
+ this.state = 2;
788
+ this.fireArgs = fireArgs;
789
+ }
790
+ if (this.numHandlers) {
791
+ // Copy the values first so that it is safe to modify it from within
792
+ // callbacks.
793
+ var toCall = [];
794
+ for (var item in this.handlers) {
795
+ toCall.push(this.handlers[item]);
796
+ }
797
+ for (var i = 0; i < toCall.length; ++i) {
798
+ toCall[i].apply(this, fireArgs);
799
+ }
800
+ if (this.state === 2 && this.numHandlers) {
801
+ this.numHandlers = 0;
802
+ this.handlers = {};
803
+ this.onHasSubscribersChange && this.onHasSubscribersChange();
804
+ }
805
+ }
806
+ };
807
+
808
+ // defining them here so they are ready super fast!
809
+ // DOM event that is received when the web page is loaded and parsed.
810
+ channel.createSticky('onDOMContentLoaded');
811
+
812
+ // Event to indicate the Cordova native side is ready.
813
+ channel.createSticky('onNativeReady');
814
+
815
+ // Event to indicate that all Cordova JavaScript objects have been created
816
+ // and it's time to run plugin constructors.
817
+ channel.createSticky('onCordovaReady');
818
+
819
+ // Event to indicate that all automatically loaded JS plugins are loaded and ready.
820
+ // FIXME remove this
821
+ channel.createSticky('onPluginsReady');
822
+
823
+ // Event to indicate that Cordova is ready
824
+ channel.createSticky('onDeviceReady');
825
+
826
+ // Event to indicate a resume lifecycle event
827
+ channel.create('onResume');
828
+
829
+ // Event to indicate a pause lifecycle event
830
+ channel.create('onPause');
831
+
832
+ // Channels that must fire before "deviceready" is fired.
833
+ channel.waitForInitialization('onCordovaReady');
834
+ channel.waitForInitialization('onDOMContentLoaded');
835
+
836
+ module.exports = channel;
837
+
838
+ });
839
+
840
+ // file: /Users/brodybits/Documents/cordova/cordova-ios/cordova-js-src/exec.js
841
+ define("cordova/exec", function(require, exports, module) {
842
+
843
+ /*global require, module, atob, document */
844
+
845
+ /**
846
+ * Creates a gap bridge iframe used to notify the native code about queued
847
+ * commands.
848
+ */
849
+ var cordova = require('cordova'),
850
+ utils = require('cordova/utils'),
851
+ base64 = require('cordova/base64'),
852
+ execIframe,
853
+ commandQueue = [], // Contains pending JS->Native messages.
854
+ isInContextOfEvalJs = 0,
855
+ failSafeTimerId = 0;
856
+
857
+ function massageArgsJsToNative(args) {
858
+ if (!args || utils.typeName(args) != 'Array') {
859
+ return args;
860
+ }
861
+ var ret = [];
862
+ args.forEach(function(arg, i) {
863
+ if (utils.typeName(arg) == 'ArrayBuffer') {
864
+ ret.push({
865
+ 'CDVType': 'ArrayBuffer',
866
+ 'data': base64.fromArrayBuffer(arg)
867
+ });
868
+ } else {
869
+ ret.push(arg);
870
+ }
871
+ });
872
+ return ret;
873
+ }
874
+
875
+ function massageMessageNativeToJs(message) {
876
+ if (message.CDVType == 'ArrayBuffer') {
877
+ var stringToArrayBuffer = function(str) {
878
+ var ret = new Uint8Array(str.length);
879
+ for (var i = 0; i < str.length; i++) {
880
+ ret[i] = str.charCodeAt(i);
881
+ }
882
+ return ret.buffer;
883
+ };
884
+ var base64ToArrayBuffer = function(b64) {
885
+ return stringToArrayBuffer(atob(b64));
886
+ };
887
+ message = base64ToArrayBuffer(message.data);
888
+ }
889
+ return message;
890
+ }
891
+
892
+ function convertMessageToArgsNativeToJs(message) {
893
+ var args = [];
894
+ if (!message || !message.hasOwnProperty('CDVType')) {
895
+ args.push(message);
896
+ } else if (message.CDVType == 'MultiPart') {
897
+ message.messages.forEach(function(e) {
898
+ args.push(massageMessageNativeToJs(e));
899
+ });
900
+ } else {
901
+ args.push(massageMessageNativeToJs(message));
902
+ }
903
+ return args;
904
+ }
905
+
906
+ function iOSExec() {
907
+
908
+ var successCallback, failCallback, service, action, actionArgs;
909
+ var callbackId = null;
910
+ if (typeof arguments[0] !== 'string') {
911
+ // FORMAT ONE
912
+ successCallback = arguments[0];
913
+ failCallback = arguments[1];
914
+ service = arguments[2];
915
+ action = arguments[3];
916
+ actionArgs = arguments[4];
917
+
918
+ // Since we need to maintain backwards compatibility, we have to pass
919
+ // an invalid callbackId even if no callback was provided since plugins
920
+ // will be expecting it. The Cordova.exec() implementation allocates
921
+ // an invalid callbackId and passes it even if no callbacks were given.
922
+ callbackId = 'INVALID';
923
+ } else {
924
+ throw new Error('The old format of this exec call has been removed (deprecated since 2.1). Change to: ' +
925
+ 'cordova.exec(null, null, \'Service\', \'action\', [ arg1, arg2 ]);'
926
+ );
927
+ }
928
+
929
+ // If actionArgs is not provided, default to an empty array
930
+ actionArgs = actionArgs || [];
931
+
932
+ // Register the callbacks and add the callbackId to the positional
933
+ // arguments if given.
934
+ if (successCallback || failCallback) {
935
+ callbackId = service + cordova.callbackId++;
936
+ cordova.callbacks[callbackId] =
937
+ {success:successCallback, fail:failCallback};
938
+ }
939
+
940
+ actionArgs = massageArgsJsToNative(actionArgs);
941
+
942
+ var command = [callbackId, service, action, actionArgs];
943
+
944
+ // Stringify and queue the command. We stringify to command now to
945
+ // effectively clone the command arguments in case they are mutated before
946
+ // the command is executed.
947
+ commandQueue.push(JSON.stringify(command));
948
+
949
+ // If we're in the context of a stringByEvaluatingJavaScriptFromString call,
950
+ // then the queue will be flushed when it returns; no need for a poke.
951
+ // Also, if there is already a command in the queue, then we've already
952
+ // poked the native side, so there is no reason to do so again.
953
+ if (!isInContextOfEvalJs && commandQueue.length == 1) {
954
+ pokeNative();
955
+ }
956
+ }
957
+
958
+ // CB-10530
959
+ function proxyChanged() {
960
+ var cexec = cordovaExec();
961
+
962
+ return (execProxy !== cexec && // proxy objects are different
963
+ iOSExec !== cexec // proxy object is not the current iOSExec
964
+ );
965
+ }
966
+
967
+ // CB-10106
968
+ function handleBridgeChange() {
969
+ if (proxyChanged()) {
970
+ var commandString = commandQueue.shift();
971
+ while(commandString) {
972
+ var command = JSON.parse(commandString);
973
+ var callbackId = command[0];
974
+ var service = command[1];
975
+ var action = command[2];
976
+ var actionArgs = command[3];
977
+ var callbacks = cordova.callbacks[callbackId] || {};
978
+
979
+ execProxy(callbacks.success, callbacks.fail, service, action, actionArgs);
980
+
981
+ commandString = commandQueue.shift();
982
+ };
983
+ return true;
984
+ }
985
+
986
+ return false;
987
+ }
988
+
989
+ function pokeNative() {
990
+ // CB-5488 - Don't attempt to create iframe before document.body is available.
991
+ if (!document.body) {
992
+ setTimeout(pokeNative);
993
+ return;
994
+ }
995
+
996
+ // Check if they've removed it from the DOM, and put it back if so.
997
+ if (execIframe && execIframe.contentWindow) {
998
+ execIframe.contentWindow.location = 'gap://ready';
999
+ } else {
1000
+ execIframe = document.createElement('iframe');
1001
+ execIframe.style.display = 'none';
1002
+ execIframe.src = 'gap://ready';
1003
+ document.body.appendChild(execIframe);
1004
+ }
1005
+ // Use a timer to protect against iframe being unloaded during the poke (CB-7735).
1006
+ // This makes the bridge ~ 7% slower, but works around the poke getting lost
1007
+ // when the iframe is removed from the DOM.
1008
+ // An onunload listener could be used in the case where the iframe has just been
1009
+ // created, but since unload events fire only once, it doesn't work in the normal
1010
+ // case of iframe reuse (where unload will have already fired due to the attempted
1011
+ // navigation of the page).
1012
+ failSafeTimerId = setTimeout(function() {
1013
+ if (commandQueue.length) {
1014
+ // CB-10106 - flush the queue on bridge change
1015
+ if (!handleBridgeChange()) {
1016
+ pokeNative();
1017
+ }
1018
+ }
1019
+ }, 50); // Making this > 0 improves performance (marginally) in the normal case (where it doesn't fire).
1020
+ }
1021
+
1022
+ iOSExec.nativeFetchMessages = function() {
1023
+ // Stop listing for window detatch once native side confirms poke.
1024
+ if (failSafeTimerId) {
1025
+ clearTimeout(failSafeTimerId);
1026
+ failSafeTimerId = 0;
1027
+ }
1028
+ // Each entry in commandQueue is a JSON string already.
1029
+ if (!commandQueue.length) {
1030
+ return '';
1031
+ }
1032
+ var json = '[' + commandQueue.join(',') + ']';
1033
+ commandQueue.length = 0;
1034
+ return json;
1035
+ };
1036
+
1037
+ iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, debug) {
1038
+ return iOSExec.nativeEvalAndFetch(function() {
1039
+ var success = status === 0 || status === 1;
1040
+ var args = convertMessageToArgsNativeToJs(message);
1041
+ function nc2() {
1042
+ cordova.callbackFromNative(callbackId, success, status, args, keepCallback);
1043
+ }
1044
+ setTimeout(nc2, 0);
1045
+ });
1046
+ };
1047
+
1048
+ iOSExec.nativeEvalAndFetch = function(func) {
1049
+ // This shouldn't be nested, but better to be safe.
1050
+ isInContextOfEvalJs++;
1051
+ try {
1052
+ func();
1053
+ return iOSExec.nativeFetchMessages();
1054
+ } finally {
1055
+ isInContextOfEvalJs--;
1056
+ }
1057
+ };
1058
+
1059
+ // Proxy the exec for bridge changes. See CB-10106
1060
+
1061
+ function cordovaExec() {
1062
+ var cexec = require('cordova/exec');
1063
+ var cexec_valid = (typeof cexec.nativeFetchMessages === 'function') && (typeof cexec.nativeEvalAndFetch === 'function') && (typeof cexec.nativeCallback === 'function');
1064
+ return (cexec_valid && execProxy !== cexec)? cexec : iOSExec;
1065
+ }
1066
+
1067
+ function execProxy() {
1068
+ cordovaExec().apply(null, arguments);
1069
+ };
1070
+
1071
+ execProxy.nativeFetchMessages = function() {
1072
+ return cordovaExec().nativeFetchMessages.apply(null, arguments);
1073
+ };
1074
+
1075
+ execProxy.nativeEvalAndFetch = function() {
1076
+ return cordovaExec().nativeEvalAndFetch.apply(null, arguments);
1077
+ };
1078
+
1079
+ execProxy.nativeCallback = function() {
1080
+ return cordovaExec().nativeCallback.apply(null, arguments);
1081
+ };
1082
+
1083
+ module.exports = execProxy;
1084
+
1085
+ });
1086
+
1087
+ // file: src/common/exec/proxy.js
1088
+ define("cordova/exec/proxy", function(require, exports, module) {
1089
+
1090
+ // internal map of proxy function
1091
+ var CommandProxyMap = {};
1092
+
1093
+ module.exports = {
1094
+
1095
+ // example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...);
1096
+ add: function (id, proxyObj) {
1097
+ console.log('adding proxy for ' + id);
1098
+ CommandProxyMap[id] = proxyObj;
1099
+ return proxyObj;
1100
+ },
1101
+
1102
+ // cordova.commandProxy.remove("Accelerometer");
1103
+ remove: function (id) {
1104
+ var proxy = CommandProxyMap[id];
1105
+ delete CommandProxyMap[id];
1106
+ CommandProxyMap[id] = null;
1107
+ return proxy;
1108
+ },
1109
+
1110
+ get: function (service, action) {
1111
+ return (CommandProxyMap[service] ? CommandProxyMap[service][action] : null);
1112
+ }
1113
+ };
1114
+
1115
+ });
1116
+
1117
+ // file: src/common/init.js
1118
+ define("cordova/init", function(require, exports, module) {
1119
+
1120
+ var channel = require('cordova/channel');
1121
+ var cordova = require('cordova');
1122
+ var modulemapper = require('cordova/modulemapper');
1123
+ var platform = require('cordova/platform');
1124
+ var pluginloader = require('cordova/pluginloader');
1125
+ var utils = require('cordova/utils');
1126
+
1127
+ var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
1128
+
1129
+ function logUnfiredChannels (arr) {
1130
+ for (var i = 0; i < arr.length; ++i) {
1131
+ if (arr[i].state !== 2) {
1132
+ console.log('Channel not fired: ' + arr[i].type);
1133
+ }
1134
+ }
1135
+ }
1136
+
1137
+ window.setTimeout(function () {
1138
+ if (channel.onDeviceReady.state !== 2) {
1139
+ console.log('deviceready has not fired after 5 seconds.');
1140
+ logUnfiredChannels(platformInitChannelsArray);
1141
+ logUnfiredChannels(channel.deviceReadyChannelsArray);
1142
+ }
1143
+ }, 5000);
1144
+
1145
+ // Replace navigator before any modules are required(), to ensure it happens as soon as possible.
1146
+ // We replace it so that properties that can't be clobbered can instead be overridden.
1147
+ function replaceNavigator (origNavigator) {
1148
+ var CordovaNavigator = function () {};
1149
+ CordovaNavigator.prototype = origNavigator;
1150
+ var newNavigator = new CordovaNavigator();
1151
+ // This work-around really only applies to new APIs that are newer than Function.bind.
1152
+ // Without it, APIs such as getGamepads() break.
1153
+ if (CordovaNavigator.bind) {
1154
+ for (var key in origNavigator) {
1155
+ if (typeof origNavigator[key] === 'function') {
1156
+ newNavigator[key] = origNavigator[key].bind(origNavigator);
1157
+ } else {
1158
+ (function (k) {
1159
+ utils.defineGetterSetter(newNavigator, key, function () {
1160
+ return origNavigator[k];
1161
+ });
1162
+ })(key);
1163
+ }
1164
+ }
1165
+ }
1166
+ return newNavigator;
1167
+ }
1168
+
1169
+ if (window.navigator) {
1170
+ window.navigator = replaceNavigator(window.navigator);
1171
+ }
1172
+
1173
+ if (!window.console) {
1174
+ window.console = {
1175
+ log: function () {}
1176
+ };
1177
+ }
1178
+ if (!window.console.warn) {
1179
+ window.console.warn = function (msg) {
1180
+ this.log('warn: ' + msg);
1181
+ };
1182
+ }
1183
+
1184
+ // Register pause, resume and deviceready channels as events on document.
1185
+ channel.onPause = cordova.addDocumentEventHandler('pause');
1186
+ channel.onResume = cordova.addDocumentEventHandler('resume');
1187
+ channel.onActivated = cordova.addDocumentEventHandler('activated');
1188
+ channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
1189
+
1190
+ // Listen for DOMContentLoaded and notify our channel subscribers.
1191
+ if (document.readyState === 'complete' || document.readyState === 'interactive') {
1192
+ channel.onDOMContentLoaded.fire();
1193
+ } else {
1194
+ document.addEventListener('DOMContentLoaded', function () {
1195
+ channel.onDOMContentLoaded.fire();
1196
+ }, false);
1197
+ }
1198
+
1199
+ // _nativeReady is global variable that the native side can set
1200
+ // to signify that the native code is ready. It is a global since
1201
+ // it may be called before any cordova JS is ready.
1202
+ if (window._nativeReady) {
1203
+ channel.onNativeReady.fire();
1204
+ }
1205
+
1206
+ modulemapper.clobbers('cordova', 'cordova');
1207
+ modulemapper.clobbers('cordova/exec', 'cordova.exec');
1208
+ modulemapper.clobbers('cordova/exec', 'Cordova.exec');
1209
+
1210
+ // Call the platform-specific initialization.
1211
+ platform.bootstrap && platform.bootstrap();
1212
+
1213
+ // Wrap in a setTimeout to support the use-case of having plugin JS appended to cordova.js.
1214
+ // The delay allows the attached modules to be defined before the plugin loader looks for them.
1215
+ setTimeout(function () {
1216
+ pluginloader.load(function () {
1217
+ channel.onPluginsReady.fire();
1218
+ });
1219
+ }, 0);
1220
+
1221
+ /**
1222
+ * Create all cordova objects once native side is ready.
1223
+ */
1224
+ channel.join(function () {
1225
+ modulemapper.mapModules(window);
1226
+
1227
+ platform.initialize && platform.initialize();
1228
+
1229
+ // Fire event to notify that all objects are created
1230
+ channel.onCordovaReady.fire();
1231
+
1232
+ // Fire onDeviceReady event once page has fully loaded, all
1233
+ // constructors have run and cordova info has been received from native
1234
+ // side.
1235
+ channel.join(function () {
1236
+ require('cordova').fireDocumentEvent('deviceready');
1237
+ }, channel.deviceReadyChannelsArray);
1238
+
1239
+ }, platformInitChannelsArray);
1240
+
1241
+ });
1242
+
1243
+ // file: src/common/init_b.js
1244
+ define("cordova/init_b", function(require, exports, module) {
1245
+
1246
+ var channel = require('cordova/channel');
1247
+ var cordova = require('cordova');
1248
+ var modulemapper = require('cordova/modulemapper');
1249
+ var platform = require('cordova/platform');
1250
+ var pluginloader = require('cordova/pluginloader');
1251
+ var utils = require('cordova/utils');
1252
+
1253
+ var platformInitChannelsArray = [channel.onDOMContentLoaded, channel.onNativeReady, channel.onPluginsReady];
1254
+
1255
+ // setting exec
1256
+ cordova.exec = require('cordova/exec');
1257
+
1258
+ function logUnfiredChannels (arr) {
1259
+ for (var i = 0; i < arr.length; ++i) {
1260
+ if (arr[i].state !== 2) {
1261
+ console.log('Channel not fired: ' + arr[i].type);
1262
+ }
1263
+ }
1264
+ }
1265
+
1266
+ window.setTimeout(function () {
1267
+ if (channel.onDeviceReady.state !== 2) {
1268
+ console.log('deviceready has not fired after 5 seconds.');
1269
+ logUnfiredChannels(platformInitChannelsArray);
1270
+ logUnfiredChannels(channel.deviceReadyChannelsArray);
1271
+ }
1272
+ }, 5000);
1273
+
1274
+ // Replace navigator before any modules are required(), to ensure it happens as soon as possible.
1275
+ // We replace it so that properties that can't be clobbered can instead be overridden.
1276
+ function replaceNavigator (origNavigator) {
1277
+ var CordovaNavigator = function () {};
1278
+ CordovaNavigator.prototype = origNavigator;
1279
+ var newNavigator = new CordovaNavigator();
1280
+ // This work-around really only applies to new APIs that are newer than Function.bind.
1281
+ // Without it, APIs such as getGamepads() break.
1282
+ if (CordovaNavigator.bind) {
1283
+ for (var key in origNavigator) {
1284
+ if (typeof origNavigator[key] === 'function') {
1285
+ newNavigator[key] = origNavigator[key].bind(origNavigator);
1286
+ } else {
1287
+ (function (k) {
1288
+ utils.defineGetterSetter(newNavigator, key, function () {
1289
+ return origNavigator[k];
1290
+ });
1291
+ })(key);
1292
+ }
1293
+ }
1294
+ }
1295
+ return newNavigator;
1296
+ }
1297
+ if (window.navigator) {
1298
+ window.navigator = replaceNavigator(window.navigator);
1299
+ }
1300
+
1301
+ if (!window.console) {
1302
+ window.console = {
1303
+ log: function () {}
1304
+ };
1305
+ }
1306
+ if (!window.console.warn) {
1307
+ window.console.warn = function (msg) {
1308
+ this.log('warn: ' + msg);
1309
+ };
1310
+ }
1311
+
1312
+ // Register pause, resume and deviceready channels as events on document.
1313
+ channel.onPause = cordova.addDocumentEventHandler('pause');
1314
+ channel.onResume = cordova.addDocumentEventHandler('resume');
1315
+ channel.onActivated = cordova.addDocumentEventHandler('activated');
1316
+ channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
1317
+
1318
+ // Listen for DOMContentLoaded and notify our channel subscribers.
1319
+ if (document.readyState === 'complete' || document.readyState === 'interactive') {
1320
+ channel.onDOMContentLoaded.fire();
1321
+ } else {
1322
+ document.addEventListener('DOMContentLoaded', function () {
1323
+ channel.onDOMContentLoaded.fire();
1324
+ }, false);
1325
+ }
1326
+
1327
+ // _nativeReady is global variable that the native side can set
1328
+ // to signify that the native code is ready. It is a global since
1329
+ // it may be called before any cordova JS is ready.
1330
+ if (window._nativeReady) {
1331
+ channel.onNativeReady.fire();
1332
+ }
1333
+
1334
+ // Call the platform-specific initialization.
1335
+ platform.bootstrap && platform.bootstrap();
1336
+
1337
+ // Wrap in a setTimeout to support the use-case of having plugin JS appended to cordova.js.
1338
+ // The delay allows the attached modules to be defined before the plugin loader looks for them.
1339
+ setTimeout(function () {
1340
+ pluginloader.load(function () {
1341
+ channel.onPluginsReady.fire();
1342
+ });
1343
+ }, 0);
1344
+
1345
+ /**
1346
+ * Create all cordova objects once native side is ready.
1347
+ */
1348
+ channel.join(function () {
1349
+ modulemapper.mapModules(window);
1350
+
1351
+ platform.initialize && platform.initialize();
1352
+
1353
+ // Fire event to notify that all objects are created
1354
+ channel.onCordovaReady.fire();
1355
+
1356
+ // Fire onDeviceReady event once page has fully loaded, all
1357
+ // constructors have run and cordova info has been received from native
1358
+ // side.
1359
+ channel.join(function () {
1360
+ require('cordova').fireDocumentEvent('deviceready');
1361
+ }, channel.deviceReadyChannelsArray);
1362
+
1363
+ }, platformInitChannelsArray);
1364
+
1365
+ });
1366
+
1367
+ // file: src/common/modulemapper.js
1368
+ define("cordova/modulemapper", function(require, exports, module) {
1369
+
1370
+ var builder = require('cordova/builder');
1371
+ var moduleMap = define.moduleMap; // eslint-disable-line no-undef
1372
+ var symbolList;
1373
+ var deprecationMap;
1374
+
1375
+ exports.reset = function () {
1376
+ symbolList = [];
1377
+ deprecationMap = {};
1378
+ };
1379
+
1380
+ function addEntry (strategy, moduleName, symbolPath, opt_deprecationMessage) {
1381
+ if (!(moduleName in moduleMap)) {
1382
+ throw new Error('Module ' + moduleName + ' does not exist.');
1383
+ }
1384
+ symbolList.push(strategy, moduleName, symbolPath);
1385
+ if (opt_deprecationMessage) {
1386
+ deprecationMap[symbolPath] = opt_deprecationMessage;
1387
+ }
1388
+ }
1389
+
1390
+ // Note: Android 2.3 does have Function.bind().
1391
+ exports.clobbers = function (moduleName, symbolPath, opt_deprecationMessage) {
1392
+ addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
1393
+ };
1394
+
1395
+ exports.merges = function (moduleName, symbolPath, opt_deprecationMessage) {
1396
+ addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
1397
+ };
1398
+
1399
+ exports.defaults = function (moduleName, symbolPath, opt_deprecationMessage) {
1400
+ addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
1401
+ };
1402
+
1403
+ exports.runs = function (moduleName) {
1404
+ addEntry('r', moduleName, null);
1405
+ };
1406
+
1407
+ function prepareNamespace (symbolPath, context) {
1408
+ if (!symbolPath) {
1409
+ return context;
1410
+ }
1411
+ var parts = symbolPath.split('.');
1412
+ var cur = context;
1413
+ for (var i = 0, part; part = parts[i]; ++i) { // eslint-disable-line no-cond-assign
1414
+ cur = cur[part] = cur[part] || {};
1415
+ }
1416
+ return cur;
1417
+ }
1418
+
1419
+ exports.mapModules = function (context) {
1420
+ var origSymbols = {};
1421
+ context.CDV_origSymbols = origSymbols;
1422
+ for (var i = 0, len = symbolList.length; i < len; i += 3) {
1423
+ var strategy = symbolList[i];
1424
+ var moduleName = symbolList[i + 1];
1425
+ var module = require(moduleName);
1426
+ // <runs/>
1427
+ if (strategy === 'r') {
1428
+ continue;
1429
+ }
1430
+ var symbolPath = symbolList[i + 2];
1431
+ var lastDot = symbolPath.lastIndexOf('.');
1432
+ var namespace = symbolPath.substr(0, lastDot);
1433
+ var lastName = symbolPath.substr(lastDot + 1);
1434
+
1435
+ var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
1436
+ var parentObj = prepareNamespace(namespace, context);
1437
+ var target = parentObj[lastName];
1438
+
1439
+ if (strategy === 'm' && target) {
1440
+ builder.recursiveMerge(target, module);
1441
+ } else if ((strategy === 'd' && !target) || (strategy !== 'd')) {
1442
+ if (!(symbolPath in origSymbols)) {
1443
+ origSymbols[symbolPath] = target;
1444
+ }
1445
+ builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
1446
+ }
1447
+ }
1448
+ };
1449
+
1450
+ exports.getOriginalSymbol = function (context, symbolPath) {
1451
+ var origSymbols = context.CDV_origSymbols;
1452
+ if (origSymbols && (symbolPath in origSymbols)) {
1453
+ return origSymbols[symbolPath];
1454
+ }
1455
+ var parts = symbolPath.split('.');
1456
+ var obj = context;
1457
+ for (var i = 0; i < parts.length; ++i) {
1458
+ obj = obj && obj[parts[i]];
1459
+ }
1460
+ return obj;
1461
+ };
1462
+
1463
+ exports.reset();
1464
+
1465
+ });
1466
+
1467
+ // file: src/common/modulemapper_b.js
1468
+ define("cordova/modulemapper_b", function(require, exports, module) {
1469
+
1470
+ var builder = require('cordova/builder');
1471
+ var symbolList = [];
1472
+ var deprecationMap;
1473
+
1474
+ exports.reset = function () {
1475
+ symbolList = [];
1476
+ deprecationMap = {};
1477
+ };
1478
+
1479
+ function addEntry (strategy, moduleName, symbolPath, opt_deprecationMessage) {
1480
+ symbolList.push(strategy, moduleName, symbolPath);
1481
+ if (opt_deprecationMessage) {
1482
+ deprecationMap[symbolPath] = opt_deprecationMessage;
1483
+ }
1484
+ }
1485
+
1486
+ // Note: Android 2.3 does have Function.bind().
1487
+ exports.clobbers = function (moduleName, symbolPath, opt_deprecationMessage) {
1488
+ addEntry('c', moduleName, symbolPath, opt_deprecationMessage);
1489
+ };
1490
+
1491
+ exports.merges = function (moduleName, symbolPath, opt_deprecationMessage) {
1492
+ addEntry('m', moduleName, symbolPath, opt_deprecationMessage);
1493
+ };
1494
+
1495
+ exports.defaults = function (moduleName, symbolPath, opt_deprecationMessage) {
1496
+ addEntry('d', moduleName, symbolPath, opt_deprecationMessage);
1497
+ };
1498
+
1499
+ exports.runs = function (moduleName) {
1500
+ addEntry('r', moduleName, null);
1501
+ };
1502
+
1503
+ function prepareNamespace (symbolPath, context) {
1504
+ if (!symbolPath) {
1505
+ return context;
1506
+ }
1507
+ var parts = symbolPath.split('.');
1508
+ var cur = context;
1509
+ for (var i = 0, part; part = parts[i]; ++i) { // eslint-disable-line no-cond-assign
1510
+ cur = cur[part] = cur[part] || {};
1511
+ }
1512
+ return cur;
1513
+ }
1514
+
1515
+ exports.mapModules = function (context) {
1516
+ var origSymbols = {};
1517
+ context.CDV_origSymbols = origSymbols;
1518
+ for (var i = 0, len = symbolList.length; i < len; i += 3) {
1519
+ var strategy = symbolList[i];
1520
+ var moduleName = symbolList[i + 1];
1521
+ var module = require(moduleName);
1522
+ // <runs/>
1523
+ if (strategy === 'r') {
1524
+ continue;
1525
+ }
1526
+ var symbolPath = symbolList[i + 2];
1527
+ var lastDot = symbolPath.lastIndexOf('.');
1528
+ var namespace = symbolPath.substr(0, lastDot);
1529
+ var lastName = symbolPath.substr(lastDot + 1);
1530
+
1531
+ var deprecationMsg = symbolPath in deprecationMap ? 'Access made to deprecated symbol: ' + symbolPath + '. ' + deprecationMsg : null;
1532
+ var parentObj = prepareNamespace(namespace, context);
1533
+ var target = parentObj[lastName];
1534
+
1535
+ if (strategy === 'm' && target) {
1536
+ builder.recursiveMerge(target, module);
1537
+ } else if ((strategy === 'd' && !target) || (strategy !== 'd')) {
1538
+ if (!(symbolPath in origSymbols)) {
1539
+ origSymbols[symbolPath] = target;
1540
+ }
1541
+ builder.assignOrWrapInDeprecateGetter(parentObj, lastName, module, deprecationMsg);
1542
+ }
1543
+ }
1544
+ };
1545
+
1546
+ exports.getOriginalSymbol = function (context, symbolPath) {
1547
+ var origSymbols = context.CDV_origSymbols;
1548
+ if (origSymbols && (symbolPath in origSymbols)) {
1549
+ return origSymbols[symbolPath];
1550
+ }
1551
+ var parts = symbolPath.split('.');
1552
+ var obj = context;
1553
+ for (var i = 0; i < parts.length; ++i) {
1554
+ obj = obj && obj[parts[i]];
1555
+ }
1556
+ return obj;
1557
+ };
1558
+
1559
+ exports.reset();
1560
+
1561
+ });
1562
+
1563
+ // file: /Users/brodybits/Documents/cordova/cordova-ios/cordova-js-src/platform.js
1564
+ define("cordova/platform", function(require, exports, module) {
1565
+
1566
+ module.exports = {
1567
+ id: 'ios',
1568
+ bootstrap: function () {
1569
+ // Attach the console polyfill that is iOS-only to window.console
1570
+ // see the file under plugin/ios/console.js
1571
+ require('cordova/modulemapper').clobbers('cordova/plugin/ios/console', 'window.console');
1572
+
1573
+ require('cordova/channel').onNativeReady.fire();
1574
+ }
1575
+ };
1576
+
1577
+ });
1578
+
1579
+ // file: /Users/brodybits/Documents/cordova/cordova-ios/cordova-js-src/plugin/ios/console.js
1580
+ define("cordova/plugin/ios/console", function(require, exports, module) {
1581
+
1582
+ //------------------------------------------------------------------------------
1583
+
1584
+ var logger = require('cordova/plugin/ios/logger');
1585
+
1586
+ //------------------------------------------------------------------------------
1587
+ // object that we're exporting
1588
+ //------------------------------------------------------------------------------
1589
+ var console = module.exports;
1590
+
1591
+ //------------------------------------------------------------------------------
1592
+ // copy of the original console object
1593
+ //------------------------------------------------------------------------------
1594
+ var WinConsole = window.console;
1595
+
1596
+ //------------------------------------------------------------------------------
1597
+ // whether to use the logger
1598
+ //------------------------------------------------------------------------------
1599
+ var UseLogger = false;
1600
+
1601
+ //------------------------------------------------------------------------------
1602
+ // Timers
1603
+ //------------------------------------------------------------------------------
1604
+ var Timers = {};
1605
+
1606
+ //------------------------------------------------------------------------------
1607
+ // used for unimplemented methods
1608
+ //------------------------------------------------------------------------------
1609
+ function noop() {}
1610
+
1611
+ //------------------------------------------------------------------------------
1612
+ // used for unimplemented methods
1613
+ //------------------------------------------------------------------------------
1614
+ console.useLogger = function (value) {
1615
+ if (arguments.length) UseLogger = !!value;
1616
+
1617
+ if (UseLogger) {
1618
+ if (logger.useConsole()) {
1619
+ throw new Error("console and logger are too intertwingly");
1620
+ }
1621
+ }
1622
+
1623
+ return UseLogger;
1624
+ };
1625
+
1626
+ //------------------------------------------------------------------------------
1627
+ console.log = function() {
1628
+ if (logger.useConsole()) return;
1629
+ logger.log.apply(logger, [].slice.call(arguments));
1630
+ };
1631
+
1632
+ //------------------------------------------------------------------------------
1633
+ console.error = function() {
1634
+ if (logger.useConsole()) return;
1635
+ logger.error.apply(logger, [].slice.call(arguments));
1636
+ };
1637
+
1638
+ //------------------------------------------------------------------------------
1639
+ console.warn = function() {
1640
+ if (logger.useConsole()) return;
1641
+ logger.warn.apply(logger, [].slice.call(arguments));
1642
+ };
1643
+
1644
+ //------------------------------------------------------------------------------
1645
+ console.info = function() {
1646
+ if (logger.useConsole()) return;
1647
+ logger.info.apply(logger, [].slice.call(arguments));
1648
+ };
1649
+
1650
+ //------------------------------------------------------------------------------
1651
+ console.debug = function() {
1652
+ if (logger.useConsole()) return;
1653
+ logger.debug.apply(logger, [].slice.call(arguments));
1654
+ };
1655
+
1656
+ //------------------------------------------------------------------------------
1657
+ console.assert = function(expression) {
1658
+ if (expression) return;
1659
+
1660
+ var message = logger.format.apply(logger.format, [].slice.call(arguments, 1));
1661
+ console.log("ASSERT: " + message);
1662
+ };
1663
+
1664
+ //------------------------------------------------------------------------------
1665
+ console.clear = function() {};
1666
+
1667
+ //------------------------------------------------------------------------------
1668
+ console.dir = function(object) {
1669
+ console.log("%o", object);
1670
+ };
1671
+
1672
+ //------------------------------------------------------------------------------
1673
+ console.dirxml = function(node) {
1674
+ console.log(node.innerHTML);
1675
+ };
1676
+
1677
+ //------------------------------------------------------------------------------
1678
+ console.trace = noop;
1679
+
1680
+ //------------------------------------------------------------------------------
1681
+ console.group = console.log;
1682
+
1683
+ //------------------------------------------------------------------------------
1684
+ console.groupCollapsed = console.log;
1685
+
1686
+ //------------------------------------------------------------------------------
1687
+ console.groupEnd = noop;
1688
+
1689
+ //------------------------------------------------------------------------------
1690
+ console.time = function(name) {
1691
+ Timers[name] = new Date().valueOf();
1692
+ };
1693
+
1694
+ //------------------------------------------------------------------------------
1695
+ console.timeEnd = function(name) {
1696
+ var timeStart = Timers[name];
1697
+ if (!timeStart) {
1698
+ console.warn("unknown timer: " + name);
1699
+ return;
1700
+ }
1701
+
1702
+ var timeElapsed = new Date().valueOf() - timeStart;
1703
+ console.log(name + ": " + timeElapsed + "ms");
1704
+ };
1705
+
1706
+ //------------------------------------------------------------------------------
1707
+ console.timeStamp = noop;
1708
+
1709
+ //------------------------------------------------------------------------------
1710
+ console.profile = noop;
1711
+
1712
+ //------------------------------------------------------------------------------
1713
+ console.profileEnd = noop;
1714
+
1715
+ //------------------------------------------------------------------------------
1716
+ console.count = noop;
1717
+
1718
+ //------------------------------------------------------------------------------
1719
+ console.exception = console.log;
1720
+
1721
+ //------------------------------------------------------------------------------
1722
+ console.table = function(data, columns) {
1723
+ console.log("%o", data);
1724
+ };
1725
+
1726
+ //------------------------------------------------------------------------------
1727
+ // return a new function that calls both functions passed as args
1728
+ //------------------------------------------------------------------------------
1729
+ function wrappedOrigCall(orgFunc, newFunc) {
1730
+ return function() {
1731
+ var args = [].slice.call(arguments);
1732
+ try { orgFunc.apply(WinConsole, args); } catch (e) {}
1733
+ try { newFunc.apply(console, args); } catch (e) {}
1734
+ };
1735
+ }
1736
+
1737
+ //------------------------------------------------------------------------------
1738
+ // For every function that exists in the original console object, that
1739
+ // also exists in the new console object, wrap the new console method
1740
+ // with one that calls both
1741
+ //------------------------------------------------------------------------------
1742
+ for (var key in console) {
1743
+ if (typeof WinConsole[key] == "function") {
1744
+ console[key] = wrappedOrigCall(WinConsole[key], console[key]);
1745
+ }
1746
+ }
1747
+
1748
+ });
1749
+
1750
+ // file: /Users/brodybits/Documents/cordova/cordova-ios/cordova-js-src/plugin/ios/logger.js
1751
+ define("cordova/plugin/ios/logger", function(require, exports, module) {
1752
+
1753
+ //------------------------------------------------------------------------------
1754
+ // The logger module exports the following properties/functions:
1755
+ //
1756
+ // LOG - constant for the level LOG
1757
+ // ERROR - constant for the level ERROR
1758
+ // WARN - constant for the level WARN
1759
+ // INFO - constant for the level INFO
1760
+ // DEBUG - constant for the level DEBUG
1761
+ // logLevel() - returns current log level
1762
+ // logLevel(value) - sets and returns a new log level
1763
+ // useConsole() - returns whether logger is using console
1764
+ // useConsole(value) - sets and returns whether logger is using console
1765
+ // log(message,...) - logs a message at level LOG
1766
+ // error(message,...) - logs a message at level ERROR
1767
+ // warn(message,...) - logs a message at level WARN
1768
+ // info(message,...) - logs a message at level INFO
1769
+ // debug(message,...) - logs a message at level DEBUG
1770
+ // logLevel(level,message,...) - logs a message specified level
1771
+ //
1772
+ //------------------------------------------------------------------------------
1773
+
1774
+ var logger = exports;
1775
+
1776
+ var exec = require('cordova/exec');
1777
+
1778
+ var UseConsole = false;
1779
+ var UseLogger = true;
1780
+ var Queued = [];
1781
+ var DeviceReady = false;
1782
+ var CurrentLevel;
1783
+
1784
+ var originalConsole = console;
1785
+
1786
+ /**
1787
+ * Logging levels
1788
+ */
1789
+
1790
+ var Levels = [
1791
+ "LOG",
1792
+ "ERROR",
1793
+ "WARN",
1794
+ "INFO",
1795
+ "DEBUG"
1796
+ ];
1797
+
1798
+ /*
1799
+ * add the logging levels to the logger object and
1800
+ * to a separate levelsMap object for testing
1801
+ */
1802
+
1803
+ var LevelsMap = {};
1804
+ for (var i=0; i<Levels.length; i++) {
1805
+ var level = Levels[i];
1806
+ LevelsMap[level] = i;
1807
+ logger[level] = level;
1808
+ }
1809
+
1810
+ CurrentLevel = LevelsMap.WARN;
1811
+
1812
+ /**
1813
+ * Getter/Setter for the logging level
1814
+ *
1815
+ * Returns the current logging level.
1816
+ *
1817
+ * When a value is passed, sets the logging level to that value.
1818
+ * The values should be one of the following constants:
1819
+ * logger.LOG
1820
+ * logger.ERROR
1821
+ * logger.WARN
1822
+ * logger.INFO
1823
+ * logger.DEBUG
1824
+ *
1825
+ * The value used determines which messages get printed. The logging
1826
+ * values above are in order, and only messages logged at the logging
1827
+ * level or above will actually be displayed to the user. E.g., the
1828
+ * default level is WARN, so only messages logged with LOG, ERROR, or
1829
+ * WARN will be displayed; INFO and DEBUG messages will be ignored.
1830
+ */
1831
+ logger.level = function (value) {
1832
+ if (arguments.length) {
1833
+ if (LevelsMap[value] === null) {
1834
+ throw new Error("invalid logging level: " + value);
1835
+ }
1836
+ CurrentLevel = LevelsMap[value];
1837
+ }
1838
+
1839
+ return Levels[CurrentLevel];
1840
+ };
1841
+
1842
+ /**
1843
+ * Getter/Setter for the useConsole functionality
1844
+ *
1845
+ * When useConsole is true, the logger will log via the
1846
+ * browser 'console' object.
1847
+ */
1848
+ logger.useConsole = function (value) {
1849
+ if (arguments.length) UseConsole = !!value;
1850
+
1851
+ if (UseConsole) {
1852
+ if (typeof console == "undefined") {
1853
+ throw new Error("global console object is not defined");
1854
+ }
1855
+
1856
+ if (typeof console.log != "function") {
1857
+ throw new Error("global console object does not have a log function");
1858
+ }
1859
+
1860
+ if (typeof console.useLogger == "function") {
1861
+ if (console.useLogger()) {
1862
+ throw new Error("console and logger are too intertwingly");
1863
+ }
1864
+ }
1865
+ }
1866
+
1867
+ return UseConsole;
1868
+ };
1869
+
1870
+ /**
1871
+ * Getter/Setter for the useLogger functionality
1872
+ *
1873
+ * When useLogger is true, the logger will log via the
1874
+ * native Logger plugin.
1875
+ */
1876
+ logger.useLogger = function (value) {
1877
+ // Enforce boolean
1878
+ if (arguments.length) UseLogger = !!value;
1879
+ return UseLogger;
1880
+ };
1881
+
1882
+ /**
1883
+ * Logs a message at the LOG level.
1884
+ *
1885
+ * Parameters passed after message are used applied to
1886
+ * the message with utils.format()
1887
+ */
1888
+ logger.log = function(message) { logWithArgs("LOG", arguments); };
1889
+
1890
+ /**
1891
+ * Logs a message at the ERROR level.
1892
+ *
1893
+ * Parameters passed after message are used applied to
1894
+ * the message with utils.format()
1895
+ */
1896
+ logger.error = function(message) { logWithArgs("ERROR", arguments); };
1897
+
1898
+ /**
1899
+ * Logs a message at the WARN level.
1900
+ *
1901
+ * Parameters passed after message are used applied to
1902
+ * the message with utils.format()
1903
+ */
1904
+ logger.warn = function(message) { logWithArgs("WARN", arguments); };
1905
+
1906
+ /**
1907
+ * Logs a message at the INFO level.
1908
+ *
1909
+ * Parameters passed after message are used applied to
1910
+ * the message with utils.format()
1911
+ */
1912
+ logger.info = function(message) { logWithArgs("INFO", arguments); };
1913
+
1914
+ /**
1915
+ * Logs a message at the DEBUG level.
1916
+ *
1917
+ * Parameters passed after message are used applied to
1918
+ * the message with utils.format()
1919
+ */
1920
+ logger.debug = function(message) { logWithArgs("DEBUG", arguments); };
1921
+
1922
+ // log at the specified level with args
1923
+ function logWithArgs(level, args) {
1924
+ args = [level].concat([].slice.call(args));
1925
+ logger.logLevel.apply(logger, args);
1926
+ }
1927
+
1928
+ // return the correct formatString for an object
1929
+ function formatStringForMessage(message) {
1930
+ return (typeof message === "string") ? "" : "%o";
1931
+ }
1932
+
1933
+ /**
1934
+ * Logs a message at the specified level.
1935
+ *
1936
+ * Parameters passed after message are used applied to
1937
+ * the message with utils.format()
1938
+ */
1939
+ logger.logLevel = function(level /* , ... */) {
1940
+ // format the message with the parameters
1941
+ var formatArgs = [].slice.call(arguments, 1);
1942
+ var fmtString = formatStringForMessage(formatArgs[0]);
1943
+ if (fmtString.length > 0){
1944
+ formatArgs.unshift(fmtString); // add formatString
1945
+ }
1946
+
1947
+ var message = logger.format.apply(logger.format, formatArgs);
1948
+
1949
+ if (LevelsMap[level] === null) {
1950
+ throw new Error("invalid logging level: " + level);
1951
+ }
1952
+
1953
+ if (LevelsMap[level] > CurrentLevel) return;
1954
+
1955
+ // queue the message if not yet at deviceready
1956
+ if (!DeviceReady && !UseConsole) {
1957
+ Queued.push([level, message]);
1958
+ return;
1959
+ }
1960
+
1961
+ // Log using the native logger if that is enabled
1962
+ if (UseLogger) {
1963
+ exec(null, null, "Console", "logLevel", [level, message]);
1964
+ }
1965
+
1966
+ // Log using the console if that is enabled
1967
+ if (UseConsole) {
1968
+ // make sure console is not using logger
1969
+ if (console.useLogger()) {
1970
+ throw new Error("console and logger are too intertwingly");
1971
+ }
1972
+
1973
+ // log to the console
1974
+ switch (level) {
1975
+ case logger.LOG: originalConsole.log(message); break;
1976
+ case logger.ERROR: originalConsole.log("ERROR: " + message); break;
1977
+ case logger.WARN: originalConsole.log("WARN: " + message); break;
1978
+ case logger.INFO: originalConsole.log("INFO: " + message); break;
1979
+ case logger.DEBUG: originalConsole.log("DEBUG: " + message); break;
1980
+ }
1981
+ }
1982
+ };
1983
+
1984
+
1985
+ /**
1986
+ * Formats a string and arguments following it ala console.log()
1987
+ *
1988
+ * Any remaining arguments will be appended to the formatted string.
1989
+ *
1990
+ * for rationale, see FireBug's Console API:
1991
+ * http://getfirebug.com/wiki/index.php/Console_API
1992
+ */
1993
+ logger.format = function(formatString, args) {
1994
+ return __format(arguments[0], [].slice.call(arguments,1)).join(' ');
1995
+ };
1996
+
1997
+
1998
+ //------------------------------------------------------------------------------
1999
+ /**
2000
+ * Formats a string and arguments following it ala vsprintf()
2001
+ *
2002
+ * format chars:
2003
+ * %j - format arg as JSON
2004
+ * %o - format arg as JSON
2005
+ * %c - format arg as ''
2006
+ * %% - replace with '%'
2007
+ * any other char following % will format it's
2008
+ * arg via toString().
2009
+ *
2010
+ * Returns an array containing the formatted string and any remaining
2011
+ * arguments.
2012
+ */
2013
+ function __format(formatString, args) {
2014
+ if (formatString === null || formatString === undefined) return [""];
2015
+ if (arguments.length == 1) return [formatString.toString()];
2016
+
2017
+ if (typeof formatString != "string")
2018
+ formatString = formatString.toString();
2019
+
2020
+ var pattern = /(.*?)%(.)(.*)/;
2021
+ var rest = formatString;
2022
+ var result = [];
2023
+
2024
+ while (args.length) {
2025
+ var match = pattern.exec(rest);
2026
+ if (!match) break;
2027
+
2028
+ var arg = args.shift();
2029
+ rest = match[3];
2030
+ result.push(match[1]);
2031
+
2032
+ if (match[2] == '%') {
2033
+ result.push('%');
2034
+ args.unshift(arg);
2035
+ continue;
2036
+ }
2037
+
2038
+ result.push(__formatted(arg, match[2]));
2039
+ }
2040
+
2041
+ result.push(rest);
2042
+
2043
+ var remainingArgs = [].slice.call(args);
2044
+ remainingArgs.unshift(result.join(''));
2045
+ return remainingArgs;
2046
+ }
2047
+
2048
+ function __formatted(object, formatChar) {
2049
+
2050
+ try {
2051
+ switch(formatChar) {
2052
+ case 'j':
2053
+ case 'o': return JSON.stringify(object);
2054
+ case 'c': return '';
2055
+ }
2056
+ }
2057
+ catch (e) {
2058
+ return "error JSON.stringify()ing argument: " + e;
2059
+ }
2060
+
2061
+ if ((object === null) || (object === undefined)) {
2062
+ return Object.prototype.toString.call(object);
2063
+ }
2064
+
2065
+ return object.toString();
2066
+ }
2067
+
2068
+
2069
+ //------------------------------------------------------------------------------
2070
+ // when deviceready fires, log queued messages
2071
+ logger.__onDeviceReady = function() {
2072
+ if (DeviceReady) return;
2073
+
2074
+ DeviceReady = true;
2075
+
2076
+ for (var i=0; i<Queued.length; i++) {
2077
+ var messageArgs = Queued[i];
2078
+ logger.logLevel(messageArgs[0], messageArgs[1]);
2079
+ }
2080
+
2081
+ Queued = null;
2082
+ };
2083
+
2084
+ // add a deviceready event to log queued messages
2085
+ document.addEventListener("deviceready", logger.__onDeviceReady, false);
2086
+
2087
+ });
2088
+
2089
+ // file: src/common/pluginloader.js
2090
+ define("cordova/pluginloader", function(require, exports, module) {
2091
+
2092
+ var modulemapper = require('cordova/modulemapper');
2093
+
2094
+ // Helper function to inject a <script> tag.
2095
+ // Exported for testing.
2096
+ exports.injectScript = function (url, onload, onerror) {
2097
+ var script = document.createElement('script');
2098
+ // onload fires even when script fails loads with an error.
2099
+ script.onload = onload;
2100
+ // onerror fires for malformed URLs.
2101
+ script.onerror = onerror;
2102
+ script.src = url;
2103
+ document.head.appendChild(script);
2104
+ };
2105
+
2106
+ function injectIfNecessary (id, url, onload, onerror) {
2107
+ onerror = onerror || onload;
2108
+ if (id in define.moduleMap) { // eslint-disable-line no-undef
2109
+ onload();
2110
+ } else {
2111
+ exports.injectScript(url, function () {
2112
+ if (id in define.moduleMap) { // eslint-disable-line no-undef
2113
+ onload();
2114
+ } else {
2115
+ onerror();
2116
+ }
2117
+ }, onerror);
2118
+ }
2119
+ }
2120
+
2121
+ function onScriptLoadingComplete (moduleList, finishPluginLoading) {
2122
+ // Loop through all the plugins and then through their clobbers and merges.
2123
+ for (var i = 0, module; module = moduleList[i]; i++) { // eslint-disable-line no-cond-assign
2124
+ if (module.clobbers && module.clobbers.length) {
2125
+ for (var j = 0; j < module.clobbers.length; j++) {
2126
+ modulemapper.clobbers(module.id, module.clobbers[j]);
2127
+ }
2128
+ }
2129
+
2130
+ if (module.merges && module.merges.length) {
2131
+ for (var k = 0; k < module.merges.length; k++) {
2132
+ modulemapper.merges(module.id, module.merges[k]);
2133
+ }
2134
+ }
2135
+
2136
+ // Finally, if runs is truthy we want to simply require() the module.
2137
+ if (module.runs) {
2138
+ modulemapper.runs(module.id);
2139
+ }
2140
+ }
2141
+
2142
+ finishPluginLoading();
2143
+ }
2144
+
2145
+ // Handler for the cordova_plugins.js content.
2146
+ // See plugman's plugin_loader.js for the details of this object.
2147
+ // This function is only called if the really is a plugins array that isn't empty.
2148
+ // Otherwise the onerror response handler will just call finishPluginLoading().
2149
+ function handlePluginsObject (path, moduleList, finishPluginLoading) {
2150
+ // Now inject the scripts.
2151
+ var scriptCounter = moduleList.length;
2152
+
2153
+ if (!scriptCounter) {
2154
+ finishPluginLoading();
2155
+ return;
2156
+ }
2157
+ function scriptLoadedCallback () {
2158
+ if (!--scriptCounter) {
2159
+ onScriptLoadingComplete(moduleList, finishPluginLoading);
2160
+ }
2161
+ }
2162
+
2163
+ for (var i = 0; i < moduleList.length; i++) {
2164
+ injectIfNecessary(moduleList[i].id, path + moduleList[i].file, scriptLoadedCallback);
2165
+ }
2166
+ }
2167
+
2168
+ function findCordovaPath () {
2169
+ var path = null;
2170
+ var scripts = document.getElementsByTagName('script');
2171
+ var term = '/cordova.js';
2172
+ for (var n = scripts.length - 1; n > -1; n--) {
2173
+ var src = scripts[n].src.replace(/\?.*$/, ''); // Strip any query param (CB-6007).
2174
+ if (src.indexOf(term) === (src.length - term.length)) {
2175
+ path = src.substring(0, src.length - term.length) + '/';
2176
+ break;
2177
+ }
2178
+ }
2179
+ return path;
2180
+ }
2181
+
2182
+ // Tries to load all plugins' js-modules.
2183
+ // This is an async process, but onDeviceReady is blocked on onPluginsReady.
2184
+ // onPluginsReady is fired when there are no plugins to load, or they are all done.
2185
+ exports.load = function (callback) {
2186
+ var pathPrefix = findCordovaPath();
2187
+ if (pathPrefix === null) {
2188
+ console.log('Could not find cordova.js script tag. Plugin loading may fail.');
2189
+ pathPrefix = '';
2190
+ }
2191
+ injectIfNecessary('cordova/plugin_list', pathPrefix + 'cordova_plugins.js', function () {
2192
+ var moduleList = require('cordova/plugin_list');
2193
+ handlePluginsObject(pathPrefix, moduleList, callback);
2194
+ }, callback);
2195
+ };
2196
+
2197
+ });
2198
+
2199
+ // file: src/common/pluginloader_b.js
2200
+ define("cordova/pluginloader_b", function(require, exports, module) {
2201
+
2202
+ var modulemapper = require('cordova/modulemapper');
2203
+
2204
+ // Handler for the cordova_plugins.js content.
2205
+ // See plugman's plugin_loader.js for the details of this object.
2206
+ function handlePluginsObject (moduleList) {
2207
+ // if moduleList is not defined or empty, we've nothing to do
2208
+ if (!moduleList || !moduleList.length) {
2209
+ return;
2210
+ }
2211
+
2212
+ // Loop through all the modules and then through their clobbers and merges.
2213
+ for (var i = 0, module; module = moduleList[i]; i++) { // eslint-disable-line no-cond-assign
2214
+ if (module.clobbers && module.clobbers.length) {
2215
+ for (var j = 0; j < module.clobbers.length; j++) {
2216
+ modulemapper.clobbers(module.id, module.clobbers[j]);
2217
+ }
2218
+ }
2219
+
2220
+ if (module.merges && module.merges.length) {
2221
+ for (var k = 0; k < module.merges.length; k++) {
2222
+ modulemapper.merges(module.id, module.merges[k]);
2223
+ }
2224
+ }
2225
+
2226
+ // Finally, if runs is truthy we want to simply require() the module.
2227
+ if (module.runs) {
2228
+ modulemapper.runs(module.id);
2229
+ }
2230
+ }
2231
+ }
2232
+
2233
+ // Loads all plugins' js-modules. Plugin loading is syncronous in browserified bundle
2234
+ // but the method accepts callback to be compatible with non-browserify flow.
2235
+ // onDeviceReady is blocked on onPluginsReady. onPluginsReady is fired when there are
2236
+ // no plugins to load, or they are all done.
2237
+ exports.load = function (callback) {
2238
+ var moduleList = require('cordova/plugin_list');
2239
+ handlePluginsObject(moduleList);
2240
+
2241
+ callback();
2242
+ };
2243
+
2244
+ });
2245
+
2246
+ // file: src/common/urlutil.js
2247
+ define("cordova/urlutil", function(require, exports, module) {
2248
+
2249
+ /**
2250
+ * For already absolute URLs, returns what is passed in.
2251
+ * For relative URLs, converts them to absolute ones.
2252
+ */
2253
+ exports.makeAbsolute = function makeAbsolute (url) {
2254
+ var anchorEl = document.createElement('a');
2255
+ anchorEl.href = url;
2256
+ return anchorEl.href;
2257
+ };
2258
+
2259
+ });
2260
+
2261
+ // file: src/common/utils.js
2262
+ define("cordova/utils", function(require, exports, module) {
2263
+
2264
+ var utils = exports;
2265
+
2266
+ /**
2267
+ * Defines a property getter / setter for obj[key].
2268
+ */
2269
+ utils.defineGetterSetter = function (obj, key, getFunc, opt_setFunc) {
2270
+ if (Object.defineProperty) {
2271
+ var desc = {
2272
+ get: getFunc,
2273
+ configurable: true
2274
+ };
2275
+ if (opt_setFunc) {
2276
+ desc.set = opt_setFunc;
2277
+ }
2278
+ Object.defineProperty(obj, key, desc);
2279
+ } else {
2280
+ obj.__defineGetter__(key, getFunc);
2281
+ if (opt_setFunc) {
2282
+ obj.__defineSetter__(key, opt_setFunc);
2283
+ }
2284
+ }
2285
+ };
2286
+
2287
+ /**
2288
+ * Defines a property getter for obj[key].
2289
+ */
2290
+ utils.defineGetter = utils.defineGetterSetter;
2291
+
2292
+ utils.arrayIndexOf = function (a, item) {
2293
+ if (a.indexOf) {
2294
+ return a.indexOf(item);
2295
+ }
2296
+ var len = a.length;
2297
+ for (var i = 0; i < len; ++i) {
2298
+ if (a[i] === item) {
2299
+ return i;
2300
+ }
2301
+ }
2302
+ return -1;
2303
+ };
2304
+
2305
+ /**
2306
+ * Returns whether the item was found in the array.
2307
+ */
2308
+ utils.arrayRemove = function (a, item) {
2309
+ var index = utils.arrayIndexOf(a, item);
2310
+ if (index !== -1) {
2311
+ a.splice(index, 1);
2312
+ }
2313
+ return index !== -1;
2314
+ };
2315
+
2316
+ utils.typeName = function (val) {
2317
+ return Object.prototype.toString.call(val).slice(8, -1);
2318
+ };
2319
+
2320
+ /**
2321
+ * Returns an indication of whether the argument is an array or not
2322
+ */
2323
+ utils.isArray = Array.isArray ||
2324
+ function (a) { return utils.typeName(a) === 'Array'; };
2325
+
2326
+ /**
2327
+ * Returns an indication of whether the argument is a Date or not
2328
+ */
2329
+ utils.isDate = function (d) {
2330
+ return (d instanceof Date);
2331
+ };
2332
+
2333
+ /**
2334
+ * Does a deep clone of the object.
2335
+ */
2336
+ utils.clone = function (obj) {
2337
+ if (!obj || typeof obj === 'function' || utils.isDate(obj) || typeof obj !== 'object') {
2338
+ return obj;
2339
+ }
2340
+
2341
+ var retVal, i;
2342
+
2343
+ if (utils.isArray(obj)) {
2344
+ retVal = [];
2345
+ for (i = 0; i < obj.length; ++i) {
2346
+ retVal.push(utils.clone(obj[i]));
2347
+ }
2348
+ return retVal;
2349
+ }
2350
+
2351
+ retVal = {};
2352
+ for (i in obj) {
2353
+ // https://issues.apache.org/jira/browse/CB-11522 'unknown' type may be returned in
2354
+ // custom protocol activation case on Windows Phone 8.1 causing "No such interface supported" exception
2355
+ // on cloning.
2356
+ if ((!(i in retVal) || retVal[i] !== obj[i]) && typeof obj[i] !== 'undefined' && typeof obj[i] !== 'unknown') { // eslint-disable-line valid-typeof
2357
+ retVal[i] = utils.clone(obj[i]);
2358
+ }
2359
+ }
2360
+ return retVal;
2361
+ };
2362
+
2363
+ /**
2364
+ * Returns a wrapped version of the function
2365
+ */
2366
+ utils.close = function (context, func, params) {
2367
+ return function () {
2368
+ var args = params || arguments;
2369
+ return func.apply(context, args);
2370
+ };
2371
+ };
2372
+
2373
+ // ------------------------------------------------------------------------------
2374
+ function UUIDcreatePart (length) {
2375
+ var uuidpart = '';
2376
+ for (var i = 0; i < length; i++) {
2377
+ var uuidchar = parseInt((Math.random() * 256), 10).toString(16);
2378
+ if (uuidchar.length === 1) {
2379
+ uuidchar = '0' + uuidchar;
2380
+ }
2381
+ uuidpart += uuidchar;
2382
+ }
2383
+ return uuidpart;
2384
+ }
2385
+
2386
+ /**
2387
+ * Create a UUID
2388
+ */
2389
+ utils.createUUID = function () {
2390
+ return UUIDcreatePart(4) + '-' +
2391
+ UUIDcreatePart(2) + '-' +
2392
+ UUIDcreatePart(2) + '-' +
2393
+ UUIDcreatePart(2) + '-' +
2394
+ UUIDcreatePart(6);
2395
+ };
2396
+
2397
+ /**
2398
+ * Extends a child object from a parent object using classical inheritance
2399
+ * pattern.
2400
+ */
2401
+ utils.extend = (function () {
2402
+ // proxy used to establish prototype chain
2403
+ var F = function () {};
2404
+ // extend Child from Parent
2405
+ return function (Child, Parent) {
2406
+
2407
+ F.prototype = Parent.prototype;
2408
+ Child.prototype = new F();
2409
+ Child.__super__ = Parent.prototype;
2410
+ Child.prototype.constructor = Child;
2411
+ };
2412
+ }());
2413
+
2414
+ /**
2415
+ * Alerts a message in any available way: alert or console.log.
2416
+ */
2417
+ utils.alert = function (msg) {
2418
+ if (window.alert) {
2419
+ window.alert(msg);
2420
+ } else if (console && console.log) {
2421
+ console.log(msg);
2422
+ }
2423
+ };
2424
+
2425
+ });
2426
+
2427
+ window.cordova = require('cordova');
2428
+ // file: src/scripts/bootstrap.js
2429
+
2430
+ require('cordova/init');
2431
+
2432
+ })();