예제 #1
0
 public ContactRequest(MContactRequest contactRequest)
 {
     Handle           = contactRequest.getHandle();
     SourceEmail      = contactRequest.getSourceEmail();
     SourceMessage    = contactRequest.getSourceMessage();
     TargetEmail      = contactRequest.getTargetEmail();
     CreationTime     = contactRequest.getCreationTime();
     ModificationTime = contactRequest.getModificationTime();
     Status           = contactRequest.getStatus();
     IsOutgoing       = contactRequest.isOutgoing();
 }
예제 #2
0
        public void onContactRequestsUpdate(MegaSDK api, MContactRequestList requests)
        {
            // Exit methods when contact request list is incorrect
            if (requests == null || requests.size() < 1)
            {
                return;
            }

            try
            {
                bool isIncomingContactRequestUpdate = false;
                bool isOutgoingContactRequestUpdate = false;

                // Retrieve the listsize for performance reasons and store local
                int listSize = requests.size();

                for (int i = 0; i < listSize; i++)
                {
                    // Get the specific contact request that has an update.
                    // If null exit the method and process no notification.
                    MContactRequest megaContactRequest = requests.get(i);
                    if (megaContactRequest == null)
                    {
                        return;
                    }

                    if (megaContactRequest.isOutgoing())
                    {
                        isOutgoingContactRequestUpdate = true;
                    }
                    else
                    {
                        isIncomingContactRequestUpdate = true;
                    }
                }

                if (isIncomingContactRequestUpdate)
                {
                    OnIncomingContactRequestUpdated();
                }
                if (isOutgoingContactRequestUpdate)
                {
                    OnOutgoingContactRequestUpdated();
                }
            }
            catch (Exception) { /* Dummy catch, suppress possible exception */ }
        }
예제 #3
0
        public ContactRequestViewModel(MContactRequest contactRequest, ContactRequestsListViewModel contactRequestsList)
        {
            MegaContactRequest = contactRequest;
            Handle             = contactRequest.getHandle();
            SourceEmail        = contactRequest.getSourceEmail();
            SourceMessage      = contactRequest.getSourceMessage();
            TargetEmail        = contactRequest.getTargetEmail();
            CreationTime       = contactRequest.getCreationTime();
            ModificationTime   = contactRequest.getModificationTime();
            Status             = contactRequest.getStatus();
            IsOutgoing         = contactRequest.isOutgoing();

            AvatarColor = UiService.GetColorFromHex(
                SdkService.MegaSdk.getUserHandleAvatarColor(Handle.ToString()));

            this.ContactRequestsList = contactRequestsList;

            this.AcceptContactRequestCommand  = new RelayCommand(AcceptContact);
            this.IgnoreContactRequestCommand  = new RelayCommand(IgnoreContact);
            this.DeclineContactRequestCommand = new RelayCommand(DeclineContact);
            this.RemindContactRequestCommand  = new RelayCommand(RemindContact);
            this.CancelContactRequestCommand  = new RelayCommand(CancelContact);
        }