Jorge Baquero 7 лет назад
Родитель
Сommit
817f9083b4
8 измененных файлов: 127 добавлений и 78 удалений
  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 Просмотреть файл

91
     <plugin name="cordova-sqlite-storage" spec="^2.2.1" />
91
     <plugin name="cordova-sqlite-storage" spec="^2.2.1" />
92
     <allow-navigation href="http://192.168.43.167:8100" />
92
     <allow-navigation href="http://192.168.43.167:8100" />
93
     <plugin name="cordova-plugin-x-socialsharing" spec="^5.3.2" />
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
 </widget>
95
 </widget>

+ 20 - 0
package-lock.json Просмотреть файл

101
       "resolved": "https://registry.npmjs.org/@ionic-native/google-maps/-/google-maps-4.5.3.tgz",
101
       "resolved": "https://registry.npmjs.org/@ionic-native/google-maps/-/google-maps-4.5.3.tgz",
102
       "integrity": "sha512-7CYuU3fy2WbOGMg3AI0/PH+0eg5lFShv9+3NT4/HiihHmMR6mGCdVvpZZaKHeAFkBXcFwHcjZjGId4SAASHoBg=="
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
     "@ionic-native/social-sharing": {
109
     "@ionic-native/social-sharing": {
105
       "version": "4.6.0",
110
       "version": "4.6.0",
106
       "resolved": "https://registry.npmjs.org/@ionic-native/social-sharing/-/social-sharing-4.6.0.tgz",
111
       "resolved": "https://registry.npmjs.org/@ionic-native/social-sharing/-/social-sharing-4.6.0.tgz",
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
     "cordova-plugin-device": {
1332
     "cordova-plugin-device": {
1323
       "version": "2.0.1",
1333
       "version": "2.0.1",
1324
       "resolved": "https://registry.npmjs.org/cordova-plugin-device/-/cordova-plugin-device-2.0.1.tgz",
1334
       "resolved": "https://registry.npmjs.org/cordova-plugin-device/-/cordova-plugin-device-2.0.1.tgz",
1325
       "integrity": "sha1-m54jE+aCEZ/4QC9oCWo4vMUBNZM="
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
     "cordova-plugin-googlemaps": {
1342
     "cordova-plugin-googlemaps": {
1328
       "version": "2.2.5",
1343
       "version": "2.2.5",
1329
       "resolved": "https://registry.npmjs.org/cordova-plugin-googlemaps/-/cordova-plugin-googlemaps-2.2.5.tgz",
1344
       "resolved": "https://registry.npmjs.org/cordova-plugin-googlemaps/-/cordova-plugin-googlemaps-2.2.5.tgz",
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
     "ultron": {
6272
     "ultron": {
6253
       "version": "1.1.1",
6273
       "version": "1.1.1",
6254
       "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz",
6274
       "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz",

+ 6 - 1
package.json Просмотреть файл

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

+ 44 - 3
src/app/app.component.ts Просмотреть файл

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
 import { StatusBar } from '@ionic-native/status-bar';
3
 import { StatusBar } from '@ionic-native/status-bar';
4
 import { SplashScreen } from '@ionic-native/splash-screen';
4
 import { SplashScreen } from '@ionic-native/splash-screen';
5
+import { Storage } from '@ionic/storage';
5
 
6
 
6
 import { HomePage } from '../pages/home/home';
7
 import { HomePage } from '../pages/home/home';
8
+import { DevicesPage } from '../pages/devices/devices';
9
+import { ConfigurationPage } from '../pages/configuration/configuration';
10
+
7
 @Component({
11
 @Component({
8
   templateUrl: 'app.html'
12
   templateUrl: 'app.html'
9
 })
13
 })
10
 export class MyApp {
14
 export class MyApp {
15
+  @ViewChild(Nav) nav: Nav;
11
   rootPage:any = HomePage;
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
     /*platform.ready().then(() => {
21
     /*platform.ready().then(() => {
15
       // Okay, so the platform is ready and our plugins are available.
22
       // Okay, so the platform is ready and our plugins are available.
16
       // Here you can do any higher level native things you might need.
23
       // Here you can do any higher level native things you might need.
18
       splashScreen.hide();
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 Просмотреть файл

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 Просмотреть файл

6
 import { HttpClientModule } from '@angular/common/http';
6
 import { HttpClientModule } from '@angular/common/http';
7
 import { GoogleMaps } from '@ionic-native/google-maps';
7
 import { GoogleMaps } from '@ionic-native/google-maps';
8
 import { IonicStorageModule } from '@ionic/storage';
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
 import { MyApp } from './app.component';
12
 import { MyApp } from './app.component';
11
 import { HomePage } from '../pages/home/home';
13
 import { HomePage } from '../pages/home/home';
43
     GoogleMaps,
45
     GoogleMaps,
44
     {provide: ErrorHandler, useClass: IonicErrorHandler},
46
     {provide: ErrorHandler, useClass: IonicErrorHandler},
45
     VespotServiceProvider,
47
     VespotServiceProvider,
46
-    ShareService
48
+    ShareService,
49
+    LaunchNavigator,
50
+    SocialSharing
47
   ]
51
   ]
48
 })
52
 })
49
 export class AppModule {}
53
 export class AppModule {}

+ 6 - 34
src/pages/main/main.html Просмотреть файл

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
 <ion-header>
1
 <ion-header>
26
   <ion-navbar color="primary">
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
   </ion-navbar>
7
   </ion-navbar>
36
 </ion-header>
8
 </ion-header>
37
 
9
 
38
-<ion-content>
10
+<ion-content padding>
39
   <div id="map_canvas">
11
   <div id="map_canvas">
40
     <ion-fab right bottom>
12
     <ion-fab right bottom>
41
       <button ion-fab color="primary"><ion-icon name="car"></ion-icon></button>
13
       <button ion-fab color="primary"><ion-icon name="car"></ion-icon></button>
43
         <button ion-fab><ion-icon name="map" (click)="shareViaMaps()"></ion-icon></button>
15
         <button ion-fab><ion-icon name="map" (click)="shareViaMaps()"></ion-icon></button>
44
         <button ion-fab><ion-icon name="logo-whatsapp" (click)="shareViaWhatsapp()"></ion-icon></button>
16
         <button ion-fab><ion-icon name="logo-whatsapp" (click)="shareViaWhatsapp()"></ion-icon></button>
45
       </ion-fab-list>
17
       </ion-fab-list>
46
-    </ion-fab>
18
+    </ion-fab>-
47
   </div>
19
   </div>
48
 </ion-content>
20
 </ion-content>

+ 19 - 38
src/pages/main/main.ts Просмотреть файл

3
 import { AlertController } from 'ionic-angular';
3
 import { AlertController } from 'ionic-angular';
4
 import { interval } from 'rxjs/observable/interval';
4
 import { interval } from 'rxjs/observable/interval';
5
 import { Storage } from '@ionic/storage';
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
 import { DevicesPage } from '../devices/devices'
9
 import { DevicesPage } from '../devices/devices'
9
 import { ConfigurationPage } from '../configuration/configuration'
10
 import { ConfigurationPage } from '../configuration/configuration'
10
 import { ShareService } from '../../services/share/share';
11
 import { ShareService } from '../../services/share/share';
39
   private googleMaps: GoogleMaps,
40
   private googleMaps: GoogleMaps,
40
   private vespotService: VespotServiceProvider,
41
   private vespotService: VespotServiceProvider,
41
   public alertCtrl: AlertController,
42
   public alertCtrl: AlertController,
42
-  private storage: Storage) {
43
+  private storage: Storage,
44
+  private launchNavigator: LaunchNavigator,
45
+  private socialSharing: SocialSharing) {
43
       this.devicesPage = DevicesPage;
46
       this.devicesPage = DevicesPage;
44
       this.configurationPage = ConfigurationPage;
47
       this.configurationPage = ConfigurationPage;
45
       this.devices = this.shareService.getDevices();
48
       this.devices = this.shareService.getDevices();
48
 
51
 
49
   }
52
   }
50
 
53
 
54
+
55
+
51
   ionViewWillEnter() {
56
   ionViewWillEnter() {
52
     if(typeof this.shareService.getRootDevice() == "undefined") {
57
     if(typeof this.shareService.getRootDevice() == "undefined") {
53
       console.log('ionViewWillEnter: Entro al undefined');
58
       console.log('ionViewWillEnter: Entro al undefined');
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
   GOOGLE MAPS
111
   GOOGLE MAPS
141
   **/
112
   **/
181
       }
152
       }
182
     });
153
     });
183
     this.deviceMarker.showInfoWindow();
154
     this.deviceMarker.showInfoWindow();
155
+    this.deviceMarker.setDisableAutoPan(true);
184
   }
156
   }
185
 
157
 
186
   updateMarker() {
158
   updateMarker() {
204
   }
176
   }
205
 
177
 
206
   shareViaMaps() {
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
 }