This commit is contained in:
LagradOst 2021-07-26 20:29:04 +02:00
parent 208747492f
commit 3b7327f27e
7 changed files with 115 additions and 11 deletions

View File

@ -2,6 +2,7 @@ plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-android-extensions'
id 'kotlin-kapt'
}
android {
@ -12,10 +13,14 @@ android {
applicationId "com.lagradost.cloudstream3"
minSdkVersion 21
targetSdkVersion 30
versionCode 1
versionName "1.0"
versionCode 3
versionName "1.1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
kapt {
includeCompileClasspath = true
}
}
buildTypes {
@ -31,6 +36,7 @@ android {
}
kotlinOptions {
jvmTarget = '1.8'
freeCompilerArgs = ['-Xjvm-default=compatibility']
}
}
@ -43,9 +49,9 @@ repositories {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.5.0'
implementation 'androidx.core:core-ktx:1.6.0'
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
@ -54,14 +60,14 @@ dependencies {
implementation 'androidx.navigation:navigation-fragment-ktx:2.3.5'
implementation 'androidx.navigation:navigation-ui-ktx:2.3.5'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
implementation "io.karn:khttp-android:0.1.2"
implementation 'org.jsoup:jsoup:1.13.1'
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:2.11.3"
implementation("com.google.android.material:material:1.3.0")
implementation("com.google.android.material:material:1.4.0")
implementation "androidx.preference:preference-ktx:1.1.1"
@ -71,8 +77,18 @@ dependencies {
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
// Exoplayer
implementation 'com.google.android.exoplayer:exoplayer:2.14.1'
implementation 'com.google.android.exoplayer:extension-cast:2.14.1'
implementation "com.google.android.exoplayer:extension-mediasession:2.14.1"
implementation 'com.google.android.exoplayer:exoplayer:2.14.2'
implementation 'com.google.android.exoplayer:extension-cast:2.14.2'
implementation "com.google.android.exoplayer:extension-mediasession:2.14.2"
//implementation "com.google.android.exoplayer:extension-leanback:2.14.0"
// Bug reports
implementation "ch.acra:acra-core:5.8.4"
implementation "ch.acra:acra-toast:5.8.4"
compileOnly "com.google.auto.service:auto-service-annotations:1.0"
//either for java sources:
annotationProcessor "com.google.auto.service:auto-service:1.0"
//or for kotlin sources (requires kapt gradle plugin):
kapt "com.google.auto.service:auto-service:1.0"
}

View File

@ -10,6 +10,7 @@
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<application
android:name=".AcraApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"

View File

@ -0,0 +1,70 @@
package com.lagradost.cloudstream3
import android.app.Application
import android.content.Context
import com.google.auto.service.AutoService
import org.acra.ReportField
import org.acra.config.CoreConfiguration
import org.acra.config.toast
import org.acra.data.CrashReportData
import org.acra.data.StringFormat
import org.acra.ktx.initAcra
import org.acra.sender.ReportSender
import org.acra.sender.ReportSenderFactory
import kotlin.concurrent.thread
class CustomReportSender : ReportSender {
// Sends all your crashes to google forms
override fun send(context: Context, errorContent: CrashReportData) {
try {
println("Report sent")
val url =
"https://docs.google.com/forms/u/0/d/e/1FAIpQLSeFmyBChi6HF3IkhTVWPiDXJtxt8W0Hf4Agljm_0-0_QuEYFg/formResponse"
val data = mapOf(
"entry.134906550" to errorContent.toJSON()
)
thread {
val post = khttp.post(url, data = data)
println("Report response: $post")
}
} catch (e: Exception) {
println("ERROR SENDING BUG")
}
}
}
@AutoService(ReportSenderFactory::class)
class CustomSenderFactory : ReportSenderFactory {
override fun create(context: Context, config: CoreConfiguration): ReportSender {
return CustomReportSender()
}
override fun enabled(config: CoreConfiguration): Boolean {
return true
}
}
class AcraApplication : Application() {
override fun attachBaseContext(base: Context?) {
super.attachBaseContext(base)
initAcra {
//core configuration:
buildConfigClass = BuildConfig::class.java
reportFormat = StringFormat.JSON
reportContent = arrayOf(
ReportField.BUILD_CONFIG, ReportField.USER_CRASH_DATE,
ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL,
ReportField.STACK_TRACE
)
//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.
}
}
}
}

View File

@ -144,7 +144,6 @@ class SearchFragment : Fragment() {
}
}
allApi.providersActive = requireActivity().getApiSettings()
//searchViewModel.search("iron man")
//(activity as AppCompatActivity).loadResult("https://shiro.is/overlord-dubbed", "overlord-dubbed", "Shiro")
/*

View File

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M20,8h-2.81c-0.45,-0.78 -1.07,-1.45 -1.82,-1.96L17,4.41 15.59,3l-2.17,2.17C12.96,5.06 12.49,5 12,5c-0.49,0 -0.96,0.06 -1.41,0.17L8.41,3 7,4.41l1.62,1.63C7.88,6.55 7.26,7.22 6.81,8L4,8v2h2.09c-0.05,0.33 -0.09,0.66 -0.09,1v1L4,12v2h2v1c0,0.34 0.04,0.67 0.09,1L4,16v2h2.81c1.04,1.79 2.97,3 5.19,3s4.15,-1.21 5.19,-3L20,18v-2h-2.09c0.05,-0.33 0.09,-0.66 0.09,-1v-1h2v-2h-2v-1c0,-0.34 -0.04,-0.67 -0.09,-1L20,10L20,8zM14,16h-4v-2h4v2zM14,12h-4v-2h4v2z"/>
</vector>

View File

@ -30,6 +30,7 @@
<string name="type_dropped">Dropped</string>
<string name="type_plan_to_watch">Plan to Watch</string>
<string name="type_none">None</string>
<string name="play_movie_button">Play Movie</string>
<string name="pick_source">Sources</string>
<string name="pick_subtitle">Subtitles</string>
@ -42,10 +43,15 @@
<string name="error_loading_links">Error Loading Links</string>
<string name="download_storage_text">Internal Storage</string>
<string name="options">Options</string>
<string name="app_dubbed_text">Dub</string>
<string name="app_subbed_text">Sub</string>
<string name="popup_delete_file">Delete File</string>
<string name="popup_play_file">Play File</string>
<string name="popup_resume_download">Resume Download</string>
<string name="popup_pause_download">Pause Download</string>
<string name="acra_report_toast">Sorry, the application crashed. An anonymous bug report will be sent to the developers</string>
<string name="pref_disable_acra">Disable automatic bug reporting</string>
</resources>

View File

@ -49,6 +49,13 @@
android:summary="Tap twice on the right or left side to seek forwards or backwards"
app:defaultValue="false"
/>
<SwitchPreference
android:key="acra.disable"
android:icon="@drawable/ic_baseline_bug_report_24"
android:title="@string/pref_disable_acra"
android:summaryOff="Only sends data on crashes"
android:summaryOn="Sends no data"
android:defaultValue="false"/>
<Preference
android:title="Github"
android:icon="@drawable/ic_github_logo"