Skip to content

Commit 154cd75

Browse files
authored
Remove @prerelease annotations and enable some deprecations (#2614)
1 parent 76e30d2 commit 154cd75

File tree

8 files changed

+33
-80
lines changed

8 files changed

+33
-80
lines changed
Lines changed: 33 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,103 +1,78 @@
11
package com.lagradost.cloudstream3
22

3-
import android.content.Context
4-
import com.lagradost.api.setContext
5-
import com.lagradost.cloudstream3.utils.DataStore.getKey
6-
import com.lagradost.cloudstream3.utils.DataStore.removeKeys
7-
import com.lagradost.cloudstream3.utils.DataStore.setKey
8-
import java.lang.ref.WeakReference
9-
103
/**
114
* Deprecated alias for CloudStreamApp for backwards compatibility with plugins.
125
* Use CloudStreamApp instead.
136
*/
14-
// Deprecate after next stable
15-
/*@Deprecated(
7+
@Deprecated(
168
message = "AcraApplication is deprecated, use CloudStreamApp instead",
179
replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp"),
1810
level = DeprecationLevel.WARNING
19-
)*/
11+
)
2012
class AcraApplication {
21-
// All methods here can be changed to be a wrapper around CloudStream app
22-
// without a seperate deprecation after next stable. All methods should
23-
// also be deprecated at that time.
2413
companion object {
2514

26-
// This can be removed without deprecation after next stable
27-
private var _context: WeakReference<Context>? = null
28-
/*@Deprecated(
15+
@Deprecated(
2916
message = "AcraApplication is deprecated, use CloudStreamApp instead",
3017
replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.context"),
3118
level = DeprecationLevel.WARNING
32-
)*/
33-
var context
34-
get() = _context?.get()
35-
internal set(value) {
36-
_context = WeakReference(value)
37-
setContext(WeakReference(value))
38-
}
19+
)
20+
val context get() = CloudStreamApp.context
3921

40-
/*@Deprecated(
22+
@Deprecated(
4123
message = "AcraApplication is deprecated, use CloudStreamApp instead",
4224
replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.removeKeys(folder)"),
4325
level = DeprecationLevel.WARNING
44-
)*/
45-
fun removeKeys(folder: String): Int? {
46-
return context?.removeKeys(folder)
47-
}
26+
)
27+
fun removeKeys(folder: String): Int? =
28+
CloudStreamApp.removeKeys(folder)
4829

49-
/*@Deprecated(
30+
@Deprecated(
5031
message = "AcraApplication is deprecated, use CloudStreamApp instead",
5132
replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.setKey(path, value)"),
5233
level = DeprecationLevel.WARNING
53-
)*/
54-
fun <T> setKey(path: String, value: T) {
55-
context?.setKey(path, value)
56-
}
34+
)
35+
fun <T> setKey(path: String, value: T) =
36+
CloudStreamApp.setKey(path, value)
5737

58-
/*@Deprecated(
38+
@Deprecated(
5939
message = "AcraApplication is deprecated, use CloudStreamApp instead",
6040
replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.setKey(folder, path, value)"),
6141
level = DeprecationLevel.WARNING
62-
)*/
63-
fun <T> setKey(folder: String, path: String, value: T) {
64-
context?.setKey(folder, path, value)
65-
}
42+
)
43+
fun <T> setKey(folder: String, path: String, value: T) =
44+
CloudStreamApp.setKey(folder, path, value)
6645

67-
/*@Deprecated(
46+
@Deprecated(
6847
message = "AcraApplication is deprecated, use CloudStreamApp instead",
6948
replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.getKey(path, defVal)"),
7049
level = DeprecationLevel.WARNING
71-
)*/
72-
inline fun <reified T : Any> getKey(path: String, defVal: T?): T? {
73-
return context?.getKey(path, defVal)
74-
}
50+
)
51+
inline fun <reified T : Any> getKey(path: String, defVal: T?): T? =
52+
CloudStreamApp.getKey(path, defVal)
7553

