1using CommunityToolkit.Mvvm.ComponentModel;
2using CommunityToolkit.Mvvm.Input;
8using System.Collections.ObjectModel;
31 this.navigationArguments = Args;
39 this.@
event = Args.
Event;
47 if (this.FriendlyName == this.BareJid)
50 this.RemoteFriendlyNameAvailable = this.RemoteFriendlyName != this.RemoteJid;
51 if (!this.RemoteFriendlyNameAvailable)
59 await base.OnInitialize();
61 if (this.navigationArguments is not
null)
67 if (Thing?.MetaData is not
null)
74 this.CallerInContactsList = Caller is not
null;
75 if (Caller?.MetaData is not
null)
86 this.SelectedRuleRangeIndex = 0;
95 public ObservableCollection<HumanReadableTag>
Tags {
get; }
100 public ObservableCollection<HumanReadableTag>
CallerTags {
get; }
105 public ObservableCollection<RuleRangeModel>
RuleRanges {
get; }
111 private string? bareJid;
117 private string? friendlyName;
123 private string? remoteJid;
129 private string? remoteFriendlyName;
135 private bool remoteFriendlyNameAvailable;
147 private string? provisioningService;
153 private bool callerInContactsList;
159 private int selectedRuleRangeIndex;
167 private static Task Click(
object obj)
171 else if (obj is
string s)
174 return Task.CompletedTask;
181 private async Task AddContact()
183 if (!this.CallerInContactsList)
187 BareJid = this.RemoteJid,
188 FriendlyName = (this.RemoteFriendlyNameAvailable ? this.RemoteFriendlyName : this.RemoteJid) ??
string.Empty
193 this.CallerInContactsList =
true;
201 private async Task RemoveContact()
203 if (this.CallerInContactsList)
206 if (Info is not
null)
209 this.CallerInContactsList =
false;
215 return this.SelectedRuleRangeIndex
switch
227 private void Accept()
236 private void Reject()
241 private void Respond(
bool Accepts)
244 FriendshipResolver Resolver =
new(this.BareJid ??
string.Empty, this.RemoteJid ??
string.Empty, Range);
247 this.BareJid ??
string.Empty,
this.RemoteJid ??
string.Empty,
this.Key ??
string.Empty, Accepts, Range,
248 this.ResponseHandler, Resolver);
251 private async Task ResponseHandler(
object? Sender, IqResultEventArgs e)
255 if (this.@event is not
null)
260 MainThread.BeginInvokeOnMainThread(async () =>
267 MainThread.BeginInvokeOnMainThread(async () => await
ServiceRef.
UiService.DisplayException(e.StanzaError ??
276 private async Task Ignore()
278 if (this.@event is not
null)
Base class that references services in the app.
static IUiService UiService
Service serializing and managing UI-related tasks.
static INotificationService NotificationService
Service for managing notifications for the user.
static ITagProfile TagProfile
TAG Profile service.
static IStringLocalizer Localizer
Localization service
static IXmppService XmppService
The XMPP service for XMPP communication.
virtual async Task GoBack()
Method called when user wants to navigate to the previous screen.
Class used to present a meta-data tag in a human interface.
Holds navigation parameters specific to displaying the is-friend provisioning question.
The view model to bind to when displaying a thing.
IsFriendViewModel(IsFriendNavigationArgs? Args)
Creates an instance of the IsFriendViewModel class.
override async Task OnInitialize()
Method called when view is initialized for the first time. Use this method to implement registration ...
ObservableCollection< RuleRangeModel > RuleRanges
Available Rule Ranges
ObservableCollection< HumanReadableTag > CallerTags
Holds a list of meta-data tags associated with the caller.
ObservableCollection< HumanReadableTag > Tags
Holds a list of meta-data tags associated with a thing.
string? Key
Provisioning key
string? BareJid
Bare JID of device.
ProvisioningNotificationEvent? Event
Notification event object.
string? RemoteFriendlyName
Friendly name of remote entity.
string? FriendlyName
Friendly name of device.
string? RemoteJid
Bare JID of remote entity trying to connect to device.
string? ProvisioningService
Provisioning Service
The view model to bind to for when displaying thing claim information.
static async Task LabelClicked(string Name, string Value, string LocalizedValue)
Processes the click of a localized meta-data label.
A view model that holds the XMPP state.
Manages an XMPP client connection. Implements XMPP, as defined in https://tools.ietf....
static string GetDomain(string JID)
Gets the domain part of a JID.
Static interface for database persistence. In order to work, a database provider has to be assigned t...
static async Task Delete(object Object)
Deletes an object in the database.
static async Task Insert(object Object)
Inserts an object into the default collection of the database.
Interface for event resolvers. Such can be used to resolve multiple pending notifications at once.
Task DeleteEvents(NotificationEventType Type, CaseInsensitiveString Category)
Deletes events for a given button and category.
Task DeleteResolvedEvents(IEventResolver Resolver)
Deletes pending events that have already been resolved.
abstract class NotificationEvent()
Abstract base class of notification events.
class RuleRangeModel(object RuleRange, string Label)
Rule Range model
RuleRange
Range of a rule change