Update master with backend overhaul branch (#2829)

* Beginnings of integration with Wikipedia client library. (#2642)

* Remove remaining unnecessary API version check.

* Roll up sleeves.

* Add and integrate the beginnings of app adapter.

* Remove vestigial event logging logic.

Event logging is no longer used in this app.

* Beginnings: remove StringUtils and associated redundancies.

* Remove redundant capitalize() method.

* Remove redundant urlEncode() method.

* Remove redundant (and incomplete) language lists.

* Remove redundant usages of SimpleDateFormat.

* Remove redundant json type adapter.

* Remove redundant MW error model classes.

* Rip out redundant MW model classes.

* Pass SessionManager into AppAdapter instead of injecting.

* Wire up more of the AppAdapter.

* Remove redundant Gson initialization and type adapters.

* Rip out PageTitle.

This was being used in some slightly incorrect/unexpected ways.

* Don't need static WikiSite.

* Bump data client library version

* Bump library version and fix build

* Fix tests

* Fix build

* Fix media of the day

* With fixes in recently modified APIs
This commit is contained in:
Vivek Maskara 2019-04-02 08:35:22 +05:30 committed by GitHub
parent 76e5a30fb5
commit dcbf076965
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
76 changed files with 424 additions and 2122 deletions

View file

@ -41,7 +41,6 @@ import butterknife.OnClick;
import butterknife.OnEditorAction;
import butterknife.OnFocusChange;
import fr.free.nrw.commons.BuildConfig;
import fr.free.nrw.commons.PageTitle;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.Utils;
import fr.free.nrw.commons.WelcomeActivity;
@ -192,22 +191,6 @@ public class LoginActivity extends AccountAuthenticatorActivity {
Utils.handleWebUrl(this, Uri.parse(BuildConfig.PRIVACY_POLICY_URL));
}
@OnClick(R.id.login_button)
void performLogin() {
loginCurrentlyInProgress = true;
Timber.d("Login to start!");
final String username = canonicializeUsername(usernameEdit.getText().toString());
final String rawUsername = Utils.capitalize(usernameEdit.getText().toString().trim());
final String password = passwordEdit.getText().toString();
String twoFactorCode = twoFactorEdit.getText().toString();
showLoggingProgressBar();
compositeDisposable.add(Observable.fromCallable(() -> login(username, password, twoFactorCode))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(result -> handleLogin(username, rawUsername, password, result)));
}
@OnClick(R.id.sign_up_button)
void signUp() {
Intent intent = new Intent(this, SignupActivity.class);
@ -259,6 +242,22 @@ public class LoginActivity extends AccountAuthenticatorActivity {
super.onDestroy();
}
@OnClick(R.id.login_button)
public void performLogin() {
loginCurrentlyInProgress = true;
Timber.d("Login to start!");
final String username = usernameEdit.getText().toString();
final String rawUsername = usernameEdit.getText().toString().trim();
final String password = passwordEdit.getText().toString();
String twoFactorCode = twoFactorEdit.getText().toString();
showLoggingProgressBar();
compositeDisposable.add(Observable.fromCallable(() -> login(username, password, twoFactorCode))
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(result -> handleLogin(username, rawUsername, password, result)));
}
private String login(String username, String password, String twoFactorCode) {
try {
if (twoFactorCode.isEmpty()) {
@ -364,16 +363,6 @@ public class LoginActivity extends AccountAuthenticatorActivity {
}
}
/**
* Because Mediawiki is upercase-first-char-then-case-sensitive :)
*
* @param username String
* @return String canonicial username
*/
private String canonicializeUsername(String username) {
return new PageTitle(username).getText();
}
@Override
protected void onStart() {
super.onStart();

View file

@ -14,7 +14,6 @@ import javax.inject.Singleton;
import fr.free.nrw.commons.BuildConfig;
import fr.free.nrw.commons.kvstore.JsonKvStore;
import fr.free.nrw.commons.kvstore.JsonKvStore;
import fr.free.nrw.commons.mwapi.MediaWikiApi;
import io.reactivex.Completable;
import io.reactivex.Observable;