76-
/*@Deprecated(
54+
@Deprecated(
7755
message = "AcraApplication is deprecated, use CloudStreamApp instead",
7856
replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.getKey(path)"),
7957
level = DeprecationLevel.WARNING
80-
)*/
81-
inline fun <reified T : Any> getKey(path: String): T? {
82-
return context?.getKey(path)
83-
}
58+
)
59+
inline fun <reified T : Any> getKey(path: String): T? =
60+
CloudStreamApp.getKey(path)
8461

85-
/*@Deprecated(
62+
@Deprecated(
8663
message = "AcraApplication is deprecated, use CloudStreamApp instead",
8764
replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.getKey(folder, path)"),
8865
level = DeprecationLevel.WARNING
89-
)*/
90-
inline fun <reified T : Any> getKey(folder: String, path: String): T? {
91-
return context?.getKey(folder, path)
92-
}
66+
)
67+
inline fun <reified T : Any> getKey(folder: String, path: String): T? =
68+
CloudStreamApp.getKey(folder, path)
9369

94-
/*@Deprecated(
70+
@Deprecated(
9571
message = "AcraApplication is deprecated, use CloudStreamApp instead",
9672
replaceWith = ReplaceWith("com.lagradost.cloudstream3.CloudStreamApp.getKey(folder, path, defVal)"),
9773
level = DeprecationLevel.WARNING
98-
)*/
99-
inline fun <reified T : Any> getKey(folder: String, path: String, defVal: T?): T? {
100-
return context?.getKey(folder, path, defVal)
101-
}
74+
)
75+
inline fun <reified T : Any> getKey(folder: String, path: String, defVal: T?): T? =
76+
CloudStreamApp.getKey(folder, path, defVal)
10277
}
10378
}

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class ExceptionHandler(
6767
}
6868
}
6969

70-
@Prerelease
7170
class CloudStreamApp : Application(), SingletonImageLoader.Factory {
7271

7372
override fun onCreate() {
@@ -90,8 +89,6 @@ class CloudStreamApp : Application(), SingletonImageLoader.Factory {
9089
override fun attachBaseContext(base: Context?) {
9190
super.attachBaseContext(base)
9291
context = base
93-
// This can be removed without deprecation after next stable
94-
AcraApplication.context = context
9592
}
9693

9794
override fun newImageLoader(context: PlatformContext): ImageLoader {

library/src/commonMain/kotlin/com/lagradost/cloudstream3/MainAPI.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,7 +1159,6 @@ suspend fun newSubtitleFile(
11591159
* @property headers Optional headers for the audio file request.
11601160
* @see newAudioFile
11611161
* */
1162-
@Prerelease
11631162
@ConsistentCopyVisibility
11641163
data class AudioFile internal constructor(
11651164
var url: String,
@@ -1171,7 +1170,6 @@ data class AudioFile internal constructor(
11711170
* @param initializer Lambda to configure additional properties like headers.
11721171
* @return Configured AudioFile instance.
11731172
* */
1174-
@Prerelease
11751173
suspend fun newAudioFile(
11761174
url: String,
11771175
initializer: suspend AudioFile.() -> Unit = { }
@@ -1786,7 +1784,6 @@ interface LoadResponse {
17861784
var posterHeaders: Map<String, String>?
17871785
var backgroundPosterUrl: String?
17881786

1789-
@Prerelease
17901787
var logoUrl: String?
17911788
var contentRating: String?
17921789

@@ -1893,7 +1890,6 @@ interface LoadResponse {
18931890
this.addSimklId(SimklSyncServices.Mal, id.toString())
18941891
}
18951892

1896-
@Prerelease
18971893
fun LoadResponse.addKitsuId(id: Int?) {
18981894
this.syncData[kitsuIdPrefix] = (id ?: return).toString()
18991895
}

library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/ByseSX.kt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.lagradost.cloudstream3.extractors
22

33
import com.fasterxml.jackson.annotation.JsonProperty
4-
import com.lagradost.cloudstream3.Prerelease
54
import com.lagradost.cloudstream3.SubtitleFile
65
import com.lagradost.cloudstream3.app
76
import com.lagradost.cloudstream3.base64DecodeArray
@@ -15,31 +14,26 @@ import javax.crypto.Cipher
1514
import javax.crypto.spec.GCMParameterSpec
1615
import javax.crypto.spec.SecretKeySpec
1716

18-
@Prerelease
1917
class Bysezejataos : ByseSX() {
2018
override var name = "Bysezejataos"
2119
override var mainUrl = "https://bysezejataos.com"
2220
}
2321

24-
@Prerelease
2522
class ByseBuho : ByseSX() {
2623
override var name = "ByseBuho"
2724
override var mainUrl = "https://bysebuho.com"
2825
}
2926

30-
@Prerelease
3127
class ByseVepoin : ByseSX() {
3228
override var name = "ByseVepoin"
3329
override var mainUrl = "https://bysevepoin.com"
3430
}
3531

36-
@Prerelease
3732
class ByseQekaho : ByseSX() {
3833
override var name = "ByseQekaho"
3934
override var mainUrl = "https://byseqekaho.com"
4035
}
4136

42-
@Prerelease
4337
open class ByseSX : ExtractorApi() {
4438
override var name = "Byse"
4539
override var mainUrl = "https://byse.sx"

library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/HubCloud.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.lagradost.cloudstream3.extractors
22

33
import com.lagradost.api.Log
4-
import com.lagradost.cloudstream3.Prerelease
54
import com.lagradost.cloudstream3.SubtitleFile
65
import com.lagradost.cloudstream3.amap
76
import com.lagradost.cloudstream3.app
@@ -12,7 +11,6 @@ import com.lagradost.cloudstream3.utils.loadExtractor
1211
import com.lagradost.cloudstream3.utils.newExtractorLink
1312
import java.net.URI
1413

15-
@Prerelease
1614
class HubCloud : ExtractorApi() {
1715
override val name = "Hub-Cloud"
1816
override val mainUrl = "https://hubcloud.*"

library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/OkRuExtractor.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
package com.lagradost.cloudstream3.extractors
44

5-
import com.lagradost.cloudstream3.Prerelease
6-
75
open class OkRuSSL : Odnoklassniki() {
86
override var name = "OkRuSSL"
97
override var mainUrl = "https://ok.ru"
@@ -14,12 +12,10 @@ open class OkRuHTTP : Odnoklassniki() {
1412
override var mainUrl = "http://ok.ru"
1513
}
1614

17-
@Prerelease
1815
class OkRuSSLMobile : OkRuSSL() {
1916
override var mainUrl = "https://m.ok.ru"
2017
}
2118

22-
@Prerelease
2319
class OkRuHTTPMobile : OkRuHTTP() {
2420
override var mainUrl = "http://m.ok.ru"
2521
}

library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/PixelDrainExtractor.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ package com.lagradost.cloudstream3.extractors
55
import com.lagradost.cloudstream3.*
66
import com.lagradost.cloudstream3.utils.*
77

8-
@Prerelease
98
class PixelDrainDev : PixelDrain() {
109
override var mainUrl = "https://pixeldrain.dev"
1110
}

library/src/commonMain/kotlin/com/lagradost/cloudstream3/extractors/VkExtractor.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// Made by @kraptor123 for cs-kraptor
22
package com.lagradost.cloudstream3.extractors
33

4-
import com.lagradost.cloudstream3.Prerelease
54
import com.lagradost.cloudstream3.SubtitleFile
65
import com.lagradost.cloudstream3.app
76
import com.lagradost.cloudstream3.utils.ExtractorApi
@@ -10,7 +9,6 @@ import com.lagradost.cloudstream3.utils.ExtractorLinkType
109
import com.lagradost.cloudstream3.utils.getQualityFromName
1110
import com.lagradost.cloudstream3.utils.newExtractorLink
1211

13-
@Prerelease
1412
open class VkExtractor : ExtractorApi() {
1513
override val name = "Vk"
1614
override val mainUrl = "https://vkvideo.ru"

0 commit comments

Comments
 (0)