Skip to content
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

S/refactor 0.9.2 #122

Open
wants to merge 20 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
42 changes: 16 additions & 26 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,34 +1,21 @@
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
//noinspection GradleDynamicVersion
classpath 'io.fabric.tools:gradle:1.+'
}
}

repositories {
maven { url 'https://maven.fabric.io/public' }
}

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: 'io.fabric'
apply plugin: 'com.google.firebase.crashlytics'

def keyStorePass = hasProperty("key_store_password") ? key_store_password : ""

android {
compileSdkVersion 28
compileSdkVersion 29
defaultConfig {
applicationId "com.github.khangnt.mcp"
minSdkVersion 16
targetSdkVersion 28
minSdkVersion 23
targetSdkVersion 29
multiDexEnabled true
versionCode 1
versionName "0.9.2"
versionName "0.10.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

javaCompileOptions {
Expand Down Expand Up @@ -71,7 +58,7 @@ android {
}
}

final _versionCode = 28
final _versionCode = 29

flavorDimensions 'cpuArch'
productFlavors {
Expand Down Expand Up @@ -128,7 +115,6 @@ android {

sourceSets {
main {
jni.srcDirs = []
}
}
}
Expand All @@ -155,6 +141,14 @@ dependencies {
implementation "androidx.room:room-rxjava2:$roomVersion"
kapt "androidx.room:room-compiler:$roomVersion"

def multidex_version = "2.0.1"
implementation "androidx.multidex:multidex:$multidex_version"

implementation 'com.google.android.gms:play-services-ads:18.3.0'

implementation platform('com.google.firebase:firebase-bom:26.4.0')
implementation 'com.google.firebase:firebase-crashlytics-ktx'
implementation 'com.google.firebase:firebase-analytics-ktx'

implementation 'io.reactivex.rxjava2:rxjava:2.2.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.0.2'
Expand All @@ -166,10 +160,6 @@ dependencies {

implementation 'de.psdev.licensesdialog:licensesdialog:1.8.3'

implementation('com.crashlytics.sdk.android:crashlytics:2.9.2@aar') {
transitive = true
}

implementation 'com.liulishuo.filedownloader:library:1.7.1'

implementation 'cat.ereza:customactivityoncrash:2.2.0'
Expand Down
39 changes: 39 additions & 0 deletions app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"project_info": {
"project_number": "606153105698",
"project_id": "media-converter-pro",
"storage_bucket": "media-converter-pro.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:606153105698:android:186c9eade52a523550c57b",
"android_client_info": {
"package_name": "com.github.khangnt.mcp"
}
},
"oauth_client": [
{
"client_id": "606153105698-oeul6bdpn4re614mc2l8pnm7nekvihn7.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyD9BbG5hdgWB_qpGAAJm1al3rlTj8c_nNI"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "606153105698-oeul6bdpn4re614mc2l8pnm7nekvihn7.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
Binary file modified app/src/arm/assets/ffmpeg
100755 → 100644
Binary file not shown.
1 change: 1 addition & 0 deletions app/src/arm/assets/ffmpeg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
19400508
1 change: 0 additions & 1 deletion app/src/arm/assets/ffmpeg_size.txt

This file was deleted.

Binary file modified app/src/arm7/assets/ffmpeg
100755 → 100644
Binary file not shown.
1 change: 1 addition & 0 deletions app/src/arm7/assets/ffmpeg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18421664
1 change: 0 additions & 1 deletion app/src/arm7/assets/ffmpeg_size.txt

This file was deleted.

Binary file modified app/src/arm8/assets/ffmpeg
100755 → 100644
Binary file not shown.
1 change: 1 addition & 0 deletions app/src/arm8/assets/ffmpeg.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18421664
1 change: 0 additions & 1 deletion app/src/arm8/assets/ffmpeg_size.txt

This file was deleted.

5 changes: 5 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
<application
android:name=".MainApplication"
android:allowBackup="true"
android:extractNativeLibs="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
Expand Down Expand Up @@ -74,6 +76,9 @@
android:label="@string/nav_settings"
android:theme="@style/AppTheme.NoActionBar.TransparentStatusBar" />

<meta-data
android:name="com.google.android.gms.ads.APPLICATION_ID"
android:value="ca-app-pub-8469309022192575~2742857805" />
</application>

</manifest>
21 changes: 19 additions & 2 deletions app/src/main/assets/changelog.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
<html>
<head>
<meta name="viewport" content="initial-scale=1.0" />
<meta name="viewport" content="initial-scale=1.0"/>
</head>
<body>
<br>
<h4>Version 0.9.2 [Jul 6, 2019]</h4>
<h4>Version 0.9.3 [Feb 3, 2021]</h4>
<ul>
<li>Add WAV output presets.</li>
<li>Add custom FFMPEG command presets.</li>
<li>Show advertisements (can be disable in Settings).</li>
<li>Minor bug fixes &amp; UX improvements</li>
</ul>
<b>Hi everyone!<br><br>This might be my last update for this app.<br>I am working on another Media
Converter app
which you
can create your own FFMPEG command preset and share with everyone.<br>If you want to support me,
please keep
ads running. Otherwise you can disable it in the Settings.<br>You can leave your email in <a
href="https://forms.gle/UQPm2eY8w8DrWxD77">this
form</a> and I will send an announcement email when the new app is available.<br><br>Thank
you!</b>
<br>
<h4>Version 0.9.2 [Aug 10, 2019]</h4>
<ul>
<li>Fix conversion error for AC3, ALAC, AIFF, APE, DSF, WAV, WMA inputs</li>
<li>Remember your last output command configurations</li>
Expand Down
11 changes: 8 additions & 3 deletions app/src/main/java/com/github/khangnt/mcp/Consts.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ const val APP_TEMP_FOLDER = "temp"
const val JOB_TEMP_FOLDER = "jobTemp"
const val JOB_LOG_FOLDER = "jobLogs"

const val FFMPEG_FILE = "ffmpeg"
const val FFMPEG_SIZE_FILE = "ffmpeg_size.txt"
const val FFMPEG_FILE = "libffmpeg.so"
const val FFMPEG_FILE_LEGACY = "ffmpeg"
const val FFMPEG_SIZE_FILE = "ffmpeg.txt"
const val FFMPEG_TEMP_OUTPUT_FILE = "ffmpeg_out.temp"


Expand All @@ -31,4 +32,8 @@ const val GITHUB_ISSUE_URL = "$GITHUB_REPO/issues"
const val GITHUB_NEW_ISSUE_URL = "$GITHUB_ISSUE_URL/new"
const val PRIVACY_POLICY_URL = "https://khang-nt.github.io/Android-Media-Converter/privacy_policy.html"
const val TRANSLATE_PAGE = "http://translate.ymusicapp.com/projects/media-converter/strings/"
const val CHANGELOG_URL = "file:///android_asset/changelog.html"
const val CHANGELOG_URL = "file:///android_asset/changelog.html"

const val STEP_FIVE_AD_UNIT_ID = "ca-app-pub-8469309022192575/1023553194"
const val REWARD_AD_UNIT_ID = "ca-app-pub-8469309022192575/3405656686"
const val JOB_MANAGER_AD_UNIT_ID = "ca-app-pub-8469309022192575/8215920221"
4 changes: 2 additions & 2 deletions app/src/main/java/com/github/khangnt/mcp/CrashlyticsTree.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.khangnt.mcp

import com.crashlytics.android.Crashlytics
import com.google.firebase.crashlytics.FirebaseCrashlytics
import timber.log.Timber

/**
Expand All @@ -10,6 +10,6 @@ import timber.log.Timber

class CrashlyticsTree : Timber.Tree() {
override fun log(priority: Int, tag: String?, message: String, t: Throwable?) {
Crashlytics.log(message)
FirebaseCrashlytics.getInstance().log(message)
}
}
18 changes: 12 additions & 6 deletions app/src/main/java/com/github/khangnt/mcp/MainApplication.kt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.github.khangnt.mcp

import android.app.Application
import android.os.Build
import android.os.StrictMode
import androidx.multidex.MultiDexApplication
import cat.ereza.customactivityoncrash.config.CaocConfig
import com.crashlytics.android.Crashlytics
import com.github.khangnt.mcp.util.IMMLeaks
import com.google.android.gms.ads.MobileAds
import com.liulishuo.filedownloader.FileDownloader
import com.liulishuo.filedownloader.database.NoDatabaseImpl
import com.squareup.leakcanary.LeakCanary
import io.fabric.sdk.android.Fabric
import io.reactivex.exceptions.UndeliverableException
import io.reactivex.plugins.RxJavaPlugins
import timber.log.Timber
Expand All @@ -18,7 +18,7 @@ import timber.log.Timber
* Email: khang.neon.1997@gmail.com
*/

class MainApplication : Application() {
class MainApplication : MultiDexApplication() {

override fun onCreate() {
super.onCreate()
Expand All @@ -39,8 +39,6 @@ class MainApplication : Application() {
.maxNetworkThreadCount(4)
.commit()

Fabric.with(this, Crashlytics())

CaocConfig.Builder.create()
.backgroundMode(CaocConfig.BACKGROUND_MODE_SILENT)
.showErrorDetails(true)
Expand All @@ -55,6 +53,14 @@ class MainApplication : Application() {
}

setUpRxPlugins()

MobileAds.initialize(this)

val sharedPrefs = SingletonInstances.getSharedPrefs()
if (sharedPrefs.conversionCountLeftBeforeShowAds <= 0) {
sharedPrefs.enabledAds = true
sharedPrefs.conversionCountLeftBeforeShowAds = 0
}
}

private fun setupStrictMode() {
Expand Down
16 changes: 10 additions & 6 deletions app/src/main/java/com/github/khangnt/mcp/NonFatalReport.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.github.khangnt.mcp

import android.content.Context
import com.crashlytics.android.Crashlytics
import com.github.khangnt.mcp.exception.HttpResponseCodeException
import com.google.firebase.crashlytics.FirebaseCrashlytics
import com.liulishuo.filedownloader.exception.FileDownloadHttpException
import com.liulishuo.filedownloader.exception.FileDownloadOutOfSpaceException
import java.io.EOFException
Expand All @@ -29,7 +29,7 @@ fun <T : Throwable> rootCauseIs(clazz: Class<T>, error: Throwable): Boolean {
return false
}

fun <T : Throwable> Throwable.castTo(clazz: Class<T>): T {
fun <T : Throwable> Throwable.castTo(clazz: Class<T>): T? {
var temp: Throwable? = this
while (temp !== null) {
if (clazz.isInstance(temp)) {
Expand Down Expand Up @@ -58,8 +58,8 @@ private fun inWhiteList(error: Throwable): Boolean =

fun reportNonFatal(throwable: Throwable, where: String, message: String? = null) {
if (!BuildConfig.DEBUG && !inWhiteList(throwable)) {
Crashlytics.setString("where", "Non-fatal at '$where': ${message ?: throwable.message}")
Crashlytics.logException(throwable)
FirebaseCrashlytics.getInstance().setCustomKey("where", "Non-fatal at '$where': ${message ?: throwable.message}")
FirebaseCrashlytics.getInstance().log(message ?: throwable.message.toString())
}
}

Expand All @@ -73,10 +73,14 @@ fun getKnownReasonOf(error: Throwable, context: Context, fallback: String): Stri
return context.getString(R.string.network_error)
} else if (rootCauseIs(FileDownloadHttpException::class.java, error)) {
val httpException = error.castTo(FileDownloadHttpException::class.java)
return "Link broken, response: ${httpException.code}"
if (httpException != null) {
return "Link broken, response: ${httpException.code}"
}
} else if (rootCauseIs(HttpResponseCodeException::class.java, error)) {
val httpResponseCodeException = error.castTo(HttpResponseCodeException::class.java)
return "Link broken, response: ${httpResponseCodeException.message}"
if (httpResponseCodeException != null) {
return "Link broken, response: ${httpResponseCodeException.message}"
}
} else if (error.message?.contains("ENOSPC") == true ||
rootCauseIs(FileDownloadOutOfSpaceException::class.java, error)) {
return "Your device's storage is full"
Expand Down
Loading