mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Merge remote-tracking branch 'refs/remotes/origin/2.8-release'
# Conflicts: # app/build.gradle
This commit is contained in:
commit
107729cdf0
4 changed files with 18 additions and 2 deletions
|
|
@ -21,7 +21,7 @@ dependencies {
|
|||
implementation 'com.jakewharton.timber:timber:4.5.1'
|
||||
implementation 'info.debatty:java-string-similarity:0.24'
|
||||
implementation 'com.borjabravo:readmoretextview:2.1.0'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
|
||||
implementation('com.mapbox.mapboxsdk:mapbox-android-sdk:5.5.0@aar') {
|
||||
transitive = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import android.accounts.AccountManager;
|
|||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import fr.free.nrw.commons.mwapi.MediaWikiApi;
|
||||
import io.reactivex.Completable;
|
||||
import io.reactivex.Observable;
|
||||
|
|
@ -31,6 +33,7 @@ public class SessionManager {
|
|||
/**
|
||||
* @return Account|null
|
||||
*/
|
||||
@Nullable
|
||||
public Account getCurrentAccount() {
|
||||
if (currentAccount == null) {
|
||||
AccountManager accountManager = AccountManager.get(context);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package fr.free.nrw.commons.upload;
|
||||
|
||||
import android.accounts.Account;
|
||||
import android.content.ComponentName;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
|
|
@ -13,6 +14,7 @@ import android.os.AsyncTask;
|
|||
import android.os.IBinder;
|
||||
import android.provider.MediaStore;
|
||||
import android.text.TextUtils;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.IOException;
|
||||
|
|
@ -22,9 +24,11 @@ import java.util.concurrent.Executors;
|
|||
|
||||
import fr.free.nrw.commons.CommonsApplication;
|
||||
import fr.free.nrw.commons.HandlerService;
|
||||
import fr.free.nrw.commons.R;
|
||||
import fr.free.nrw.commons.auth.SessionManager;
|
||||
import fr.free.nrw.commons.contributions.Contribution;
|
||||
import fr.free.nrw.commons.settings.Prefs;
|
||||
import fr.free.nrw.commons.utils.ViewUtil;
|
||||
import timber.log.Timber;
|
||||
|
||||
public class UploadController {
|
||||
|
|
@ -95,8 +99,15 @@ public class UploadController {
|
|||
Contribution contribution;
|
||||
|
||||
//TODO: Modify this to include coords
|
||||
Account currentAccount = sessionManager.getCurrentAccount();
|
||||
if(currentAccount == null) {
|
||||
Timber.d("Current account is null");
|
||||
ViewUtil.showLongToast(context, context.getString(R.string.user_not_logged_in));
|
||||
sessionManager.forceLogin(context);
|
||||
return;
|
||||
}
|
||||
contribution = new Contribution(mediaUri, null, title, description, -1,
|
||||
null, null, sessionManager.getCurrentAccount().name,
|
||||
null, null, currentAccount.name,
|
||||
CommonsApplication.DEFAULT_EDIT_SUMMARY, decimalCoords);
|
||||
|
||||
contribution.setTag("mimeType", mimeType);
|
||||
|
|
|
|||
|
|
@ -289,4 +289,6 @@
|
|||
<string name="wikidata_edit_failure">Failed to update corresponding Wikidata entity!</string>
|
||||
<string name="menu_set_wallpaper">Set wallpaper</string>
|
||||
<string name="wallpaper_set_successfully">Wallpaper set successfully!</string>
|
||||
|
||||
<string name="user_not_logged_in">Login session expired, please log in again.</string>
|
||||
</resources>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue