Commit graph

134 commits

Author SHA1 Message Date
Ashish Kumar
fe540eb135 Bugfix/getuploadcount (#3049)
* Closes #3048
* response.body().string() was called more than once and because response body can be huge so OkHttp doesnot store it in memory, it reads it as a stream from network when we need it, which cannot be done without a new request.

* null check in response.body()

* Fixed possible NumberFormatException, made review suggested changes

* added getUploadCount test case
2019-07-08 01:45:11 +05:30
Ashish Kumar
60b1eb1957 Feature/refactor contributions (#3046)
* * Refactored ContributionsListFragment to use RecyclerView
* Added ContributionsPresenter
* Extracted out the cursor to presenter
* Probable fix for #3028

* Improved the logic for cache in ContributionViewHolder

* Some more refactoring

* While displaying images in ContributionsList, check if status is not completed && local uri exists, use that uri to show image

* typo correction in LocalDataSource

* Fixed formatting in ContributionsPresenter

* retain adapter position when orientation changes

* retain child position with its id

* Made ContributionViewHolder not implement ViewHolder

* Code formatting, review suggested changes

* initialise the rv layout managers only when needed

* added test cases for ContributionPresenter

* removed not needed semi colon

* added more java docs and code formatting
2019-07-07 10:24:28 +03:00
Vivek Maskara
d7628959a7
Fix bugs in peer review flow (#3039) (#3042)
* Fix bugs in peer review flow

* Fix tests

* Bug fixes

* Fix remaining issues with peer review
2019-06-26 21:31:06 +05:30
Ashish Kumar
7a5dc77057 Refactor uploads (#2981)
* Feature/refractor uploads [WIP] (#2887)

* Fix duplicate param information (#2515)

* Bug fix issue #2476 (#2526)

* Added wikidataEntityID in all db versions, handled db.execSql via method runQuery

* Versioning and changelog for v2.10.2 (#2531)

* Update changelog.md

* Versioning for v2.10.2

* Update changelog.md

* Bugfix/issue 2580 (#2584)

* Corrected string placedholders in certain string files

* Corrected string placedholders in certain string files[Bug fix #2580]

* Bug Fix #2585 (#2647)

* Bug Fix #2585
* Added null checks on view in SearchImageFragment when updating views from external sources
* Disposed the disposables in SearchActivity and SearchImageFragment when no longer in active lifecycle

* use FragmentUtils to verify fragment active state

* Bug Fix issue #2648 (#2678)

* Bug Fix issue #2648
* Handled external storage permission before file download

* * Removed redudant check for permission in MediaDetailPagerFragment (Dexter already does that)
* Removed duplicate code in PermissionUtil$checkPermissionsAndPerformAction, used the existing function with conditional extra parameters

* string name typo correction

* BugFix issue #2652 (#2706)

* Addded null check on bookmark before operating on it

* BugFix issue #2711 (#2712)

* Added null checks in OkHttpJsonApiClient$searchImages MwQueryResponse

* BugFix #2718 (#2719)

* Handled null auth cookies

* Fix #2791: NPE when nominating for deletion and leaving screen (#2792)

* Bug Fix issue #2789 (#2790)

* Handled Illegal State Exception for non existent appropriate view parents in ViewUtils$showShortSnackbar

* BugFix #2720 (#2831)

BugFix deprecated licenes #2720

* ui fixes, wip, upload

* *Issue #2886, BugFix #2832[wip]
* updated UploadActivity code
* modified ui
* Updated UploadPresenterTest

* * updated interfaces names to follow names suffixed with Contract
* added test cases

* card view elevation

* view pager disabled swipe

* bug fix, duplicate image

* used existing non-swipable view pager

* Avoid image view resize with keyboard, added adjustPan and stateVisible as softinputMode for UploadActivity

* retain UploadBaseFragment instances on orientation changes

* * Added test cases for UploadMediaPresenter
* Injected io and main thread schedulers

* categories presenter test cased wip

* Added CategoriesPresenter test

* * Added the logic to show open map (with to be uploaded image's coordinates while uploading image)

* codacy suggested changes * added java docs

* Added travis_wait fot android-wait-for-emulator

* ranamed interface onResponseCallback to Callback

* * Added api to delete picture in UploadModel
* cleanUp in UploadModel. once upload has been initiated
* Removed unused methods from UploadModel and the corresponding test class

* * Added tests for UploadPresenter
* Travis suggested changes
* Addded copy previous title and description

* * Made the upload add descriptions visible when keyboard visible
* add description request focus only when user manually requests it

* Added JavaDocs, review suggested changes

* Fix dagger injection

* use DialogUtil to show info in descriptions

* use activity context for DialogUtil

* Minor changes

* Bug fix, reduced the add description edit text clickable bound (#2973)

* Bugfix/uploads (#3000)

* merged with master

* BugFix IllegalStateException
* setRetainState(true), not required with FragmentStatePagerAdapter
* Increase the ViewPager's Offscreen Limit, we want all the fragments to be active

* BugFix, clear selected categoris for previous upload session
* Clear Selected Categories
* Addded JavaDocs for CategoriesModel

* Code Formatting in app/src/main/java/fr/free/nrw/commons/upload/UploadModel.java

* Added class level JavaDoc UploadRemoteDataSource

* Added class level JavaDoc for UploadRepository

* Added JavaDocs for ThumbnailsAdapter

* Added JavaDocs for MediaLicensePresenter, CategoriesPresenter

* Removed null check on category query
* Show default catgeories based on image title and gps location when category text empty
* Allow search for empty category search

* Attached image scale listener to upload media image

* Bug fix, reduced the add description edit text clickable bound

* Fix memory leak (#3001)

* Bugfix/uploads (#3002)

* merged with master

* BugFix IllegalStateException
* setRetainState(true), not required with FragmentStatePagerAdapter
* Increase the ViewPager's Offscreen Limit, we want all the fragments to be active

* BugFix, clear selected categoris for previous upload session
* Clear Selected Categories
* Addded JavaDocs for CategoriesModel

* Code Formatting in app/src/main/java/fr/free/nrw/commons/upload/UploadModel.java

* Added class level JavaDoc UploadRemoteDataSource

* Added class level JavaDoc for UploadRepository

* Added JavaDocs for ThumbnailsAdapter

* Added JavaDocs for MediaLicensePresenter, CategoriesPresenter

* Removed null check on category query
* Show default catgeories based on image title and gps location when category text empty
* Allow search for empty category search

* Attached image scale listener to upload media image

* Bug fix, reduced the add description edit text clickable bound

* Added tooltip in Title in UploadMediaFragment

* BugFix recent categories

* Updated test methods

* Bugfix/uploads (#3011)

* merged with master

* BugFix IllegalStateException
* setRetainState(true), not required with FragmentStatePagerAdapter
* Increase the ViewPager's Offscreen Limit, we want all the fragments to be active

* BugFix, clear selected categoris for previous upload session
* Clear Selected Categories
* Addded JavaDocs for CategoriesModel

* Code Formatting in app/src/main/java/fr/free/nrw/commons/upload/UploadModel.java

* Added class level JavaDoc UploadRemoteDataSource

* Added class level JavaDoc for UploadRepository

* Added JavaDocs for ThumbnailsAdapter

* Added JavaDocs for MediaLicensePresenter, CategoriesPresenter

* Removed null check on category query
* Show default catgeories based on image title and gps location when category text empty
* Allow search for empty category search

* Attached image scale listener to upload media image

* Bug fix, reduced the add description edit text clickable bound

* Added tooltip in Title in UploadMediaFragment

* BugFix recent categories

* Updated test methods

* Avoid memory leak, free the adpater in MediaLicenseFragment.onDestroyView

* bugfix/uploads (#3012)

* merged with master

* BugFix IllegalStateException
* setRetainState(true), not required with FragmentStatePagerAdapter
* Increase the ViewPager's Offscreen Limit, we want all the fragments to be active

* BugFix, clear selected categoris for previous upload session
* Clear Selected Categories
* Addded JavaDocs for CategoriesModel

* Code Formatting in app/src/main/java/fr/free/nrw/commons/upload/UploadModel.java

* Added class level JavaDoc UploadRemoteDataSource

* Added class level JavaDoc for UploadRepository

* Added JavaDocs for ThumbnailsAdapter

* Added JavaDocs for MediaLicensePresenter, CategoriesPresenter

* Removed null check on category query
* Show default catgeories based on image title and gps location when category text empty
* Allow search for empty category search

* Attached image scale listener to upload media image

* Bug fix, reduced the add description edit text clickable bound

* Added tooltip in Title in UploadMediaFragment

* BugFix recent categories

* Updated test methods

* Avoid memory leak, free the adpater in MediaLicenseFragment.onDestroyView

* BugFix Illegal State Exception in ViewpPagerAdapter

* Remove irrelevant comment

* merge conflict with strings (#3016)
2019-06-14 01:09:41 +05:30
Vivek Maskara
6f9d69e63c Use data client for peer review calls (#2937)
* Use data client for peer review calls

* With java docs

* Optimise API calls and fix tests
2019-06-07 09:59:08 +03:00
Adam Jones
67e43ef446 Upgrade to Robolectric 4 (#2982) 2019-06-04 22:02:07 +05:30
Vitaly V. Pinchuk
cc0b059595 Image EXIF/XMP metadata removal routine (#2863)
* [WIP] Added preferences for EXIF tags

* [WIP] Added arrays, keys, strings to support EXIF preferences

* [WIP] Updated SettingsFragment to setup summary of added preferences(locationAccuracy)

* [WIP] Added methods getStringSet()in BasicKvStore, KeyValueStore to support Set<String> data type used in preferences (EXIF tags)

* [WIP] Added methods for removing EXIF tags and anonimyzing location coordinates in FileProcessor, GPSExtractor

* [WIP] Fixed errors in preferences EXIF tags, added XMP removal routine

* [WIP] Removed erroneous location accuracy handling

* [WIP] Fixed mistyped GPS Tags

* Reverted BasicKvStore. Removed Set<String> support in BasicKvStore as JsonKVStore already has it.

* FileProcessor: Replaced throwing runtime exception with warning if EXIF redaction fails.

* FileMetadataUtils: Javadoc added

* [WIP] FileMetadataUtilsTest added

* [WIP] FileMetadataUtilsTest: added javadoc

* [WIP] FileMetadataUtilsTest: added javadoc

* [WIP] FileProcessor: fixed disposing observables

* [WIP] FileMetadataUtils.getTagsFromPref: changed return type from observable to simple array

* [WIP] FileProcessorTest: added test for redactExifTags

* [WIP] FileProcessorTest: redactExifTags() doesn't work properly
2019-06-04 15:38:01 +03:00
Ashish Kumar
c8a58bfc2e
Revert "Fixes #2337 - Show captions of image in media details (conflicts fixed) (#2933)" (#2934)
This reverts commit 3c9b7ba7a8.
2019-05-01 16:10:43 +05:30
neslihanturan
3c9b7ba7a8 Fixes #2337 - Show captions of image in media details (conflicts fixed) (#2933)
* Api call

* added captions

* final commit

* some minor changes

* sigular

* test for captions

* mock fetchCaptionbyFileName

* corrected method name

* * used ? instead of !! (unsafe call on nullable)
* updated unit test for fetchCaptionByFilename()
2019-05-01 15:08:38 +05:30
Cesar Villalobos
ee3f4d4d30 Fix wrong language codes displaying to user (#2880) (#2930)
* Updated language codes displayed for Hebrew, Indonesian and Yiddish (#2880)

* Function 'fixLanguageCode' encapsulated with unit tests (#2880)

* Renaming class "StringUtils" as "LangCodeUtils" and small String formatting improvement in "SpinnerLanguagesAdapter"
2019-04-27 07:55:12 +03:00
Vivek Maskara
98d28c60a2 Bump data client library version (#2926)
* Bump data client library version

* Fix tests

* Add javadocs
2019-04-25 10:54:51 +05:30
Vivek Maskara
af9d991a15 Fix fetching of bookmarks (#2905)
* Fix fetching of bookmarks

* With more robust tests
2019-04-21 17:06:31 +05:30
Vivek Maskara
a003e9706f Do not use erroneous thumb url util function (#2901)
* Do not use erroneous thumb url util function

* Remove unused code

* Fix image loading for peer review

* Clear disposable
2019-04-20 15:03:52 +05:30
Vivek Maskara
accb880256 Fix image not loading issue in peer review (#2902)
* Fix image loading issue in peer review

* With more test cases
2019-04-20 10:42:09 +03:00
Vivek Maskara
dcbf076965
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
2019-04-02 08:35:22 +05:30
Adam Jones
23c23cc9fc Use JSON version 2 API for MwQueryResponse responses (#2816) 2019-04-01 23:33:30 +05:30
Vivek Maskara
0bf63f50b3 Replace remaining AsyncTask with RxAndroid (#2681) 2019-03-28 21:10:47 +00:00
Vivek Maskara
c45b945526 Use JSON APIs for explore (#2731)
* Use JSON APIs for explore

* With tests

* Use JSON APIs for explore

* With tests

* BugFix #2731 (#4)

* Increased sdk version to 23

* with more robust tests

* Fix crashes and other reported issues

* Add javadocs

* Use common method for search and categories

* Add javadocs
2019-03-26 18:02:58 +05:30
Dmitry Brant
adf23c257f Improve extremely inefficient darkness-checking logic. (#2639)
* Improve extremely inefficient darkness-checking logic.

* Use ExifInterface from AndroidX instead of android.media.

* Fix false-positive detekt check.

* Fix false-positive detekt check.
2019-03-19 20:23:36 +05:30
Vanshika Arora
3417d713d2 Fixes #97: Added metadata reader for reading exif data (#2581)
* initial commit

* initial commit

* reading 3 exif directories

* minor changes

* fixed unit tests

* reviwied requested changes

* minor changes

* minor changes
2019-03-19 19:08:42 +05:30
Adam Jones
d719a4a9d4 Add tests for PageTitle (#2624) 2019-03-17 11:22:37 +05:30
Adam Jones
561f9ea23c Add more tests to StringSortingUtils (#2622)
* Add more tests to StringSortingUtils

* Add test with empty strings to improve coverage
2019-03-16 23:21:23 +05:30
Vivek Maskara
7cb87f3cab Consolidate shared prefs to a single store (#2613)
* Consolidate shared prefs to a single store
* Fix achievements activity
* Fix store usage
2019-03-16 13:56:56 +00:00
Vivek Maskara
57e685cf6c Fix #2593: Migrate to androidX (#2594)
* Update dependencies and migrate to androidX
* Make gradle properties tidy
2019-03-16 11:22:37 +00:00
Vanshika Arora
6389b35b49 replaced icafe with metadata extractor (#2546)
* replaced icafe with metadata extractor

* replaced icafe with metadata extractor

* removed icafe from gradle

* removed icafe from gradle

* Revert: travis commented code

* Use original content URI

* merged pr

* commit after merge

* modified unit tests
2019-03-12 00:20:47 +05:30
Ronan Brigdale
480c05b2f3 Fix Lint Issues #171: Fix numerous errors/warnings (#2537) 2019-03-10 23:55:35 +05:30
Ashish Kumar
1b86726364 Bugfix #2476 (#2527)
updated database version and added associated tests
2019-03-01 06:14:36 +13:00
Ashish Kumar
64eae8be82 Bug fix issue #2476 (#2526)
* Added wikidataEntityID in all db versions, handled db.execSql via method runQuery
2019-02-28 05:55:16 +13:00
Vanshika Arora
3a822d3c30 Added IPTC reader (#2383)
* graddle changes

* readfbmd class

* jar files

* added icafe

* gradle changes

* ReadFBMD

* recent commit

* commit changes

* commit changes

* fixed code quality issues

* optimised imports

* changes for  reviews

* not instantiating class

* removed irrelevant code

* added documentation

* modified test cases

* commit changes

* modified variable

* modified variable

* javadoc

* test changes

* removed .log file

* Show warning dialog for FBMD
2019-02-24 23:16:22 +05:30
Ashish Kumar
9c6e9bd017 updated test cases to support db upgrade in #2476 (#2497)
* updated test cases to support db upgrade in #2476

* fixed errors
2019-02-21 00:33:31 +05:30
Vivek Maskara
2bc0d41748 Fix date time issue for google photos (#2438) 2019-02-13 00:17:06 +13:00
Vivek Maskara
5a6402cd07 Make nearby query faster (#2419)
* Make nearby query faster

* Fix query
2019-02-10 20:53:02 +05:30
Vivek Maskara
f12837650a Use JSON SPARQL query for fetching nearby places (#2398)
* Use JSON response for nearby places

* Move okhttp calls to a different class

* wip

* Fetch picture of the day using JSON API

* Search images using JSON APIs

* tests

* Fix injection based on code review comments
2019-02-06 10:40:30 +05:30
Vivek Maskara
52ab39381e Add module for file picker for camera and gallery uploads (#2375)
* Use easy image for image picker

* Do not use harcoded mime type

* Use uploadable file for image uploads

* Add picker files in filepicker module

* Remove redundant checks for file

* Make usage of file extensions consistent

* Add javadocs

* Fix tests

* Enable image upload using bookmark activity

* Fix multiple uploads

* Fix external image uploads

* Fix chooser intents

* Fix image quality checks

* Segregate internal and external upload intents

* Invoke all error messages from one place

* Minor changes

* Fix tests

* Add image processing service tests
2019-02-03 22:40:31 +02:00
Shubham Pinjwani
9451b00a15 Show bookmarked nearby locations differently (#2059) (#2349)
* Show bookmarked nearby locations differently (#2059)

* added custom bookmark marker

* passed value of bookmarkplacelist in tests

* update the nearby markers on clicking bookmark buttons
2019-02-02 19:13:42 +05:30
Vivek Maskara
4bbbfc839b Save Wikidata entity ID in contributions DB (#2317) 2019-01-30 11:49:30 +02:00
Vivek Maskara
68ae11e37f Use central auth token only for cross wiki calls (#2318)
* Use central auth token only for cross wiki calls

* Fix tests

* Add test for wikidata edit token
2019-01-25 18:14:41 +10:00
Vivek Maskara
de9611821b Fix version number for alpha builds (#2325) 2019-01-24 23:32:16 +05:30
Vivek Maskara
532ab8aeae Fix uploads getting stuck (#2309)
* Fix uploads getting stuck

* Fix test

* Use single instance of Gson across the app

* More logs to help debug upload failure

* Add request identifier

* wip

* Fix issues with image quality check dialogs
2019-01-24 17:56:18 +10:00
Vivek Maskara
559127dfa3 Fix app stuck and memory issues while uploading images (#2287)
* Do not use an image array to store all bitmap pixels at once

* Extract image preprocessing to a different service and use computation thread

* Add java docs

* Cleanup code to remove temp file logic

* Add logs in upload flow

* Fix tests

* Fix more tests
2019-01-16 18:32:25 +02:00
Vivek Maskara
d4fa9cfa45 Use wrapper for interacting with shared preferences (#2288)
* Use wrapper for accessing shared preferences across the app

* Use Json kv store for storing place object

* Fix tests

* Fix test failure

* Fix UI tests
2019-01-14 00:13:21 +05:30
Vivek Maskara
e773a82206 Handle null URI while uploading picture (#2262)
* Handle null URI while uploading picture

* Modify cache method to never return null path

* Fix tests
2019-01-04 18:21:55 +10:00
Vivek Maskara
2ea6bd7f65 With more information while sending logs (#2222)
* With more information while sending logs

* With java docs and unit tests

* Changes based on code review
2019-01-03 01:12:08 +10:00
Adam Jones
fb3136ab19 Spelling mistake fixes (#2151)
* Spelling mistake fixes

* Spelling mistake fix
2018-12-21 15:20:52 +02:00
Adam Jones
d7e73c37e6 Refactor and add tests to LengthUtils (#2201) 2018-12-21 14:23:53 +02:00
Vivek Maskara
4b58f16557 Fix null context error in network utils (#2184) 2018-12-20 12:55:21 +00:00
Adam Jones
fb3055e716 Add FileUtils tests for SHA1 and deletion (#2152)
* Add FileUtils tests for SHA1 and deletion

* Avoid changing access modifier for SHA1 test
2018-12-17 21:15:00 +05:30
Vivek Maskara
f897af028a
Fix upload tests (#2130) 2018-12-16 21:04:49 +05:30
Vivek Maskara
8c083f3dd5 Changes to fix build (#2128)
* Changes to fix build

* Apply GPP plugin only on travis
2018-12-17 00:29:33 +10:00
Adam Jones
aa4ab37adb Move utils tests to utils package (#2109) 2018-12-14 10:54:46 +05:30