Skip to content

Commit

Permalink
Merge pull request #27 from Tawkie/feature-logo-chat-list
Browse files Browse the repository at this point in the history
Feature logo chat list
  • Loading branch information
ignyx authored May 17, 2024
2 parents 1e6d265 + 00c736a commit 5a31357
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 0 deletions.
Binary file added assets/discord.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/linkedin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/signal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions lib/config/themes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ abstract class FluffyThemes {
static const Color facebookColor = Color(0xFF00B2FF);
static const Color instagramColor = Color(0xFFE1306C);
static const Color whatsAppColor = Color(0xFF25D366);
static const Color linkedinColor = Color(0xFF0077B5);
static const Color dicordColor = Color(0xFF7289DA);
static const Color signalColor = Color(0xFF3A76F0);

static var fallbackTextTheme = const TextTheme(
bodyLarge: fallbackTextStyle,
Expand Down
59 changes: 59 additions & 0 deletions lib/pages/chat_list/chat_list_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,18 @@ class ChatListItem extends StatelessWidget {
return participantsIds.any((id) => id.contains('@whatsapp'));
}

bool containsLinkedin(List<String> participantsIds) {
return participantsIds.any((id) => id.contains('@linkedin'));
}

bool containsDiscord(List<String> participantsIds) {
return participantsIds.any((id) => id.contains('@discord'));
}

bool containsSignal(List<String> participantsIds) {
return participantsIds.any((id) => id.contains('@signal'));
}

void removeFacebookTag() {
if (displayname.contains('(FB)')) {
displayname = displayname.replaceAll('(FB)', ''); // Delete (FB)
Expand All @@ -110,6 +122,29 @@ class ChatListItem extends StatelessWidget {
}
}

void removeLinkedinTag() {
if (displayname.contains('(Linkedin)')) {
displayname =
displayname.replaceAll('(Linkedin)', ''); // Delete (Linkedin)
}
}

// It's the only bridge that doesn't display the social network source in the name.
// But I'm putting this function here just in case, for the future.
void removeDiscordTag() {
if (displayname.contains('(Discord)')) {
displayname =
displayname.replaceAll('(Discord)', ''); // Delete (Discord)
}
}

void removeSignalTag() {
if (displayname.contains('(Signal)')) {
displayname =
displayname.replaceAll('(Signal)', ''); // Delete (Linkedin)
}
}

// Condition for verifying the presence of social networks in participants ID
Future<List<dynamic>> loadRoomInfo() async {
List<User> participants = room.getParticipants();
Expand Down Expand Up @@ -141,6 +176,30 @@ class ChatListItem extends StatelessWidget {
filterQuality: FilterQuality.high,
);
removeWhatsAppTag();
} else if (containsLinkedin(participantsIds)) {
networkColor = FluffyThemes.linkedinColor;
networkImage = Image.asset(
'assets/linkedin.png',
color: networkColor,
filterQuality: FilterQuality.high,
);
removeLinkedinTag();
} else if (containsDiscord(participantsIds)) {
networkColor = FluffyThemes.dicordColor;
networkImage = Image.asset(
'assets/discord.png',
color: networkColor,
filterQuality: FilterQuality.high,
);
removeDiscordTag();
} else if (containsSignal(participantsIds)) {
networkColor = FluffyThemes.signalColor;
networkImage = Image.asset(
'assets/signal.png',
color: networkColor,
filterQuality: FilterQuality.high,
);
removeSignalTag();
}

return [networkColor, networkImage];
Expand Down

0 comments on commit 5a31357

Please sign in to comment.