bledeviceChanged(value) {
   this.blescan = false;
   this.datastream = [];
   if (this.platform.is('mobile')) {
     BluetoothSerial.connect(value).then(
       value => {
         this.datastream.push("connect ok:" + JSON.stringify(value));
         console.log(value);
         this.watcher = BluetoothSerial.subscribe('\n').subscribe(
           (data) => {
             this.datastream.push("subscribe data:" + JSON.stringify(data));
             this.userData.setBluetoothData(data);
             console.log("subscribe data" + data);
           },
           (err) => {
             this.datastream.push("subscribe err:" + JSON.stringify(data));
             console.log("subscribeRaw err:" + data);
           }
         );
       },
       err => {
         this.datastream.push("connect err:" + JSON.stringify(err));
         console.error(err);
       }
     );
   } else {
     var data = '{\"id\":\"0000000001\",\"pr\":127,\"tp\":22.0,\"ba\":2.95}\r\n';
     this.datastream.push(JSON.stringify(data));
     this.userData.setBluetoothData(data);
   }
 }
 constructor(
   public platform: Platform,
   public elementRef: ElementRef,
   public renderer: Renderer) {
   this.isAndroid = platform.is('android');
   renderer.setElementAttribute(elementRef.nativeElement, 'primary', this.isAndroid ? '' : null);
 }
Example #3
0
  openMenu() {
    let actionSheet = ActionSheet.create({
      title: 'Albums',
      cssClass: 'action-sheets-basic-page',
      buttons: [
        {
          text: 'Delete',
          role: 'destructive',
          icon: !this.platform.is('ios') ? 'trash' : null,
          handler: () => {
            console.log('Delete clicked');
          }
        },
        {
          text: 'Share',
          icon: !this.platform.is('ios') ? 'share' : null,
          handler: () => {
            console.log('Share clicked');
          }
        },
        {
          text: 'Play',
          icon: !this.platform.is('ios') ? 'arrow-dropright-circle' : null,
          handler: () => {
            console.log('Play clicked');
          }
        },
        {
          text: 'Favorite',
          icon: !this.platform.is('ios') ? 'heart-outline' : null,
          handler: () => {
            console.log('Favorite clicked');
          }
        },
        {
          text: 'Cancel',
          role: 'cancel', // will always sort to be on the bottom
          icon: !this.platform.is('ios') ? 'close' : null,
          handler: () => {
            console.log('Cancel clicked');
          }
        }
      ]
    });

    this.nav.present(actionSheet);
  }
Example #4
0
  ionViewDidLoad() {
    if (this.platform.is('cordova') === true) {
      let mapEle = document.getElementById('map_canvas');
      this.confData.getMap().subscribe(mapData => {
        this.map = new GoogleMap('map_canvas');
        mapEle.classList.add('show-map');

        GoogleMap.isAvailable().then(() => {
          mapData.find(data => {
            const position = new GoogleMapsLatLng(43.074395, -89.381056);

            this.map.animateCamera({
              target: position,
              zoom: 16
            }).then(() => {
              mapData.forEach(markerData => {
                const markerOptions: GoogleMapsMarkerOptions = {
                  position: markerData,
                  title: markerData.name
                };

                this.map.addMarker(markerOptions);
              });
            });
          });
        });
      });
    } else {
      this.confData.getMap().subscribe(mapData => {
        let mapEle = document.getElementById('map_canvas');

        let map = new google.maps.Map(mapEle, {
          center: mapData.find(d => d.center),
          zoom: 16
        });

        mapData.forEach(markerData => {
          let infoWindow = new google.maps.InfoWindow({
            content: `<h5>${markerData.name}</h5>`
          });

          let marker = new google.maps.Marker({
            position: markerData,
            map: map,
            title: markerData.name
          });

          marker.addListener('click', () => {
            infoWindow.open(map, marker);
          });
        });

        google.maps.event.addListenerOnce(map, 'idle', () => {
          mapEle.classList.add('show-map');
        });

      });
    }
  }
Example #5
0
 reviewApp() {
   if(this.platform.is('ios')) {
     window.open(`itms-apps://itunes.apple.com/app/viewContentsUserReviews/id1186113597`, '_system');
   }
   else {
     this.appRate.promptForRating(true);
   }
 }
Example #6
0
 platform.ready().then(() => {
   // Okay, so the platform is ready and our plugins are available.
   // Here you can do any higher level native things you might need.
   if (platform.is('cordova')) {
     StatusBar.styleDefault();
     Splashscreen.hide();
   }
 });
Example #7
0
 openMenu() {
   let actionSheet = this.actionsheetCtrl.create({
     title: "Albums",
     cssClass: "action-sheets-basic-page",
     buttons: [
       {
         text: "Delete",
         role: "destructive",
         icon: !this.platform.is("ios") ? "trash" : null,
         handler: () => {
           console.log("Delete clicked");
         }
       },
       {
         text: "Share",
         icon: !this.platform.is("ios") ? "share" : null,
         handler: () => {
           console.log("Share clicked");
         }
       },
       {
         text: "Play",
         icon: !this.platform.is("ios") ? "arrow-dropright-circle" : null,
         handler: () => {
           console.log("Play clicked");
         }
       },
       {
         text: "Favorite",
         icon: !this.platform.is("ios") ? "heart-outline" : null,
         handler: () => {
           console.log("Favorite clicked");
         }
       },
       {
         text: "Cancel",
         role: "cancel", // will always sort to be on the bottom
         icon: !this.platform.is("ios") ? "close" : null,
         handler: () => {
           console.log("Cancel clicked");
         }
       }
     ]
   });
   actionSheet.present();
 }
Example #8
0
  blurActiveInput() {
    if (!this.platform.is("iOS")) return;

    var activeElement:any = document.activeElement;
    if(activeElement.tagName == "INPUT" || activeElement.tagName == "TEXTAREA") {
      activeElement.blur();
    }
  }  
Example #9
0
 private actuallyShow(text) {
   if (this.platform.is('cordova')) {
     Toast.show(text, '1500', 'bottom').subscribe();
   }
   else {
     console.log(`Toast: ${text}`);
   }
 }
 createEditButton(message, handler) {
   
   return {
       text: this.translate.instant(message),
       icon: !this.platform.is('ios') ? 'create' : null,
       cssClass: 'WorkoutAction-edit',
       handler
     } 
 }