Refactor usage of dagger application with fixed dagger application

This commit is contained in:
maskara 2018-01-13 01:40:15 +05:30
parent 1224302ccb
commit e1afa6081e
32 changed files with 556 additions and 311 deletions

View file

@ -33,6 +33,7 @@ import fr.free.nrw.commons.R;
import fr.free.nrw.commons.Utils;
import fr.free.nrw.commons.WelcomeActivity;
import fr.free.nrw.commons.contributions.ContributionsActivity;
import fr.free.nrw.commons.di.ApplicationlessInjection;
import fr.free.nrw.commons.mwapi.MediaWikiApi;
import fr.free.nrw.commons.theme.NavigationBaseActivity;
import timber.log.Timber;
@ -66,8 +67,12 @@ public class LoginActivity extends AccountAuthenticatorActivity {
setTheme(Utils.isDarkTheme(this) ? R.style.DarkAppTheme : R.style.LightAppTheme);
getDelegate().installViewFactory();
getDelegate().onCreate(savedInstanceState);
AndroidInjection.inject(this);
super.onCreate(savedInstanceState);
ApplicationlessInjection
.getInstance(this.getApplicationContext())
.getCommonsApplicationComponent()
.inject(this);
setContentView(R.layout.activity_login);

View file

@ -1,20 +1,28 @@
package fr.free.nrw.commons.auth;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import javax.inject.Inject;
import dagger.android.AndroidInjection;
import dagger.android.DaggerService;
import fr.free.nrw.commons.di.FixedDaggerService;
import fr.free.nrw.commons.mwapi.MediaWikiApi;
import static android.accounts.AccountManager.ACTION_AUTHENTICATOR_INTENT;
public class WikiAccountAuthenticatorService extends DaggerService {
public class WikiAccountAuthenticatorService extends FixedDaggerService {
@Inject MediaWikiApi mwApi;
private WikiAccountAuthenticator wikiAccountAuthenticator = null;
@Override
public void onCreate() {
super.onCreate();
}
@Override
public IBinder onBind(Intent intent) {
if (!intent.getAction().equals(ACTION_AUTHENTICATOR_INTENT)) {