mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +01:00
Merge branch 'main' into account-delete
This commit is contained in:
commit
a1385a4997
5 changed files with 9 additions and 14 deletions
|
|
@ -1,11 +1,7 @@
|
|||
package fr.free.nrw.commons.settings
|
||||
|
||||
object Prefs {
|
||||
const val GLOBAL_PREFS = "fr.free.nrw.commons.preferences"
|
||||
|
||||
const val TRACKING_ENABLED = "eventLogging"
|
||||
const val DEFAULT_LICENSE = "defaultLicense"
|
||||
const val UPLOADS_SHOWING = "uploadsShowing"
|
||||
const val MANAGED_EXIF_TAGS = "managed_exif_tags"
|
||||
const val VANISHED_ACCOUNT = "vanishAccount"
|
||||
const val DESCRIPTION_LANGUAGE = "languageDescription"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import fr.free.nrw.commons.theme.BaseActivity
|
|||
class SettingsActivity : BaseActivity() {
|
||||
|
||||
private lateinit var binding: ActivitySettingsBinding
|
||||
// private var settingsDelegate: AppCompatDelegate? = null
|
||||
|
||||
/**
|
||||
* to be called when the activity starts
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
inAppCameraLocationPref?.setOnPreferenceChangeListener { _, newValue ->
|
||||
val isInAppCameraLocationTurnedOn = newValue as Boolean
|
||||
if (isInAppCameraLocationTurnedOn) {
|
||||
createDialogsAndHandleLocationPermissions(requireActivity())
|
||||
createDialogsAndHandleLocationPermissions()
|
||||
}
|
||||
true
|
||||
}
|
||||
|
|
@ -279,7 +279,7 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
*
|
||||
* @param activity
|
||||
*/
|
||||
private fun createDialogsAndHandleLocationPermissions(activity: Activity) {
|
||||
private fun createDialogsAndHandleLocationPermissions() {
|
||||
inAppCameraLocationPermissionLauncher.launch(arrayOf(permission.ACCESS_FINE_LOCATION))
|
||||
}
|
||||
|
||||
|
|
@ -307,7 +307,6 @@ class SettingsFragment : PreferenceFragmentCompat() {
|
|||
return object : PreferenceGroupAdapter(preferenceScreen) {
|
||||
override fun onBindViewHolder(holder: PreferenceViewHolder, position: Int) {
|
||||
super.onBindViewHolder(holder, position)
|
||||
val preference = getItem(position)
|
||||
val iconFrame: View? = holder.itemView.findViewById(R.id.icon_frame)
|
||||
iconFrame?.visibility = View.GONE
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,10 @@ class FileUtilsWrapper @Inject constructor(private val context: Context) {
|
|||
while ((bis.read(buffer).also { size = it }) > 0) {
|
||||
buffers.add(
|
||||
writeToFile(
|
||||
buffer.copyOf(size),
|
||||
buffer,
|
||||
file.name ?: "",
|
||||
getFileExt(file.name)
|
||||
getFileExt(file.name),
|
||||
size
|
||||
)
|
||||
)
|
||||
}
|
||||
|
|
@ -67,7 +68,7 @@ class FileUtilsWrapper @Inject constructor(private val context: Context) {
|
|||
* Create a temp file containing the passed byte data.
|
||||
*/
|
||||
@Throws(IOException::class)
|
||||
private fun writeToFile(data: ByteArray, fileName: String, fileExtension: String): File {
|
||||
private fun writeToFile(data: ByteArray, fileName: String, fileExtension: String, size: Int): File {
|
||||
val file = File.createTempFile(fileName, fileExtension, context.cacheDir)
|
||||
try {
|
||||
if (!file.exists()) {
|
||||
|
|
@ -75,7 +76,7 @@ class FileUtilsWrapper @Inject constructor(private val context: Context) {
|
|||
}
|
||||
|
||||
FileOutputStream(file).use { fos ->
|
||||
fos.write(data)
|
||||
fos.write(data, 0, size)
|
||||
}
|
||||
} catch (throwable: Exception) {
|
||||
Timber.e(throwable, "Failed to create file")
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ class NearbyParentFragmentPresenterTest {
|
|||
// 111.19 km real distance, return false if 148306.444306 > currentLocationSearchRadius
|
||||
NearbyController.currentLocationSearchRadius = 148306.0
|
||||
val isClose = nearbyPresenter.searchCloseToCurrentLocation()
|
||||
assertFalse(isClose!!.equals(false))
|
||||
assertFalse(!isClose)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -318,7 +318,7 @@ class NearbyParentFragmentPresenterTest {
|
|||
// 111.19 km real distance, return false if 148253.333 > currentLocationSearchRadius
|
||||
NearbyController.currentLocationSearchRadius = 148307.0
|
||||
val isClose = nearbyPresenter.searchCloseToCurrentLocation()
|
||||
assertTrue(isClose!!)
|
||||
assertTrue(isClose)
|
||||
}
|
||||
|
||||
fun expectMapAndListUpdate() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue