@nativescript/template-master-detail-vue 7.0.5 → 8.1.1

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 (77) hide show
  1. package/.editorconfig +5 -1
  2. package/App_Resources/Android/src/main/AndroidManifest.xml +8 -3
  3. package/App_Resources/Android/src/main/res/drawable/ic_launcher_foreground.xml +15 -0
  4. package/App_Resources/Android/src/main/res/drawable-hdpi/background.png +0 -0
  5. package/App_Resources/Android/src/main/res/drawable-hdpi/logo.png +0 -0
  6. package/App_Resources/Android/src/main/res/drawable-ldpi/background.png +0 -0
  7. package/App_Resources/Android/src/main/res/drawable-ldpi/logo.png +0 -0
  8. package/App_Resources/Android/src/main/res/drawable-mdpi/background.png +0 -0
  9. package/App_Resources/Android/src/main/res/drawable-mdpi/logo.png +0 -0
  10. package/App_Resources/Android/src/main/res/drawable-xhdpi/background.png +0 -0
  11. package/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png +0 -0
  12. package/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png +0 -0
  13. package/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png +0 -0
  14. package/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png +0 -0
  15. package/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png +0 -0
  16. package/App_Resources/Android/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +5 -0
  17. package/App_Resources/Android/src/main/res/mipmap-hdpi/ic_launcher.png +0 -0
  18. package/App_Resources/Android/src/main/res/mipmap-mdpi/ic_launcher.png +0 -0
  19. package/App_Resources/Android/src/main/res/mipmap-xhdpi/ic_launcher.png +0 -0
  20. package/App_Resources/Android/src/main/res/mipmap-xxhdpi/ic_launcher.png +0 -0
  21. package/App_Resources/Android/src/main/res/mipmap-xxxhdpi/ic_launcher.png +0 -0
  22. package/App_Resources/Android/src/main/res/values/colors.xml +1 -1
  23. package/App_Resources/Android/src/main/res/values/ic_launcher_background.xml +4 -0
  24. package/App_Resources/Android/src/main/res/values-v21/colors.xml +1 -1
  25. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png +0 -0
  26. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png +0 -0
  27. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png +0 -0
  28. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png +0 -0
  29. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png +0 -0
  30. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png +0 -0
  31. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png +0 -0
  32. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png +0 -0
  33. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png +0 -0
  34. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png +0 -0
  35. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png +0 -0
  36. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png +0 -0
  37. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png +0 -0
  38. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png +0 -0
  39. package/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png +0 -0
  40. package/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png +0 -0
  41. package/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png +0 -0
  42. package/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png +0 -0
  43. package/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png +0 -0
  44. package/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png +0 -0
  45. package/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png +0 -0
  46. package/App_Resources/iOS/Info.plist +0 -4
  47. package/App_Resources/iOS/build.xcconfig +1 -1
  48. package/README.md +1 -1
  49. package/app/_app-common.scss +9 -9
  50. package/app/app.android.scss +1 -1
  51. package/app/app.ios.scss +1 -1
  52. package/app/app.js +7 -43
  53. package/app/car-rental-export-public.json +82 -0
  54. package/app/components/AddRemoveImage.vue +1 -1
  55. package/app/components/App.vue +22 -0
  56. package/app/components/CarDetailsEdit.vue +2 -2
  57. package/app/components/CarList.vue +7 -7
  58. package/app/components/SelectorModal.vue +1 -1
  59. package/app/shared/cars/car-model.js +16 -18
  60. package/app/shared/cars/car-service.js +50 -49
  61. package/app/shared/cars/constants.js +4 -22
  62. package/hooks/after-createProject/after-createProject.js +54 -64
  63. package/jsconfig.json +2 -1
  64. package/package.json +20 -17
  65. package/tools/dot.gitignore +0 -6
  66. package/tools/vscode.extensions.json +1 -3
  67. package/App_Resources/Android/google-services.json +0 -42
  68. package/App_Resources/Android/src/main/res/drawable-hdpi/icon.png +0 -0
  69. package/App_Resources/Android/src/main/res/drawable-ldpi/icon.png +0 -0
  70. package/App_Resources/Android/src/main/res/drawable-mdpi/icon.png +0 -0
  71. package/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png +0 -0
  72. package/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png +0 -0
  73. package/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png +0 -0
  74. package/App_Resources/iOS/GoogleService-Info.plist +0 -40
  75. package/app/shared/firebase-config.js +0 -4
  76. package/firebase.nativescript.json +0 -12
  77. package/tools/firebase/car-rental-export-public.json +0 -82
package/.editorconfig CHANGED
@@ -12,4 +12,8 @@ indent_size = 2
12
12
 
13
13
  [*.js]
14
14
  indent_style = space
15
- indent_size = 4
15
+ indent_size = 2
16
+
17
+ [*.ts]
18
+ indent_style = space
19
+ indent_size = 2
@@ -13,19 +13,24 @@
13
13
  <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
14
14
  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
15
15
  <uses-permission android:name="android.permission.INTERNET"/>
16
+ <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
16
17
 
17
18
  <application
18
19
  android:name="com.tns.NativeScriptApplication"
19
20
  android:allowBackup="true"
20
- android:icon="@drawable/icon"
21
+ android:icon="@mipmap/ic_launcher"
21
22
  android:label="@string/app_name"
22
- android:theme="@style/AppTheme">
23
+ android:theme="@style/AppTheme"
24
+ android:hardwareAccelerated="true">
23
25
 
24
26
  <activity
25
27
  android:name="com.tns.NativeScriptActivity"
