mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-07 16:06:08 +00:00
Merge pull request #22 from owncloud/operations_service
Moved result data from GetRemoteStatusOperation and GetRemoteUserNameOperation into the RemoteOperationResult instance they their methods execute() return.
This commit is contained in:
commit
614163529b
@ -24,6 +24,8 @@
|
||||
|
||||
package com.owncloud.android.lib.resources.status;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.commons.httpclient.HttpStatus;
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
import org.json.JSONException;
|
||||
@ -60,18 +62,12 @@ public class GetRemoteStatusOperation extends RemoteOperation {
|
||||
private String mUrl;
|
||||
private RemoteOperationResult mLatestResult;
|
||||
private Context mContext;
|
||||
private OwnCloudVersion mOCVersion;
|
||||
|
||||
public GetRemoteStatusOperation(String url, Context context) {
|
||||
mUrl = url;
|
||||
mContext = context;
|
||||
mOCVersion = null;
|
||||
}
|
||||
|
||||
public OwnCloudVersion getDiscoveredVersion() {
|
||||
return mOCVersion;
|
||||
}
|
||||
|
||||
private boolean tryConnection(OwnCloudClient wc, String urlSt) {
|
||||
boolean retval = false;
|
||||
GetMethod get = null;
|
||||
@ -85,8 +81,8 @@ public class GetRemoteStatusOperation extends RemoteOperation {
|
||||
mLatestResult = new RemoteOperationResult(RemoteOperationResult.ResultCode.INSTANCE_NOT_CONFIGURED);
|
||||
} else {
|
||||
String version = json.getString(NODE_VERSION);
|
||||
mOCVersion = new OwnCloudVersion(version);
|
||||
if (!mOCVersion.isVersionValid()) {
|
||||
OwnCloudVersion ocVersion = new OwnCloudVersion(version);
|
||||
if (!ocVersion.isVersionValid()) {
|
||||
mLatestResult = new RemoteOperationResult(RemoteOperationResult.ResultCode.BAD_OC_VERSION);
|
||||
|
||||
} else {
|
||||
@ -95,6 +91,9 @@ public class GetRemoteStatusOperation extends RemoteOperation {
|
||||
RemoteOperationResult.ResultCode.OK_NO_SSL
|
||||
);
|
||||
|
||||
ArrayList<Object> data = new ArrayList<Object>();
|
||||
data.add(ocVersion);
|
||||
mLatestResult.setData(data);
|
||||
retval = true;
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,8 @@
|
||||
|
||||
package com.owncloud.android.lib.resources.users;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.commons.httpclient.methods.GetMethod;
|
||||
import org.apache.http.HttpStatus;
|
||||
import org.json.JSONObject;
|
||||
@ -93,6 +95,10 @@ public class GetRemoteUserNameOperation extends RemoteOperation {
|
||||
|
||||
// Result
|
||||
result = new RemoteOperationResult(true, status, get.getResponseHeaders());
|
||||
// Username in result.data
|
||||
ArrayList<Object> data = new ArrayList<Object>();
|
||||
data.add(displayName);
|
||||
result.setData(data);
|
||||
mUserName = displayName;
|
||||
|
||||
Log.d(TAG, "*** Parsed user information: " + id + " - " + displayName + " - " + email);
|
||||
|
Loading…
x
Reference in New Issue
Block a user