예제 #1
0
        protected override async Task Archive(ReaderItem item)
        {
            await CacheService.DeleteArticle(item);

            Items.Remove(item);
            await CacheService.SaveLocalItems(Items);
        }
예제 #2
0
        private async Task SaveItemFromExternal(UriSchemeMessage message, Action errorAction = null)
        {
            HomeButtonIsVisible = true;
            var        allOk = true;
            ReaderItem item  = null;

            try
            {
                IsSavingVisible = true;

                item = await _readerHelper.HandleProtocolMessage(message);
            }
            catch (Exception ex)
            {
                Log.ErrorException("ShareMessage", ex);
                allOk = false;
            }

            if (item != null)
            {
                await SetReaderItem(item, autostart : false);
            }

            IsSavingVisible = false;


            if (allOk && _canStart)
            {
                StartStopTimer();
            }
            else
            {
                errorAction?.Invoke();
            }
        }
예제 #3
0
        protected override async Task <ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return(null);
            }

            if (!isRefresh)
            {
                var article = await CacheService.GetArticle(item);

                if (article != null)
                {
                    return(article);
                }
            }

            var text = await GetArticleText(item.Id);

            var result = new ReaderItem();

            item.CopyItem(result);
            result.Text       = text.StripHtmlTags();
            item.Text         = result.Text.ToExcerpt();
            item.IsDownloaded = !string.IsNullOrEmpty(result.Text);
            await CacheService.SaveArticle(result).ConfigureAwait(false);

            return(result);
        }
예제 #4
0
        protected override async Task <ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return(null);
            }

            if (!isRefresh)
            {
                var article = await CacheService.GetArticle(item);

                if (article != null)
                {
                    return(article);
                }
            }

            var response = await _readabilityClient.GetArticleAsync(item.Id);

            if (response != null)
            {
                var article = response.ToReaderItem();
                item.IsDownloaded = !string.IsNullOrEmpty(article.Text);
                await CacheService.SaveArticle(article).ConfigureAwait(false);

                return(article);
            }

            return(null);
        }
예제 #5
0
        protected override async Task Archive(ReaderItem item)
        {
            if (!AuthenticationService.IsLoggedIntoReadability)
            {
                return;
            }
            var id     = int.Parse(item.Id);
            var failed = false;

            try
            {
                await _readabilityClient.SetBookmarkArchiveStateAsync(id, true);
            }
            catch (Exception ex)
            {
                Log.ErrorException("ArchiveArticle", ex);
                failed = true;
            }

            if (!failed)
            {
                var itemToRemove = Items.FirstOrDefault(x => x.Id == item.Id);
                if (itemToRemove != null)
                {
                    Items.Remove(itemToRemove);
                }

                CacheService.SaveReadabilityItems(Items).ConfigureAwait(false);

                await CacheService.DeleteArticle(item);
            }
        }
예제 #6
0
        protected override async Task Archive(ReaderItem item)
        {
            if (!AuthenticationService.IsLoggedInToPocket)
            {
                return;
            }
            var failed = false;

            try
            {
                if (!await _pocketClient.Archive(item.Id))
                {
                    failed = true;
                }
            }
            catch (Exception ex)
            {
                Log.ErrorException("PocketArchiveMessage", ex);
                failed = true;
            }

            if (!failed)
            {
                var itemToDelete = Items.FirstOrDefault(x => x.Id == item.Id);
                if (itemToDelete == null)
                {
                    return;
                }

                Items.Remove(itemToDelete);
                CacheService.SavePocketItems(Items).ConfigureAwait(false);

                await CacheService.DeleteArticle(item);
            }
        }
예제 #7
0
        protected override async Task<ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return null;
            }

            if (!isRefresh)
            {
                var article = await CacheService.GetArticle(item);
                if (article != null)
                {
                    return article;
                }
            }

            var text = await GetArticleText(item.Id);
            var result = new ReaderItem();
            item.CopyItem(result);
            result.Text = text.StripHtmlTags();
            item.Text = result.Text.ToExcerpt();
            item.IsDownloaded = !string.IsNullOrEmpty(result.Text);
            await CacheService.SaveArticle(result).ConfigureAwait(false);

            return result;
        }
예제 #8
0
        public async Task DeleteArticle(ReaderItem item)
        {
            var filename = GetFileName(item.InternalId);

            if (await _storage.Local.FileExistsAsync(filename))
            {
                await _storage.Local.DeleteFileAsync(filename);
            }
        }
예제 #9
0
        protected override async Task<ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return null;
            }

            var article = await CacheService.GetArticle(item);

            return article;
        }
예제 #10
0
        protected override async Task <ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return(null);
            }

            var article = await CacheService.GetArticle(item);

            return(article);
        }
예제 #11
0
        protected virtual async Task FullPage(ReaderItem item)
        {
            var article = await GetArticle(item);

            if (article == null)
            {
                return;
            }

            FullPageViewModel.ReaderItem = article;
            NavigationService.Navigate <FullPageView>();
        }
예제 #12
0
        public async Task SaveArticle(ReaderItem item)
        {
            var filename = GetFileName(item.InternalId);

            using (var file = await _storage.Local.CreateFileAsync(filename))
            {
                using (var writer = new BinaryWriter(file))
                {
                    writer.Write(item);
                }
            }
        }
예제 #13
0
        protected virtual async Task Reader(ReaderItem item)
        {
            var article = await GetArticle(item);

            if (article == null)
            {
                return;
            }

            ReaderViewModel.SetReaderItem(article);
            NavigationService.Navigate <ReaderView>();
        }
예제 #14
0
        private async Task Save(Action navigationAction = null)
        {
            var text = _loader.GetString("Saving.Text");
            SetProgressBar(text);

            var copyItem = new ReaderItem();
            ReaderItem.CopyItem(copyItem);
            await _readerHelper.SaveEditedArticle(copyItem);

            SetProgressBar();

            navigationAction?.Invoke();
        }
예제 #15
0
        private async Task Save(Action navigationAction = null)
        {
            var text = _loader.GetString("Saving.Text");

            SetProgressBar(text);

            var copyItem = new ReaderItem();

            ReaderItem.CopyItem(copyItem);
            await _readerHelper.SaveEditedArticle(copyItem);

            SetProgressBar();

            navigationAction?.Invoke();
        }
예제 #16
0
        public static ReaderItem ToReaderItem(this Bookmark article)
        {
            var result = new ReaderItem
            {
                Id = article.Id.ToString(),
                Source = SourceProvider.Instapaper,
                Author = string.Empty,
                Title = article.Title ?? string.Empty,
                Url = article.Url ?? string.Empty,
                Excerpt = article.Description ?? string.Empty,
                Text= string.Empty,
                CreatedDate = article.Time ?? DateTime.Now
            };

            return result;
        }
예제 #17
0
        public static ReaderItem ToReaderItem(this Bookmark article)
        {
            var result = new ReaderItem
            {
                Id          = article.Id.ToString(),
                Source      = SourceProvider.Instapaper,
                Author      = string.Empty,
                Title       = article.Title ?? string.Empty,
                Url         = article.Url ?? string.Empty,
                Excerpt     = article.Description ?? string.Empty,
                Text        = string.Empty,
                CreatedDate = article.Time ?? DateTime.Now
            };

            return(result);
        }
예제 #18
0
        public static ReaderItem ToReaderItem(this PocketArticle article)
        {
            var result = new ReaderItem
            {
                Id = article.ID ?? string.Empty,
                Source= SourceProvider.Pocket,
                Author = article.Authors == null ? string.Empty : string.Join(", ", article.Authors) ?? string.Empty,
                Title = article.Title ?? string.Empty,
                Url = article.Uri.AbsoluteUri ?? string.Empty,
                Excerpt = string.Empty,
                Text = article.Content.StripHtmlTags() ?? string.Empty,
                CreatedDate = article.PublishedTime ?? DateTime.Now
            };

            result.WordCount = string.IsNullOrEmpty(result.Text) ? 0 : result.Text.Split(new[] {' '}).Length;
            return result;
        }
예제 #19
0
        public static ReaderItem ToReaderItem(this PocketArticle article)
        {
            var result = new ReaderItem
            {
                Id          = article.ID ?? string.Empty,
                Source      = SourceProvider.Pocket,
                Author      = article.Authors == null ? string.Empty : string.Join(", ", article.Authors) ?? string.Empty,
                Title       = article.Title ?? string.Empty,
                Url         = article.Uri.AbsoluteUri ?? string.Empty,
                Excerpt     = string.Empty,
                Text        = article.Content.StripHtmlTags() ?? string.Empty,
                CreatedDate = article.PublishedTime ?? DateTime.Now
            };

            result.WordCount = string.IsNullOrEmpty(result.Text) ? 0 : result.Text.Split(new[] { ' ' }).Length;
            return(result);
        }
예제 #20
0
        public static ReaderItem ToReaderItem(this Article article)
        {
            var result = new ReaderItem
            {
                Id = article.Id ?? string.Empty,
                Source = SourceProvider.Readability,
                Author = article.Author ?? string.Empty,
                Title = article.Title ?? string.Empty,
                Url = article.Url ?? string.Empty,
                Excerpt = article.Excerpt ?? string.Empty,
                WordCount = article.WordCount,
                CreatedDate = article.DatePublished ?? DateTime.Now,
                Text = string.IsNullOrEmpty(article.Content) ? string.Empty : article.Content.StripHtmlTags()
            };

            return result;
        }
예제 #21
0
        public static ReaderItem ToReaderItem(this ExtendedPocketItem article)
        {
            var result = new ReaderItem
            {
                Id          = article.ResolvedId ?? string.Empty,
                Source      = SourceProvider.Pocket,
                Author      = article.Authors == null ? string.Empty : string.Join(", ", article.Authors) ?? string.Empty,
                Title       = article.DisplayTitle ?? string.Empty,
                Text        = string.Empty,
                Url         = article.Uri.ToString() ?? string.Empty,
                Excerpt     = article.Excerpt ?? string.Empty,
                CreatedDate = article.UpdateTime ?? DateTime.Now
            };

            result.WordCount = string.IsNullOrEmpty(result.Text) ? 0 : result.Text.Split(new[] { ' ' }).Length;
            return(result);
        }
예제 #22
0
        public static ReaderItem ToReaderItem(this ExtendedPocketItem article)
        {
            var result = new ReaderItem
            {
                Id = article.ResolvedId ?? string.Empty,
                Source = SourceProvider.Pocket,
                Author = article.Authors == null ? string.Empty : string.Join(", ", article.Authors) ?? string.Empty,
                Title = article.DisplayTitle ?? string.Empty,
                Text = string.Empty,
                Url = article.Uri.ToString() ?? string.Empty,
                Excerpt = article.Excerpt ?? string.Empty,
                CreatedDate = article.UpdateTime ?? DateTime.Now
            };

            result.WordCount = string.IsNullOrEmpty(result.Text) ? 0 : result.Text.Split(new[] { ' ' }).Length;
            return result;
        }
예제 #23
0
        public static ReaderItem ToReaderItem(this Article article)
        {
            var result = new ReaderItem
            {
                Id          = article.Id ?? string.Empty,
                Source      = SourceProvider.Readability,
                Author      = article.Author ?? string.Empty,
                Title       = article.Title ?? string.Empty,
                Url         = article.Url ?? string.Empty,
                Excerpt     = article.Excerpt ?? string.Empty,
                WordCount   = article.WordCount,
                CreatedDate = article.DatePublished ?? DateTime.Now,
                Text        = string.IsNullOrEmpty(article.Content) ? string.Empty : article.Content.StripHtmlTags()
            };

            return(result);
        }
