1using System.ComponentModel;
3using System.Windows.Input;
4using CommunityToolkit.Mvvm.ComponentModel;
5using CommunityToolkit.Mvvm.Input;
30 private readonly ICommand toggleSubscriptionCommand;
48 public string UniqueName => this.contact?.ThingNotificationCategoryKey ??
string.Empty;
78 public string?
SourceId => this.contact?.SourceId;
83 public string?
Partition => this.contact?.Partition;
88 public string?
NodeId => this.contact?.NodeId;
108 public bool?
IsThing => this.contact?.IsThing;
113 public bool?
Owner => this.contact?.Owner;
128 public bool HasEvents => this.events is not
null && this.events.Length > 0;
142 if (
string.IsNullOrEmpty(this.contact?.
BareJid))
163 return Item.LastPresence.Availability
switch
165 Availability.Online or Availability.Chat =>
AppColors.TnPSuccessFigure,
166 Availability.Away or Availability.ExtendedAway =>
AppColors.TnPWarningContent,
167 Availability.DoNotDisturb =>
AppColors.TnPDangerContent,
180 if (
string.IsNullOrEmpty(this.contact?.
BareJid))
181 return AppColors.ButtonNeutralNavButtonsOnContainerbgActive;
190 return AppColors.ButtonNeutralNavButtonsOnContainerbgActive;
193 return AppColors.ButtonNeutralNavButtonsOnContainerbgActive;
195 return AppColors.ButtonNeutralNavButtonsOnContainerbgActive;
197 return AppColors.ButtonNeutralNavButtonsOnContainerbgActive;
199 return Item.LastPresence.Availability
switch
201 Availability.Online or Availability.Chat =>
AppColors.TnPSuccessBg,
202 Availability.Away or Availability.ExtendedAway =>
AppColors.TnPWarningBg,
203 Availability.DoNotDisturb =>
AppColors.TnPDangerContent,
204 _ =>
AppColors.ButtonNeutralNavButtonsOnContainerbgActive,
213 if (
string.IsNullOrEmpty(this.contact?.
BareJid))
226 return Item.State == SubscriptionState.To || Item.State ==
SubscriptionState.Both;
241 return !
string.IsNullOrEmpty(this.contact?.
BareJid);
249 if (
string.IsNullOrEmpty(this.contact?.
BareJid))
268 Subscribed = Item.State == SubscriptionState.To || Item.State ==
SubscriptionState.Both;
287 bool? Remove = await ViewModel.
Result;
289 if (Remove.HasValue && Remove.Value)
293 if ((this.contact?.
AllowSubscriptionFrom.HasValue ??
false) && this.contact.AllowSubscriptionFrom.Value)
295 this.contact.AllowSubscriptionFrom =
null;
307 bool? SubscribeTo = await ViewModel.
Result;
309 if (SubscribeTo.HasValue && SubscribeTo.Value)
314 IdXml =
string.Empty;
317 StringBuilder Xml =
new();
319 IdXml = Xml.ToString();
347 this.
PropertyChanged?.Invoke(
this,
new PropertyChangedEventArgs(PropertyName));
379 if (this.events is
null)
385 if (Event2.ObjectId == Event.ObjectId)
389 int c = this.events.Length;
391 Array.Copy(this.events, 0, NewArray, 0, c);
404 if (this.events is not
null)
406 int i, c = this.events.Length;
408 for (i = 0; i < c; i++)
412 if (Event2.ObjectId == Event.ObjectId)
417 Array.Copy(this.events, 0, NewArray, 0, i);
420 Array.Copy(this.events, i + 1, NewArray, i, c - i - 1);
432 public async Task ViewContact()
434 if (this.LegalIdentity is not
null)
436 ViewIdentityNavigationArgs ViewIdentityArgs =
new(this.
LegalIdentity);
440 else if (!
string.IsNullOrEmpty(this.LegalId))
448 public async Task ViewChat()
450 if (!
string.IsNullOrEmpty(this.BareJid) && this.Contact is not
null)
A strongly-typed resource class, for looking up localized strings, etc.
static string Yes
Looks up a localized string similar to Yes.
static string Cancel
Looks up a localized string similar to Cancel.
static string Question
Looks up a localized string similar to Question.
static string NetworkSeemsToBeMissing
Looks up a localized string similar to Network seems to be missing. Please check your configuration a...
static string Ok
Looks up a localized string similar to OK.
static string RemoveSubscriptionFrom
Looks up a localized string similar to Do you want to remove the presence subscription from {0}?...
static string ScannedQrCode
Looks up a localized string similar to Scanned QR Code.
static string Error
Looks up a localized string similar to Error.
Base class that references services in the app.
static ILogService LogService
Log service.
static IUiService UiService
Service serializing and managing UI-related tasks.
static INavigationService NavigationService
The navigation service for navigating between pages.
static IPopupService PopupService
Popup service for presenting application popups.
static ITagProfile TagProfile
TAG Profile service.
static IContractOrchestratorService ContractOrchestratorService
Contract orchestrator service.
static IReportingStringLocalizer Localizer
Localization service
static IXmppService XmppService
The XMPP service for XMPP communication.
Static class that gives access to app-specific themed colors. All colors are fetched directly from th...
Holds navigation parameters specific to views displaying a list of contacts.
A page that displays a list of the current user's contacts.
Contact Information model, including related notification information.
bool CanToggleSubscription()
If toggle subscription can be performed on the contact.
LegalIdentity? LegalIdentity
Legal Identity object.
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.
Color ConnectionSecondaryColor
Secondary Color representing the current connection state of the contact.
A page to display when the user wants to view an identity.
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.
Task GoToAsync(string Route)
Navigates to the specified route and pushes the page onto the navigation stack.
Task< bool > DisplayAlert(string Title, string Message, string? Accept=null, string? Cancel=null)
Displays an alert/message box to the user.
abstract class NotificationEvent()
Abstract base class of notification events.
BackMethod
Navigation Back Method
SubscriptionState
State of a presence subscription.