Skip to content

On Logout, fetch the CSRF token and the make the post call to logout #3181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
5dc45a5
Fix bugs in peer review flow (#3039)
maskaravivek Jun 26, 2019
31b5179
Merge branch 'master' into 2.11-release
maskaravivek Jun 26, 2019
bb570a5
Localisation updates from https://translatewiki.net.
translatewiki Jul 11, 2019
94f3b6e
Localisation updates from https://translatewiki.net.
translatewiki Jul 15, 2019
32715d9
Set defaults to ON for all EXIF tags (#3068)
VitalyVPinchuk Jul 16, 2019
1560b77
Localisation updates from https://translatewiki.net.
translatewiki Jul 18, 2019
8cd9bd5
Fix category search bug (#3080)
ashishkumar468 Jul 21, 2019
1a60fec
Merge remote-tracking branch 'origin/2.11-release'
misaochan Jul 21, 2019
0574b75
Localisation updates from https://translatewiki.net.
translatewiki Jul 22, 2019
2c7d210
Localisation updates from https://translatewiki.net.
translatewiki Jul 25, 2019
9b769df
Closes #3094 (#3095)
ashishkumar468 Jul 28, 2019
d55f38b
Update changelog.md
misaochan Jul 29, 2019
e7dd272
Versioning for v2.11.0
misaochan Jul 29, 2019
93b948d
Merge branch '2.11-release-fork-3' of https://github.com/misaochan/ap…
misaochan Jul 29, 2019
0160225
Merge branch '2.11-release'
misaochan Jul 29, 2019
9bccbfe
Localisation updates from https://translatewiki.net.
translatewiki Jul 29, 2019
0090f24
Merge branch 'backend-overhaul' into master
maskaravivek Jul 30, 2019
009fe6f
Localisation updates from https://translatewiki.net.
translatewiki Aug 1, 2019
579d44c
Localisation updates from https://translatewiki.net.
translatewiki Aug 5, 2019
67d9afe
Center map on location clicked in nearby list and notification card(#…
cypherop Aug 5, 2019
ec8bbb2
removed swipe to delete (#2589)
vanshikaarora Aug 5, 2019
cbdfb05
Localisation updates from https://translatewiki.net.
translatewiki Aug 8, 2019
887d7ea
Revert "Merge branch 'backend-overhaul' into master"
ashishkumar468 Aug 12, 2019
5865d59
Revert "Merge branch 'backend-overhaul' into master" (#3125)
ashishkumar468 Aug 12, 2019
74df6ac
Localisation updates from https://translatewiki.net.
translatewiki Aug 12, 2019
2f72744
Localisation updates from https://translatewiki.net.
translatewiki Aug 15, 2019
175fba3
Merge branch 'master' of https://github.com/commons-app/apps-android-…
ashishkumar468 Aug 18, 2019
6c84192
Localisation updates from https://translatewiki.net.
translatewiki Aug 19, 2019
eeeea47
Localisation updates from https://translatewiki.net.
translatewiki Aug 23, 2019
24f1f40
Localisation updates from https://translatewiki.net.
translatewiki Aug 26, 2019
c34447e
edited CREDITS file (#3145)
vanshikaarora Aug 28, 2019
a658620
Unused dependencies are removed (#3141)
RozaliiaRusskikh Aug 28, 2019
76a759f
Localisation updates from https://translatewiki.net.
translatewiki Aug 29, 2019
33620f5
Localisation updates from https://translatewiki.net.
translatewiki Sep 3, 2019
0349e3e
Localisation updates from https://translatewiki.net.
translatewiki Sep 6, 2019
62feae6
Merge branch 'master' of https://github.com/commons-app/apps-android-…
ashishkumar468 Sep 8, 2019
864ecad
Working with #3129 issue (#3146)
PavelAplevich Sep 9, 2019
b1ea9c9
Localisation updates from https://translatewiki.net.
translatewiki Sep 9, 2019
2602690
Merge branch 'master' of https://github.com/commons-app/apps-android-…
ashishkumar468 Sep 10, 2019
77feb0a
Localisation updates from https://translatewiki.net.
translatewiki Sep 12, 2019
3a2b8b3
Merge branch 'master' of https://github.com/commons-app/apps-android-…
ashishkumar468 Sep 15, 2019
bfc9998
Localisation updates from https://translatewiki.net.
translatewiki Sep 16, 2019
bd8810a
Localisation updates from https://translatewiki.net.
translatewiki Sep 19, 2019
11d92ae
delete res/values-en-gb (#3153)
neslihanturan Sep 23, 2019
d5ea1eb
Localisation updates from https://translatewiki.net.
translatewiki Sep 23, 2019
11d3618
Localisation updates from https://translatewiki.net.
translatewiki Sep 26, 2019
49c13ae
Merge branch 'master' of https://github.com/commons-app/apps-android-…
ashishkumar468 Sep 29, 2019
8aa6e0b
* Fixed upload presenter tests
ashishkumar468 Sep 29, 2019
fbbaffb
First commit (#3093)
thetimeheist76 Sep 29, 2019
844e090
Solution #3126 (#3155)
PavelAplevich Sep 29, 2019
f64e6eb
Bugfix/fix upload presenter tests (#3158)
ashishkumar468 Sep 29, 2019
dfe59c4
Localisation updates from https://translatewiki.net.
translatewiki Oct 1, 2019
04d9db3
Remove dependency on Exif parsing library. (#2947)
dbrant Oct 5, 2019
b31cf11
Localisation updates from https://translatewiki.net.
translatewiki Oct 7, 2019
5b72cbf
Localisation updates from https://translatewiki.net.
translatewiki Oct 14, 2019
44cdd2f
Refactor nearby classes mvp (#2969)
neslihanturan Oct 15, 2019
855b3d3
Localisation updates from https://translatewiki.net.
translatewiki Oct 16, 2019
4a30748
Merge branch 'master' of https://github.com/commons-app/apps-android-…
ashishkumar468 Oct 17, 2019
e7f8f54
sd
ashishkumar468 Oct 17, 2019
ed9e995
switched to viv's data client temporarily
ashishkumar468 Oct 23, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Wikimedia Commons for Android

## v2.11.0
- Refactored upload process, explore/media details, and peer review to use MVP architecture
- Refactored all AsyncTasks to use RxAndroid
- Partial migration to Retrofit
- Allow users to remove EXIF tags from their uploads if desired
- Multiple crash and bug fixes

## v2.10.2
- Fixed remaining issues with date image taken
- Fixed database crash
Expand Down
1 change: 1 addition & 0 deletions CREDITS
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ their contribution to the product.
* Ilgaz Er
* Alicia Bendz
* Kaartic Sivaraam
* Vanshika Arora

3rd party open source libraries used:
* Butterknife
Expand Down
24 changes: 8 additions & 16 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
plugins {
id 'com.github.triplet.play' version '2.2.1' apply false
}

apply from: '../gitutils.gradle'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
Expand All @@ -18,27 +19,23 @@ dependencies {

// Utils
implementation 'com.github.nicolas-raoul:Quadtree:ac16ea8035bf07'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'in.yuvi:http.fluent:1.3'
implementation 'com.squareup.okhttp3:okhttp:3.12.1'
implementation 'com.squareup.okio:okio:1.15.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.3'
implementation 'com.jakewharton.rxbinding2:rxbinding:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-support-v4:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-appcompat-v7:2.1.1'
implementation 'com.jakewharton.rxbinding2:rxbinding-design:2.1.1'
implementation 'com.facebook.fresco:fresco:1.13.0'
implementation 'com.drewnoakes:metadata-extractor:2.11.0'
implementation 'com.github.maskaravivek:wikimedia-android-data-client:v0.0.28'
implementation 'org.apache.commons:commons-lang3:3.8.1'
implementation 'com.dmitrybrant:wikimedia-android-data-client:0.0.25'

// UI
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
implementation 'com.github.chrisbanes:PhotoView:2.0.0'
implementation 'com.github.pedrovgs:renderers:3.3.3'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:6.8.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-localization:0.6.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-sdk:7.2.0'
implementation 'com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v7:0.7.0'
implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0'
implementation 'com.dinuscxj:circleprogressbar:1.1.1'
implementation 'com.karumi:dexter:5.0.0'
Expand All @@ -48,14 +45,12 @@ dependencies {
// Logging
implementation 'ch.acra:acra-dialog:5.3.0'
implementation 'ch.acra:acra-mail:5.3.0'
implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'org.slf4j:slf4j-api:1.7.25'
api('com.github.tony19:logback-android-classic:1.1.1-6') {
exclude group: 'com.google.android', module: 'android'
}

// Dependency injector
implementation "com.google.dagger:dagger:$DAGGER_VERSION"
implementation "com.google.dagger:dagger-android-support:$DAGGER_VERSION"
kapt "com.google.dagger:dagger-android-processor:$DAGGER_VERSION"
kapt "com.google.dagger:dagger-compiler:$DAGGER_VERSION"
Expand All @@ -76,6 +71,7 @@ dependencies {
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.1.1'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test:rules:1.1.1'
androidTestImplementation 'androidx.annotation:annotation:1.0.2'
Expand All @@ -97,8 +93,6 @@ dependencies {

//swipe_layout
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
//metadata extractor
implementation 'com.drewnoakes:metadata-extractor:2.11.0'
}

android {
Expand All @@ -107,8 +101,8 @@ android {

defaultConfig {
applicationId 'fr.free.nrw.commons'
versionCode 243
versionName '2.10.2'
versionCode 475
versionName '2.11.0'
setProperty("archivesBaseName", "app-commons-v$versionName-" + getBranchName())

minSdkVersion 19
Expand Down Expand Up @@ -167,7 +161,7 @@ android {
versionNameSuffix "-debug-" + getBranchName()
}
}

if (isRunningOnTravisAndIsNotPRBuild) {
// configure keystore based on env vars in Travis for automated alpha builds
signingConfigs.release.storeFile = file("../nr-commons.keystore")
Expand All @@ -194,7 +188,6 @@ android {
buildConfigField "String", "IMAGE_URL_BASE", "\"https://upload.wikimedia.org/wikipedia/commons\""
buildConfigField "String", "HOME_URL", "\"https://commons.wikimedia.org/wiki/\""
buildConfigField "String", "COMMONS_URL", "\"https://commons.wikimedia.org\""
buildConfigField "String", "WIKIDATA_URL", "\"https://wikidata.org\""
buildConfigField "String", "MOBILE_HOME_URL", "\"https://commons.m.wikimedia.org/wiki/\""
buildConfigField "String", "SIGNUP_LANDING_URL", "\"https://commons.m.wikimedia.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page&returntoquery=welcome%3Dyes\""
buildConfigField "String", "SIGNUP_SUCCESS_REDIRECTION_URL", "\"https://commons.m.wikimedia.org/w/index.php?title=Main_Page&welcome=yes\""
Expand Down Expand Up @@ -226,7 +219,6 @@ android {
buildConfigField "String", "IMAGE_URL_BASE", "\"https://upload.beta.wmflabs.org/wikipedia/commons\""
buildConfigField "String", "HOME_URL", "\"https://commons.wikimedia.beta.wmflabs.org/wiki/\""
buildConfigField "String", "COMMONS_URL", "\"https://commons.wikimedia.beta.wmflabs.org\""
buildConfigField "String", "WIKIDATA_URL", "\"https://wikidata.org\""
buildConfigField "String", "MOBILE_HOME_URL", "\"https://commons.m.wikimedia.beta.wmflabs.org/wiki/\""
buildConfigField "String", "SIGNUP_LANDING_URL", "\"https://commons.m.wikimedia.beta.wmflabs.org/w/index.php?title=Special:CreateAccount&returnto=Main+Page&returntoquery=welcome%3Dyes\""
buildConfigField "String", "SIGNUP_SUCCESS_REDIRECTION_URL", "\"https://commons.m.wikimedia.beta.wmflabs.org/w/index.php?title=Main_Page&welcome=yes\""
Expand Down
21 changes: 18 additions & 3 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,7 @@
</service>
<service
android:name=".contributions.ContributionsSyncService"
android:exported="true"
android:process=":sync">
android:exported="true">
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>
Expand All @@ -162,6 +161,17 @@
android:name="android.content.SyncAdapter"
android:resource="@xml/contributions_sync_adapter" />
</service>
<service
android:name=".modifications.ModificationsSyncService"
android:exported="true">
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>

<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/modifications_sync_adapter" />
</service>

<service
android:name="org.acra.sender.SenderService"
Expand All @@ -183,7 +193,12 @@
android:exported="false"
android:label="@string/provider_contributions"
android:syncable="true" />

<provider
android:name=".modifications.ModificationsContentProvider"
android:authorities="${applicationId}.modifications.contentprovider"
android:exported="false"
android:label="@string/provider_modifications"
android:syncable="true" />
<provider
android:name=".category.CategoryContentProvider"
android:authorities="${applicationId}.categories.contentprovider"
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/fr/free/nrw/commons/CommonsAppAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,15 @@ public String getPassword() {

@Override
public void updateAccount(@NonNull LoginResult result) {
sessionManager.updateAccount(result);
// TODO: sessionManager.updateAccount(result);
}

@Override
public SharedPreferenceCookieManager getCookies() {
if (!preferences.contains(COOKIE_STORE_NAME)) {
return null;
}
return GsonUnmarshaller.unmarshal(SharedPreferenceCookieManager.class,
preferences.getString(COOKIE_STORE_NAME, null));
return GsonUnmarshaller.unmarshal(SharedPreferenceCookieManager.class, preferences.getString(COOKIE_STORE_NAME, null));
}

@Override
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/fr/free/nrw/commons/CommonsApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import android.os.Process;
import android.util.Log;

import androidx.annotation.NonNull;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.imagepipeline.core.ImagePipelineConfig;
import com.squareup.leakcanary.LeakCanary;
Expand All @@ -30,6 +28,7 @@
import javax.inject.Inject;
import javax.inject.Named;

import androidx.annotation.NonNull;
import fr.free.nrw.commons.auth.SessionManager;
import fr.free.nrw.commons.bookmarks.locations.BookmarkLocationsDao;
import fr.free.nrw.commons.bookmarks.pictures.BookmarkPicturesDao;
Expand All @@ -42,6 +41,7 @@
import fr.free.nrw.commons.kvstore.JsonKvStore;
import fr.free.nrw.commons.logging.FileLoggingTree;
import fr.free.nrw.commons.logging.LogUtils;
import fr.free.nrw.commons.modifications.ModifierSequenceDao;
import fr.free.nrw.commons.upload.FileUtils;
import fr.free.nrw.commons.utils.ConfigUtils;
import io.reactivex.android.schedulers.AndroidSchedulers;
Expand Down Expand Up @@ -265,6 +265,7 @@ private void updateAllDatabases() {
dbOpenHelper.getReadableDatabase().close();
SQLiteDatabase db = dbOpenHelper.getWritableDatabase();

ModifierSequenceDao.Table.onDelete(db);
CategoryDao.Table.onDelete(db);
ContributionDao.Table.onDelete(db);
BookmarkPicturesDao.Table.onDelete(db);
Expand Down
22 changes: 10 additions & 12 deletions app/src/main/java/fr/free/nrw/commons/Media.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import android.os.Parcel;
import android.os.Parcelable;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import org.apache.commons.lang3.StringUtils;
import org.wikipedia.dataclient.mwapi.MwQueryPage;
import org.wikipedia.gallery.ExtMetadata;
Expand All @@ -23,13 +20,14 @@
import java.util.Locale;
import java.util.Map;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import fr.free.nrw.commons.location.LatLng;
import fr.free.nrw.commons.utils.CommonsDateUtil;
import fr.free.nrw.commons.utils.MediaDataExtractorUtil;

public class Media implements Parcelable {

public static final Media EMPTY = new Media("");
public static Creator<Media> CREATOR = new Creator<Media>() {
@Override
public Media createFromParcel(Parcel parcel) {
Expand Down Expand Up @@ -158,9 +156,9 @@ public static Media from(MwQueryPage page) {
page.title(),
"",
0,
safeParseDate(metadata.dateTime()),
safeParseDate(metadata.dateTime()),
StringUtil.fromHtml(metadata.artist()).toString()
safeParseDate(metadata.dateTimeOriginal().value()),
safeParseDate(metadata.dateTime().value()),
StringUtil.fromHtml(metadata.artist().value()).toString()
);

if (!StringUtils.isBlank(imageInfo.getThumbUrl())) {
Expand All @@ -172,17 +170,17 @@ public static Media from(MwQueryPage page) {
language = "default";
}

media.setDescriptions(Collections.singletonMap(language, metadata.imageDescription()));
media.setCategories(MediaDataExtractorUtil.extractCategoriesFromList(metadata.getCategories()));
String latitude = metadata.getGpsLatitude();
String longitude = metadata.getGpsLongitude();
media.setDescriptions(Collections.singletonMap(language, metadata.imageDescription().value()));
media.setCategories(MediaDataExtractorUtil.extractCategoriesFromList(metadata.categories().value()));
String latitude = metadata.gpsLatitude().value();
String longitude = metadata.gpsLongitude().value();

if (!StringUtils.isBlank(latitude) && !StringUtils.isBlank(longitude)) {
LatLng latLng = new LatLng(Double.parseDouble(latitude), Double.parseDouble(longitude), 0);
media.setCoordinates(latLng);
}

media.setLicenseInformation(metadata.licenseShortName(), metadata.licenseUrl());
media.setLicenseInformation(metadata.licenseShortName().value(), metadata.licenseUrl().value());
return media;
}

Expand Down
13 changes: 4 additions & 9 deletions app/src/main/java/fr/free/nrw/commons/MediaDataExtractor.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package fr.free.nrw.commons;

import androidx.core.text.HtmlCompat;

import javax.inject.Inject;
import javax.inject.Singleton;

import fr.free.nrw.commons.media.MediaClient;
import androidx.core.text.HtmlCompat;
import fr.free.nrw.commons.mwapi.MediaWikiApi;
import fr.free.nrw.commons.mwapi.OkHttpJsonApiClient;
import io.reactivex.Single;
Expand All @@ -21,15 +19,12 @@
public class MediaDataExtractor {
private final MediaWikiApi mediaWikiApi;
private final OkHttpJsonApiClient okHttpJsonApiClient;
private final MediaClient mediaClient;

@Inject
public MediaDataExtractor(MediaWikiApi mwApi,
OkHttpJsonApiClient okHttpJsonApiClient,
MediaClient mediaClient) {
OkHttpJsonApiClient okHttpJsonApiClient) {
this.okHttpJsonApiClient = okHttpJsonApiClient;
this.mediaWikiApi = mwApi;
this.mediaClient = mediaClient;
}

/**
Expand All @@ -40,7 +35,7 @@ public MediaDataExtractor(MediaWikiApi mwApi,
*/
public Single<Media> fetchMediaDetails(String filename) {
Single<Media> mediaSingle = getMediaFromFileName(filename);
Single<Boolean> pageExistsSingle = mediaClient.checkPageExistsUsingTitle("Commons:Deletion_requests/" + filename);
Single<Boolean> pageExistsSingle = mediaWikiApi.pageExists("Commons:Deletion_requests/" + filename);
Single<String> discussionSingle = getDiscussion(filename);
return Single.zip(mediaSingle, pageExistsSingle, discussionSingle, (media, deletionStatus, discussion) -> {
media.setDiscussion(discussion);
Expand All @@ -57,7 +52,7 @@ public Single<Media> fetchMediaDetails(String filename) {
* @return return data rich Media object
*/
public Single<Media> getMediaFromFileName(String filename) {
return mediaClient.getMedia(filename);
return okHttpJsonApiClient.getMedia(filename, false);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ void shareScreen(Bitmap bitmap) {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.putExtra(Intent.EXTRA_STREAM, fileUri);
intent.setType("image/png");
startActivity(Intent.createChooser(intent, "Share image via"));
startActivity(Intent.createChooser(intent, getString(R.string.share_image_via)));
} catch (IOException e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -316,8 +316,8 @@ private void setUploadProgress(int uploadCount){

private void setZeroAchievements() {
AlertDialog.Builder builder=new AlertDialog.Builder(this)
.setMessage("You haven't made any contributions yet")
.setPositiveButton("Ok", (dialog, which) -> {
.setMessage(getString(R.string.no_achievements_yet))
.setPositiveButton(getString(R.string.ok), (dialog, which) -> {
});
AlertDialog dialog = builder.create();
dialog.show();
Expand Down
Loading