예제 #24
0
        private ReaderItem CopyReaderItem(int?wordsRead = null)
        {
            var readerItem = new ReaderItem();

            SelectedItem.CopyItem(readerItem);
            if (wordsRead.HasValue)
            {
                readerItem.WordsRead = wordsRead.Value;
            }

            if (string.IsNullOrEmpty(readerItem.Excerpt))
            {
                readerItem.Excerpt = readerItem.Text.ToExcerpt();
            }

            readerItem.Text = string.Empty;
            return(readerItem);
        }
예제 #25
0
        public async Task <ReaderItem> GetArticle(ReaderItem item)
        {
            var filename = GetFileName(item.InternalId);

            if (!await _storage.Local.FileExistsAsync(filename))
            {
                return(null);
            }

            using (var file = await _storage.Local.OpenFileForReadAsync(filename))
            {
                using (var reader = new BinaryReader(file))
                {
                    var cachedItem = reader.ReadGeneric <ReaderItem>();
                    return(cachedItem);
                }
            }
        }
예제 #26
0
        public async Task SetReaderItem(ReaderItem item, bool isRestarting = false, bool autostart = true)
        {
            ReaderFont   = _settingsService.ReaderFont;
            SelectedItem = item;
            GetInProgressItems().ConfigureAwait(false);
            AddToRecent().ConfigureAwait(false);
            IsPaused = false;
            if (!isRestarting)
            {
                _canStart = false;
            }

            WordsList      = null;
            TimeRemaining  = null;
            _readerTimer   = null;
            WordsPerMinute = _settingsService.WordsPerMin;
            SelectedIndex  = -1;
            SetProgressBar("Preparing article...");

            SelectedItem.WordsRead = GetWordsRead();

            var words = item.Text.Clean().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            if (_settingsService.WordsAtATime == 1)
            {
                WordsList = words.ToList();
                SetTimings();
                SetProgressBar();
            }
            else
            {
                var list = words.ToWordList(_settingsService.WordsAtATime);
                WordsList = list;
                SetTimings();
                SetProgressBar();
            }

            if (_canStart && autostart)
            {
                StartStopTimer();
                return;
            }
            _canStart = true;
        }
예제 #27
0
        protected override async Task Archive(ReaderItem item)
        {
            if (!AuthenticationService.IsLoggedIntoInstapaper)
            {
                return;
            }
            var id     = int.Parse(item.Id);
            var failed = false;

            try
            {
                var archivedItem = await _instapaperClient.ArchiveBookmarkAsync(id);

                if (archivedItem == null || archivedItem.Response == null)
                {
                    failed = true;
                }
            }
            catch (Exception ex)
            {
                Log.ErrorException("ArchiveArticle", ex);
                failed = true;
            }

            if (!failed)
            {
                var itemToRemove = Items.FirstOrDefault(x => x.Id == item.Id);
                if (itemToRemove == null)
                {
                    return;
                }

                Items.Remove(itemToRemove);

                CacheService.SaveInstapaperItems(Items).ConfigureAwait(false);

                await CacheService.DeleteArticle(item);
            }
        }
