mirror of
				https://github.com/commons-app/apps-android-commons.git
				synced 2025-10-31 14:53:59 +01:00 
			
		
		
		
	Further reduce code calling back to the CommonsApplication by pulling out a SessionManager to manage our current account.
This commit is contained in:
		
							parent
							
								
									e7d0c647c2
								
							
						
					
					
						commit
						9c0cbe7ad5
					
				
					 25 changed files with 273 additions and 294 deletions
				
			
		|  | @ -7,6 +7,8 @@ import javax.inject.Singleton; | |||
| import dagger.Module; | ||||
| import dagger.Provides; | ||||
| import fr.free.nrw.commons.CommonsApplication; | ||||
| import fr.free.nrw.commons.auth.AccountUtil; | ||||
| import fr.free.nrw.commons.auth.SessionManager; | ||||
| import fr.free.nrw.commons.caching.CacheController; | ||||
| import fr.free.nrw.commons.data.DBOpenHelper; | ||||
| import fr.free.nrw.commons.mwapi.ApacheHttpClientMediaWikiApi; | ||||
|  | @ -22,8 +24,14 @@ public class CommonsApplicationModule { | |||
|     } | ||||
| 
 | ||||
|     @Provides | ||||
|     public CommonsApplication providesCommonsApplication() { | ||||
|         return application; | ||||
|     public AccountUtil providesAccountUtil() { | ||||
|         return new AccountUtil(application); | ||||
|     } | ||||
| 
 | ||||
|     @Provides | ||||
|     @Singleton | ||||
|     public SessionManager providesSessionManager(AccountUtil accountUtil, MediaWikiApi mediaWikiApi) { | ||||
|         return new SessionManager(application, accountUtil, mediaWikiApi); | ||||
|     } | ||||
| 
 | ||||
|     @Provides | ||||
|  | @ -40,7 +48,7 @@ public class CommonsApplicationModule { | |||
| 
 | ||||
|     @Provides | ||||
|     @Singleton | ||||
|     public DBOpenHelper provideDBOpenHelper(CommonsApplication application) { | ||||
|     public DBOpenHelper provideDBOpenHelper() { | ||||
|         return new DBOpenHelper(application); | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Paul Hawke
						Paul Hawke