mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-11-01 07:13:56 +01:00
@Inject the MediaWikiApi where needed to reduce coupling between classes.
This commit is contained in:
parent
ed1ae98d8e
commit
647cc166ef
16 changed files with 85 additions and 82 deletions
|
|
@ -25,7 +25,7 @@ import timber.log.Timber;
|
|||
|
||||
public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter {
|
||||
|
||||
@Inject CommonsApplication application;
|
||||
@Inject MediaWikiApi mwApi;
|
||||
|
||||
public ModificationsSyncAdapter(Context context, boolean autoInitialize) {
|
||||
super(context, autoInitialize);
|
||||
|
|
@ -64,12 +64,11 @@ public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||
return;
|
||||
}
|
||||
|
||||
MediaWikiApi api = application.getMWApi();
|
||||
api.setAuthCookie(authCookie);
|
||||
mwApi.setAuthCookie(authCookie);
|
||||
String editToken;
|
||||
|
||||
try {
|
||||
editToken = api.getEditToken();
|
||||
editToken = mwApi.getEditToken();
|
||||
} catch (IOException e) {
|
||||
Timber.d("Can not retreive edit token!");
|
||||
return;
|
||||
|
|
@ -100,7 +99,7 @@ public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||
if (contrib.getState() == Contribution.STATE_COMPLETED) {
|
||||
String pageContent;
|
||||
try {
|
||||
pageContent = api.revisionsByFilename(contrib.getFilename());
|
||||
pageContent = mwApi.revisionsByFilename(contrib.getFilename());
|
||||
} catch (IOException e) {
|
||||
Timber.d("Network fuckup on modifications sync!");
|
||||
continue;
|
||||
|
|
@ -111,7 +110,7 @@ public class ModificationsSyncAdapter extends AbstractThreadedSyncAdapter {
|
|||
|
||||
String editResult;
|
||||
try {
|
||||
editResult = api.edit(editToken, processedPageContent, contrib.getFilename(), sequence.getEditSummary());
|
||||
editResult = mwApi.edit(editToken, processedPageContent, contrib.getFilename(), sequence.getEditSummary());
|
||||
} catch (IOException e) {
|
||||
Timber.d("Network fuckup on modifications sync!");
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue