mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 20:33:53 +01:00
Merge remote-tracking branch 'refs/remotes/commons-app/2.8-release' into 2.8-release-misaochan
This commit is contained in:
commit
bd5d183fd2
4 changed files with 25 additions and 1 deletions
|
|
@ -62,6 +62,7 @@ dependencies {
|
|||
testImplementation 'com.squareup.okhttp3:mockwebserver:3.8.1'
|
||||
implementation 'com.dinuscxj:circleprogressbar:1.1.1'
|
||||
|
||||
implementation 'com.tspoon.traceur:traceur:1.0.1'
|
||||
implementation 'com.caverock:androidsvg:1.2.1'
|
||||
implementation 'com.github.bumptech.glide:glide:4.7.1'
|
||||
kapt 'com.github.bumptech.glide:compiler:4.7.1'
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@ import com.facebook.imagepipeline.core.ImagePipelineConfig;
|
|||
import com.facebook.stetho.Stetho;
|
||||
import com.squareup.leakcanary.LeakCanary;
|
||||
import com.squareup.leakcanary.RefWatcher;
|
||||
import com.tspoon.traceur.Traceur;
|
||||
import com.tspoon.traceur.TraceurConfig;
|
||||
|
||||
import org.acra.ACRA;
|
||||
import org.acra.ReportingInteractionMode;
|
||||
|
|
@ -69,6 +71,8 @@ public class CommonsApplication extends MultiDexApplication {
|
|||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
Traceur.enableLogging();
|
||||
|
||||
ApplicationlessInjection
|
||||
.getInstance(this)
|
||||
.getCommonsApplicationComponent()
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public class Utils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Fixing incorrect extension
|
||||
* Adds extension to filename. Converts to .jpg if system provides .jpeg, adds .jpg if no extension detected
|
||||
* @param title File name
|
||||
* @param extension Correct extension
|
||||
* @return File with correct extension
|
||||
|
|
@ -128,6 +128,15 @@ public class Utils {
|
|||
.endsWith("." + extension.toLowerCase(Locale.ENGLISH))) {
|
||||
title += "." + extension;
|
||||
}
|
||||
|
||||
// If extension is still null, make it jpg. (Hotfix for https://github.com/commons-app/apps-android-commons/issues/228)
|
||||
// If title has an extension in it, if won't be true
|
||||
// FIXME: .png uploads fail when uploaded via Share
|
||||
if (extension == null && title.lastIndexOf(".")<=0) {
|
||||
extension = "jpg";
|
||||
title += "." + extension;
|
||||
}
|
||||
|
||||
return title;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,4 +65,14 @@ class UtilsFixExtensionTest {
|
|||
fun inWordJpegToJpgResultsInJpg() {
|
||||
assertEquals("X.jpeg.SAMPLE.jpg", fixExtension("X.jpeg.SAMPLE", "jpg"))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun noExtensionShouldResultInJpg() {
|
||||
assertEquals("Sample.jpg", fixExtension("Sample", null))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun extensionAlreadyInTitleShouldRemain() {
|
||||
assertEquals("Sample.jpg", fixExtension("Sample.jpg", null))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue