Skip to content

Commit

Permalink
feat update
Browse files Browse the repository at this point in the history
  • Loading branch information
sansan88 committed Oct 18, 2023
1 parent 62c3e89 commit e74d71f
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 5 deletions.
19 changes: 17 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@capacitor/haptics": "5.0.6",
"@capacitor/ios": "5.5.0",
"@capacitor/keyboard": "5.0.6",
"@capacitor/network": "^5.0.6",
"@capacitor/share": "5.0.6",
"@capacitor/splash-screen": "5.0.6",
"@capacitor/status-bar": "5.0.6",
Expand Down Expand Up @@ -109,4 +110,4 @@
}
},
"description": "myclub App"
}
}
32 changes: 31 additions & 1 deletion src/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit } from "@angular/core";
import { SwPush, SwUpdate, VersionEvent } from "@angular/service-worker";
import { AlertController, MenuController } from "@ionic/angular";
import { AlertController, MenuController, ToastController } from "@ionic/angular";
import { AuthService } from "./services/auth.service";
import packagejson from "./../../package.json";
import { FirebaseService } from "./services/firebase.service";
Expand All @@ -10,6 +10,7 @@ import { Subscription, take } from "rxjs";
import { onAuthStateChanged } from "@angular/fire/auth";
import { UserProfileService } from "./services/firebase/user-profile.service";
import { Device, DeviceId, DeviceInfo } from "@capacitor/device";
import { Network, ConnectionStatus } from '@capacitor/network';

@Component({
selector: "app-root",
Expand All @@ -31,6 +32,7 @@ export class AppComponent implements OnInit {
private readonly swUpdate: SwUpdate,
private readonly swPush: SwPush,
private readonly alertController: AlertController,
private readonly toastController: ToastController,
private readonly authService: AuthService,
private readonly fbService: FirebaseService,
private readonly profileService: UserProfileService,
Expand Down Expand Up @@ -95,6 +97,31 @@ export class AppComponent implements OnInit {
});
}
ngOnInit(): void {

Network.addListener('networkStatusChange', async (status:ConnectionStatus) => {

if (!status.connected) {
const toast = await this.toastController.create({
message: "Du bist offline",
duration: 1500,
position: "top",
color: "danger",
});
await toast.present();
} else {
const toast = await this.toastController.create({
message: "Du bist online",
duration: 1500,
position: "top",
color: "success",
});
await toast.present();
}

});



this.requestSubscription();
this.swPush.messages.subscribe( message =>{
console.log(message);
Expand All @@ -105,6 +132,9 @@ export class AppComponent implements OnInit {
}

ngOnDestroy() {

Network.removeAllListeners();

// this.pushNotificationClickSubscription.unsubscribe();
// this.pushMessageSubscription.unsubscribe();
// this.swPush.unsubscribe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ export class TrainingCreatePage implements OnInit {

this.trainingCopy = this.navParams.get("data");
if (this.trainingCopy.id) {
console.log(this.trainingCopy)
console.log(this.trainingCopy.endDate);
const startDate: Timestamp = this.trainingCopy.startDate as any;
const endDate: Timestamp = this.trainingCopy.endDate as any;
this.training = this.trainingCopy;
this.training.startDate = startDate.toDate().toISOString();
this.training.endDate = endDate.toDate().toISOString();
}

let teamsList: any[] = [];
Expand Down

0 comments on commit e74d71f

Please sign in to comment.