@@ -184,47 +184,6 @@ IObservable<AccountCacheItem> GetUserFromCache()
184184 return Observable . Defer ( ( ) => hostCache . GetObject < AccountCacheItem > ( "user" ) ) ;
185185 }
186186
187- /// <summary>
188- /// Gets a collection of Pull Requests. If you want to refresh existing data, pass a collection in
189- /// </summary>
190- /// <param name="repo"></param>
191- /// <param name="collection"></param>
192- /// <returns></returns>
193- public ITrackingCollection < IPullRequestModel > GetPullRequests ( RepositoryModel repo ,
194- ITrackingCollection < IPullRequestModel > collection )
195- {
196- // Since the api to list pull requests returns all the data for each pr, cache each pr in its own entry
197- // and also cache an index that contains all the keys for each pr. This way we can fetch prs in bulk
198- // but also individually without duplicating information. We store things in a custom observable collection
199- // that checks whether an item is being updated (coming from the live stream after being retrieved from cache)
200- // and replaces it instead of appending, so items get refreshed in-place as they come in.
201-
202- var keyobs = GetUserFromCache ( )
203- . Select ( user => string . Format ( CultureInfo . InvariantCulture , "{0}|{1}:{2}" , CacheIndex . PRPrefix , repo . Owner , repo . Name ) ) ;
204-
205- var source = Observable . Defer ( ( ) => keyobs
206- . SelectMany ( key =>
207- hostCache . GetAndFetchLatestFromIndex ( key , ( ) =>
208- ApiClient . GetPullRequestsForRepository ( repo . CloneUrl . Owner , repo . CloneUrl . RepositoryName )
209- . Select ( PullRequestCacheItem . Create ) ,
210- item =>
211- {
212- if ( collection . Disposed ) return ;
213-
214- // this could blow up due to the collection being disposed somewhere else
215- try { collection . RemoveItem ( Create ( item ) ) ; }
216- catch ( ObjectDisposedException ) { }
217- } ,
218- TimeSpan . Zero ,
219- TimeSpan . FromDays ( 7 ) )
220- )
221- . Select ( Create )
222- ) ;
223-
224- collection . Listen ( source ) ;
225- return collection ;
226- }
227-
228187 public IObservable < IPullRequestModel > GetPullRequest ( string owner , string name , int number )
229188 {
230189 throw new NotImplementedException ( ) ;
@@ -243,34 +202,6 @@ public IObservable<RemoteRepositoryModel> GetRepository(string owner, string rep
243202 . Select ( Create ) ) ) ;
244203 }
245204
246- public ITrackingCollection < RemoteRepositoryModel > GetRepositories ( ITrackingCollection < RemoteRepositoryModel > collection )
247- {
248- var keyobs = GetUserFromCache ( )
249- . Select ( user => string . Format ( CultureInfo . InvariantCulture , "{0}|{1}" , CacheIndex . RepoPrefix , user . Login ) ) ;
250-
251- var source = Observable . Defer ( ( ) => keyobs
252- . SelectMany ( key =>
253- hostCache . GetAndFetchLatestFromIndex ( key , ( ) =>
254- ApiClient . GetRepositories ( )
255- . Select ( RepositoryCacheItem . Create ) ,
256- item =>
257- {
258- if ( collection . Disposed ) return ;
259-
260- // this could blow up due to the collection being disposed somewhere else
261- try { collection . RemoveItem ( Create ( item ) ) ; }
262- catch ( ObjectDisposedException ) { }
263- } ,
264- TimeSpan . FromMinutes ( 5 ) ,
265- TimeSpan . FromDays ( 1 ) )
266- )
267- . Select ( Create )
268- ) ;
269-
270- collection . Listen ( source ) ;
271- return collection ;
272- }
273-
274205 public IObservable < IPullRequestModel > CreatePullRequest ( LocalRepositoryModel sourceRepository , RepositoryModel targetRepository ,
275206 BranchModel sourceBranch , BranchModel targetBranch ,
276207 string title , string body )
0 commit comments