├── Mapbox
├── .vscode
│ └── settings.json
├── .gitignore
├── app
│ ├── res
│ │ ├── telerik-logo.png
│ │ └── markers
│ │ │ ├── home_marker.png
│ │ │ └── green_pin_marker.png
│ ├── App_Resources
│ │ ├── iOS
│ │ │ ├── icon.png
│ │ │ ├── Default.png
│ │ │ ├── icon-40.png
│ │ │ ├── icon-60.png
│ │ │ ├── icon-72.png
│ │ │ ├── icon-76.png
│ │ │ ├── icon@2x.png
│ │ │ ├── Default@2x.png
│ │ │ ├── Icon-Small.png
│ │ │ ├── icon-40@2x.png
│ │ │ ├── icon-60@2x.png
│ │ │ ├── icon-72@2x.png
│ │ │ ├── icon-76@2x.png
│ │ │ ├── Icon-Small-50.png
│ │ │ ├── Icon-Small@2x.png
│ │ │ ├── Default-568h@2x.png
│ │ │ ├── Default-Portrait.png
│ │ │ ├── Icon-Small-50@2x.png
│ │ │ ├── Default-Landscape.png
│ │ │ ├── Default-Landscape@2x.png
│ │ │ ├── Default-Portrait@2x.png
│ │ │ └── Info.plist
│ │ └── Android
│ │ │ ├── drawable-hdpi
│ │ │ └── icon.png
│ │ │ ├── drawable-ldpi
│ │ │ └── icon.png
│ │ │ ├── drawable-mdpi
│ │ │ └── icon.png
│ │ │ ├── drawable-nodpi
│ │ │ └── splashscreen.9.png
│ │ │ └── AndroidManifest.xml
│ ├── app.js
│ ├── references.d.ts
│ ├── app.css
│ ├── package.json
│ ├── LICENSE
│ ├── main-page.js
│ ├── main-page.xml
│ └── main-view-model.js
├── .yo-rc.json
├── references.d.ts
├── tsconfig.json
├── .app.json
├── package.json
├── .abproject
└── .abignore
├── screenshots
├── ios
│ └── ios-1.png
└── android
│ └── android-1.png
├── .gitignore
└── README.md
/Mapbox/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "typescript.check.workspaceVersion": false
3 | }
--------------------------------------------------------------------------------
/Mapbox/.gitignore:
--------------------------------------------------------------------------------
1 | metadata-i386
2 | metadata-x86_64
3 | typings-i386
4 | typings-x86_64
5 |
--------------------------------------------------------------------------------
/screenshots/ios/ios-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/screenshots/ios/ios-1.png
--------------------------------------------------------------------------------
/Mapbox/app/res/telerik-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/res/telerik-logo.png
--------------------------------------------------------------------------------
/Mapbox/.yo-rc.json:
--------------------------------------------------------------------------------
1 | {
2 | "generator-NativeScript": {
3 | "dependsOn": [
4 | "generator-NativeScript@0.0.15"
5 | ]
6 | }
7 | }
--------------------------------------------------------------------------------
/Mapbox/references.d.ts:
--------------------------------------------------------------------------------
1 | /// Needed for autocompletion and compilation.
--------------------------------------------------------------------------------
/screenshots/android/android-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/screenshots/android/android-1.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/icon.png
--------------------------------------------------------------------------------
/Mapbox/app/res/markers/home_marker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/res/markers/home_marker.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/Default.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/Default.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/icon-40.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/icon-40.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/icon-60.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/icon-60.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/icon-72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/icon-72.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/icon-76.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/icon-76.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/icon@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/icon@2x.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/Default@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/Default@2x.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/Icon-Small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/Icon-Small.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/icon-40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/icon-40@2x.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/icon-60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/icon-60@2x.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/icon-72@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/icon-72@2x.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/icon-76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/icon-76@2x.png
--------------------------------------------------------------------------------
/Mapbox/app/res/markers/green_pin_marker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/res/markers/green_pin_marker.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea
2 | */bin
3 | */obj
4 | *.user-settings.xml
5 | Mapbox/node_modules
6 | Mapbox/platforms
7 | Mapbox/lib
8 | Mapbox/bin
9 | Mapbox/hooks
10 |
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/Icon-Small-50.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/Icon-Small-50.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/Icon-Small@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/Icon-Small@2x.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/Default-568h@2x.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/Default-Portrait.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/Default-Portrait.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/Icon-Small-50@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/Icon-Small-50@2x.png
--------------------------------------------------------------------------------
/Mapbox/app/app.js:
--------------------------------------------------------------------------------
1 | var application = require("application");
2 | application.mainModule = "main-page";
3 | application.cssFile = "./app.css";
4 | application.start();
5 |
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/Default-Landscape.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/Default-Landscape.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/Default-Landscape@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/Default-Landscape@2x.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/Default-Portrait@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/iOS/Default-Portrait@2x.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/Android/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/Android/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/Android/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/Android/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/Android/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/Android/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/Mapbox/app/references.d.ts:
--------------------------------------------------------------------------------
1 | /// Enable smart suggestions and completions in Visual Studio Code JavaScript projects.
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/Android/drawable-nodpi/splashscreen.9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/EddyVerbruggen/nativescript-mapbox-demo/HEAD/Mapbox/app/App_Resources/Android/drawable-nodpi/splashscreen.9.png
--------------------------------------------------------------------------------
/Mapbox/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "module": "commonjs",
4 | "target": "es5",
5 | "experimentalDecorators": true,
6 | "noEmitHelpers": true
7 | },
8 | "exclude": [
9 | "node_modules",
10 | "platforms"
11 | ]
12 | }
--------------------------------------------------------------------------------
/Mapbox/.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "type": "NativeScript",
3 | "views": [
4 | {
5 | "type": "NativeScript:view",
6 | "name": "homeView",
7 | "components": [],
8 | "title": "Home View",
9 | "addToNavigation": true,
10 | "icon": "home"
11 | }
12 | ],
13 | "dataProviders": [],
14 | "name": "nativeScriptApp",
15 | "navigation": "listmenu",
16 | "transition": "none",
17 | "skin": "native"
18 | }
--------------------------------------------------------------------------------
/Mapbox/app/app.css:
--------------------------------------------------------------------------------
1 | page {
2 | background-color: #F4F4F4;
3 | }
4 |
5 | .tab-content {
6 | color: #808080;
7 | padding: 10;
8 | }
9 |
10 | .title {
11 | font-size: 20;
12 | margin: 0 0 10 0;
13 | color: #3c3c3c;
14 | }
15 |
16 | label {
17 | font-size: 16;
18 | }
19 |
20 | button {
21 | background-color: #3598db;
22 | padding: 2 0;
23 | margin: 3 6;
24 | font-size: 13;
25 | border-radius: 3;
26 | height: 30;
27 | }
28 |
29 | .button {
30 | color: #FFFFFF;
31 | }
32 |
33 | .button-offline {
34 | background-color: #A0A0A0;
35 | }
36 |
37 | .button-permissions {
38 | background-color: #808080;
39 | }
40 |
--------------------------------------------------------------------------------
/Mapbox/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "nativescript": {
3 | "id": "org.nativescript.mapboxdemo",
4 | "tns-android": {
5 | "version": "2.5.0"
6 | },
7 | "tns-ios": {
8 | "version": "2.5.0"
9 | }
10 | },
11 | "dependencies": {
12 | "nativescript-mapbox": "^2.6.0",
13 | "tns-core-modules": "^2.5.1"
14 | },
15 | "scripts": {
16 | "iphone": "tns emulate ios --device 'iPhone SE'",
17 | "ipad": "tns emulate ios --device 'iPad Air 2'",
18 | "ios.device": "tns run ios",
19 | "android": "tns run android"
20 | },
21 | "devDependencies": {
22 | "babel-traverse": "6.10.4",
23 | "babel-types": "6.11.1",
24 | "babylon": "6.8.4",
25 | "lazy": "1.0.11",
26 | "nativescript-dev-typescript": "^0.3.0",
27 | "typescript": "^2.1.0"
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Mapbox/.abproject:
--------------------------------------------------------------------------------
1 | {
2 | "ProjectName": "Mapbox",
3 | "ProjectGuid": "f03f6a6d-914b-48be-862c-04f88787c3d7",
4 | "projectVersion": 1,
5 | "AppIdentifier": "com.telerik.plugindemo.nativescript.mapbox",
6 | "DisplayName": "Mapbox",
7 | "Author": "Telerik",
8 | "Description": "Mapbox",
9 | "BundleVersion": "1.0.2",
10 | "AndroidVersionCode": "1",
11 | "iOSDeviceFamily": [
12 | "1",
13 | "2"
14 | ],
15 | "iOSBackgroundMode": [],
16 | "ProjectTypeGuids": "{F0A65104-D4F4-4012-B799-F612D75820F6}",
17 | "AndroidPermissions": [
18 | "android.permission.INTERNET"
19 | ],
20 | "DeviceOrientations": [
21 | "Portrait",
22 | "Landscape"
23 | ],
24 | "AndroidHardwareAcceleration": "false",
25 | "iOSStatusBarStyle": "Default",
26 | "FrameworkVersion": "2.2.0",
27 | "Framework": "NativeScript"
28 | }
--------------------------------------------------------------------------------
/Mapbox/app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tns-template-hello-world",
3 | "main": "app.js",
4 | "jsoptions": "--expose_gc",
5 | "version": "1.4.0",
6 | "author": {
7 | "name": "Telerik",
8 | "email": "support@telerik.com"
9 | },
10 | "description": "Nativescript hello-world project template",
11 | "license": "BSD",
12 | "keywords": [
13 | "telerik",
14 | "mobile",
15 | "nativescript",
16 | "{N}",
17 | "tns",
18 | "appbuilder",
19 | "template"
20 | ],
21 | "repository": {
22 | "type": "git",
23 | "url": "git://github.com/NativeScript/template-hello-world.git"
24 | },
25 | "bugs": {
26 | "url": "https://github.com/NativeScript/template-hello-world/issues"
27 | },
28 | "homepage": "https://github.com/NativeScript/template-hello-world",
29 | "readme": "ERROR: No README data found!",
30 | "_id": "tns-template-hello-world@1.4.0",
31 | "_from": "tns-template-hello-world@1.4.0"
32 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # nativescript-mapbox demo app
2 |
3 | Demo app for the {N} [mapbox plugin](https://www.npmjs.com/package/nativescript-mapbox)
4 |
5 | ## Installation
6 |
7 | This app is built with the [NativeScript CLI](https://github.com/NativeScript/nativescript-cli).
8 | Once you have the [CLI installed](https://github.com/NativeScript/nativescript-cli#installation), start by cloning the repo:
9 |
10 | ```
11 | $ git clone https://github.com/EddyVerbruggen/nativescript-mapbox-demo
12 | $ cd nativescript-mapbox-demo
13 | $ cd Mapbox
14 | ```
15 |
16 | Next, install the app's iOS and Android runtimes, as well as the app's npm dependencies:
17 |
18 | ```
19 | $ tns install
20 | ```
21 |
22 | From there you can use the `run` command to run the demo app on iOS:
23 |
24 | ```
25 | $ tns run ios --emulator
26 | ```
27 |
28 | .. or on Android
29 |
30 | ```
31 | $ tns run android --emulator
32 | ```
33 |
34 | ## Screenshots
35 |
36 | 
37 |
38 | 
39 |
--------------------------------------------------------------------------------
/Mapbox/app/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2015, Telerik AD
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 |
7 | 1. Redistributions of source code must retain the above copyright notice, this
8 | list of conditions and the following disclaimer.
9 |
10 | 2. Redistributions in binary form must reproduce the above copyright notice,
11 | this list of conditions and the following disclaimer in the documentation
12 | and/or other materials provided with the distribution.
13 |
14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
18 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
20 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
21 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 |
--------------------------------------------------------------------------------
/Mapbox/.abignore:
--------------------------------------------------------------------------------
1 | # .abignore lets you configure which of your files and folders should be excluded from your application package during the build process.
2 | # Each project created with AppBuilder 2.6 or later contains a default .abignore which lists a number of system files and folders that might affect the size of your app or might prevent build operations from completing successfully.
3 | #
4 | # For more information about .abignore and how to write exclude and include rules for your projects, see http://docs.telerik.com/platform/appbuilder/testing-your-app/abignore
5 |
6 | # Windows files
7 | **/Thumbs.db
8 |
9 | # Mac OS files
10 | **/.DS_Store
11 | **/__MACOSX/**/*
12 |
13 | # Visual Studio files
14 | bin/**/*
15 | obj/**/*
16 | **/.vs/**/*
17 | **/.vscode/**/*
18 | **/*.obj
19 | **/*.pdb
20 | **/*.user
21 | **/*.aps
22 | **/*.pch
23 | **/*.vspscc
24 | **/*_i.c
25 | **/*_p.c
26 | **/*.ncb
27 | **/*.suo
28 | **/*.tlb
29 | **/*.tlh
30 | **/*.ilk
31 | **/*.lib
32 | **/*.sbr
33 |
34 | # Source control files
35 | .gitignore
36 | **/.git/**/*
37 |
38 | # AppBuilder files
39 | .abignore
40 | .*.abignore
41 | .*.*.abignore
42 | .ab/**/*
43 | .app.json
44 | .yo-rc.json
45 |
46 | # TypeScript files
47 | **/*.ts
48 | **/*.map
49 | tsconfig.json
50 |
51 | # Other
52 | **/*.bak
53 | **/*.cache
54 | **/*.log
55 |
56 | # NativeScript files
57 | platforms/**/*
58 | node_modules/**/*
59 | typings/**/*
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/Android/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
8 |
9 |
10 |
11 |
16 |
17 |
20 |
21 |
27 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/Mapbox/app/App_Resources/iOS/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleIdentifier
6 | com.telerik.plugindemo.mapbox
7 | CFBundleDevelopmentRegion
8 | en
9 | CFBundleDisplayName
10 | ${PRODUCT_NAME}
11 | CFBundleExecutable
12 | ${EXECUTABLE_NAME}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | LSRequiresIPhoneOS
26 |
27 | UILaunchStoryboardName
28 | LaunchScreen
29 | UIRequiredDeviceCapabilities
30 |
31 | armv7
32 |
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 |
47 | NSAppTransportSecurity
48 |
49 | NSAllowsArbitraryLoads
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/Mapbox/app/main-page.js:
--------------------------------------------------------------------------------
1 | var vmModule = require("./main-view-model");
2 | function pageLoaded(args) {
3 | var page = args.object;
4 | page.bindingContext = vmModule.mainViewModel;
5 | }
6 | exports.pageLoaded = pageLoaded;
7 |
8 | var mapbox = require("nativescript-mapbox");
9 |
10 | function onMapReady(args) {
11 | args.map.addMarkers([
12 | {
13 | id: 2,
14 | lat: 52.3602160,
15 | lng: 4.8891680,
16 | title: 'One-line title here', // no popup unless set
17 | subtitle: 'Really really nice location',
18 | iconPath: 'res/markers/green_pin_marker.png',
19 | onTap: function(){console.log("'Nice location' marker tapped");},
20 | onCalloutTap: function(){console.log("'Nice location' marker callout tapped");}
21 | }]
22 | );
23 |
24 | setTimeout(function() {
25 | args.map.setOnMapClickListener(function(point) {
26 | console.log("Map clicked: " + JSON.stringify(point));
27 | });
28 | args.map.setViewport(
29 | {
30 | bounds: {
31 | north: 52.4820,
32 | east: 5.1087,
33 | south: 52.2581,
34 | west: 4.6816
35 | },
36 | animated: true
37 | }
38 | );
39 | }, 3000);
40 |
41 | setTimeout(function() {
42 | args.map.setMapStyle(mapbox.MapStyle.DARK);
43 | }, 5000);
44 |
45 | /*
46 | setTimeout(function() {
47 | args.map.addPolyline({
48 | id: 10,
49 | color: 0xffff0000,
50 | points: [
51 | {
52 | lat: 52.4,
53 | lng: 5
54 | },
55 | {
56 | lat: 51.9,
57 | lng: 5.1
58 | },
59 | {
60 | lat: 51.8,
61 | lng: 4.95
62 | }
63 | ]
64 | });
65 | }, 6000);
66 | */
67 |
68 | setTimeout(function() {
69 | args.map.setCenter({
70 | lat: 52.4820,
71 | lng: 5.1087,
72 | animated: true
73 | });
74 | }, 6100);
75 |
76 | setTimeout(function() {
77 | args.map.setZoomLevel({
78 | level: 8,
79 | animated: true
80 | });
81 | }, 8000);
82 |
83 | // setTimeout(function() {
84 | // args.map.removeMarkers([2]);
85 | // }, 10000);
86 |
87 | setTimeout(function() {
88 | args.map.setTilt({
89 | tilt: 85,
90 | duration: 2500
91 | });
92 | }, 10000);
93 |
94 | /*
95 | setTimeout(function() {
96 | args.map.animateCamera({
97 | target: {
98 | lat: 51.8,
99 | lng: 5
100 | },
101 | tilt: 80,
102 | zoomLevel: 9,
103 | duration: 4000
104 | });
105 | }, 13000);
106 | */
107 |
108 | // setTimeout(function() {
109 | // args.map.removePolylines([10]);
110 | // }, 15000);
111 | }
112 |
113 | exports.onMapReady = onMapReady;
--------------------------------------------------------------------------------
/Mapbox/app/main-page.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
28 |
29 |
30 |
31 |
41 |
42 |
43 |
44 |
54 |
55 |
56 |
57 |
65 |
66 |
67 |
68 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
--------------------------------------------------------------------------------
/Mapbox/app/main-view-model.js:
--------------------------------------------------------------------------------
1 | var observable = require("data/observable");
2 | var mapbox = require("nativescript-mapbox");
3 | var dialogs = require("ui/dialogs");
4 | var platform = require("platform");
5 | var isIOS = platform.device.os === platform.platformNames.ios;
6 |
7 | var DemoAppModel = (function (_super) {
8 | __extends(DemoAppModel, _super);
9 | function DemoAppModel() {
10 | _super.call(this);
11 | }
12 |
13 | var accessToken = 'sk.eyJ1IjoiZWRkeXZlcmJydWdnZW4iLCJhIjoia1JpRW82NCJ9.OgnvpsKzB3GJhzyofQNUBw';
14 |
15 | DemoAppModel.prototype.doShow = function () {
16 | mapbox.show({
17 | accessToken: accessToken,
18 | style: mapbox.MapStyle.OUTDOORS,
19 | margins: {
20 | left: 18,
21 | right: 18,
22 | top: isIOS ? 400 : 424,
23 | bottom: isIOS ? 50 : 8
24 | },
25 | center: {
26 | lat: 52.3702160,
27 | lng: 4.8951680
28 | },
29 | zoomLevel: 9, // 0 (most of the world) to 20, default 0
30 | showUserLocation: true, // default false
31 | hideAttribution: true, // default false
32 | hideLogo: true, // default false
33 | hideCompass: false, // default false
34 | disableRotation: false, // default false
35 | disableScroll: false, // default false
36 | disableZoom: false, // default false
37 | disableTilt: false, // default false
38 | markers: [
39 | {
40 | id: 1,
41 | lat: 52.3732160,
42 | lng: 4.8941680,
43 | title: 'Nice location',
44 | subtitle: 'Really really nice location',
45 | iconPath: 'res/markers/green_pin_marker.png',
46 | onTap: function(){console.log("'Nice location' marker tapped");},
47 | onCalloutTap: function(){console.log("'Nice location' marker callout tapped");}
48 | }
49 | ]
50 | }).then(
51 | function(result) {
52 | console.log("Mapbox show done");
53 | },
54 | function(error) {
55 | console.log("mapbox show error: " + error);
56 | }
57 | );
58 | };
59 |
60 | DemoAppModel.prototype.doHide = function () {
61 | mapbox.hide().then(
62 | function(result) {
63 | console.log("Mapbox hide done");
64 | },
65 | function(error) {
66 | console.log("mapbox hide error: " + error);
67 | }
68 | );
69 | };
70 |
71 | DemoAppModel.prototype.doDestroy = function () {
72 | mapbox.destroy().then(
73 | function(result) {
74 | console.log("Mapbox destroyed");
75 | },
76 | function(error) {
77 | console.log("mapbox destroy error: " + error);
78 | }
79 | );
80 | };
81 |
82 | DemoAppModel.prototype.doUnhide = function () {
83 | mapbox.unhide().then(
84 | function(result) {
85 | console.log("Mapbox doUnhide done");
86 | },
87 | function(error) {
88 | console.log("mapbox doUnhide error: " + error);
89 | }
90 | );
91 | };
92 |
93 | DemoAppModel.prototype.doRemoveAllMarkers = function () {
94 | mapbox.removeMarkers(
95 | ).then(
96 | function(result) {
97 | console.log("Mapbox doRemoveAllMarkers done");
98 | },
99 | function(error) {
100 | console.log("mapbox doRemoveAllMarkers error: " + error);
101 | }
102 | );
103 | };
104 |
105 | DemoAppModel.prototype.doRemove2Markers = function () {
106 | mapbox.removeMarkers([
107 | 1,
108 | 2
109 | ]).then(
110 | function(result) {
111 | console.log("Mapbox doRemove2Markers done");
112 | },
113 | function(error) {
114 | console.log("mapbox doRemove2Markers error: " + error);
115 | }
116 | );
117 | };
118 |
119 | DemoAppModel.prototype.doAddMarkers = function () {
120 | var onTap = function(marker) {
121 | console.log("Marker tapped with title: '" + marker.title + "'");
122 | };
123 | var onCalloutTap = function(marker) {
124 | alert("Marker callout tapped with title: '" + marker.title + "'");
125 | };
126 |
127 | mapbox.addMarkers([
128 | {
129 | id: 2,
130 | lat: 52.3602160,
131 | lng: 4.8891680,
132 | title: 'One-line title here', // no popup unless set
133 | subtitle: 'With a res://icon-40 image',
134 | icon: isIOS ? 'res://icon-40' : 'res://icon',
135 | onTap: onTap,
136 | onCalloutTap: onCalloutTap
137 | },
138 | {
139 | id: 3,
140 | lat: 52.3602160,
141 | lng: 5,
142 | title: 'One-line title here 2', // no popup unless set
143 | subtitle: 'And a one-liner here as well.',
144 | icon: 'http://www.bme.be/wp-content/uploads/2014/04/marker.png',
145 | onTap: onTap,
146 | onCalloutTap: onCalloutTap
147 | },
148 | {
149 | id: 4,
150 | lat: 52.3602160,
151 | lng: 4.7891680,
152 | title: 'One-line title here 3', // no popup unless set
153 | subtitle: 'And a one-liner here as well.',
154 | iconPath: 'res/markers/home_marker.png',
155 | onTap: onTap,
156 | onCalloutTap: onCalloutTap
157 | },
158 | {
159 | id: 5,
160 | lat: 52.4,
161 | lng: 5.1,
162 | title: 'This title is cut off on iOS, but multi-line on Android', // no popup unless set
163 | subtitle: 'Same for this subtitle. Same for this subtitle. Same for this subtitle. Same for this subtitle. Same for this subtitle.',
164 | icon: 'http://maryjanewa.com/wp-content/uploads/2016/01/map-marker.png',
165 | onTap: function(){console.log("Marker tapped");},
166 | onCalloutTap: function(){console.log("Marker callout tapped");}
167 | }
168 | ]).then(
169 | function(result) {
170 | console.log("Mapbox addMarkers done");
171 | },
172 | function(error) {
173 | console.log("mapbox addMarkers error: " + error);
174 | }
175 | );
176 | };
177 |
178 | DemoAppModel.prototype.doGetViewport = function () {
179 | mapbox.getViewport().then(
180 | function(result) {
181 | dialogs.alert({
182 | title: "Viewport determined",
183 | message: JSON.stringify(result),
184 | okButtonText: "OK"
185 | });
186 | },
187 | function(error) {
188 | console.log("mapbox doGetViewport error: " + error);
189 | }
190 | );
191 | };
192 |
193 | DemoAppModel.prototype.doSetViewport = function () {
194 | mapbox.setViewport(
195 | {
196 | bounds: {
197 | north: 52.4820,
198 | east: 5.1087,
199 | south: 52.2581,
200 | west: 4.6816
201 | },
202 | animated: true // default true
203 | }
204 | ).then(
205 | function() {
206 | console.log("Viewport set");
207 | },
208 | function(error) {
209 | console.log("mapbox doSetViewport error: " + error);
210 | }
211 | );
212 | };
213 |
214 | // Add an option to download the current viewport: https://www.mapbox.com/ios-sdk/examples/offline-pack/ (look for visibleCoordinateBounds)
215 | DemoAppModel.prototype.doDownloadAmsterdam = function () {
216 | mapbox.downloadOfflineRegion(
217 | {
218 | // required for Android in case no map has been shown yet
219 | accessToken: accessToken,
220 | name: "Amsterdam",
221 | style: mapbox.MapStyle.OUTDOORS,
222 | minZoom: 9,
223 | maxZoom: 11,
224 | bounds: {
225 | north: 52.4820,
226 | east: 5.1087,
227 | south: 52.2581,
228 | west: 4.6816
229 | },
230 | onProgress: function (progress) {
231 | console.log("Download progress: " + JSON.stringify(progress));
232 | }
233 | }
234 | ).then(
235 | function() {
236 | dialogs.alert({
237 | title: "Offline region downloaded",
238 | message: "Done! Zoom levels 9-11 have been downloaded. The download progress was reported via console.log",
239 | okButtonText: "OK"
240 | });
241 | },
242 | function(error) {
243 | console.log("mapbox doDownloadAmsterdam error: " + error);
244 | }
245 | );
246 |
247 | dialogs.alert({
248 | title: "Be patient",
249 | message: "This takes a while, progress is logged via console.log",
250 | okButtonText: "Understood"
251 | });
252 | };
253 |
254 | DemoAppModel.prototype.doDownloadCurrentViewportAsOfflineRegion = function () {
255 | mapbox.getViewport().then(function(viewport) {
256 | mapbox.downloadOfflineRegion(
257 | {
258 | name: "LastViewport",
259 | style: mapbox.MapStyle.OUTDOORS,
260 | minZoom: viewport.zoomLevel,
261 | maxZoom: viewport.zoomLevel + 2,
262 | bounds: viewport.bounds,
263 | onProgress: function (progress) {
264 | console.log("Download progress: " + JSON.stringify(progress));
265 | }
266 | }
267 | ).then(
268 | function() {
269 | dialogs.alert({
270 | title: "Viewport downloaded",
271 | message: "Downloaded viewport with bounds " + JSON.stringify(viewport.bounds) + " at zoom levels " + viewport.zoomLevel + " - " + (viewport.zoomLevel + 2),
272 | okButtonText: "OK :)"
273 | });
274 | },
275 | function(error) {
276 | console.log("mapbox doDownloadCurrentViewportAsOfflineRegion error: " + error);
277 | }
278 | );
279 | }, function(error) {
280 | dialogs.alert({
281 | title: "Download error",
282 | message: error,
283 | okButtonText: "Got it"
284 | });
285 | });
286 | };
287 |
288 | DemoAppModel.prototype.doAddAndClusterGeoJSON = function () {
289 | mapbox.addGeoJsonClustered(
290 | {
291 | name: "earthquakes",
292 | data: "https://www.mapbox.com/mapbox-gl-js/assets/earthquakes.geojson",
293 | clusterMaxZoom: 15,
294 | clusterRadius: 20
295 | // clusters: [
296 | // {}
297 | // ]
298 | }
299 | ).then(
300 | function() {
301 | dialogs.alert({
302 | title: "GeoJSON added",
303 | message: "Moving to the USA as that's where the GeoJson data is drawn",
304 | okButtonText: "OK"
305 | }).then(function() {
306 | mapbox.setViewport(
307 | {
308 | bounds: {
309 | north: 52.9,
310 | east: -62.2,
311 | south: 22.1,
312 | west: -128.2
313 | },
314 | zoomLevel: 3
315 | }
316 | )
317 | });
318 | },
319 | function(error) {
320 | console.log("mapbox doAddAndClusterGeoJSON error: " + error);
321 | }
322 | );
323 | };
324 |
325 | DemoAppModel.prototype.doListOfflineRegions = function () {
326 | mapbox.listOfflineRegions().then(
327 | function(regions) {
328 | dialogs.alert({
329 | title: "Offline regions",
330 | message: JSON.stringify(regions),
331 | okButtonText: "Thanks"
332 | });
333 | },
334 | function(error) {
335 | dialogs.alert({
336 | title: "Offline regions list error",
337 | message: error,
338 | okButtonText: "Hmm"
339 | });
340 | }
341 | );
342 | };
343 |
344 | DemoAppModel.prototype.doDeleteOfflineRegion = function () {
345 | mapbox.deleteOfflineRegion({
346 | name: "Amsterdam"
347 | }).then(
348 | function() {
349 | dialogs.alert({
350 | title: "Offline region deleted",
351 | okButtonText: "Cool"
352 | });
353 | },
354 | function(error) {
355 | dialogs.alert({
356 | title: "Error deleting offline region",
357 | message: error,
358 | okButtonText: "Hmmz"
359 | });
360 | }
361 | );
362 | };
363 |
364 | DemoAppModel.prototype.doSetTilt = function () {
365 | mapbox.setTilt(
366 | {
367 | tilt: 35,
368 | duration: 4000
369 | }
370 | ).then(
371 | function(result) {
372 | console.log("Mapbox doSetTilt done");
373 | },
374 | function(error) {
375 | console.log("mapbox doSetTilt error: " + error);
376 | }
377 | );
378 | };
379 |
380 | DemoAppModel.prototype.doAnimateCamera = function () {
381 | mapbox.animateCamera(
382 | {
383 | target: {
384 | lat: 52.3732160,
385 | lng: 4.8941680,
386 | },
387 | zoomLevel: 17, // Android
388 | altitude: 500, // iOS
389 | bearing: 270,
390 | tilt: 50,
391 | duration: 10000
392 | }
393 | ).then(
394 | function(result) {
395 | console.log("Mapbox doAnimateCamera done");
396 | },
397 | function(error) {
398 | console.log("mapbox doAnimateCamera error: " + error);
399 | }
400 | );
401 | };
402 |
403 | DemoAppModel.prototype.doSetCenter = function () {
404 | mapbox.setCenter(
405 | {
406 | lat: 52.3602160,
407 | lng: 4.8891680,
408 | animated: true
409 | }
410 | ).then(
411 | function(result) {
412 | console.log("Mapbox setCenter done");
413 | },
414 | function(error) {
415 | console.log("mapbox setCenter error: " + error);
416 | }
417 | );
418 | };
419 |
420 | DemoAppModel.prototype.doGetCenter = function () {
421 | mapbox.getCenter().then(
422 | function(result) {
423 | dialogs.alert({
424 | title: "Center",
425 | message: JSON.stringify(result),
426 | okButtonText: "OK"
427 | });
428 | },
429 | function(error) {
430 | console.log("mapbox getCenter error: " + error);
431 | }
432 | );
433 | };
434 |
435 | DemoAppModel.prototype.doGetZoomLevel = function () {
436 | mapbox.getZoomLevel().then(
437 | function(result) {
438 | dialogs.alert({
439 | title: "Zoom Level",
440 | message: JSON.stringify(result),
441 | okButtonText: "OK"
442 | });
443 | },
444 | function(error) {
445 | console.log("mapbox getCenter error: " + error);
446 | }
447 | );
448 | };
449 |
450 | DemoAppModel.prototype.doSetZoomLevel = function () {
451 | mapbox.setZoomLevel(
452 | {
453 | level: 2, // shows most of the world
454 | animated: true
455 | }
456 | ).then(
457 | function(result) {
458 | console.log("Mapbox setZoomLevel done");
459 | },
460 | function(error) {
461 | console.log("mapbox setZoomLevel error: " + error);
462 | }
463 | );
464 | };
465 |
466 | DemoAppModel.prototype.doAddPolygon = function () {
467 | mapbox.addPolygon({
468 | points: [
469 | {
470 | lat: 52.3832160,
471 | lng: 4.8991680
472 | },
473 | {
474 | lat: 52.3632160,
475 | lng: 4.9011680
476 | },
477 | {
478 | lat: 52.3932160,
479 | lng: 4.8911680
480 | }
481 | ]
482 | }).then(
483 | function(result) {
484 | console.log("Mapbox addPolygon done");
485 | },
486 | function(error) {
487 | console.log("mapbox addPolygon error: " + error);
488 | }
489 | );
490 | };
491 |
492 | DemoAppModel.prototype.doCheckHasFineLocationPermission = function () {
493 | mapbox.hasFineLocationPermission().then(
494 | function(granted) {
495 | dialogs.alert({
496 | title: "Permission granted?",
497 | message: granted ? "YES" : "NO",
498 | okButtonText: "OK"
499 | });
500 | }
501 | );
502 | };
503 |
504 | DemoAppModel.prototype.doRequestFineLocationPermission = function () {
505 | mapbox.requestFineLocationPermission().then(
506 | function() {
507 | console.log("Fine Location permission requested");
508 | }
509 | );
510 | };
511 |
512 | return DemoAppModel;
513 | })(observable.Observable);
514 | exports.DemoAppModel = DemoAppModel;
515 | exports.mainViewModel = new DemoAppModel();
516 |
--------------------------------------------------------------------------------