mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 06:43:56 +01:00 
			
		
		
		
	remove asynchronous call to fetch local depictedItems
This commit is contained in:
		
							parent
							
								
									39a0b88e3a
								
							
						
					
					
						commit
						6e2d4a4288
					
				
					 1 changed files with 5 additions and 16 deletions
				
			
		|  | @ -16,12 +16,9 @@ import io.reactivex.android.schedulers.AndroidSchedulers | ||||||
| import io.reactivex.disposables.CompositeDisposable | import io.reactivex.disposables.CompositeDisposable | ||||||
| import io.reactivex.processors.PublishProcessor | import io.reactivex.processors.PublishProcessor | ||||||
| import io.reactivex.schedulers.Schedulers | import io.reactivex.schedulers.Schedulers | ||||||
| import kotlinx.coroutines.CoroutineScope | import kotlinx.coroutines.runBlocking | ||||||
| import kotlinx.coroutines.Dispatchers |  | ||||||
| import kotlinx.coroutines.launch |  | ||||||
| import timber.log.Timber | import timber.log.Timber | ||||||
| import java.lang.reflect.Proxy | import java.lang.reflect.Proxy | ||||||
| import java.util.* |  | ||||||
| import javax.inject.Inject | import javax.inject.Inject | ||||||
| import javax.inject.Named | import javax.inject.Named | ||||||
| import javax.inject.Singleton | import javax.inject.Singleton | ||||||
|  | @ -88,7 +85,7 @@ class DepictsPresenter @Inject constructor( | ||||||
|         var recentDepictedItemList: MutableList<DepictedItem> = ArrayList(); |         var recentDepictedItemList: MutableList<DepictedItem> = ArrayList(); | ||||||
|         //show recentDepictedItemList when queryString is empty |         //show recentDepictedItemList when queryString is empty | ||||||
|         if (querystring.isEmpty()) { |         if (querystring.isEmpty()) { | ||||||
|             recentDepictedItemList = getRecentDepictedItems(); |             recentDepictedItemList = getRecentDepictedItems().toMutableList() | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (media == null) { |         if (media == null) { | ||||||
|  | @ -268,17 +265,9 @@ class DepictsPresenter @Inject constructor( | ||||||
|     /** |     /** | ||||||
|      * Get the depicts from DepictsRoomdataBase |      * Get the depicts from DepictsRoomdataBase | ||||||
|      */ |      */ | ||||||
|     fun getRecentDepictedItems(): MutableList<DepictedItem> { |     private fun getRecentDepictedItems(): List<DepictedItem> = runBlocking { | ||||||
|         val depictedItemList: MutableList<DepictedItem> = ArrayList() |         val depictsList = depictsDao.depictsList().await() | ||||||
|         CoroutineScope(Dispatchers.IO).launch { |         return@runBlocking depictsList.map { it.item } | ||||||
|             val depictsList = depictsDao.depictsList().await() |  | ||||||
| 
 |  | ||||||
|             for (i in depictsList.indices) { |  | ||||||
|                 val depictedItem = depictsList[i].item |  | ||||||
|                 depictedItemList.add(depictedItem) |  | ||||||
|             } |  | ||||||
|         } |  | ||||||
|         return depictedItemList |  | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Rohit Verma
						Rohit Verma