Force Neos bot account status to be always online
This commit is contained in:
parent
a9424cc84b
commit
801881cc07
1 changed files with 4 additions and 1 deletions
|
@ -3,6 +3,7 @@ import 'package:contacts_plus_plus/models/user_profile.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
class Friend implements Comparable {
|
||||
static const _neosBotId = "U-Neos";
|
||||
final String id;
|
||||
final String username;
|
||||
final String ownerId;
|
||||
|
@ -16,11 +17,13 @@ class Friend implements Comparable {
|
|||
});
|
||||
|
||||
factory Friend.fromMap(Map map) {
|
||||
final userStatus = UserStatus.fromMap(map["userStatus"]);
|
||||
return Friend(
|
||||
id: map["id"],
|
||||
username: map["friendUsername"],
|
||||
ownerId: map["ownerId"] ?? map["id"],
|
||||
userStatus: UserStatus.fromMap(map["userStatus"]),
|
||||
// Neos bot status is always offline but should be displayed as online
|
||||
userStatus: map["id"] == _neosBotId ? userStatus.copyWith(onlineStatus: OnlineStatus.online) : userStatus,
|
||||
userProfile: UserProfile.fromMap(map["profile"] ?? {}),
|
||||
friendStatus: FriendStatus.fromString(map["friendStatus"]),
|
||||
latestMessageTime: map["latestMessageTime"] == null
|
||||
|
|
Loading…
Reference in a new issue