-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- split upload process and use stash - resolve filename conflict after upload not before - use NotificationManagerCompat; add notification tag; assign temporaty stash file name
- Loading branch information
Showing
5 changed files
with
174 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
app/src/main/java/fr/free/nrw/commons/mwapi/UploadStash.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
package fr.free.nrw.commons.mwapi; | ||
|
||
import android.support.annotation.NonNull; | ||
import android.support.annotation.Nullable; | ||
|
||
public class UploadStash { | ||
@NonNull | ||
private String errorCode; | ||
@NonNull | ||
private String resultStatus; | ||
@NonNull | ||
private String filename; | ||
@NonNull | ||
private String filekey; | ||
|
||
@NonNull | ||
public final String getErrorCode() { | ||
return this.errorCode; | ||
} | ||
|
||
@NonNull | ||
public final String getResultStatus() { | ||
return this.resultStatus; | ||
} | ||
|
||
@NonNull | ||
public final String getFilename() { | ||
return this.filename; | ||
} | ||
|
||
@NonNull | ||
public final String getFilekey() { | ||
return this.filekey; | ||
} | ||
|
||
public UploadStash(@NonNull String errorCode, @NonNull String resultStatus, @NonNull String filename, @NonNull String filekey) { | ||
this.errorCode = errorCode; | ||
this.resultStatus = resultStatus; | ||
this.filename = filename; | ||
this.filekey = filekey; | ||
} | ||
|
||
public String toString() { | ||
return "UploadStash(errorCode=" + this.errorCode + ", resultStatus=" + this.resultStatus + ", filename=" + this.filename + ", filekey=" + this.filekey + ")"; | ||
} | ||
|
||
public int hashCode() { | ||
return ((this.errorCode.hashCode() * 31 + this.resultStatus.hashCode() | ||
) * 31 + this.filename.hashCode() | ||
) * 31 + this.filekey.hashCode(); | ||
} | ||
|
||
public boolean equals(@Nullable Object obj) { | ||
if (this != obj) { | ||
if (obj instanceof UploadStash) { | ||
UploadStash that = (UploadStash)obj; | ||
if (this.errorCode.equals(that.errorCode) | ||
&& this.resultStatus.equals(that.resultStatus) | ||
&& this.filename.equals(that.filename) | ||
&& this.filekey.equals(that.filekey)) { | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} else { | ||
return true; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters