Skip to content

Commit

Permalink
remove unneeded accountManager
Browse files Browse the repository at this point in the history
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
  • Loading branch information
tobiasKaminsky committed Dec 12, 2019
1 parent e5cd5ff commit 8b61e74
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import android.text.TextUtils;
import android.util.Pair;

import com.nextcloud.client.account.UserAccountManager;
import com.owncloud.android.MainApp;
import com.owncloud.android.datamodel.FileDataStorageManager;
import com.owncloud.android.datamodel.OCFile;
Expand Down Expand Up @@ -75,8 +74,6 @@
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ConcurrentMap;

import javax.inject.Inject;

import dagger.android.AndroidInjection;

public class OperationsService extends Service {
Expand Down Expand Up @@ -136,8 +133,6 @@ public class OperationsService extends Service {
private ConcurrentMap<Integer, Pair<RemoteOperation, RemoteOperationResult>>
mUndispatchedFinishedOperations = new ConcurrentHashMap<>();

@Inject UserAccountManager accountManager;

private static class Target {
public Uri mServerUrl;
public Account mAccount;
Expand All @@ -163,7 +158,7 @@ public void onCreate() {
HandlerThread thread = new HandlerThread("Operations thread",
Process.THREAD_PRIORITY_BACKGROUND);
thread.start();
mOperationsHandler = new ServiceHandler(thread.getLooper(), this, accountManager);
mOperationsHandler = new ServiceHandler(thread.getLooper(), this);
mOperationsBinder = new OperationsServiceBinder(mOperationsHandler);

// Separated worker thread for download of folders (WIP)
Expand Down Expand Up @@ -399,16 +394,14 @@ private static class ServiceHandler extends Handler {
private Target mLastTarget;
private OwnCloudClient mOwnCloudClient;
private FileDataStorageManager mStorageManager;
private UserAccountManager accountManager;


public ServiceHandler(Looper looper, OperationsService service, UserAccountManager accountManager) {
public ServiceHandler(Looper looper, OperationsService service) {
super(looper);
if (service == null) {
throw new IllegalArgumentException("Received invalid NULL in parameter 'service'");
}
mService = service;
this.accountManager = accountManager;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import android.content.Context;
import android.os.AsyncTask;

import com.nextcloud.client.account.User;
import com.nextcloud.client.account.UserAccountManager;
import com.nextcloud.common.NextcloudClient;
import com.owncloud.android.MainApp;
Expand Down Expand Up @@ -59,9 +58,7 @@ public ActivitiesServiceApiImpl(UserAccountManager accountManager) {

@Override
public void getAllActivities(int lastGiven, ActivitiesServiceCallback<List<Object>> callback) {
User user = accountManager.getUser();
GetActivityListTask getActivityListTask = new GetActivityListTask(user.toPlatformAccount(),
accountManager,
GetActivityListTask getActivityListTask = new GetActivityListTask(accountManager.getUser().toPlatformAccount(),
lastGiven,
callback);
getActivityListTask.execute();
Expand All @@ -72,17 +69,14 @@ private static class GetActivityListTask extends AsyncTask<Void, Void, Boolean>
private final ActivitiesServiceCallback<List<Object>> callback;
private List<Object> activities;
private Account account;
private UserAccountManager accountManager;
private int lastGiven;
private String errorMessage;
private NextcloudClient client;

private GetActivityListTask(Account account,
UserAccountManager accountManager,
int lastGiven,
ActivitiesServiceCallback<List<Object>> callback) {
this.account = account;
this.accountManager = accountManager;
this.lastGiven = lastGiven;
this.callback = callback;
activities = new ArrayList<>();
Expand Down

0 comments on commit 8b61e74

Please sign in to comment.