-
Notifications
You must be signed in to change notification settings - Fork 843
Remove @prerelease annotations and enable some deprecations
#2614
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
91 changes: 33 additions & 58 deletions
91
app/src/main/java/com/lagradost/cloudstream3/AcraApplication.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,103 +1,78 @@ | ||
| package com.lagradost.cloudstream3 | ||
|
|
||
| import android.content.Context | ||
| import com.lagradost.api.setContext | ||
| import com.lagradost.cloudstream3.utils.DataStore.getKey | ||
| import com.lagradost.cloudstream3.utils.DataStore.removeKeys | ||
| import com.lagradost.cloudstream3.utils.DataStore.setKey | ||
| import java.lang.ref.WeakReference | ||
|
|
||
| /** | ||
| * Deprecated alias for CloudStreamApp for backwards compatibility with plugins. | ||
| * Use CloudStreamApp instead. | ||
| */ | ||
| // Deprecate after next stable | ||
| /*@Deprecated( | ||
| @Deprecated( | ||
| message = "AcraApplication is deprecated, use CloudStreamApp instead", | ||
| replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp"), | ||
| level = DeprecationLevel.WARNING | ||
| )*/ | ||
| ) | ||
| class AcraApplication { | ||
| // All methods here can be changed to be a wrapper around CloudStream app | ||
| // without a seperate deprecation after next stable. All methods should | ||
| // also be deprecated at that time. | ||
| companion object { | ||
|
|
||
| // This can be removed without deprecation after next stable | ||
| private var _context: WeakReference<Context>? = null | ||
| /*@Deprecated( | ||
| @Deprecated( | ||
| message = "AcraApplication is deprecated, use CloudStreamApp instead", | ||
| replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.context"), | ||
| level = DeprecationLevel.WARNING | ||
| )*/ | ||
| var context | ||
| get() = _context?.get() | ||
| internal set(value) { | ||
| _context = WeakReference(value) | ||
| setContext(WeakReference(value)) | ||
| } | ||
| ) | ||
| val context get() = CloudStreamApp.context | ||
|
|
||
| /*@Deprecated( | ||
| @Deprecated( | ||
| message = "AcraApplication is deprecated, use CloudStreamApp instead", | ||
| replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.removeKeys(folder)"), | ||
| level = DeprecationLevel.WARNING | ||
| )*/ | ||
| fun removeKeys(folder: String): Int? { | ||
| return context?.removeKeys(folder) | ||
| } | ||
| ) | ||
| fun removeKeys(folder: String): Int? = | ||
| CloudStreamApp.removeKeys(folder) | ||
|
|
||
| /*@Deprecated( | ||
| @Deprecated( | ||
| message = "AcraApplication is deprecated, use CloudStreamApp instead", | ||
| replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.setKey(path, value)"), | ||
| level = DeprecationLevel.WARNING | ||
| )*/ | ||
| fun <T> setKey(path: String, value: T) { | ||
| context?.setKey(path, value) | ||
| } | ||
| ) | ||
| fun <T> setKey(path: String, value: T) = | ||
| CloudStreamApp.setKey(path, value) | ||
|
|
||
| /*@Deprecated( | ||
| @Deprecated( | ||
| message = "AcraApplication is deprecated, use CloudStreamApp instead", | ||
| replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.setKey(folder, path, value)"), | ||
| level = DeprecationLevel.WARNING | ||
| )*/ | ||
| fun <T> setKey(folder: String, path: String, value: T) { | ||
| context?.setKey(folder, path, value) | ||
| } | ||
| ) | ||
| fun <T> setKey(folder: String, path: String, value: T) = | ||
| CloudStreamApp.setKey(folder, path, value) | ||
|
|
||
| /*@Deprecated( | ||
| @Deprecated( | ||
| message = "AcraApplication is deprecated, use CloudStreamApp instead", | ||
| replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.getKey(path, defVal)"), | ||
| level = DeprecationLevel.WARNING | ||
| )*/ | ||
| inline fun <reified T : Any> getKey(path: String, defVal: T?): T? { | ||
| return context?.getKey(path, defVal) | ||
| } | ||
| ) | ||
| inline fun <reified T : Any> getKey(path: String, defVal: T?): T? = | ||
| CloudStreamApp.getKey(path, defVal) | ||
|
|
||
| /*@Deprecated( | ||
| @Deprecated( | ||
| message = "AcraApplication is deprecated, use CloudStreamApp instead", | ||
| replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.getKey(path)"), | ||
| level = DeprecationLevel.WARNING | ||
| )*/ | ||
| inline fun <reified T : Any> getKey(path: String): T? { | ||
| return context?.getKey(path) | ||
| } | ||
| ) | ||
| inline fun <reified T : Any> getKey(path: String): T? = | ||
| CloudStreamApp.getKey(path) | ||
|
|
||
| /*@Deprecated( | ||
| @Deprecated( | ||
| message = "AcraApplication is deprecated, use CloudStreamApp instead", | ||
| replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.getKey(folder, path)"), | ||
| level = DeprecationLevel.WARNING | ||
| )*/ | ||
| inline fun <reified T : Any> getKey(folder: String, path: String): T? { | ||
| return context?.getKey(folder, path) | ||
| } | ||
| ) | ||
| inline fun <reified T : Any> getKey(folder: String, path: String): T? = | ||
| CloudStreamApp.getKey(folder, path) | ||
|
|
||
| /*@Deprecated( | ||
| @Deprecated( | ||
| message = "AcraApplication is deprecated, use CloudStreamApp instead", | ||
| replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.getKey(folder, path, defVal)"), | ||
| level = DeprecationLevel.WARNING | ||
| )*/ | ||
| inline fun <reified T : Any> getKey(folder: String, path: String, defVal: T?): T? { | ||
| return context?.getKey(folder, path, defVal) | ||
| } | ||
| ) | ||
| inline fun <reified T : Any> getKey(folder: String, path: String, defVal: T?): T? = | ||
| CloudStreamApp.getKey(folder, path, defVal) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to note/provide some background/rational for changes here: the way the wrappers are here now is how it was when I first changed it to CloudStreamApp, however in d43a371 I changed it because CloudStreamApp didn't exist on stable so had some crash issues. Now that CloudStreamApp does exist on stable as well, we can now do this with wrappers around CloudStreamApp methods again, which removes setting
AcraApplication.contextfrom CloudStreamApp and thus easier if/when AcraApplication is fully removed as well as more easily manage any future changes with less code duplication.