mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	acra
This commit is contained in:
		
							parent
							
								
									208747492f
								
							
						
					
					
						commit
						3b7327f27e
					
				
					 7 changed files with 115 additions and 11 deletions
				
			
		|  | @ -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" | ||||
|  |  | |||
|  | @ -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. | ||||
|             } | ||||
| 
 | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -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") | ||||
| /* | ||||
|  |  | |||
							
								
								
									
										5
									
								
								app/src/main/res/drawable/ic_baseline_bug_report_24.xml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								app/src/main/res/drawable/ic_baseline_bug_report_24.xml
									
										
									
									
									
										Normal 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> | ||||
|  | @ -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> | ||||
|  | @ -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" | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue