mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-11 01:32:08 +10:00
add support for update/delete project
move some code to background threads
This commit is contained in:
Binary file not shown.
@@ -104,7 +104,8 @@ public interface IServiceAPI {
|
||||
@ParamName("page") Integer page, @ParamName("itemsPerPage") Integer itemsPerPage, @ParamName("sort") String sort);
|
||||
|
||||
/**
|
||||
* Uploads a project using token to authenticate.
|
||||
* Uploads a project using token to authenticate. When projectI is specified, it updates the
|
||||
* existing project instead. In that case, the project must belong to the user.
|
||||
*
|
||||
* @param username
|
||||
* @param token
|
||||
@@ -116,13 +117,27 @@ public interface IServiceAPI {
|
||||
* @param keywords
|
||||
* @param thumbnail
|
||||
* @param project
|
||||
* @param projectId
|
||||
* @return "Success" if the upload was successful or error message if it failed.
|
||||
*/
|
||||
String upload(@ParamName("username") String username, @ParamName("token") String token,
|
||||
String uploadProject(@ParamName("username") String username, @ParamName("token") String token,
|
||||
@ParamName("machineId") String machineId, @ParamName("projectName") String projectName,
|
||||
@ParamName("category") String category, @ParamName("description") String description,
|
||||
@ParamName("diylcVersion") String diylcVersion, @ParamName("keywords") String keywords,
|
||||
@ParamName("thumbnail") File thumbnail, @ParamName("project") File project);
|
||||
@ParamName("thumbnail") File thumbnail, @ParamName("project") File project,
|
||||
@ParamName("projectId") Integer projectId);
|
||||
|
||||
/**
|
||||
*Deletes an existing project. The project must belong to the user
|
||||
*
|
||||
* @param username
|
||||
* @param token
|
||||
* @param machineId
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
String deleteProject(@ParamName("username") String username, @ParamName("token") String token,
|
||||
@ParamName("machineId") String machineId, @ParamName("projectId") Integer projectId);
|
||||
|
||||
/**
|
||||
* Posts a comment to the specified project.
|
||||
|
||||
@@ -134,7 +134,7 @@ public class CloudPresenter {
|
||||
return categories;
|
||||
}
|
||||
|
||||
public void upload(String projectName, String category, String description, String keywords, String diylcVersion,
|
||||
public void uploadProject(String projectName, String category, String description, String keywords, String diylcVersion,
|
||||
File thumbnail, File project) throws IOException, CloudException {
|
||||
String username = ConfigurationManager.getInstance().readString(USERNAME_KEY, null);
|
||||
String token = ConfigurationManager.getInstance().readString(TOKEN_KEY, null);
|
||||
@@ -144,8 +144,8 @@ public class CloudPresenter {
|
||||
|
||||
try {
|
||||
String res =
|
||||
getService().upload(username, token, getMachineId(), projectName, category, description, diylcVersion,
|
||||
keywords, thumbnail, project);
|
||||
getService().uploadProject(username, token, getMachineId(), projectName, category, description, diylcVersion,
|
||||
keywords, thumbnail, project, null);
|
||||
if (!res.equals(SUCCESS))
|
||||
throw new CloudException(res);
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user