mirror of
				https://github.com/recloudstream/cloudstream.git
				synced 2024-08-15 01:53:11 +00:00 
			
		
		
		
	Download all plugins from repository (#23)
This commit is contained in:
		
							parent
							
								
									6e74515e37
								
							
						
					
					
						commit
						ffd8db4c65
					
				
					 3 changed files with 28 additions and 0 deletions
				
			
		|  | @ -25,6 +25,7 @@ import com.lagradost.cloudstream3.plugins.RepositoryManager | |||
| import com.lagradost.cloudstream3.ui.result.setText | ||||
| import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTvSettings | ||||
| import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.setUpToolbar | ||||
| import com.lagradost.cloudstream3.utils.AppUtils.downloadAllPluginsDialog | ||||
| import com.lagradost.cloudstream3.utils.Coroutines.ioSafe | ||||
| import com.lagradost.cloudstream3.utils.Coroutines.main | ||||
| import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe | ||||
|  | @ -213,6 +214,7 @@ class ExtensionsFragment : Fragment() { | |||
|                     RepositoryManager.addRepository(newRepo) | ||||
|                     extensionViewModel.loadStats() | ||||
|                     extensionViewModel.loadRepositories() | ||||
|                     this@ExtensionsFragment.activity?.downloadAllPluginsDialog(url, fixedName) | ||||
|                 } | ||||
|                 dialog.dismissSafe(activity) | ||||
|             } | ||||
|  |  | |||
|  | @ -25,6 +25,7 @@ import android.widget.Toast | |||
| import androidx.activity.result.contract.ActivityResultContracts | ||||
| import androidx.annotation.RequiresApi | ||||
| import androidx.annotation.WorkerThread | ||||
| import androidx.appcompat.app.AlertDialog | ||||
| import androidx.appcompat.app.AppCompatActivity | ||||
| import androidx.core.content.ContextCompat | ||||
| import androidx.core.text.HtmlCompat | ||||
|  | @ -52,6 +53,7 @@ import com.lagradost.cloudstream3.plugins.RepositoryManager | |||
| import com.lagradost.cloudstream3.ui.WebviewFragment | ||||
| import com.lagradost.cloudstream3.ui.result.ResultFragment | ||||
| import com.lagradost.cloudstream3.ui.settings.SettingsFragment.Companion.isTrueTvSettings | ||||
| import com.lagradost.cloudstream3.ui.settings.extensions.PluginsViewModel.Companion.downloadAll | ||||
| import com.lagradost.cloudstream3.ui.settings.extensions.RepositoryData | ||||
| import com.lagradost.cloudstream3.utils.Coroutines.ioSafe | ||||
| import com.lagradost.cloudstream3.utils.Coroutines.main | ||||
|  | @ -257,6 +259,28 @@ object AppUtils { | |||
|                 ) | ||||
|             } | ||||
|             afterRepositoryLoadedEvent.invoke(true) | ||||
|             downloadAllPluginsDialog(url, repo.name) | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     fun Activity.downloadAllPluginsDialog(repositoryUrl: String, repositoryName: String) { | ||||
|         runOnUiThread { | ||||
|             val context = this | ||||
|             val builder: AlertDialog.Builder = AlertDialog.Builder(this) | ||||
|             builder.setTitle( | ||||
|                 repositoryName | ||||
|             ) | ||||
|             builder.setMessage( | ||||
|                 R.string.download_all_plugins_from_repo | ||||
|             ) | ||||
|             builder.apply { | ||||
|                 setPositiveButton(R.string.download) { _, _ -> | ||||
|                     downloadAll(context, repositoryUrl, null) | ||||
|                 } | ||||
| 
 | ||||
|                 setNegativeButton(R.string.cancel) { _, _ -> } | ||||
|             } | ||||
|             builder.show() | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -602,4 +602,6 @@ | |||
|     <string name="view_public_repositories_button">View community repositories</string> | ||||
|     <string name="view_public_repositories_button_short">Public list</string> | ||||
|     <string name="uppercase_all_subtitles">Uppercase all subtitles</string> | ||||
| 
 | ||||
|     <string name="download_all_plugins_from_repo">Download all plugins from this repository?</string> | ||||
| </resources> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue