Skip to content

Commit 8bdc1a8

Browse files
authored
Use InternalAPI rather than permanent deprecations in PluginManager (#2615)
1 parent be69ec9 commit 8bdc1a8

File tree

4 files changed

+14
-40
lines changed

4 files changed

+14
-40
lines changed

app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
274274
* @return true if the str has launched an app task (be it successful or not)
275275
* @param isWebview does not handle providers and opening download page if true. Can still add repos and login.
276276
* */
277-
@Suppress("DEPRECATION_ERROR")
278277
fun handleAppIntentUrl(
279278
activity: FragmentActivity?,
280279
str: String?,
@@ -1169,7 +1168,6 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
11691168
}
11701169
}
11711170

1172-
@Suppress("DEPRECATION_ERROR")
11731171
override fun onCreate(savedInstanceState: Bundle?) {
11741172
app.initClient(this)
11751173
val settingsManager = PreferenceManager.getDefaultSharedPreferences(this)

app/src/main/java/com/lagradost/cloudstream3/plugins/PluginManager.kt

Lines changed: 13 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import com.lagradost.cloudstream3.CloudStreamApp.Companion.getKey
2626
import com.lagradost.cloudstream3.CloudStreamApp.Companion.removeKey
2727
import com.lagradost.cloudstream3.CloudStreamApp.Companion.setKey
2828
import com.lagradost.cloudstream3.CommonActivity.showToast
29+
import com.lagradost.cloudstream3.InternalAPI
2930
import com.lagradost.cloudstream3.MainAPI
3031
import com.lagradost.cloudstream3.MainAPI.Companion.settingsForProvider
3132
import com.lagradost.cloudstream3.MainActivity.Companion.afterPluginsLoadedEvent
@@ -259,12 +260,8 @@ object PluginManager {
259260
* DO NOT USE THIS IN A PLUGIN! It may case an infinite recursive loop lagging or crashing everyone's devices.
260261
* If you use it from a plugin, do not expect a stable jvmName, SO DO NOT USE IT!
261262
*/
262-
@Suppress("FunctionName", "DEPRECATION_ERROR")
263-
@Deprecated(
264-
"Calling this function from a plugin will lead to crashes, use loadPlugin and unloadPlugin",
265-
replaceWith = ReplaceWith("loadPlugin"),
266-
level = DeprecationLevel.ERROR
267-
)
263+
@Suppress("FunctionName")
264+
@InternalAPI
268265
@Throws
269266
suspend fun ___DO_NOT_CALL_FROM_A_PLUGIN_updateAllOnlinePluginsAndLoadThem(activity: Activity) {
270267
assertNonRecursiveCallstack()
@@ -340,12 +337,8 @@ object PluginManager {
340337
* DO NOT USE THIS IN A PLUGIN! It may case an infinite recursive loop lagging or crashing everyone's devices.
341338
* If you use it from a plugin, do not expect a stable jvmName, SO DO NOT USE IT!
342339
*/
343-
@Suppress("FunctionName", "DEPRECATION_ERROR")
344-
@Deprecated(
345-
"Calling this function from a plugin will lead to crashes, use loadPlugin and unloadPlugin",
346-
replaceWith = ReplaceWith("loadPlugin"),
347-
level = DeprecationLevel.ERROR
348-
)
340+
@Suppress("FunctionName")
341+
@InternalAPI
349342
@Throws
350343
suspend fun ___DO_NOT_CALL_FROM_A_PLUGIN_downloadNotExistingPluginsAndLoad(
351344
activity: Activity,
@@ -454,12 +447,8 @@ object PluginManager {
454447
* DO NOT USE THIS IN A PLUGIN! It may case an infinite recursive loop lagging or crashing everyone's devices.
455448
* If you use it from a plugin, do not expect a stable jvmName, SO DO NOT USE IT!
456449
*/
457-
@Suppress("FunctionName", "DEPRECATION_ERROR")
458-
@Deprecated(
459-
"Calling this function from a plugin will lead to crashes, use loadPlugin and unloadPlugin",
460-
replaceWith = ReplaceWith("loadPlugin"),
461-
level = DeprecationLevel.ERROR
462-
)
450+
@Suppress("FunctionName")
451+
@InternalAPI
463452
@Throws
464453
suspend fun ___DO_NOT_CALL_FROM_A_PLUGIN_loadAllOnlinePlugins(context: Context) {
465454
assertNonRecursiveCallstack()
@@ -480,13 +469,9 @@ object PluginManager {
480469
* DO NOT USE THIS IN A PLUGIN! It may case an infinite recursive loop lagging or crashing everyone's devices.
481470
* If you use it from a plugin, do not expect a stable jvmName, SO DO NOT USE IT!
482471
*/
483-
@Suppress("FunctionName", "DEPRECATION_ERROR")
472+
@Suppress("FunctionName")
473+
@InternalAPI
484474
@Throws
485-
@Deprecated(
486-
"Calling this function from a plugin will lead to crashes, use loadPlugin and unloadPlugin",
487-
replaceWith = ReplaceWith("loadPlugin"),
488-
level = DeprecationLevel.ERROR
489-
)
490475
suspend fun ___DO_NOT_CALL_FROM_A_PLUGIN_hotReloadAllLocalPlugins(activity: FragmentActivity?) {
491476
assertNonRecursiveCallstack()
492477

@@ -505,12 +490,8 @@ object PluginManager {
505490
* DO NOT USE THIS IN A PLUGIN! It may case an infinite recursive loop lagging or crashing everyone's devices.
506491
* If you use it from a plugin, do not expect a stable jvmName, SO DO NOT USE IT!
507492
*/
508-
@Suppress("FunctionName", "DEPRECATION_ERROR")
509-
@Deprecated(
510-
"Calling this function from a plugin will lead to crashes, use loadPlugin and unloadPlugin",
511-
replaceWith = ReplaceWith("loadPlugin"),
512-
level = DeprecationLevel.ERROR
513-
)
493+
@Suppress("FunctionName")
494+
@InternalAPI
514495
@Throws
515496
suspend fun ___DO_NOT_CALL_FROM_A_PLUGIN_loadAllLocalPlugins(context: Context, forceReload: Boolean) {
516497
assertNonRecursiveCallstack()
@@ -814,13 +795,9 @@ object PluginManager {
814795
* DO NOT USE THIS IN A PLUGIN! It may case an infinite recursive loop lagging or crashing everyone's devices.
815796
* If you use it from a plugin, do not expect a stable jvmName, SO DO NOT USE IT!
816797
*/
817-
@Suppress("FunctionName", "DEPRECATION_ERROR")
798+
@Suppress("FunctionName")
799+
@InternalAPI
818800
@Throws
819-
@Deprecated(
820-
"Calling this function from a plugin will lead to crashes, use loadPlugin and unloadPlugin",
821-
replaceWith = ReplaceWith("loadPlugin"),
822-
level = DeprecationLevel.ERROR
823-
)
824801
suspend fun ___DO_NOT_CALL_FROM_A_PLUGIN_manuallyReloadAndUpdatePlugins(activity: Activity) {
825802
assertNonRecursiveCallstack()
826803

app/src/main/java/com/lagradost/cloudstream3/services/SubscriptionWorkManager.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class SubscriptionWorkManager(val context: Context, workerParams: WorkerParamete
9797
.build()
9898
)
9999
}
100-
@Suppress("DEPRECATION_ERROR")
100+
101101
override suspend fun doWork(): Result {
102102
try {
103103
// println("Update subscriptions!")

app/src/main/java/com/lagradost/cloudstream3/ui/settings/SettingsUpdates.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class SettingsUpdates : BasePreferenceFragmentCompat() {
6767
}
6868
}
6969

70-
@Suppress("DEPRECATION_ERROR")
7170
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
7271
hideKeyboard()
7372
setPreferencesFromResource(R.xml.settings_updates, rootKey)

0 commit comments

Comments
 (0)