Sfoglia il codice sorgente

Changes on theme and menu

Jorge Baquero 7 anni fa
parent
commit
817f9083b4
8 ha cambiato i file con 127 aggiunte e 78 eliminazioni
  1. 1 0
      config.xml
  2. 20 0
      package-lock.json
  3. 6 1
      package.json
  4. 44 3
      src/app/app.component.ts
  5. 26 1
      src/app/app.html
  6. 5 1
      src/app/app.module.ts
  7. 6 34
      src/pages/main/main.html
  8. 19 38
      src/pages/main/main.ts

+ 1 - 0
config.xml Vedi File

@@ -91,4 +91,5 @@
91 91
     <plugin name="cordova-sqlite-storage" spec="^2.2.1" />
92 92
     <allow-navigation href="http://192.168.43.167:8100" />
93 93
     <plugin name="cordova-plugin-x-socialsharing" spec="^5.3.2" />
94
+    <plugin name="uk.co.workingedge.phonegap.plugin.launchnavigator" spec="^4.2.0" />
94 95
 </widget>

+ 20 - 0
package-lock.json Vedi File

@@ -101,6 +101,11 @@
101 101
       "resolved": "https://registry.npmjs.org/@ionic-native/google-maps/-/google-maps-4.5.3.tgz",
102 102
       "integrity": "sha512-7CYuU3fy2WbOGMg3AI0/PH+0eg5lFShv9+3NT4/HiihHmMR6mGCdVvpZZaKHeAFkBXcFwHcjZjGId4SAASHoBg=="
103 103
     },
104
+    "@ionic-native/launch-navigator": {
105
+      "version": "4.6.0",
106
+      "resolved": "https://registry.npmjs.org/@ionic-native/launch-navigator/-/launch-navigator-4.6.0.tgz",
107
+      "integrity": "sha512-4BO2r/E1rnar+H/KIPbzBDwfsgUOVduFDfcU9Jx/bkB31FRbZKeW268jBFzZlPxOrg+hazmjs0w11ibgItDP9w=="
108
+    },
104 109
     "@ionic-native/social-sharing": {
105 110
       "version": "4.6.0",
106 111
       "resolved": "https://registry.npmjs.org/@ionic-native/social-sharing/-/social-sharing-4.6.0.tgz",
@@ -1319,11 +1324,21 @@
1319 1324
         }
1320 1325
       }
1321 1326
     },
1327
+    "cordova-plugin-actionsheet": {
1328
+      "version": "2.3.3",
1329
+      "resolved": "https://registry.npmjs.org/cordova-plugin-actionsheet/-/cordova-plugin-actionsheet-2.3.3.tgz",
1330
+      "integrity": "sha1-6SYbLQBKjaQHOI1g31NMFWxS/xE="
1331
+    },
1322 1332
     "cordova-plugin-device": {
1323 1333
       "version": "2.0.1",
1324 1334
       "resolved": "https://registry.npmjs.org/cordova-plugin-device/-/cordova-plugin-device-2.0.1.tgz",
1325 1335
       "integrity": "sha1-m54jE+aCEZ/4QC9oCWo4vMUBNZM="
1326 1336
     },
1337
+    "cordova-plugin-dialogs": {
1338
+      "version": "2.0.1",
1339
+      "resolved": "https://registry.npmjs.org/cordova-plugin-dialogs/-/cordova-plugin-dialogs-2.0.1.tgz",
1340
+      "integrity": "sha1-N/7xUSWWyNXflUP7eHJFkPdn3PM="
1341
+    },
1327 1342
     "cordova-plugin-googlemaps": {
1328 1343
       "version": "2.2.5",
1329 1344
       "resolved": "https://registry.npmjs.org/cordova-plugin-googlemaps/-/cordova-plugin-googlemaps-2.2.5.tgz",
@@ -6249,6 +6264,11 @@
6249 6264
         }
6250 6265
       }
6251 6266
     },
