feat: invitations to show the real phone number after accepting the invitation

This commit is contained in:
sBubshait 2025-08-07 04:25:15 +03:00
parent 766a2d8f28
commit 3b50c997fa
4 changed files with 27 additions and 6 deletions

View File

@ -183,6 +183,7 @@ public class InvitationResponse {
private Long id;
private String displayName;
private String avatar;
private String phoneNumber;
private LocalDateTime joinedAt;
public AttendeeDto() {}
@ -211,6 +212,14 @@ public class InvitationResponse {
this.avatar = avatar;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public LocalDateTime getJoinedAt() {
return joinedAt;
}

View File

@ -240,6 +240,7 @@ public class InvitationService {
dto.setId(attendee.getUser().getId());
dto.setDisplayName(attendee.getUser().getDisplayName());
dto.setAvatar(attendee.getUser().getAvatar());
dto.setPhoneNumber(attendee.getUser().getPhoneNumber());
dto.setJoinedAt(attendee.getJoinedAt());
return dto;
})

View File

@ -34,11 +34,13 @@ class InvitationCreator {
final int id;
final String displayName;
final String? avatar;
final String? phoneNumber;
InvitationCreator({
required this.id,
required this.displayName,
this.avatar,
this.phoneNumber,
});
factory InvitationCreator.fromJson(Map<String, dynamic> json) {
@ -46,6 +48,7 @@ class InvitationCreator {
id: json['id'],
displayName: json['displayName'],
avatar: json['avatar'],
phoneNumber: json['phoneNumber'],
);
}
@ -54,6 +57,7 @@ class InvitationCreator {
'id': id,
'displayName': displayName,
'avatar': avatar,
'phoneNumber': phoneNumber,
};
}
}
@ -63,12 +67,14 @@ class InvitationAttendee {
final String displayName;
final String? avatar;
final DateTime joinedAt;
final String? phoneNumber;
InvitationAttendee({
required this.id,
required this.displayName,
this.avatar,
required this.joinedAt,
this.phoneNumber,
});
factory InvitationAttendee.fromJson(Map<String, dynamic> json) {
@ -77,6 +83,7 @@ class InvitationAttendee {
displayName: json['displayName'],
avatar: json['avatar'],
joinedAt: DateTime.parse(json['joinedAt']),
phoneNumber: json['phoneNumber'],
);
}
@ -86,6 +93,7 @@ class InvitationAttendee {
'displayName': displayName,
'avatar': avatar,
'joinedAt': joinedAt.toIso8601String(),
'phoneNumber': phoneNumber,
};
}
}

View File

@ -6,8 +6,7 @@ import '../../utils/invitation_utils.dart';
import '../../widgets/whatsapp_button.dart';
// WhatsApp configuration
const String _whatsappNumber = 'PHONE_NUMBER';
const bool _showWhatsappButton = true; // Set to false for production
const bool _showWhatsappButton = true;
class InvitationDetailsPage extends StatefulWidget {
final int invitationId;
@ -545,10 +544,12 @@ class _InvitationDetailsPageState extends State<InvitationDetailsPage> {
),
),
if ((widget.isOwner || _isCurrentlyParticipant) &&
_showWhatsappButton) ...[
_showWhatsappButton &&
_invitationDetails!.creator.phoneNumber != null &&
_invitationDetails!.creator.phoneNumber!.isNotEmpty) ...[
SizedBox(width: 8),
WhatsAppButton(
phoneNumber: _whatsappNumber,
phoneNumber: _invitationDetails!.creator.phoneNumber!,
size: 28,
),
],
@ -633,10 +634,12 @@ class _InvitationDetailsPageState extends State<InvitationDetailsPage> {
),
if ((widget.isOwner ||
_isCurrentlyParticipant) &&
_showWhatsappButton) ...[
_showWhatsappButton &&
attendee.phoneNumber != null &&
attendee.phoneNumber!.isNotEmpty) ...[
SizedBox(width: 8),
WhatsAppButton(
phoneNumber: _whatsappNumber,
phoneNumber: attendee.phoneNumber!,
size: 24,
),
],