1using System.ComponentModel;
3using System.Windows.Input;
25 private readonly ICommand toggleSubscriptionCommand;
41 public string UniqueName => this.contact?.ThingNotificationCategoryKey ??
string.Empty;
71 public string?
SourceId => this.contact?.SourceId;
76 public string?
Partition => this.contact?.Partition;
81 public string?
NodeId => this.contact?.NodeId;
101 public bool?
IsThing => this.contact?.IsThing;
106 public bool?
Owner => this.contact?.Owner;
121 public bool HasEvents => this.events is not
null && this.events.Length > 0;
135 if (
string.IsNullOrEmpty(this.contact?.
BareJid))
136 return Colors.Transparent;
145 return Colors.Transparent;
148 return Colors.Transparent;
151 return Colors.Transparent;
154 return Colors.LightSalmon;
156 return Item.LastPresence.Availability
switch
158 Availability.Online or Availability.Chat => Colors.LightGreen,
159 Availability.Away or Availability.ExtendedAway => Colors.LightYellow,
160 _ => Colors.LightSalmon,
176 return !
string.IsNullOrEmpty(this.contact?.
BareJid);
184 if (
string.IsNullOrEmpty(this.contact?.
BareJid))
203 Subscribed = Item.State == SubscriptionState.To || Item.State ==
SubscriptionState.Both;
208 ServiceRef.
Localizer[nameof(AppResources.RemoveSubscriptionFrom),
this.FriendlyName ??
string.Empty],
221 await MopupService.Instance.PushAsync(Page);
222 bool? Remove = await ViewModel.
Result;
224 if (Remove.HasValue && Remove.Value)
228 if ((this.contact?.
AllowSubscriptionFrom.HasValue ??
false) && this.contact.AllowSubscriptionFrom.Value)
230 this.contact.AllowSubscriptionFrom =
null;
241 await MopupService.Instance.PushAsync(Page);
242 bool? SubscribeTo = await ViewModel.
Result;
244 if (SubscribeTo.HasValue && SubscribeTo.Value)
249 IdXml =
string.Empty;
252 StringBuilder Xml =
new();
254 IdXml = Xml.ToString();
278 this.
PropertyChanged?.Invoke(
this,
new PropertyChangedEventArgs(PropertyName));
310 if (this.events is
null)
316 if (Event2.ObjectId == Event.ObjectId)
320 int c = this.events.Length;
322 Array.Copy(this.events, 0, NewArray, 0, c);
335 if (this.events is not
null)
337 int i, c = this.events.Length;
339 for (i = 0; i < c; i++)
343 if (Event2.ObjectId == Event.ObjectId)
348 Array.Copy(this.events, 0, NewArray, 0, i);
351 Array.Copy(this.events, i + 1, NewArray, i, c - i - 1);
Base class that references services in the app.
static ILogService LogService
Log service.
static IUiService UiService
Service serializing and managing UI-related tasks.
static ITagProfile TagProfile
TAG Profile service.
static IStringLocalizer Localizer
Localization service
static IXmppService XmppService
The XMPP service for XMPP communication.
Contact Information model, including related notification information.
bool CanToggleSubscription()
If toggle subscription can be performed on the contact.
ContactInfoModel(ContactInfo? Contact, params NotificationEvent[] Events)
Contact Information model, including related notification information.
string? Partition
Partition
NotificationEvent[] Events
Notification events.
string? SourceId
Source ID
CaseInsensitiveString? RegistryJid
Registry JID
CaseInsensitiveString? LegalId
Legal ID of contact.
bool? Owner
If the account is registered as the owner of the thing.
bool? SubcribeTo
Subscribe to this contact
int NrEvents
Number of events associated with contact.
string? FriendlyName
Friendly name.
async Task ToggleSubscription()
Subscribes to an unsubscribed contact; unsubscribes from a subscribed one, with user permission.
void RemoveEvent(NotificationEvent Event)
Removes a notification event.
string UniqueName
Unique name used to compare items.
void PresenceUpdated()
Method called when presence for contact has been updated.
bool HasEvents
If the contact has associated events.
Color ConnectionColor
A color representing the current connection state of the contact.
ContactInfo? Contact
Contact Information object in database.
bool? IsThing
The contact is a thing
PropertyChangedEventHandler? PropertyChanged
Occurs when a property value changes.
ICommand ToggleSubscriptionCommand
Command to execute when user wants to toggle XMPP subcription.
void AddEvent(NotificationEvent Event)
Adds a notification event.
bool? AllowSubscriptionFrom
Allow subscriptions from this contact
void OnPropertyChanged(string PropertyName)
Called when a property has changed.
Property?[] MetaData
Meta-data related to a thing.
void NotificationsUpdated(NotificationEvent[] Events)
Method called when notifications for the item have been updated.
CaseInsensitiveString? BareJid
Bare JID of contact.
LegalIdentity()
Legal identity
Maintains information about an item in the roster.
SubscriptionState State
roup Current subscription state.
bool HasLastPresence
If the roster item has received presence from an online resource having the given bare JID.
Represents a case-insensitive string.
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static async Task Update(object Object)
Updates an object in the database.
abstract class NotificationEvent()
Abstract base class of notification events.
SubscriptionState
State of a presence subscription.