Skip to content

Commit

Permalink
Solve git conflict
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <alper_ozturk@proton.me>
  • Loading branch information
alperozturk96 committed Feb 6, 2024
1 parent fa0c2da commit 9471881
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,16 @@ class DashboardGetWidgetItemsRemoteOperation(val id: String, private val limitSi
get,
object :
TypeToken<ServerResponse<HashMap<String, List<DashboardWidgetItem>>>>() {}
).ocs.data
)?.ocs?.data

result =
RemoteOperationResult<HashMap<String, List<DashboardWidgetItem>>>(true, get)
result.resultData = list
if (list != null) {
result =
RemoteOperationResult<HashMap<String, List<DashboardWidgetItem>>>(true, get)
result.resultData = list
} else {
result =
RemoteOperationResult<HashMap<String, List<DashboardWidgetItem>>>(false, get)
}
} else {
result =
RemoteOperationResult<HashMap<String, List<DashboardWidgetItem>>>(false, get)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ class DashboardListWidgetsRemoteOperation : OCSRemoteOperation<Map<String, Dashb
getServerResponse(
get,
object : TypeToken<ServerResponse<HashMap<String, DashboardWidget>>>() {}
).ocs.data
)?.ocs?.data

result = RemoteOperationResult<Map<String, DashboardWidget>>(true, get)
result.resultData = list
if (list != null) {
result = RemoteOperationResult<Map<String, DashboardWidget>>(true, get)
result.resultData = list
} else {
result = RemoteOperationResult<Map<String, DashboardWidget>>(false, get)
}
} else {
result = RemoteOperationResult<Map<String, DashboardWidget>>(false, get)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,15 @@ protected RemoteOperationResult<TemplateList> run(OwnCloudClient client) {
int status = client.executeMethod(getMethod, SYNC_READ_TIMEOUT, SYNC_CONNECTION_TIMEOUT);

if (status == HttpStatus.SC_OK) {
TemplateList templateList = getServerResponse(getMethod,
new TypeToken<ServerResponse<TemplateList>>() {
})
.getOcs().getData();
ServerResponse<TemplateList> serverResponse = getServerResponse(getMethod, new TypeToken<>() {});

result = new RemoteOperationResult<>(true, getMethod);
result.setResultData(templateList);
if (serverResponse != null) {
TemplateList templateList = serverResponse.getOcs().getData();
result = new RemoteOperationResult<>(true, getMethod);
result.setResultData(templateList);
} else {
result = new RemoteOperationResult<>(false, getMethod);
}
} else {
result = new RemoteOperationResult<>(false, getMethod);
client.exhaustResponse(getMethod.getResponseBodyAsStream());
Expand All @@ -89,6 +91,7 @@ protected RemoteOperationResult<TemplateList> run(OwnCloudClient client) {
getMethod.releaseConnection();
}
}

return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,18 @@ protected RemoteOperationResult<DirectEditing> run(OwnCloudClient client) {
int status = client.executeMethod(getMethod, SYNC_READ_TIMEOUT, SYNC_CONNECTION_TIMEOUT);

if (status == HttpStatus.SC_OK) {
DirectEditing directEditing = getServerResponse(getMethod,
new TypeToken<ServerResponse<DirectEditing>>() {
})
.getOcs().getData();
ServerResponse<DirectEditing> serverResponse = getServerResponse(getMethod,
new TypeToken<>() {
});

if (serverResponse != null) {
DirectEditing directEditing = serverResponse.getOcs().getData();
result = new RemoteOperationResult<>(true, getMethod);
result.setResultData(directEditing);
} else {
result = new RemoteOperationResult<>(false, getMethod);
}

result = new RemoteOperationResult<>(true, getMethod);
result.setResultData(directEditing);
} else {
result = new RemoteOperationResult<>(false, getMethod);
client.exhaustResponse(getMethod.getResponseBodyAsStream());
Expand All @@ -77,6 +82,7 @@ protected RemoteOperationResult<DirectEditing> run(OwnCloudClient client) {
getMethod.releaseConnection();
}
}

return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@ class GetGroupfoldersRemoteOperation :
getServerResponse(
getMethod,
object : TypeToken<ServerResponse<Map<String, Groupfolder>>>() {}
)
.ocs.data
result = RemoteOperationResult(true, getMethod)
result.setResultData(map)
)?.ocs?.data

if (map != null) {
result = RemoteOperationResult(true, getMethod)
result.setResultData(map)
} else {
result = RemoteOperationResult(false, getMethod)
}
} else {
result = RemoteOperationResult(false, getMethod)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,19 @@ class GetHoverCardRemoteOperation(private val userId: String) : OCSRemoteOperati
GetMethod(client.baseUri.toString() + DIRECT_ENDPOINT + userId + JSON_FORMAT, true)
val status = client.execute(getMethod)
if (status == HttpStatus.SC_OK) {
val hoverCard: HoverCard =
getServerResponse<ServerResponse<HoverCard>>(
getMethod,
object : TypeToken<ServerResponse<HoverCard>?>() {}
)
.ocs.data
result = RemoteOperationResult(true, getMethod)
result.setResultData(hoverCard)
val serverResponse: ServerResponse<HoverCard>? = getServerResponse(
getMethod,
object : TypeToken<ServerResponse<HoverCard>>() {}
)

val hoverCard: HoverCard? = serverResponse?.ocs?.data

if (hoverCard != null) {
result = RemoteOperationResult(true, getMethod)
result.setResultData(hoverCard)
} else {
result = RemoteOperationResult(false, getMethod)
}
} else {
result = RemoteOperationResult(false, getMethod)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import com.google.gson.reflect.TypeToken
import com.nextcloud.common.OkHttpMethodBase
import com.owncloud.android.lib.common.operations.RemoteOperation
import org.apache.commons.httpclient.HttpMethodBase
import java.io.IOException

abstract class OCSRemoteOperation<T> : RemoteOperation<T>() {
private val gson = Gson()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,14 @@ public RemoteOperationResult<String> run(NextcloudClient client) {
int status = client.execute(method);

if (status == HttpStatus.SC_OK) {
// Parse the response
ServerResponse<AppPassword> serverResponse = getServerResponse(method,
new TypeToken<ServerResponse<AppPassword>>() {
});
ServerResponse<AppPassword> serverResponse = getServerResponse(method, new TypeToken<>() {});

result = new RemoteOperationResult<>(true, method);
result.setResultData(serverResponse.getOcs().getData().getAppPassword());
if (serverResponse != null) {
result = new RemoteOperationResult<>(true, method);
result.setResultData(serverResponse.getOcs().getData().getAppPassword());
} else {
result = new RemoteOperationResult<>(false, method);
}
} else if (status == HttpStatus.SC_FORBIDDEN) {
result = new RemoteOperationResult<>(true, method);
result.setResultData("");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ public RemoteOperationResult<ArrayList<PredefinedStatus>> run(NextcloudClient cl
int status = client.execute(getMethod);

if (status == HttpStatus.SC_OK) {
// Parse the response
ServerResponse<ArrayList<PredefinedStatus>> serverResponse =
getServerResponse(getMethod,
new TypeToken<ServerResponse<ArrayList<PredefinedStatus>>>() {
});
ServerResponse<ArrayList<PredefinedStatus>> serverResponse = getServerResponse(getMethod, new TypeToken<>() {});

result = new RemoteOperationResult<>(true, getMethod);
result.setResultData(serverResponse.getOcs().getData());
if (serverResponse != null) {
result = new RemoteOperationResult<>(true, getMethod);
result.setResultData(serverResponse.getOcs().getData());
} else {
result = new RemoteOperationResult<>(false, getMethod);
}
} else {
result = new RemoteOperationResult<>(false, getMethod);
getMethod.releaseConnection();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,12 @@ public RemoteOperationResult<PrivateKey> run(NextcloudClient client) {
getServerResponse(getMethod, new TypeToken<ServerResponse<PrivateKey>>() {
});

result = new RemoteOperationResult<>(true, getMethod);
result.setResultData(serverResponse.getOcs().data);
if (serverResponse != null) {
result = new RemoteOperationResult<>(true, getMethod);
result.setResultData(serverResponse.getOcs().data);
} else {
result = new RemoteOperationResult<>(false, getMethod);
}
} else {
result = new RemoteOperationResult<>(false, getMethod);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,13 @@ public RemoteOperationResult<Status> run(NextcloudClient client) {
int status = client.execute(getMethod);

if (status == HttpStatus.SC_OK) {
// Parse the response
ServerResponse<Status> serverResponse = getServerResponse(getMethod,
new TypeToken<ServerResponse<Status>>() {
});

result = new RemoteOperationResult<>(true, getMethod);
result.setResultData(serverResponse.getOcs().getData());
ServerResponse<Status> serverResponse = getServerResponse(getMethod, new TypeToken<>() {});
if (serverResponse != null) {
result = new RemoteOperationResult<>(true, getMethod);
result.setResultData(serverResponse.getOcs().getData());
} else {
result = new RemoteOperationResult<>(false, getMethod);
}
} else {
// 404 if no status was set before
if (HttpStatus.SC_NOT_FOUND == getMethod.getStatusCode()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,20 @@ public RemoteOperationResult<UserInfo> run(NextcloudClient client) {
status = client.execute(get);

if (isSuccess(status)) {
ServerResponse<UserInfo> ocsResponse = getServerResponse(get,
new TypeToken<ServerResponse<UserInfo>>() {
});
ServerResponse<UserInfo> ocsResponse = getServerResponse(get, new TypeToken<>() {});

UserInfo userInfo = ocsResponse.ocs.data;
if (ocsResponse != null) {
UserInfo userInfo = ocsResponse.ocs.data;

if (userInfo.getQuota() == null || userInfo.getQuota().getQuota() == 0) {
userInfo.setQuota(new Quota(QUOTA_LIMIT_INFO_NOT_AVAILABLE));
}
if (userInfo.getQuota() == null || userInfo.getQuota().getQuota() == 0) {
userInfo.setQuota(new Quota(QUOTA_LIMIT_INFO_NOT_AVAILABLE));
}

result = new RemoteOperationResult<>(true, get);
result.setResultData(userInfo);
result = new RemoteOperationResult<>(true, get);
result.setResultData(userInfo);
} else {
result = new RemoteOperationResult<>(false, get);
}
} else {
result = new RemoteOperationResult<>(false, get);
String response = get.getResponseBodyAsString();
Expand Down

0 comments on commit 9471881

Please sign in to comment.