26
28
  android:label="@string/title_activity_kimera"
27
29
  android:configChanges="keyboard|keyboardHidden|orientation|screenSize|smallestScreenSize|screenLayout|locale|uiMode"
28
- android:theme="@style/LaunchScreenTheme">
30
+ android:theme="@style/LaunchScreenTheme"
31
+ android:hardwareAccelerated="true"
32
+ android:launchMode="singleTask"
33
+ android:exported="true">
29
34
 
30
35
  <meta-data android:name="SET_THEME_ON_LAUNCH" android:resource="@style/AppTheme" />
31
36
 
@@ -0,0 +1,15 @@
1
+ <vector xmlns:android="http://schemas.android.com/apk/res/android"
2
+ android:width="108dp"
3
+ android:height="108dp"
4
+ android:viewportWidth="108"
5
+ android:viewportHeight="108">
6
+ <group android:scaleX="0.07382812"
7
+ android:scaleY="0.07382812"
8
+ android:translateX="16.2"
9
+ android:translateY="16.2">
10
+ <path
11
+ android:pathData="M843,511.86L843,512.96C843,513.22 842.8,513.43 842.55,513.46C809.18,516.58 783.07,543.69 783.07,577.86L783.07,714.8C783.07,724.37 781.06,733.6 777.43,742.03C767.08,766.1 743.59,783.6 716.27,783.6L647.07,783.6L646.59,783L377.41,445.68L377.41,783.6L307.73,783.6C270.84,783.6 240.93,753.7 240.93,716.8L240.93,577.86C240.93,543.69 214.82,516.58 181.45,513.46C181.2,513.43 181,513.22 181,512.96L181,511.86C181,511.61 181.19,511.4 181.45,511.37C214.69,508.14 240.67,480.35 240.67,446.26L240.67,307.2C240.67,297.91 242.57,289.05 246,281.01C256.18,257.14 279.87,240.39 307.47,240.39L377.13,240.39L377.41,240.74L646.59,578.07L646.59,240.39L716.53,240.39C753.42,240.39 783.33,270.3 783.33,307.2L783.33,446.26C783.33,480.35 809.31,508.14 842.55,511.37C842.81,511.4 843,511.61 843,511.86"
12
+ android:fillColor="#65ADF1"
13
+ android:fillType="nonZero"/>
14
+ </group>
15
+ </vector>
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3
+ <background android:drawable="@color/ic_launcher_background"/>
4
+ <foreground android:drawable="@drawable/ic_launcher_foreground"/>
5
+ </adaptive-icon>
@@ -2,6 +2,6 @@
2
2
  <resources>
3
3
  <color name="ns_primary">#F5F5F5</color>
4
4
  <color name="ns_primaryDark">#757575</color>
5
- <color name="ns_accent">#33B5E5</color>
5
+ <color name="ns_accent">#65ADF1</color>
6
6
  <color name="ns_blue">#272734</color>
7
7
  </resources>
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <color name="ic_launcher_background">#FFFFFF</color>
4
+ </resources>
@@ -1,4 +1,4 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
2
  <resources>
3
- <color name="ns_accent">#3d5afe</color>
3
+ <color name="ns_accent">#65ADF1</color>
4
4
  </resources>
@@ -43,9 +43,5 @@
43
43
  <string>UIInterfaceOrientationLandscapeLeft</string>
44
44
  <string>UIInterfaceOrientationLandscapeRight</string>
45
45
  </array>
46
- <key>UIStatusBarStyle</key>
47
- <string>UIStatusBarStyleLightContent</string>
48
- <key>UIViewControllerBasedStatusBarAppearance</key>
49
- <false/>
50
46
  </dict>
51
47
  </plist>
@@ -1,6 +1,6 @@
1
1
  // You can add custom settings here
2
2
  // for example you can uncomment the following line to force distribution code signing
3
3
  // CODE_SIGN_IDENTITY = iPhone Distribution
4
- // To build for device with Xcode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html
4
+ // To build for device with XCode you need to specify your development team.
5
5
  // DEVELOPMENT_TEAM = YOUR_TEAM_ID;
6
6
  ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
package/README.md CHANGED
@@ -67,7 +67,7 @@ It has 3 global style files that are located at the root of the app folder:
67
67
  ## Get Help
68
68
  The NativeScript framework has a vibrant community that can help when you run into problems.
69
69
 
70
- Try [joining the NativeScript community Slack](https://www.nativescript.org/slack-invitation-form). The Slack channel is a great place to get help troubleshooting problems, as well as connect with other NativeScript developers.
70
+ Try [joining the NativeScript community Discord](https://nativescript.org/discord). The Discord channel is a great place to get help troubleshooting problems, as well as connect with other NativeScript developers.
71
71
 
72
72
  If you have found an issue with this template, please report the problem in the [NativeScript repository](https://github.com/NativeScript/NativeScript/issues).
73
73
 
@@ -1,21 +1,21 @@
1
- @import "~@nativescript/theme/core";
2
- @import "~@nativescript/theme/blue";
1
+ @import '@nativescript/theme/core';
2
+ @import '@nativescript/theme/default';
3
3
 
4
4
  // Place any CSS rules you want to apply on both iOS and Android here.
5
5
  // This is where the vast majority of your CSS code goes.
6
6
 
7
7
  // Font icon class
8
8
  .fab {
9
- font-family: "Font Awesome 5 Brands", "fa-brands-400";
10
- font-weight: 400;
9
+ font-family: 'Font Awesome 5 Brands', 'fa-brands-400';
10
+ font-weight: 400;
11
11
  }
12
12
 
13
13
  .fas {
14
- font-family: "Font Awesome 5 Free", "fa-solid-900";
15
- font-weight: 900;
14
+ font-family: 'Font Awesome 5 Free', 'fa-solid-900';
15
+ font-weight: 900;
16
16
  }
17
17
 
18
18
  .far {
19
- font-family: "Font Awesome 5 Free", "fa-regular-400";
20
- font-weight: 400;
21
- }
19
+ font-family: 'Font Awesome 5 Free', 'fa-regular-400';
20
+ font-weight: 400;
21
+ }
@@ -1,4 +1,4 @@
1
1
  // Import common styles
2
- @import "app-common";
2
+ @import 'app-common';
3
3
 
4
4
  // Place any CSS rules you want to apply only on Android here
package/app/app.ios.scss CHANGED
@@ -1,4 +1,4 @@
1
1
  // Import common styles
2
- @import "app-common";
2
+ @import 'app-common';
3
3
 
4
4
  // Place any CSS rules you want to apply only on iOS here
package/app/app.js CHANGED
@@ -1,48 +1,12 @@
1
- import { firebase } from "@nativescript/firebase";
2
- import config from "./shared/firebase-config";
1
+ import Vue from 'nativescript-vue'
2
+ import RadListView from 'nativescript-ui-listview/vue'
3
3
 
4
- import Vue from "nativescript-vue";
4
+ Vue.use(RadListView)
5
5
 
6
- import RadListView from "nativescript-ui-listview/vue";
7
- import cars from "./shared/cars/car-service";
6
+ import App from './components/App'
8
7
 
9
- import CarList from "./components/CarList";
10
- import CarDetails from "./components/CarDetails";
11
- import CarDetailsEdit from "./components/CarDetailsEdit";
12
-
13
- Vue.use(RadListView);
14
-
15
- Vue.config.silent = (TNS_ENV === 'production');
8
+ Vue.config.silent = !__DEV__
16
9
 
17
10
  new Vue({
18
-
19
- template: `
20
- <Frame>
21
- <CarList :cars="cars" />
22
- </Frame>`,
23
-
24
- components: {
25
- CarList,
26
- CarDetails,
27
- CarDetailsEdit
28
- },
29
-
30
- data: {
31
- cars: []
32
- },
33
-
34
- created() {
35
- firebase.init(config).then(
36
- instance => {
37
- console.log("firebase.init done");
38
-
39
- cars.load().then((data) => {
40
- this.cars = Object.values(data);
41
- })
42
- },
43
- error => {
44
- console.log(`firebase.init error: ${error}`);
45
- }
46
- );
47
- }
48
- }).$start();
11
+ render: h => h(App)
12
+ }).$start()
@@ -0,0 +1,82 @@
1
+ {
2
+ "cars": {
3
+ "car1": {
4
+ "class": "Luxury",
5
+ "doors": 2,
6
+ "hasAC": true,
7
+ "id": "car1",
8
+ "imageStoragePath": "cars/BMW 5 Series.jpg",
9
+ "imageUrl": "https://firebasestorage.googleapis.com/v0/b/car-rental-b26b7.appspot.com/o/cars_public%2FBMW%205%20Series.jpg?alt=media&token=dec5a0bf-e3ca-45d2-8f2e-c7b8a25530b5",
10
+ "luggage": 3,
11
+ "name": "BMW 5 Series",
12
+ "price": 76,
13
+ "seats": "2",
14
+ "transmission": "Automatic"
15
+ },
16
+ "car2": {
17
+ "class": "Luxury",
18
+ "doors": 5,
19
+ "hasAC": false,
20
+ "id": "car2",
21
+ "imageStoragePath": "cars/Ford KA+.jpg",
22
+ "imageUrl": "https://firebasestorage.googleapis.com/v0/b/car-rental-b26b7.appspot.com/o/cars_public%2FFord%20KA%2B.jpg?alt=media&token=cf090183-ef5a-4c05-9f60-b0cbdfda7188",
23
+ "luggage": 3,
24
+ "name": "Ford KA",
25
+ "price": 44,
26
+ "seats": "4 + 1",
27
+ "transmission": "Automatic"
28
+ },
29
+ "car3": {
30
+ "class": "Mini",
31
+ "doors": 3,
32
+ "hasAC": true,
33
+ "id": "car3",
34
+ "imageStoragePath": "cars/Smart.jpg",
35
+ "imageUrl": "https://firebasestorage.googleapis.com/v0/b/car-rental-b26b7.appspot.com/o/cars_public%2FSmart.jpg?alt=media&token=6891aca9-4211-4545-834e-c934ed671961",
36
+ "luggage": 1,
37
+ "name": "Smart",
38
+ "price": 39,
39
+ "seats": "2",
40
+ "transmission": "Manual"
41
+ },
42
+ "car4": {
43
+ "class": "Standard",
44
+ "doors": 5,
45
+ "hasAC": true,
46
+ "id": "car4",
47
+ "imageStoragePath": "cars/Kia Sorento.jpg",
48
+ "imageUrl": "https://firebasestorage.googleapis.com/v0/b/car-rental-b26b7.appspot.com/o/cars_public%2FKia%20Sorento.jpg?alt=media&token=09ba5c41-5039-420f-b4fe-073dedb2ff1c",
49
+ "luggage": 2,
50
+ "name": "Kia Sorento",
51
+ "price": 45,
52
+ "seats": "4 + 1",
53
+ "transmission": "Manual"
54
+ },
55
+ "car5": {
56
+ "class": "Luxury",
57
+ "doors": 3,
58
+ "hasAC": true,
59
+ "id": "car5",
60
+ "imageStoragePath": "cars/Mazda MX-5.jpg",
61
+ "imageUrl": "https://firebasestorage.googleapis.com/v0/b/car-rental-b26b7.appspot.com/o/cars_public%2FMazda%20MX-5.jpg?alt=media&token=d27f2a97-2e09-431e-ad8c-d0e7723955ef",
62
+ "luggage": 2,
63
+ "name": "Mazda MX-5",
64
+ "price": 53,
65
+ "seats": "2",
66
+ "transmission": "Automatic"
67
+ },
68
+ "car6": {
69
+ "class": "Luxury",
70
+ "doors": "3",
71
+ "hasAC": false,
72
+ "id": "car6",
73
+ "imageStoragePath": "cars/Mercedes S-Class Cabriolet.jpg",
74
+ "imageUrl": "https://firebasestorage.googleapis.com/v0/b/car-rental-b26b7.appspot.com/o/cars_public%2FMercedes%20S-Class%20Cabriolet.jpg?alt=media&token=dc17f427-407c-45c5-b827-ed3e108e0034",
75
+ "luggage": "2",
76
+ "name": "Mercedes S-Class Cabriolet",
77
+ "price": "89",
78
+ "seats": "4",
79
+ "transmission": "Manual"
80
+ }
81
+ }
82
+ }
@@ -90,7 +90,7 @@
90
90
  </script>
