mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Fixes crash when uploading image via share without logging in
This commit is contained in:
parent
05def522af
commit
90705996a8
3 changed files with 12 additions and 18 deletions
|
|
@ -26,6 +26,7 @@ dependencies {
|
|||
transitive = true
|
||||
}
|
||||
implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0'
|
||||
//noinspection GradleCompatible
|
||||
implementation "com.android.support:support-v4:$SUPPORT_LIB_VERSION"
|
||||
implementation "com.android.support:appcompat-v7:$SUPPORT_LIB_VERSION"
|
||||
implementation "com.android.support:design:$SUPPORT_LIB_VERSION"
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ public class ShareActivity
|
|||
this.description = description;
|
||||
|
||||
|
||||
if(sessionManager.getCurrentAccount()!=null) {
|
||||
if (sessionManager.getCurrentAccount() != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
// Check for Storage permission that is required for upload.
|
||||
// Do not allow user to proceed without permission, otherwise will crash
|
||||
|
|
@ -167,11 +167,10 @@ public class ShareActivity
|
|||
uploadBegins();
|
||||
}
|
||||
}
|
||||
|
||||
else //Send user to login activity
|
||||
{
|
||||
Toast.makeText(this, "You need to login first!", Toast.LENGTH_SHORT).show();
|
||||
Intent loginIntent=new Intent(ShareActivity.this, LoginActivity.class);
|
||||
Intent loginIntent = new Intent(ShareActivity.this, LoginActivity.class);
|
||||
startActivity(loginIntent);
|
||||
}
|
||||
}
|
||||
|
|
@ -207,20 +206,13 @@ public class ShareActivity
|
|||
Timber.d("Cache the categories found");
|
||||
}
|
||||
|
||||
uploadController.startUpload(title, mediaUri, description, mimeType, source, decimalCoords, c -> {
|
||||
ShareActivity.this.contribution = c;
|
||||
showPostUpload();
|
||||
});
|
||||
uploadController.startUpload(title,mediaUri,description,mimeType,source,decimalCoords,wikiDataEntityId,c ->
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
uploadController.startUpload(title, mediaUri, description, mimeType, source, decimalCoords, wikiDataEntityId, c -> {
|
||||
ShareActivity.this.contribution = c;
|
||||
showPostUpload();
|
||||
});
|
||||
}
|
||||
{
|
||||
ShareActivity.this.contribution = c;
|
||||
showPostUpload();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts CategorizationFragment after uploadBegins.
|
||||
|
|
@ -679,3 +671,4 @@ public class ShareActivity
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,13 +83,13 @@ public class UploadController {
|
|||
|
||||
/**
|
||||
* Starts a new upload task.
|
||||
*
|
||||
* @param title the title of the contribution
|
||||
* @param mediaUri the media URI of the contribution
|
||||
* @param description the description of the contribution
|
||||
* @param mimeType the MIME type of the contribution
|
||||
* @param source the source of the contribution
|
||||
* @param decimalCoords the coordinates in decimal. (e.g. "37.51136|-77.602615")
|
||||
* @param wikiDataEntityId
|
||||
* @param onComplete the progress tracker
|
||||
*/
|
||||
public void startUpload(String title, Uri mediaUri, String description, String mimeType, String source, String decimalCoords, String wikiDataEntityId, ContributionUploadProgress onComplete) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue