Skip to content

Commit 2af9ab8

Browse files
committed
fix breakage
1 parent 5846fb2 commit 2af9ab8

File tree

12 files changed

+92
-71
lines changed

12 files changed

+92
-71
lines changed

AniyomiProvider/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
id("org.jetbrains.kotlin.android")
33
}
44
// use an integer for version numbers
5-
version = 6
5+
version = 7
66

77
cloudstream {
88
// All of these properties are optional, you can safely remove them
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest package="com.example"/>
2+
<manifest />

AniyomiProvider/src/main/java/com/example/BottomSheet.kt

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ class BottomFragment(private val plugin: Plugin) : BottomSheetDialogFragment() {
4646
}
4747

4848
private fun <T : View> View.findView(name: String): T {
49-
val id = plugin.resources!!.getIdentifier(name, "id", BuildConfig.LIBRARY_PACKAGE_NAME)
49+
val id = plugin.resources!!.getIdentifier(name, "id", "com.example")
5050
return this.findViewById(id)
5151
}
5252

5353
private fun getDrawable(name: String): Drawable? {
5454
val id =
55-
plugin.resources!!.getIdentifier(name, "drawable", BuildConfig.LIBRARY_PACKAGE_NAME)
55+
plugin.resources!!.getIdentifier(name, "drawable", "com.example")
5656
return ResourcesCompat.getDrawable(plugin.resources!!, id, null)
5757
}
5858

@@ -77,8 +77,7 @@ class BottomFragment(private val plugin: Plugin) : BottomSheetDialogFragment() {
7777
val deleteLocalButton = view.findView<ImageView>("delete_local_button")
7878
val externalApkButton = view.findView<ImageView>("external_apk_button")
7979
val externalApkRoot = view.findView<View>("external_apk_root")
80-
val downloadAniyomiExtensionsButton =
81-
view.findView<ImageView>("download_aniyomi_extensions")
80+
// val goToExtensionGithubButton = view.findView<ImageView>("go_to_apk_github")
8281

8382
val sortingGroup = view.findView<RadioGroup>("sorting_group")
8483
val radioNone = view.findView<RadioButton>("radio_button_none")
@@ -191,18 +190,18 @@ class BottomFragment(private val plugin: Plugin) : BottomSheetDialogFragment() {
191190
}
192191
})
193192

194-
downloadAniyomiExtensionsButton.imageTintList = ColorStateList.valueOf(textColor)
195-
downloadAniyomiExtensionsButton.setImageDrawable(getDrawable("baseline_open_in_browser_24"))
196-
downloadAniyomiExtensionsButton.setOnClickListener(object : OnClickListener {
197-
override fun onClick(p0: View?) {
198-
runCatching {
199-
val intent = Intent(Intent.ACTION_VIEW).apply {
200-
data = Uri.parse("https://aniyomi.org/extensions/")
201-
}
202-
activity?.startActivity(intent)
203-
}
204-
}
205-
})
193+
// goToExtensionGithubButton.imageTintList = ColorStateList.valueOf(textColor)
194+
// goToExtensionGithubButton.setImageDrawable(getDrawable("ic_github_logo"))
195+
// goToExtensionGithubButton.setOnClickListener(object : OnClickListener {
196+
// override fun onClick(p0: View?) {
197+
// runCatching {
198+
// val intent = Intent(Intent.ACTION_VIEW).apply {
199+
// data = Uri.parse("https://github.com/CranberrySoup/AniyomiCompatExtension")
200+
// }
201+
// activity?.startActivity(intent)
202+
// }
203+
// }
204+
// })
206205

207206
val sortingMap = mapOf(
208207
EpisodeSortMethods.None.num to radioNone,

AniyomiProvider/src/main/java/com/example/ExtensionAdapter.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ class ExtensionAdapter(
2929
) : RecyclerView.Adapter<ExtensionAdapter.ViewHolder>() {
3030

3131
private fun <T : View> View.findView(name: String): T {
32-
val id = plugin.resources!!.getIdentifier(name, "id", BuildConfig.LIBRARY_PACKAGE_NAME)
32+
val id = plugin.resources!!.getIdentifier(name, "id", "com.example")
3333
return this.findViewById(id)
3434
}
3535

3636
private fun getDrawable(name: String): Drawable? {
3737
val id =
38-
plugin.resources!!.getIdentifier(name, "drawable", BuildConfig.LIBRARY_PACKAGE_NAME)
38+
plugin.resources!!.getIdentifier(name, "drawable", "com.example")
3939
return ResourcesCompat.getDrawable(plugin.resources!!, id, null)
4040
}
4141

AniyomiProvider/src/main/java/com/example/ExtensionFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ class ExtensionFragment(private val plugin: Plugin) : BottomSheetDialogFragment(
3131
}
3232

3333
private fun <T : View> View.findView(name: String): T {
34-
val id = plugin.resources!!.getIdentifier(name, "id", BuildConfig.LIBRARY_PACKAGE_NAME)
34+
val id = plugin.resources!!.getIdentifier(name, "id", "com.example")
3535
return this.findViewById(id)
3636
}
3737

3838
private fun getDrawable(name: String): Drawable? {
3939
val id =
40-
plugin.resources!!.getIdentifier(name, "drawable", BuildConfig.LIBRARY_PACKAGE_NAME)
40+
plugin.resources!!.getIdentifier(name, "drawable", "com.example")
4141
return ResourcesCompat.getDrawable(plugin.resources!!, id, null)
4242
}
4343

AniyomiProvider/src/main/kotlin/recloudstream/AniyomiPlugin.kt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ import com.lagradost.cloudstream3.mvvm.logError
2222
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
2323
import com.lagradost.cloudstream3.plugins.CloudstreamPlugin
2424
import com.lagradost.cloudstream3.plugins.Plugin
25-
import com.lagradost.cloudstream3.ui.result.txt
2625
import com.lagradost.cloudstream3.utils.Coroutines.ioWorkSafe
2726
import com.lagradost.cloudstream3.utils.Coroutines.main
27+
import com.lagradost.cloudstream3.utils.txt
2828
import dalvik.system.BaseDexClassLoader
2929
import kotlinx.coroutines.runBlocking
3030
import java.io.File
@@ -113,9 +113,10 @@ class AniyomiPlugin : Plugin() {
113113

114114
return installedPkgs.filter { pkg ->
115115
pkg.reqFeatures.orEmpty().any { it.name == extensionFeature }
116-
}.map {
117-
val appInfo = it.applicationInfo
118-
val name = pkgManager.getApplicationLabel(appInfo).toString().substringAfter("Aniyomi: ")
116+
}.mapNotNull {
117+
val appInfo = it.applicationInfo ?: return@mapNotNull null
118+
val name =
119+
pkgManager.getApplicationLabel(appInfo).toString().substringAfter("Aniyomi: ")
119120
val icon = pkgManager.getApplicationIcon(appInfo)
120121
AniyomiExtension(it.packageName, name, icon)
121122
}
@@ -145,6 +146,7 @@ class AniyomiPlugin : Plugin() {
145146
fun loadAniyomi(context: Context, file: File) {
146147
normalSafeApiCall {
147148
println("Loading Aniyomi Compat at: ${file.absolutePath}")
149+
file.setReadOnly()
148150
val classLoader = context.classLoader
149151
addDexToClasspath(file, classLoader)
150152
val aniyomiPlugin = classLoader.loadClass(pluginClassName).newInstance() as Plugin
@@ -157,6 +159,9 @@ class AniyomiPlugin : Plugin() {
157159
suspend fun downloadApk(context: Context): Boolean {
158160
return ioWorkSafe {
159161
val finalFile = getLocalFile(context)
162+
normalSafeApiCall {
163+
finalFile.setWritable(true)
164+
}
160165
val tmpFile = File.createTempFile("AniyomiCompat", null)
161166

162167
val request = app.get(apkUrl)
@@ -168,7 +173,7 @@ class AniyomiPlugin : Plugin() {
168173
setKey(ANIYOMI_PLUGIN_SUCCESS_KEY, false)
169174
tmpFile.copyTo(finalFile, true)
170175
setKey(ANIYOMI_PLUGIN_SUCCESS_KEY, true)
171-
tmpFile.deleteOnExit()
176+
tmpFile.delete()
172177
true
173178
} == true
174179
}
@@ -185,7 +190,7 @@ class AniyomiPlugin : Plugin() {
185190
uri.path?.let {
186191
val contentUri = FileProvider.getUriForFile(
187192
context,
188-
BuildConfig.APPLICATION_ID + ".provider",
193+
context.packageName + ".provider",
189194
File(it)
190195
)
191196
val installIntent = Intent(Intent.ACTION_VIEW).apply {
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:width="24dp"
4+
android:height="24dp"
5+
android:tint="#FFF"
6+
android:viewportWidth="1000"
7+
android:viewportHeight="1000">
8+
<path
9+
android:fillColor="#FFF"
10+
android:pathData="M455.34,24.62c-61.96,5.16 -121.85,22.37 -176.93,49.91c-80.55,40.62 -140.44,94.66 -190.36,170.73c-35.8,54.39 -60.24,116 -72.29,182.78C7.85,471.07 8.2,555.75 16.11,597.4c33.05,172.45 148.36,312.21 307.73,372.1c26.16,9.98 36.49,10.33 45.44,1.38c6.2,-6.2 6.88,-11.36 6.88,-52.67l0,-45.44l-43.72,-0c-37.86,-0 -46.47,-1.03 -60.24,-7.57c-27.19,-12.39 -45.44,-32.35 -62.65,-68.16c-15.15,-31.67 -34.42,-55.42 -58.17,-72.29c-23.75,-16.87 -5.16,-29.95 28.57,-20.31c14.8,4.48 23.06,9.64 37.86,25.13c10.33,10.67 24.44,26.85 30.98,36.14c7.57,10.67 18.93,20.65 30.98,27.54c16.52,9.29 22.03,10.67 44.75,10.33c14.11,-0.35 31.67,-2.76 38.9,-5.16c12.05,-4.48 13.77,-7.23 20.65,-27.54c4.13,-12.05 11.02,-26.85 15.49,-32.36l7.92,-9.98l-35.46,-7.57c-63.68,-13.43 -99.82,-32.01 -132.52,-68.16c-33.73,-36.83 -52.67,-94.31 -52.67,-160.4c0,-51.63 9.98,-84.68 36.83,-121.17l11.7,-16.18l-4.13,-21c-7.23,-37.52 2.75,-103.96 16.52,-109.12c14.46,-5.51 72.97,15.83 112.21,40.96l16.18,10.33l32.01,-6.2c44.06,-8.95 139.41,-9.29 183.47,-0.34l31.33,6.54l30.29,-17.56c33.73,-19.28 64.71,-30.64 87.43,-32.01l15.49,-1.03l6.54,17.21c8.61,22.03 11.71,70.91 5.85,93.97l-4.13,17.56l15.49,23.41c27.54,41.99 31.67,57.14 31.67,116.35c-0.34,43.37 -1.38,56.11 -7.92,79.17c-19.28,67.12 -60.24,110.84 -125.3,134.59c-8.26,3.1 -30.64,8.95 -50.25,13.08l-35.46,7.57l7.57,9.29c4.13,5.51 10.67,17.9 14.46,27.54c6.88,16.18 7.57,26.16 8.61,107.4c0.69,59.9 2.41,90.88 5.16,93.97c11.71,14.46 27.88,11.71 83.65,-14.8c67.12,-31.32 136.31,-88.12 182.09,-149.39c42.68,-56.45 77.11,-136.31 89.84,-206.88c7.92,-43.72 7.92,-121.51 0,-165.23c-19.96,-110.5 -81.58,-218.24 -165.57,-288.8C716.26,54.91 586.14,12.92 455.34,24.62z"
11+
tools:ignore="VectorPath" />
12+
</vector>

AniyomiProvider/src/main/res/layout/bottom_sheet_layout.xml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -214,28 +214,28 @@
214214
android:textStyle="italic"
215215
android:visibility="gone" />
216216

217-
<LinearLayout
218-
android:layout_width="match_parent"
219-
android:layout_height="wrap_content"
220-
android:paddingTop="20dp">
221-
222-
<TextView
223-
android:layout_width="0dp"
224-
android:layout_height="wrap_content"
225-
android:layout_gravity="center"
226-
android:layout_weight="1"
227-
android:text="Download Aniyomi extensions"
228-
android:textSize="17sp"
229-
android:textStyle="bold" />
230-
231-
<ImageView
232-
android:id="@+id/download_aniyomi_extensions"
233-
android:layout_width="34dp"
234-
android:layout_height="34dp"
235-
android:clickable="true"
236-
android:focusable="true"
237-
tools:src="@drawable/baseline_open_in_browser_24" />
238-
</LinearLayout>
217+
<!-- <LinearLayout-->
218+
<!-- android:layout_width="match_parent"-->
219+
<!-- android:layout_height="wrap_content"-->
220+
<!-- android:paddingTop="20dp">-->
221+
222+
<!-- <TextView-->
223+
<!-- android:layout_width="0dp"-->
224+
<!-- android:layout_height="wrap_content"-->
225+
<!-- android:layout_gravity="center"-->
226+
<!-- android:layout_weight="1"-->
227+
<!-- android:text="Go to extension repository"-->
228+
<!-- android:textSize="17sp"-->
229+
<!-- android:textStyle="bold" />-->
230+
231+
<!-- <ImageView-->
232+
<!-- android:id="@+id/go_to_apk_github"-->
233+
<!-- android:layout_width="34dp"-->
234+
<!-- android:layout_height="34dp"-->
235+
<!-- android:clickable="true"-->
236+
<!-- android:focusable="true"-->
237+
<!-- tools:src="@drawable/ic_github_logo" />-->
238+
<!-- </LinearLayout>-->
239239

240240

241241
<LinearLayout

build.gradle.kts

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import com.android.build.gradle.BaseExtension
22
import com.lagradost.cloudstream3.gradle.CloudstreamExtension
3+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
4+
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
35

46
buildscript {
57
repositories {
@@ -10,10 +12,10 @@ buildscript {
1012
}
1113

1214
dependencies {
13-
classpath("com.android.tools.build:gradle:7.0.4")
15+
classpath("com.android.tools.build:gradle:8.7.3")
1416
// Cloudstream gradle plugin which makes everything work and builds plugins
1517
classpath("com.github.recloudstream:gradle:-SNAPSHOT")
16-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20")
18+
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0")
1719
}
1820
}
1921

@@ -43,44 +45,47 @@ subprojects {
4345
}
4446

4547
android {
46-
compileSdkVersion(33)
48+
namespace = "com.example"
49+
50+
compileSdkVersion(35)
4751

4852
defaultConfig {
4953
minSdk = 23
50-
targetSdk = 33
54+
targetSdk = 35
5155
}
5256

5357
compileOptions {
5458
sourceCompatibility = JavaVersion.VERSION_1_8
5559
targetCompatibility = JavaVersion.VERSION_1_8
5660
}
5761

58-
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
59-
kotlinOptions {
60-
jvmTarget = "1.8" // Required
61-
// Disables some unnecessary features
62-
freeCompilerArgs = freeCompilerArgs +
63-
"-Xno-call-assertions" +
64-
"-Xno-param-assertions" +
65-
"-Xno-receiver-assertions"
62+
tasks.withType<KotlinJvmCompile> {
63+
compilerOptions {
64+
jvmTarget.set(JvmTarget.JVM_1_8) // Required
65+
freeCompilerArgs.addAll(
66+
"-Xno-call-assertions",
67+
"-Xno-param-assertions",
68+
"-Xno-receiver-assertions"
69+
)
6670
}
6771
}
6872
}
6973

7074
dependencies {
71-
val apk by configurations
75+
val cloudstream by configurations
7276
val implementation by configurations
7377

7478
// Stubs for all Cloudstream classes
75-
apk("com.lagradost:cloudstream3:pre-release")
79+
cloudstream("com.lagradost:cloudstream3:pre-release")
80+
//implementation("com.github.recloudstream.cloudstream:library-jvm:master-SNAPSHOT")
7681

7782
// these dependencies can include any of those which are added by the app,
7883
// but you dont need to include any of them if you dont need them
7984
// https://github.com/recloudstream/cloudstream/blob/master/app/build.gradle
8085
implementation(kotlin("stdlib")) // adds standard kotlin features, like listOf, mapOf etc
81-
implementation("com.github.Blatzar:NiceHttp:0.4.4") // http library
82-
implementation("org.jsoup:jsoup:1.13.1") // html parser
83-
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.2")
86+
implementation("com.github.Blatzar:NiceHttp:0.4.11") // http library
87+
implementation("org.jsoup:jsoup:1.18.3") // html parser
88+
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.1")
8489
}
8590
}
8691

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# http://www.gradle.org/docs/current/userguide/build_environment.html
77
# Specifies the JVM arguments used for the daemon process.
88
# The setting is particularly useful for tweaking memory settings.
9-
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
9+
org.gradle.jvmargs=-Xmx8G -Dfile.encoding=UTF-8
1010
# When configured, Gradle will run in incubating parallel mode.
1111
# This option should only be used with decoupled projects. More details, visit
1212
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects

0 commit comments

Comments
 (0)