91
91
 
92
92
  <style lang="scss" scoped>
93
- @import '~@nativescript/theme/scss/variables/blue';
93
+ @import '@nativescript/theme/scss/variables/blue';
94
94
 
95
95
  // Custom styles
96
96
  .car-list {
@@ -0,0 +1,22 @@
1
+ <template>
2
+ <Frame>
3
+ <CarList :cars="cars" />
4
+ </Frame>
5
+ </template>
6
+
7
+ <script>
8
+ import CarList from './CarList'
9
+ import db from "~/car-rental-export-public.json"
10
+
11
+ export default {
12
+ components: {
13
+ CarList,
14
+ },
15
+
16
+ data() {
17
+ return {
18
+ cars: Object.values(db.cars),
19
+ }
20
+ },
21
+ }
22
+ </script>
@@ -69,7 +69,7 @@
69
69
  </template>
70
70
 
71
71
  <script>
72
- import {alert} from "ui/dialogs";
72
+ import { alert } from "@nativescript/core";
73
73
  import CarList from "./CarList";
74
74
  import Selector from "./Selector";
75
75
  import AddRemoveImage from "./AddRemoveImage";
@@ -169,7 +169,7 @@
169
169
  </script>
170
170
 
171
171
  <style lang="scss">
172
- @import '~@nativescript/theme/scss/variables/blue';
172
+ @import '@nativescript/theme/scss/variables/blue';
173
173
 
174
174
  // Custom styles
175
175
  .car-list {
@@ -4,7 +4,7 @@
4
4
  <Label horizontalAlignment="center" text="Car List"/>
5
5
  </ActionBar>
6
6
 
7
- <RadListView @itemTap="onItemTap" class="cars-list" for="item in carList" v-if="!isLoading">
7
+ <RadListView @itemTap="onItemTap" class="cars-list" for="item in cars" v-if="!isLoading">
8
8
  <ListViewLinearLayout scrollDirection="Vertical" v-tkListViewLayout/>
9
9
  <v-template>
10
10
  <StackLayout class="cars-list__item">
@@ -56,13 +56,13 @@
56
56
  import CarDetails from "./CarDetails";
57
57
 
58
58
  export default {
59
- computed: {
60
- carList() {
61
- return this.$root.cars;
62
- },
59
+ props: {
60
+ cars: Array
61
+ },
63
62
 
63
+ computed: {
64
64
  isLoading() {
65
- return !this.carList.length;
65
+ return !this.cars.length;
66
66
  }
67
67
  },
68
68
 
@@ -76,7 +76,7 @@
76
76
  </script>
77
77
 
78
78
  <style lang="scss" scoped>
79
- @import '~@nativescript/theme/scss/variables/blue';
79
+ @import '@nativescript/theme/scss/variables/blue';
80
80
 
81
81
  // Custom styles
82
82
  .cars-list {
@@ -59,7 +59,7 @@
59
59
  </script>
60
60
 
61
61
  <style lang="scss">
62
- @import '~@nativescript/theme/scss/variables/blue';
62
+ @import '@nativescript/theme/scss/variables/blue';
63
63
 
64
64
  // Custom styles
65
65
  .modal-input {
@@ -1,20 +1,18 @@
1
- function Car(options) {
2
- const model = {
3
- id: options.id,
4
- name: options.name,
5
- hasAC: options.hasAC,
6
- description: options.description,
7
- seats: options.seats,
8
- luggage: Number(options.luggage),
9
- class: options.class,
10
- doors: Number(options.doors),
11
- price: Number(options.price),
12
- transmission: options.transmission,
13
- imageUrl: options.imageUrl,
14
- imageStoragePath: options.imageStoragePath
15
- };
1
+ export function Car(options) {
2
+ const model = {
3
+ id: options.id,
4
+ name: options.name,
5
+ hasAC: options.hasAC,
6
+ description: options.description,
7
+ seats: options.seats,
8
+ luggage: Number(options.luggage),
9
+ class: options.class,
10
+ doors: Number(options.doors),
11
+ price: Number(options.price),
12
+ transmission: options.transmission,
13
+ imageUrl: options.imageUrl,
14
+ imageStoragePath: options.imageStoragePath,
15
+ }
16
16
 
17
- return model;
17
+ return model
18
18
  }
19
-
20
- module.exports = Car;
@@ -1,69 +1,70 @@
1
- import { firebase, storage } from "@nativescript/firebase";
1
+ import { throwError } from 'rxjs'
2
2
 
3
- import Car from "./car-model";
3
+ import { Car } from './car-model'
4
+ import ApiService from "~/services/api.service";
4
5
 
5
6
  const editableProperties = [
6
- "doors",
7
- "imageUrl",
8
- "luggage",
9
- "name",
10
- "price",
11
- "seats",
12
- "transmission",
13
- "class"
14
- ];
7
+ 'doors',
8
+ 'imageUrl',
9
+ 'luggage',
10
+ 'name',
11
+ 'price',
12
+ 'seats',
13
+ 'transmission',
14
+ 'class',
15
+ ]
15
16
 
16
17
  function CarService() {
17
- if (CarService._instance) {
18
- throw new Error("Use CarService.getInstance() instead of new.");
19
- }
18
+ if (CarService._instance) {
19
+ throw new Error('Use CarService.getInstance() instead of new.')
20
+ }
20
21
 
21
- this._cars = [];
22
- CarService._instance = this;
22
+ this._cars = []
23
+ CarService._instance = this
23
24
 
24
- this.load = function () {
25
- return new Promise((resolve, reject) => {
26
- firebase.addValueEventListener((snapshot) => {
27
- const data = snapshot.value;
25
+ this.load = function () {
26
+ return new Promise((resolve, reject) => {
27
+ ApiService.addValueEventListener((snapshot) => {
28
+ const data = snapshot
28
29
 
29
- this._cars = [];
30
+ this._cars = []
30
31
 
31
- if (data) {
32
- for (const id in data) {
33
- if (data.hasOwnProperty(id)) {
34
- this._cars.push(new Car(data[id]));
35
- }
36
- }
37
- }
32
+ if (data) {
33
+ for (const id in data) {
34
+ if (data.hasOwnProperty(id)) {
35
+ this._cars.push(new Car(data[id]))
36
+ }
37
+ }
38
+ }
38
39
 
39
- resolve(data);
40
- }, `/cars`);
41
- });
42
- };
40
+ resolve(data)
41
+ }, `/cars`)
42
+ })
43
+ }
43
44
 
44
- this.update = function (carModel) {
45
- const updateModel = cloneUpdateModel(carModel);
45
+ this.update = function (carModel) {
46
+ const updateModel = cloneUpdateModel(carModel)
46
47
 
47
- return firebase.update(`/cars/${carModel.id}`, updateModel);
48
- };
48
+ return ApiService.update(`/cars/${carModel.id}`, updateModel)
49
+ }
49
50
 
50
- this.uploadImage = function (remoteFullPath, localFullPath) {
51
- return storage.uploadFile({
52
- localFullPath,
53
- remoteFullPath,
54
- onProgress: null
55
- });
56
- };
51
+ this.uploadImage = function (remoteFullPath, localFullPath) {
52
+ return ApiService.uploadFile({
53
+ localFullPath,
54
+ remoteFullPath,
55
+ onProgress: null,
56
+ })
57
+ }
57
58
 
58
- this._handleErrors = function (error) {
59
- return Observable.throw(error);
60
- };
59
+ this._handleErrors = function (error) {
60
+ return throwError(error)
61
+ }
61
62
  }
62
63
 
63
- CarService._instance = new CarService();
64
+ CarService._instance = new CarService()
64
65
 
65
66
  function cloneUpdateModel(car) {
66
- return editableProperties.reduce((a, e) => (a[e] = car[e], a), {}); // eslint-disable-line no-return-assign, no-sequences
67
+ return editableProperties.reduce((a, e) => ((a[e] = car[e]), a), {}) // eslint-disable-line no-return-assign, no-sequences
67
68
  }
68
69
 
69
- export default CarService._instance;
70
+ export default CarService._instance
@@ -1,25 +1,7 @@
1
- export const classList = [
2
- "Mini",
3
- "Economy",
4
- "Compact",
5
- "Standard",
6
- "Luxury"
7
- ];
1
+ export const classList = ['Mini', 'Economy', 'Compact', 'Standard', 'Luxury']
8
2
 
9
- export const doorsList = [
10
- 2,
11
- 3,
12
- 5
13
- ];
3
+ export const doorsList = [2, 3, 5]
14
4
 
15
- export const seatsList = [
16
- "2",
17
- "4",
18
- "4 + 1",
19
- "6 + 1"
20
- ];
5
+ export const seatsList = ['2', '4', '4 + 1', '6 + 1']
21
6
 
22
- export const transmissionList = [
23
- "Manual",
24
- "Automatic"
25
- ];
7
+ export const transmissionList = ['Manual', 'Automatic']
@@ -1,75 +1,65 @@
1
- const fs = require("fs");
2
- const path = require("path");
1
+ const fs = require('fs')
2
+ const path = require('path')
3
+ const { execSync } = require('child_process')
3
4
 
4
5
  module.exports = function (hookArgs) {
5
- const appRootFolder = hookArgs.projectDir;
6
- const toolsDir = path.join(appRootFolder, "tools");
7
- const vscodeDir = path.join(appRootFolder, ".vscode");
8
- const srcGitignore = path.join(toolsDir, "dot.gitignore");
9
- const destGitignore = path.join(appRootFolder, ".gitignore");
10
- const srcVscodeExtensions = path.join(toolsDir, "vscode.extensions.json");
11
- const destVscodeExtensions = path.join(vscodeDir, "extensions.json");
6
+ const appRootFolder = hookArgs.projectDir
7
+ const toolsDir = path.join(appRootFolder, 'tools')
8
+ const vscodeDir = path.join(appRootFolder, '.vscode')
9
+ const srcGitignore = path.join(toolsDir, 'dot.gitignore')
10
+ const destGitignore = path.join(appRootFolder, '.gitignore')
11
+ const srcVscodeExtensions = path.join(toolsDir, 'vscode.extensions.json')
12
+ const destVscodeExtensions = path.join(vscodeDir, 'extensions.json')
12
13
 
13
- try {
14
- fs.mkdirSync(vscodeDir);
15
- fs.copyFileSync(srcVscodeExtensions, destVscodeExtensions);
16
- fs.copyFileSync(srcGitignore, destGitignore);
17
- updateFirebaseConfigAppId();
18
- } catch (error) {
19
- console.log(error);
20
- } finally {
21
- try {
22
- deleteFolderSync(toolsDir);
14
+ try {
15
+ fs.mkdirSync(vscodeDir)
16
+ fs.copyFileSync(srcVscodeExtensions, destVscodeExtensions)
17
+ fs.copyFileSync(srcGitignore, destGitignore)
18
+ initWebpackConfig(appRootFolder)
19
+ } catch (error) {
20
+ console.log(error)
21
+ }
22
+ try {
23
+ deleteFolderSync(toolsDir)
23
24
 
24
- const readme = path.join(appRootFolder, "README.md");
25
- fs.unlinkSync(readme);
26
-
27
- deleteFolderSync(__dirname);
28
- } catch (error) {
29
- console.log(error);
30
- }
31
- }
32
-
33
- function deleteFolderSync(folderPath) {
34
- if (fs.statSync(folderPath).isDirectory()) {
35
- fs.readdirSync(folderPath).forEach((file) => {
36
- const content = path.join(folderPath, file);
37
- const contentDirs = fs.statSync(content).isDirectory();
25
+ const readme = path.join(appRootFolder, 'README.md')
26
+ fs.unlinkSync(readme)
38
27
 
39
- if (contentDirs) {
40
- deleteFolderSync(content);
41
- }
42
- else {
43
- fs.unlinkSync(content);
44
- }
45
- });
46
-
47
- fs.rmdirSync(folderPath);
48
- }
49
- }
28
+ deleteFolderSync(__dirname)
29
+ } catch (error) {
30
+ console.log(error)
31
+ }
50
32
 
51
- function updateFirebaseConfigAppId() {
52
- const packageJsonPath = path.join(appRootFolder, "package.json");
53
- const packageJson = require(packageJsonPath);
54
- if (!packageJson) {
55
- throw new Error("package.json file not found");
56
- }
33
+ function deleteFolderSync(folderPath) {
34
+ if (fs.statSync(folderPath).isDirectory()) {
35
+ fs.readdirSync(folderPath).forEach((file) => {
36
+ const content = path.join(folderPath, file)
37
+ const contentDirs = fs.statSync(content).isDirectory()
57
38
 
58
- if (!packageJson.nativescript || !packageJson.nativescript.id) {
59
- throw new Error("cannot find nativescript node in package.json file");
39
+ if (contentDirs) {
40
+ deleteFolderSync(content)
41
+ } else {
42
+ fs.unlinkSync(content)
60
43
  }
44
+ })
61
45
 
62
- const googleServicesJsonPath = path.join(appRootFolder, "app", "App_Resources", "Android", "google-services.json");
63
- replaceAppId(googleServicesJsonPath, packageJson.nativescript.id);
64
-
65
- const googleServiceInfoPlistPath = path.join(appRootFolder, "app", "App_Resources", "iOS", "GoogleService-Info.plist");
66
- replaceAppId(googleServiceInfoPlistPath, packageJson.nativescript.id);
46
+ fs.rmdirSync(folderPath)
67
47
  }
48
+ }
68
49
 
69
- function replaceAppId(filePath, appId) {
70
- const content = fs.readFileSync(filePath, "utf8");
71
- const appIdPlaceholder = "__PACKAGE__";
72
- const updatedContent = content.replace(appIdPlaceholder, appId);
73
- fs.writeFileSync(filePath, updatedContent);
74
- }
75
- };
50
+ function initWebpackConfig(appRootFolder) {
51
+ const binPath = path.resolve(
52
+ require
53
+ .resolve('@nativescript/webpack/package.json', {
54
+ paths: [appRootFolder],
55
+ })
56
+ .replace('package.json', 'dist/bin/index.js')
57
+ )
58
+
59
+ // init webpack config
60
+ execSync(`node "${binPath}" init`, {
61
+ cwd: appRootFolder,
62
+ stdio: 'inherit',
63
+ })
64
+ }
65
+ }
package/jsconfig.json CHANGED
@@ -2,7 +2,8 @@
2
2
  "compilerOptions": {
3
3
  "baseUrl": "./",
4
4
  "paths": {
5
- "~/*": ["app/*"]
5
+ "~/*": ["app/*"],
6
+ "@/*": ["app/*"]
6
7
  }
7
8
  },
8
9
  "include": ["app/**/*"]
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@nativescript/template-master-detail-vue",
3
- "main": "app.js",
4
- "displayName": "Master Detail with Firebase",
5
- "version": "7.0.5",
6
- "description": "Master-detail interface to display collection of items from Firebase and inspect and edit selected item properties.",
3
+ "main": "app/app.js",
4
+ "displayName": "Master Detail",
5
+ "version": "8.1.1",
6
+ "description": "Master-detail interface to display collection of items from json collection and inspect and edit selected item properties.",
7
7
  "author": "NativeScript Team <oss@nativescript.org>",
8
8
  "license": "Apache-2.0",
9
9
  "repository": {
@@ -17,6 +17,15 @@
17
17
  "publishConfig": {
18
18
  "access": "public"
19
19
  },
20
+ "files": [
21
+ "app",
22
+ "App_Resources",
23
+ "hooks",
24
+ "tools",
25
+ "!tools/assets",
26
+ ".editorconfig",
27
+ "jsconfig.json"
28
+ ],
20
29
  "keywords": [
21
30
  "nstudio",
22
31
  "nativescript",
@@ -31,20 +40,14 @@
31
40
  "category-general"
32
41
  ],
33
42
  "dependencies": {
34
- "@nativescript/core": "~7.1.0",
35
- "@nativescript/firebase": "~11.0.0",
36
- "@nativescript/imagepicker": "~1.0.0",
37
- "@nativescript/theme": "~2.3.0",
38
- "nativescript-ui-listview": "~9.0.0",
39
- "nativescript-vue": "~2.8.0"
43
+ "@nativescript/core": "~8.1.1",
44
+ "@nativescript/imagepicker": "~1.0.5",
45
+ "@nativescript/theme": "~3.0.1",
46
+ "nativescript-ui-listview": "~10.0.0",
47
+ "nativescript-vue": "~2.9.0"
40
48
  },
41
49
  "devDependencies": {
42
- "@babel/core": "~7.1.0",
43
- "@babel/preset-env": "~7.1.0",
44
- "@nativescript/webpack": "~4.0.0",
45
- "babel-loader": "~8.0.0",
46
- "nativescript-vue-template-compiler": "~2.8.0",
47
- "sass": "^1.32.8",
48
- "vue-loader": "~15.9.3"
50
+ "@nativescript/webpack": "~5.0.0",
51
+ "nativescript-vue-template-compiler": "~2.9.0"
49
52
  }
50
53
  }
@@ -1,14 +1,8 @@
1
1
  # NativeScript
2
2
  hooks/
3
- !hooks/after-createProject/*.js
4
3
  node_modules/
5
4
  platforms/
6
5
 
7
- # NativeScript Template
8
- *.js.map
9
- !webpack.config.js
10
- *.css
11
-
12
6
  # Logs
13
7
  logs
14
8
  *.log
@@ -1,5 +1,3 @@
1
1
  {
2
- "recommendations": [
3
- "nativescript.nativescript"
4
- ]
2
+ "recommendations": ["nativescript.nativescript"]
5
3
  }
@@ -1,42 +0,0 @@
1
- {
2
- "project_info": {
3
- "project_number": "33002893899",
4
- "firebase_url": "https://car-rental-b26b7.firebaseio.com",
5
- "project_id": "car-rental-b26b7",
6
- "storage_bucket": "car-rental-b26b7.appspot.com"
7
- },
8
- "client": [
9
- {
10
- "client_info": {
11
- "mobilesdk_app_id": "1:33002893899:android:1aa8448c56b58a16",
12
- "android_client_info": {
13
- "package_name": "__PACKAGE__"
14
- }
15
- },
16
- "oauth_client": [
17
- {
18
- "client_id": "33002893899-9vqs9kk47iuj43ofml42tosba2f3rk2u.apps.googleusercontent.com",
19
- "client_type": 3
20
- }
21
- ],
22
- "api_key": [
23
- {
24
- "current_key": "AIzaSyCijF8lzSzSoCAAIjeiyR9IZBN6FEE8L4k"
25
- }
26
- ],
27
- "services": {
28
- "analytics_service": {
29
- "status": 1
30
- },
31
- "appinvite_service": {
32
- "status": 1,
33
- "other_platform_oauth_client": []
34
- },
35
- "ads_service": {
36
- "status": 2
37
- }
38
- }
39
- }
40
- ],
41
- "configuration_version": "1"
42
- }
@@ -1,40 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>AD_UNIT_ID_FOR_BANNER_TEST</key>
6
- <string>ca-app-pub-3940256099942544/2934735716</string>
7
- <key>AD_UNIT_ID_FOR_INTERSTITIAL_TEST</key>
8
- <string>ca-app-pub-3940256099942544/4411468910</string>
9
- <key>CLIENT_ID</key>
10
- <string>33002893899-tc7ct9av9cviej1onanmmq6pm5966j7u.apps.googleusercontent.com</string>
11
- <key>REVERSED_CLIENT_ID</key>
12
- <string>com.googleusercontent.apps.33002893899-tc7ct9av9cviej1onanmmq6pm5966j7u</string>
13
- <key>API_KEY</key>
14
- <string>AIzaSyCJ0KcyECoJpMIcdmJ-rMybLWcV7Ce1FNU</string>
15
- <key>GCM_SENDER_ID</key>
16
- <string>33002893899</string>
17
- <key>PLIST_VERSION</key>
18
- <string>1</string>
19
- <key>BUNDLE_ID</key>
20
- <string>__PACKAGE__</string>
21
- <key>PROJECT_ID</key>
22
- <string>car-rental-b26b7</string>
23
- <key>STORAGE_BUCKET</key>
24
- <string>car-rental-b26b7.appspot.com</string>
25
- <key>IS_ADS_ENABLED</key>
26
- <true/>
27
- <key>IS_ANALYTICS_ENABLED</key>
28
- <false/>
29
- <key>IS_APPINVITE_ENABLED</key>
30
- <false/>
31
- <key>IS_GCM_ENABLED</key>
32
- <true/>
33
- <key>IS_SIGNIN_ENABLED</key>
34
- <true/>
35
- <key>GOOGLE_APP_ID</key>
36
- <string>1:33002893899:ios:1aa8448c56b58a16</string>
37
- <key>DATABASE_URL</key>
38
- <string>https://car-rental-b26b7.firebaseio.com</string>
39
- </dict>
40
- </plist>
@@ -1,4 +0,0 @@
1
- module.exports = {
2
- persist: false,
3
- firebaseBucket: "gs://car-rental-b26b7.appspot.com/"
4
- };
@@ -1,12 +0,0 @@
1
- {
2
- "using_ios": true,
3
- "using_android": true,
4
- "remote_config": false,
5
- "messaging": false,
6
- "crash_reporting": false,
7
- "storage": true,
8
- "facebook_auth": false,
9
- "google_auth": false,
10
- "admob": false,
11
- "invites": false
12
- }
@@ -1,82 +0,0 @@
1
- {
2
- "cars" : {
3
- "car1" : {
4
- "class" : "Luxury",
5
- "doors" : 2,
6
- "hasAC" : true,
7
- "id" : "car1",
8
- "imageStoragePath" : "cars/BMW 5 Series.jpg",
9
- "imageUrl" : "https://firebasestorage.googleapis.com/v0/b/car-rental-b26b7.appspot.com/o/cars_public%2FBMW%205%20Series.jpg?alt=media&token=dec5a0bf-e3ca-45d2-8f2e-c7b8a25530b5",
10
- "luggage" : 3,
11
- "name" : "BMW 5 Series",
12
- "price" : 76,
13
- "seats" : "2",
14
- "transmission" : "Automatic"
15
- },
16
- "car2" : {
17
- "class" : "Luxury",
18
- "doors" : 5,
19
- "hasAC" : false,
20
- "id" : "car2",
21
- "imageStoragePath" : "cars/Ford KA+.jpg",
22
- "imageUrl" : "https://firebasestorage.googleapis.com/v0/b/car-rental-b26b7.appspot.com/o/cars_public%2FFord%20KA%2B.jpg?alt=media&token=cf090183-ef5a-4c05-9f60-b0cbdfda7188",
23
- "luggage" : 3,
24
- "name" : "Ford KA",
25
- "price" : 44,
26
- "seats" : "4 + 1",
27
- "transmission" : "Automatic"
28
- },
29
- "car3" : {
30
- "class" : "Mini",
31
- "doors" : 3,
32
- "hasAC" : true,
33
- "id" : "car3",
34
- "imageStoragePath" : "cars/Smart.jpg",
35
- "imageUrl" : "https://firebasestorage.googleapis.com/v0/b/car-rental-b26b7.appspot.com/o/cars_public%2FSmart.jpg?alt=media&token=6891aca9-4211-4545-834e-c934ed671961",
36
- "luggage" : 1,
37
- "name" : "Smart",
38
- "price" : 39,
39
- "seats" : "2",
40
- "transmission" : "Manual"
41
- },
42
- "car4" : {
43
- "class" : "Standard",
44
- "doors" : 5,
45
- "hasAC" : true,
46
- "id" : "car4",
47
- "imageStoragePath" : "cars/Kia Sorento.jpg",
48
- "imageUrl" : "https://firebasestorage.googleapis.com/v0/b/car-rental-b26b7.appspot.com/o/cars_public%2FKia%20Sorento.jpg?alt=media&token=09ba5c41-5039-420f-b4fe-073dedb2ff1c",
49
- "luggage" : 2,
50
- "name" : "Kia Sorento",
51
- "price" : 45,
52
- "seats" : "4 + 1",
53
- "transmission" : "Manual"
54
- },
55
- "car5" : {
56
- "class" : "Luxury",
57
- "doors" : 3,
58
- "hasAC" : true,
59
- "id" : "car5",
60
- "imageStoragePath" : "cars/Mazda MX-5.jpg",
61
- "imageUrl" : "https://firebasestorage.googleapis.com/v0/b/car-rental-b26b7.appspot.com/o/cars_public%2FMazda%20MX-5.jpg?alt=media&token=d27f2a97-2e09-431e-ad8c-d0e7723955ef",
62
- "luggage" : 2,
63
- "name" : "Mazda MX-5",
64
- "price" : 53,
65
- "seats" : "2",
66
- "transmission" : "Automatic"
67
- },
68
- "car6" : {
69
- "class" : "Luxury",
70
- "doors" : "3",
71
- "hasAC" : false,
72
- "id" : "car6",
73
- "imageStoragePath" : "cars/Mercedes S-Class Cabriolet.jpg",
74
- "imageUrl" : "https://firebasestorage.googleapis.com/v0/b/car-rental-b26b7.appspot.com/o/cars_public%2FMercedes%20S-Class%20Cabriolet.jpg?alt=media&token=dc17f427-407c-45c5-b827-ed3e108e0034",
75
- "luggage" : "2",
76
- "name" : "Mercedes S-Class Cabriolet",
77
- "price" : "89",
78
- "seats" : "4",
79
- "transmission" : "Manual"
80
- }
81
- }
82
- }