Exemple #1
0
        public async Task OverwriteContacts(IEnumerable <Contact> mergedContacts)
        {
            try
            {
                var granted = _permissionRequest.CheckAndRequestPermissions(Permission.WriteExternalStorage);
                if (!granted)
                {
                    return;
                }

                using var writer    = new StreamWriter(_path);
                await using var csv = new CsvWriter(writer, CultureInfo.InvariantCulture);
                await csv.WriteRecordsAsync(mergedContacts);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemple #2
0
        public Task <IEnumerable <ReceivedTextMessage> > ReadMessage(string startTag, DateTime fromDate)
        {
            return(Task.Run(() =>
            {
                try
                {
                    var granted = _permissionRequest.CheckAndRequestPermissions(Permission.ReadSms);
                    if (!granted)
                    {
                        return Enumerable.Empty <ReceivedTextMessage>();
                    }

                    return ReadMessagePrivate(startTag, fromDate);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    return Enumerable.Empty <ReceivedTextMessage>();
                }
            }));
        }