예제 #28
0
        public async Task SaveEditedArticle(ReaderItem copyItem)
        {
            var response = await _cacheService.GetLocalItemsFromCache();

            var isAdd = false;

            var existingItem = response.ReaderItems.FirstOrDefault(x => x.Id == copyItem.Id);

            if (existingItem == null)
            {
                isAdd         = true;
                copyItem.Text = copyItem.Text.Clean();
                var title = copyItem.Text.Length > 150 ? copyItem.Text.Substring(0, 150).Trim() : copyItem.Text;
                copyItem.Title       = title;
                copyItem.CreatedDate = DateTime.Now;
                copyItem.Url         = copyItem.Author = string.Empty;

                existingItem = copyItem;
            }
            else
            {
                existingItem.Text = copyItem.Text.Clean();
            }

            existingItem.Excerpt   = copyItem.Text.ToExcerpt();
            existingItem.WordCount = copyItem.Text.Split(' ').Length;

            await _cacheService.SaveArticle(existingItem);

            existingItem.Text = string.Empty;

            if (isAdd)
            {
                response.ReaderItems.Insert(0, existingItem);
            }

            await _cacheService.SaveLocalItems(response.ReaderItems);
        }
예제 #29
0
        public async Task <ReaderItem> HandleProtocolMessage(UriSchemeMessage m)
        {
            if (m.IsUri)
            {
                var item = await SaveArticle(new Uri(m.Content));

                if (item != null)
                {
                    var fullItem = await _cacheService.GetArticle(item);

                    return(fullItem);
                }
            }
            else
            {
                var item = ReaderItem.NewLocalItem(m.Content);
                await SaveEditedArticle(item);

                return(item);
            }

            return(null);
        }
예제 #30
0
        protected override async Task <ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return(null);
            }

            if (!isRefresh)
            {
                var article = await CacheService.GetArticle(item);

                if (article != null)
                {
                    return(article);
                }
            }

            try
            {
                var response = await _pocketClient.GetArticle(new Uri(item.Url, UriKind.Absolute), forceRefresh : isRefresh);

                if (response != null)
                {
                    var article = response.ToReaderItem();
                    item.IsDownloaded = true;
                    await CacheService.SaveArticle(article).ConfigureAwait(false);

                    return(article);
                }
            }
            catch (Exception ex)
            {
                Log.ErrorException("GetArticle", ex);
            }

            return(null);
        }
예제 #31
0
        public async Task SaveEditedArticle(ReaderItem copyItem)
        {
            var response = await _cacheService.GetLocalItemsFromCache();
            var isAdd = false;

            var existingItem = response.ReaderItems.FirstOrDefault(x => x.Id == copyItem.Id);
            if (existingItem == null)
            {
                isAdd = true;
                copyItem.Text = copyItem.Text.Clean();
                var title = copyItem.Text.Length > 150 ? copyItem.Text.Substring(0, 150).Trim() : copyItem.Text;
                copyItem.Title = title;
                copyItem.CreatedDate = DateTime.Now;
                copyItem.Url = copyItem.Author = string.Empty;

                existingItem = copyItem;
            }
            else
            {
                existingItem.Text = copyItem.Text.Clean();
            }

            existingItem.Excerpt = copyItem.Text.ToExcerpt();
            existingItem.WordCount = copyItem.Text.Split(' ').Length;

            await _cacheService.SaveArticle(existingItem);

            existingItem.Text = string.Empty;

            if (isAdd)
            {
                response.ReaderItems.Insert(0, existingItem);
            }

            await _cacheService.SaveLocalItems(response.ReaderItems);
        }
예제 #32
0
        private ReaderItem CopyReaderItem(int? wordsRead = null)
        {
            var readerItem = new ReaderItem();
            SelectedItem.CopyItem(readerItem);
            if (wordsRead.HasValue)
            {
                readerItem.WordsRead = wordsRead.Value;
            }

            if (string.IsNullOrEmpty(readerItem.Excerpt))
            {
                readerItem.Excerpt = readerItem.Text.ToExcerpt();
            }

            readerItem.Text = string.Empty;
            return readerItem;
        }
예제 #33
0
        public async Task SetReaderItem(ReaderItem item, bool isRestarting = false, bool autostart = true)
        {
            ReaderFont = _settingsService.ReaderFont;
            SelectedItem = item;
            GetInProgressItems().ConfigureAwait(false);
            AddToRecent().ConfigureAwait(false);
            IsPaused = false;
            if (!isRestarting)
            {
                _canStart = false;
            }

            WordsList = null;
            TimeRemaining = null;
            _readerTimer = null;
            WordsPerMinute = _settingsService.WordsPerMin;
            SelectedIndex = -1;
            SetProgressBar("Preparing article...");

            SelectedItem.WordsRead = GetWordsRead();

            var words = item.Text.Clean().Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            if (_settingsService.WordsAtATime == 1)
            {
                WordsList = words.ToList();
                SetTimings();
                SetProgressBar();
            }
            else
            {
                var list = words.ToWordList(_settingsService.WordsAtATime);
                WordsList = list;
                SetTimings();
                SetProgressBar();
            }

            if (_canStart && autostart)
            {
                StartStopTimer();
                return;
            }
            _canStart = true;
        }
예제 #34
0
 public async Task SaveEditedArticle(ReaderItem copyItem)
 {
 }
예제 #35
0
        protected override async Task Archive(ReaderItem item)
        {
            if (!AuthenticationService.IsLoggedIntoInstapaper) return;
            var id = int.Parse(item.Id);
            var failed = false;

            try
            {
                var archivedItem = await _instapaperClient.ArchiveBookmarkAsync(id);
                if (archivedItem == null || archivedItem.Response == null)
                {
                    failed = true;
                }
            }
            catch (Exception ex)
            {
                Log.ErrorException("ArchiveArticle", ex);
                failed = true;
            }

            if (!failed)
            {
                var itemToRemove = Items.FirstOrDefault(x => x.Id == item.Id);
                if (itemToRemove == null) return;

                Items.Remove(itemToRemove);

                CacheService.SaveInstapaperItems(Items).ConfigureAwait(false);

                await CacheService.DeleteArticle(item);
            }
        }
예제 #36
0
 protected virtual Task<ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
 {
     return null;
 }
예제 #37
0
 protected virtual Task <ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
 {
     return(null);
 }
예제 #38
0
        protected override async Task<ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return null;
            }

            if (!isRefresh)
            {
                var article = await CacheService.GetArticle(item);
                if (article != null)
                {
                    return article;
                }
            }

            var response = await _readabilityClient.GetArticleAsync(item.Id);
            if (response != null)
            {
                var article = response.ToReaderItem();
                item.IsDownloaded = !string.IsNullOrEmpty(article.Text);
                await CacheService.SaveArticle(article).ConfigureAwait(false);
                return article;
            }

            return null;
        }
예제 #39
0
        protected virtual async Task Reader(ReaderItem item)
        {
            var article = await GetArticle(item);
            if (article == null)
            {
                return;
            }

            ReaderViewModel.SetReaderItem(article);
            NavigationService.Navigate<ReaderView>();
        }
예제 #40
0
        public async Task DeleteArticle(ReaderItem item)
        {
            var filename = GetFileName(item.InternalId);

            if (await _storage.Local.FileExistsAsync(filename))
            {
                await _storage.Local.DeleteFileAsync(filename);
            }
        }
예제 #41
0
 public Task<ReaderItem> GetArticle(ReaderItem item)
 {
     throw new NotImplementedException();
 }
예제 #42
0
 public Task DeleteArticle(ReaderItem item)
 {
     throw new NotImplementedException();
 }
예제 #43
0
        protected override async Task<ReaderItem> GetArticle(ReaderItem item, bool isRefresh = false)
        {
            if (item == null)
            {
                return null;
            }

            if (!isRefresh)
            {
                var article = await CacheService.GetArticle(item);
                if (article != null)
                {
                    return article;
                }
            }

            try
            {
                var response = await _pocketClient.GetArticle(new Uri(item.Url, UriKind.Absolute), forceRefresh: isRefresh);
                if (response != null)
                {
                    var article = response.ToReaderItem();
                    item.IsDownloaded = true;
                    await CacheService.SaveArticle(article).ConfigureAwait(false);
                    return article;
                }
            }
            catch (Exception ex)
            {
                Log.ErrorException("GetArticle", ex);
            }

            return null;
        }
