Skip to content

Commit

Permalink
feat update
Browse files Browse the repository at this point in the history
  • Loading branch information
sansan88 committed Dec 20, 2023
1 parent 6d38e1d commit ece11c8
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 81 deletions.
58 changes: 29 additions & 29 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@fortawesome/fontawesome-svg-core": "6.4.2",
"@fortawesome/free-brands-svg-icons": "6.4.2",
"@fortawesome/free-solid-svg-icons": "6.4.2",
"@ionic/angular": "7.6.0",
"@ionic/angular": "7.6.1",
"@ionic/pwa-elements": "^3.1.1",
"@ngx-translate/core": "^15.0.0",
"@ngx-translate/http-loader": "^8.0.0",
Expand Down
8 changes: 6 additions & 2 deletions src/app/pages/club/club.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
-->
</ion-list>
<ion-list [inset]="true" *ngIf="club['clubRequests'].length > 0">
<ion-list-header> {{"common.requests" | translate}} </ion-list-header>
<ion-list-header>
<ion-label> {{"common.requests" | translate}} </ion-label>
</ion-list-header>
<ion-item *ngFor="let request of club['clubRequests']" detail="true">
<ion-icon
slot="start"
Expand All @@ -47,7 +49,9 @@
</ion-list>

<ion-list [inset]="true">
<ion-list-header> {{"common.members" | translate}} </ion-list-header>
<ion-list-header>
<ion-label> {{"common.members" | translate}} </ion-label>
</ion-list-header>
<ion-item *ngFor="let member of club['clubMembers']" detail="true">
<ion-avatar slot="start">
<img src="{{member?.profilePicture}}" />
Expand Down
81 changes: 38 additions & 43 deletions src/app/pages/club/club.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ export class ClubPage implements OnInit {
club$: Observable<any>;
subscribeMember: Subscription;

memberList$: Observable<Profile[]>;
adminList$: Observable<Profile[]>;
requestList$: Observable<Profile[]>;

user$: Observable<User>;
user: User;

Expand All @@ -59,12 +55,11 @@ export class ClubPage implements OnInit {
private readonly authService: AuthService,
private cdr: ChangeDetectorRef,
private translate: TranslateService
) { }
) {}

ngOnInit() {
this.club = this.navParams.get("data");
this.club.clubAdmins = [];
this.club.clubMembers = [];

this.club$ = of(this.club);
this.club$ = this.getClub(this.club.id);
}
Expand Down Expand Up @@ -175,44 +170,44 @@ export class ClubPage implements OnInit {
async addAdministrator() {
let memberSelect = [];

this.subscribeMember = this.club$.pipe(
take(1),
tap((club) => {
console.log(club);
club.clubMembers.forEach((member) => {
if (!club.clubAdmins.find((element) => element.id === member.id)) {
memberSelect.push({
type: "checkbox",
name: member.id,
label: `${member.firstName} ${member.lastName}`,
value: member,
checked: false,
this.subscribeMember = this.club$
.pipe(
take(1),
tap((club) => {
console.log(club);
club.clubMembers.forEach((member) => {
if (!club.clubAdmins.find((element) => element.id === member.id)) {
memberSelect.push({
type: "checkbox",
name: member.id,
label: `${member.firstName} ${member.lastName}`,
value: member,
checked: false,
});
}
});
}),
finalize(async () => {
if (memberSelect.length > 0) {
const alert = await this.alertCtrl.create({
header: "Administrator hinzufügen",
inputs: memberSelect,
buttons: [
{
text: "Abbrechen",
handler: () => console.log("Cancel clicked"),
},
{
text: "Hinzufügen",
handler: (data) => console.log(data),
},
],
});
await alert.present();
}

});
}),
finalize(async () => {
if (memberSelect.length > 0) {
const alert = await this.alertCtrl.create({
header: "Administrator hinzufügen",
inputs: memberSelect,
buttons: [
{
text: "Abbrechen",
handler: () => console.log("Cancel clicked"),
},
{
text: "Hinzufügen",
handler: (data) => console.log(data),
},
],
});
await alert.present();
}
})
).subscribe();

})
)
.subscribe();

/*
let memberSelect = [];
Expand Down
14 changes: 8 additions & 6 deletions src/app/services/firebase/user-profile.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class UserProfileService {
}

async addPushSubscriber(
sub: PushSubscription, // WebPush
sub: PushSubscription, // WebPush
deviceId: DeviceId,
deviceInfo: DeviceInfo,
token: string // native
Expand All @@ -91,17 +91,19 @@ export class UserProfileService {
const pushObject = JSON.stringify(sub);
const userProfileRef: DocumentReference<DocumentData> = doc(
this.firestore,
`userProfile/${user.uid}/push/${deviceId.identifier}`
// `userProfile/${user.uid}/push/${deviceId.identifier}`
`userProfile/${user.uid}/push/${deviceInfo.model}`
);

return setDoc(userProfileRef, {
pushObject: pushObject && "{}",
updated: new Date(),
identifier: deviceId.identifier,
token: token || "", // Set token for native Web Push
pushObject: pushObject || "{}", // Set token for web push
model: deviceInfo.model || "",
operatingSystem: deviceInfo.operatingSystem || "",
osVersion: deviceInfo.osVersion || "",
platform: deviceInfo.platform || "", // --> set to "Web" for Web Push from Backend or "Native" for Native Push from firebase
token: token || "", // Set token for native Web Push
updated: new Date(),
});
}

Expand All @@ -122,7 +124,7 @@ export class UserProfileService {
async changeSettingsPushModule(state: boolean, module) {
const user = this.authService.auth.currentUser;
const userProfileRef = doc(this.firestore, `userProfile/${user.uid}`);
return updateDoc(userProfileRef, { ['settingsPush' + module]: state });
return updateDoc(userProfileRef, { ["settingsPush" + module]: state });
}

async changeSettingsEmail(state: boolean) {
Expand Down

0 comments on commit ece11c8

Please sign in to comment.