Skip to content

Commit

Permalink
Merge branch 'main' into lint-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolas-raoul authored Dec 6, 2024
2 parents f89fb37 + a8387f0 commit a2179ea
Show file tree
Hide file tree
Showing 79 changed files with 3,761 additions and 4,235 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ dependencies {

implementation 'com.jakewharton.timber:timber:4.7.1'
implementation 'com.github.deano2390:MaterialShowcaseView:1.2.0'
implementation "com.google.android.material:material:1.9.0"
implementation "com.google.android.material:material:1.12.0"
implementation 'com.karumi:dexter:5.0.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class AboutActivityTest {
fun testLaunchTranslate() {
Espresso.onView(ViewMatchers.withId(R.id.about_translate)).perform(ViewActions.click())
Espresso.onView(ViewMatchers.withId(android.R.id.button1)).perform(ViewActions.click())
val langCode = CommonsApplication.instance.languageLookUpTable!!.codes[0]
val langCode = CommonsApplication.instance.languageLookUpTable!!.getCodes()[0]
Intents.intended(
CoreMatchers.allOf(
IntentMatchers.hasAction(Intent.ACTION_VIEW),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ class CampaignsPresenter @Inject constructor(
return
}

okHttpJsonApiClient.campaigns
okHttpJsonApiClient.getCampaigns()
.observeOn(mainThreadScheduler)
.subscribeOn(ioScheduler)
.doOnSubscribe { disposable = it }
.subscribe({ campaignResponseDTO ->
val campaigns = campaignResponseDTO.campaigns?.toMutableList()
val campaigns = campaignResponseDTO?.campaigns?.toMutableList()
if (campaigns.isNullOrEmpty()) {
Timber.e("The campaigns list is empty")
view!!.showCampaigns(null)
Expand Down
9 changes: 3 additions & 6 deletions app/src/main/java/fr/free/nrw/commons/di/NetworkingModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ import okhttp3.logging.HttpLoggingInterceptor
import okhttp3.logging.HttpLoggingInterceptor.Level
import timber.log.Timber
import java.io.File
import java.util.Locale
import java.util.concurrent.TimeUnit
import javax.inject.Named
import javax.inject.Singleton
Expand Down Expand Up @@ -170,14 +169,13 @@ class NetworkingModule {
@Named(NAMED_WIKI_DATA_WIKI_SITE)
fun provideWikidataWikiSite(): WikiSite = WikiSite(BuildConfig.WIKIDATA_URL)


/**
* Gson objects are very heavy. The app should ideally be using just one instance of it instead of creating new instances everywhere.
* @return returns a singleton Gson instance
*/
@Provides
@Singleton
fun provideGson(): Gson = GsonUtil.getDefaultGson()
fun provideGson(): Gson = GsonUtil.defaultGson

@Provides
@Singleton
Expand Down Expand Up @@ -294,9 +292,8 @@ class NetworkingModule {
@Provides
@Singleton
@Named(NAMED_LANGUAGE_WIKI_PEDIA_WIKI_SITE)
fun provideLanguageWikipediaSite(): WikiSite {
return WikiSite.forLanguageCode(Locale.getDefault().language)
}
fun provideLanguageWikipediaSite(): WikiSite =
WikiSite.forDefaultLocaleLanguageCode()

companion object {
private const val WIKIDATA_SPARQL_QUERY_URL = "https://query.wikidata.org/sparql"
Expand Down
23 changes: 0 additions & 23 deletions app/src/main/java/fr/free/nrw/commons/filepicker/Constants.java

This file was deleted.

29 changes: 29 additions & 0 deletions app/src/main/java/fr/free/nrw/commons/filepicker/Costants.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package fr.free.nrw.commons.filepicker

interface Constants {
companion object {
const val DEFAULT_FOLDER_NAME = "CommonsContributions"
}

/**
* Provides the request codes for permission handling
*/
interface RequestCodes {
companion object {
const val LOCATION = 1
const val STORAGE = 2
}
}

/**
* Provides locations as string for corresponding operations
*/
interface BundleKeys {
companion object {
const val FOLDER_NAME = "fr.free.nrw.commons.folder_name"
const val ALLOW_MULTIPLE = "fr.free.nrw.commons.allow_multiple"
const val COPY_TAKEN_PHOTOS = "fr.free.nrw.commons.copy_taken_photos"
const val COPY_PICKED_IMAGES = "fr.free.nrw.commons.copy_picked_images"
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package fr.free.nrw.commons.filepicker

/**
* Provides abstract methods which are overridden while handling Contribution Results
* inside the ContributionsController
*/
abstract class DefaultCallback: FilePicker.Callbacks {

override fun onImagePickerError(e: Exception, source: FilePicker.ImageSource, type: Int) {}

override fun onCanceled(source: FilePicker.ImageSource, type: Int) {}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package fr.free.nrw.commons.filepicker

import androidx.core.content.FileProvider

class ExtendedFileProvider: FileProvider() {}
Loading

0 comments on commit a2179ea

Please sign in to comment.