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

feat: divide crashlogs in two different forms for tvs and other devices #782

Closed
wants to merge 3 commits into from
Closed
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
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ dependencies {
implementation("com.github.albfernandez:juniversalchardet:2.4.0") // Subtitle Decoding

// Crash Reports (AcraApplication.kt)
implementation("ch.acra:acra-core:5.11.2")
implementation("ch.acra:acra-toast:5.11.2")
implementation("ch.acra:acra-core:5.11.3")
implementation("ch.acra:acra-toast:5.11.3")

// UI Stuff
implementation("com.facebook.shimmer:shimmer:0.5.0") // Shimmering Effect (Loading Skeleton)
Expand Down
27 changes: 13 additions & 14 deletions app/src/main/java/com/lagradost/cloudstream3/AcraApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import androidx.fragment.app.FragmentActivity
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
import com.lagradost.cloudstream3.mvvm.suspendSafeApiCall
import com.lagradost.cloudstream3.plugins.PluginManager
import com.lagradost.cloudstream3.ui.settings.SettingsFragment
import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings
import com.lagradost.cloudstream3.utils.AppUtils.openBrowser
import com.lagradost.cloudstream3.utils.Coroutines.runOnMainThread
Expand All @@ -37,11 +38,17 @@ import kotlin.concurrent.thread
import kotlin.system.exitProcess

class CustomReportSender : ReportSender {
// Sends all your crashes to google forms
// Sends crash logs to Google forms, Might give a false positive of having a Google Tracker in App Scans
override fun send(context: Context, errorContent: CrashReportData) {
println("Sending report")
val url =
"https://docs.google.com/forms/d/e/1FAIpQLSfO4r353BJ79TTY_-t5KWSIJT2xfqcQWY81xjAA1-1N0U2eSg/formResponse"

println("Sending Crash Report")

val url = if (SettingsFragment.isTrueTvSettings()) {
"FORM_URL_FOR_TVs"
} else {
"FORM_URL_FOR_PHONES"
}

val data = mapOf(
"entry.1993829403" to errorContent.toJSON()
Copy link
Member

@C10udburst C10udburst Nov 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you checked that this key does not differ between forms?

This comment was marked as outdated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have you checked that this key does not differ between forms?

hmm, found out that it won't be an issue because the form and its input data structure is same its just we have seperated their endpoint reciever url

)
Expand Down Expand Up @@ -97,14 +104,13 @@ class ExceptionHandler(val errorFile: File, val onError: (() -> Unit)) :
}
exitProcess(1)
}

}

class AcraApplication : Application() {

override fun onCreate() {
super.onCreate()
//NativeCrashHandler.initCrashHandler()
// NativeCrashHandler.initCrashHandler()
ExceptionHandler(filesDir.resolve("last_error")) {
val intent = context!!.packageManager.getLaunchIntentForPackage(context!!.packageName)
startActivity(Intent.makeRestartActivityTask(intent!!.component))
Expand All @@ -119,7 +125,7 @@ class AcraApplication : Application() {
context = base

initAcra {
//core configuration:
// core configuration:
buildConfigClass = BuildConfig::class.java
reportFormat = StringFormat.JSON

Expand All @@ -128,13 +134,6 @@ class AcraApplication : Application() {
ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL,
ReportField.STACK_TRACE,
)

// removed this due to bug when starting the app, moved it to when it actually crashes
//each plugin you chose above can be configured in a block like this:
/*toast {
text = getString(R.string.acra_report_toast)
//opening this block automatically enables the plugin.
}*/
}
}

Expand Down
Loading