6267
+    "uk.co.workingedge.phonegap.plugin.launchnavigator": {
6268
+      "version": "4.2.0",
6269
+      "resolved": "https://registry.npmjs.org/uk.co.workingedge.phonegap.plugin.launchnavigator/-/uk.co.workingedge.phonegap.plugin.launchnavigator-4.2.0.tgz",
6270
+      "integrity": "sha1-B7NHCzOpwUAVivRigpauIkw0YaU="
6271
+    },
6252 6272
     "ultron": {
6253 6273
       "version": "1.1.1",
6254 6274
       "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz",

+ 6 - 1
package.json Vedi File

@@ -22,12 +22,15 @@
22 22
     "@angular/platform-browser-dynamic": "5.0.3",
23 23
     "@ionic-native/core": "4.4.0",
24 24
     "@ionic-native/google-maps": "^4.5.3",
25
+    "@ionic-native/launch-navigator": "^4.6.0",
25 26
     "@ionic-native/social-sharing": "^4.6.0",
26 27
     "@ionic-native/splash-screen": "4.4.0",
27 28
     "@ionic-native/status-bar": "4.4.0",
28 29
     "@ionic/storage": "^2.1.3",
29 30
     "cordova-android": "7.0.0",
31
+    "cordova-plugin-actionsheet": "^2.3.3",
30 32
     "cordova-plugin-device": "^2.0.1",
33
+    "cordova-plugin-dialogs": "^2.0.1",
31 34
     "cordova-plugin-googlemaps": "^2.2.5",
32 35
     "cordova-plugin-ionic-keyboard": "^2.0.5",
33 36
     "cordova-plugin-ionic-webview": "^1.1.16",
@@ -40,6 +43,7 @@
40 43
     "ionicons": "3.0.0",
41 44
     "rxjs": "5.5.2",
42 45
     "sw-toolbox": "3.6.0",
46
+    "uk.co.workingedge.phonegap.plugin.launchnavigator": "^4.2.0",
43 47
     "zone.js": "0.8.18"
44 48
   },
45 49
   "devDependencies": {
@@ -60,7 +64,8 @@
60 64
         "ANDROID_SUPPORT_V4_VERSION": "24.1.0"
61 65
       },
62 66
       "cordova-sqlite-storage": {},
63
-      "cordova-plugin-x-socialsharing": {}
67
+      "cordova-plugin-x-socialsharing": {},
68
+      "uk.co.workingedge.phonegap.plugin.launchnavigator": {}
64 69
     },
65 70
     "platforms": [
66 71
       "android"

+ 44 - 3
src/app/app.component.ts Vedi File

@@ -1,16 +1,23 @@
1
-import { Component } from '@angular/core';
2
-import { Platform } from 'ionic-angular';
1
+import { Component, ViewChild } from '@angular/core';
2
+import { Platform, Nav, AlertController } from 'ionic-angular';
3 3
 import { StatusBar } from '@ionic-native/status-bar';
4 4
 import { SplashScreen } from '@ionic-native/splash-screen';
5
+import { Storage } from '@ionic/storage';
5 6
 
6 7
 import { HomePage } from '../pages/home/home';
8
+import { DevicesPage } from '../pages/devices/devices';
9
+import { ConfigurationPage } from '../pages/configuration/configuration';
10
+
7 11
 @Component({
8 12
   templateUrl: 'app.html'
9 13
 })
10 14
 export class MyApp {
15
+  @ViewChild(Nav) nav: Nav;
11 16
   rootPage:any = HomePage;
12 17
 
13
-  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
18
+  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen,
19
+    private alertCtrl: AlertController,
20
+  private storage: Storage) {
14 21
     /*platform.ready().then(() => {
15 22
       // Okay, so the platform is ready and our plugins are available.
16 23
       // Here you can do any higher level native things you might need.
@@ -18,4 +25,38 @@ export class MyApp {
18 25
       splashScreen.hide();
19 26
     });*/
20 27
   }
28
+
29
+  openDevicesPage() {
30
+    this.nav.push(DevicesPage);
31
+  }
32
+
33
+  openConfigurationPage() {
34
+    this.nav.push(ConfigurationPage);
35
+  }
36
+
37
+  closeSession() {
38
+    let alert = this.alertCtrl.create({
39
+      title: 'Confirmación',
40
+      message: 'Realmente desea cerrar Sesión?',
41
+      buttons: [{
42
+        text: 'Si',
43
+        handler: () => {
44
+          this.storage.set('authentication', '');
45
+          this.storage.set('remember', false);
46
+          this.storage.set('rootDevice', null);
47
+          this.storage.set('startAlarm', false);
48
+          this.storage.set('time', 30);
49
+      	  this.nav.setRoot(HomePage);
50
+        }
51
+      },{
52
+        text: 'No',
53
+        handler: () => {
54
+          alert.dismiss();
55
+          return false;
56
+        }
57
+      }]
58
+    });
59
+    alert.present();
60
+  }
61
+
21 62
 }

+ 26 - 1
src/app/app.html Vedi File

@@ -1 +1,26 @@
1
-<ion-nav [root]="rootPage"></ion-nav>
1
+<ion-menu [content]="content" >
2
+  <ion-header>
3
+    <ion-toolbar  color="primary">
4
+      <ion-title>Menu</ion-title>
5
+    </ion-toolbar>
6
+  </ion-header>
7
+  <ion-content>
8
+      <ion-list>
9
+           <button ion-item menuClose (click)="openDevicesPage()">
10
+             <ion-icon name="car"></ion-icon>
11
+               Dispositivos
12
+          </button>
13
+          <button ion-item menuClose (click)="openConfigurationPage()">
14
+            <ion-icon name="keypad"></ion-icon>
15
+              Configuración
16
+          </button>
17
+          <button ion-item menuClose (click)="closeSession()">
18
+            <ion-icon name="close"></ion-icon>
19
+              Cerrar Sesión
20
+          </button>
21
+      </ion-list>
22
+  </ion-content>
23
+
24
+</ion-menu>
25
+
26
+<ion-nav [root]="rootPage" #content swipeBackEnabled="false"></ion-nav>

+ 5 - 1
src/app/app.module.ts Vedi File

@@ -6,6 +6,8 @@ import { StatusBar } from '@ionic-native/status-bar';
6 6
 import { HttpClientModule } from '@angular/common/http';
7 7
 import { GoogleMaps } from '@ionic-native/google-maps';
8 8
 import { IonicStorageModule } from '@ionic/storage';
9
+import { LaunchNavigator, LaunchNavigatorOptions } from '@ionic-native/launch-navigator';
10
+import { SocialSharing } from '@ionic-native/social-sharing';
9 11
 
10 12
 import { MyApp } from './app.component';
11 13
 import { HomePage } from '../pages/home/home';
@@ -43,7 +45,9 @@ import { ShareService } from '../services/share/share';
43 45
     GoogleMaps,
44 46
     {provide: ErrorHandler, useClass: IonicErrorHandler},
45 47
     VespotServiceProvider,
46
-    ShareService
48
+    ShareService,
49
+    LaunchNavigator,
50
+    SocialSharing
47 51
   ]
48 52
 })
49 53
 export class AppModule {}

+ 6 - 34
src/pages/main/main.html Vedi File

@@ -1,41 +1,13 @@
1
-<ion-menu [content]="vespotMenu" >
2
-  <ion-header>
3
-    <ion-toolbar  color="primary">
4
-      <ion-title>Menu</ion-title>
5
-    </ion-toolbar>
6
-  </ion-header>
7
-    <ion-content>
8
-        <ion-list>
9
-             <button ion-item menuClose (click)="openDevicesPage()">
10
-               <ion-icon name="car"></ion-icon>
11
-		             Dispositivos
12
-            </button>
13
-            <button ion-item menuClose (click)="openConfigurationPage()">
14
-              <ion-icon name="keypad"></ion-icon>
15
-                Configuración
16
-            </button>
17
-            <button ion-item menuClose (click)="closeSession()">
18
-              <ion-icon name="close"></ion-icon>
19
-                Cerrar Sesión
20
-            </button>
21
-        </ion-list>
22
-    </ion-content>
23
-</ion-menu>
24
-
25 1
 <ion-header>
26 2
   <ion-navbar color="primary">
27
-    <ion-buttons>
28
-      <button ion-button menuToggle="left">
29
-      <ion-icon name="menu"></ion-icon>
30
-      <ion-title>SMART ALARM</ion-title>
31
-    </button>
32
-    </ion-buttons>
33
-
34
-    <ion-nav #vespotMenu ></ion-nav>
3
+      <button ion-button menuToggle>
4
+        <ion-icon name="menu"></ion-icon>
5
+      </button>
6
+    <ion-title>SMART ALARM</ion-title>
35 7
   </ion-navbar>
36 8
 </ion-header>
37 9
 
38
-<ion-content>
10
+<ion-content padding>
39 11
   <div id="map_canvas">
40 12
     <ion-fab right bottom>
41 13
       <button ion-fab color="primary"><ion-icon name="car"></ion-icon></button>
@@ -43,6 +15,6 @@
43 15
         <button ion-fab><ion-icon name="map" (click)="shareViaMaps()"></ion-icon></button>
44 16
         <button ion-fab><ion-icon name="logo-whatsapp" (click)="shareViaWhatsapp()"></ion-icon></button>
45 17
       </ion-fab-list>
46
-    </ion-fab>
18
+    </ion-fab>-
47 19
   </div>
48 20
 </ion-content>

+ 19 - 38
src/pages/main/main.ts Vedi File

@@ -3,8 +3,9 @@ import { NavController } from 'ionic-angular';
3 3
 import { AlertController } from 'ionic-angular';
4 4
 import { interval } from 'rxjs/observable/interval';
5 5
 import { Storage } from '@ionic/storage';
6
+import { LaunchNavigator, LaunchNavigatorOptions } from '@ionic-native/launch-navigator';
7
+import { SocialSharing } from '@ionic-native/social-sharing';
6 8
 
7
-import { HomePage } from '../home/home'
8 9
 import { DevicesPage } from '../devices/devices'
9 10
 import { ConfigurationPage } from '../configuration/configuration'
10 11
 import { ShareService } from '../../services/share/share';
@@ -39,7 +40,9 @@ export class Main {
39 40
   private googleMaps: GoogleMaps,
40 41
   private vespotService: VespotServiceProvider,
41 42
   public alertCtrl: AlertController,
42
-  private storage: Storage) {
43
+  private storage: Storage,
44
+  private launchNavigator: LaunchNavigator,
45
+  private socialSharing: SocialSharing) {
43 46
       this.devicesPage = DevicesPage;
44 47
       this.configurationPage = ConfigurationPage;
45 48
       this.devices = this.shareService.getDevices();
@@ -48,6 +51,8 @@ export class Main {
48 51
 
49 52
   }
50 53
 
54
+
55
+
51 56
   ionViewWillEnter() {
52 57
     if(typeof this.shareService.getRootDevice() == "undefined") {
53 58
       console.log('ionViewWillEnter: Entro al undefined');
@@ -102,40 +107,6 @@ export class Main {
102 107
       );
103 108
   }
104 109
 
105
-
106
-  openDevicesPage() {
107
-    this.navCtrl.push(DevicesPage);
108
-  }
109
-
110
-  openConfigurationPage() {
111
-    this.navCtrl.push(ConfigurationPage);
112
-  }
113
-
114
-  closeSession() {
115
-    let alert = this.alertCtrl.create({
116
-      title: 'Confirmación',
117
-      message: 'Realmente desea cerrar Sesión?',
118
-      buttons: [{
119
-        text: 'Si',
120
-        handler: () => {
121
-          this.storage.set('authentication', '');
122
-          this.storage.set('remember', false);
123
-          this.storage.set('rootDevice', null);
124
-          this.storage.set('startAlarm', false);
125
-          this.storage.set('time', 30);
126
-      	  this.navCtrl.setRoot(HomePage);
127
-        }
128
-      },{
129
-        text: 'No',
130
-        handler: () => {
131
-          alert.dismiss();
132
-          return false;
133
-        }
134
-      }]
135
-    });
136
-    alert.present();
137
-  }
138
-
139 110
   /**
140 111
   GOOGLE MAPS
141 112
   **/
@@ -181,6 +152,7 @@ export class Main {
181 152
       }
182 153
     });
183 154
     this.deviceMarker.showInfoWindow();
155
+    this.deviceMarker.setDisableAutoPan(true);
184 156
   }
185 157
 
186 158
   updateMarker() {
@@ -204,11 +176,20 @@ export class Main {
204 176
   }
205 177
 
206 178
   shareViaMaps() {
179
+    let options: LaunchNavigatorOptions = {
180
+      start: 'Bogota, ON'
181
+    };
207 182
 
183
+    this.launchNavigator.navigate([this.rootPosition.latitude, this.rootPosition.longitude], options)
184
+    .then(
185
+      success => console.log('Launched navigator'),
186
+      error => console.log('Error launching navigator', error)
187
+    );
208 188
   }
209 189
 
210
-  shareViaWhatsapp() {
211
-    
190
+  shareViaWhatsarpp() {
191
+    //http://maps.google.com/maps?&z={INSERT_MAP_ZOOM}&mrt={INSERT_TYPE_OF_SEARCH}&t={INSERT_MAP_TYPE}&q={INSERT_MAP_LAT_COORDINATES}+{INSERT_MAP_LONG_COORDINATES}
192
+    this.socialSharing.share('Posición de mi dispositivo', '', null, 'http://maps.google.com/maps?&z=15&mrt=yp&t=k&q=27.9879012+86.9253141')
212 193
   }
213 194
 
214 195
 }