예제 #44
0
 protected override async Task Archive(ReaderItem item)
 {
     await CacheService.DeleteArticle(item);
     Items.Remove(item);
     await CacheService.SaveLocalItems(Items);
 }
예제 #45
0
        protected override async Task Archive(ReaderItem item)
        {
            if (!AuthenticationService.IsLoggedInToPocket) return;
            var failed = false;
            try
            {
                if (!await _pocketClient.Archive(item.Id))
                {
                    failed = true;
                }
            }
            catch (Exception ex)
            {
                Log.ErrorException("PocketArchiveMessage", ex);
                failed = true;
            }

            if (!failed)
            {
                var itemToDelete = Items.FirstOrDefault(x => x.Id == item.Id);
                if (itemToDelete == null) return;

                Items.Remove(itemToDelete);
                CacheService.SavePocketItems(Items).ConfigureAwait(false);

                await CacheService.DeleteArticle(item);
            }
        }
예제 #46
0
        protected override async Task Archive(ReaderItem item)
        {
            if (!AuthenticationService.IsLoggedIntoReadability) return;
            var id = int.Parse(item.Id);
            var failed = false;

            try
            {
                await _readabilityClient.SetBookmarkArchiveStateAsync(id, true);
            }
            catch (Exception ex)
            {
                Log.ErrorException("ArchiveArticle", ex);
                failed = true;
            }

            if (!failed)
            {
                var itemToRemove = Items.FirstOrDefault(x => x.Id == item.Id);
                if (itemToRemove != null)
                {
                    Items.Remove(itemToRemove);
                }

                CacheService.SaveReadabilityItems(Items).ConfigureAwait(false);

                await CacheService.DeleteArticle(item);
            }
        }
예제 #47
0
 protected virtual Task Archive(ReaderItem item)
 {
     return null;
 }
예제 #48
0
        public async Task SaveArticle(ReaderItem item)
        {
            var filename = GetFileName(item.InternalId);

            using (var file = await _storage.Local.CreateFileAsync(filename))
            {
                using (var writer = new BinaryWriter(file))
                {
                    writer.Write(item);
                }
            }
        }
예제 #49
0
        protected virtual async Task FullPage(ReaderItem item)
        {
            var article = await GetArticle(item);
            if (article == null)
            {
                return;
            }

            FullPageViewModel.ReaderItem = article;
            NavigationService.Navigate<FullPageView>();
        }
예제 #50
0
        public async Task<ReaderItem> GetArticle(ReaderItem item)
        {
            var filename = GetFileName(item.InternalId);
            if (!await _storage.Local.FileExistsAsync(filename))
            {
                return null;
            }

            using (var file = await _storage.Local.OpenFileForReadAsync(filename))
            {
                using (var reader = new BinaryReader(file))
                {
                    var cachedItem = reader.ReadGeneric<ReaderItem>();
                    return cachedItem;
                }
            }
        }
예제 #51
0
 public ArchiveMessage(SourceProvider source, ReaderItem item, Action action)
 {
     SourceProvider = source;
     Item = item;
     Action = action;
 }
예제 #52
0
 public ArchiveMessage(SourceProvider source, ReaderItem item, Action action)
 {
     SourceProvider = source;
     Item           = item;
     Action         = action;
 }
예제 #53
0
 public Task DeleteArticle(ReaderItem item)
 {
     throw new NotImplementedException();
 }
예제 #54
0
 public Task <ReaderItem> GetArticle(ReaderItem item)
 {
     throw new NotImplementedException();
 }
예제 #55
0
 protected virtual Task Archive(ReaderItem item)
 {
     return(null);
 }
예제 #56
0
 public async Task SaveEditedArticle(ReaderItem copyItem)
 {
 }