diff --git a/android/app/src/main/kotlin/com/example/PiliPlus/MainActivity.kt b/android/app/src/main/kotlin/com/example/PiliPlus/MainActivity.kt index 8369d53ca..77f0dcabf 100644 --- a/android/app/src/main/kotlin/com/example/PiliPlus/MainActivity.kt +++ b/android/app/src/main/kotlin/com/example/PiliPlus/MainActivity.kt @@ -4,6 +4,7 @@ import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.engine.FlutterEngine import io.flutter.plugin.common.MethodChannel import com.ryanheise.audioservice.AudioServiceActivity +import android.content.ComponentName import android.content.Intent import android.content.res.Configuration import android.os.Build @@ -21,6 +22,37 @@ class MainActivity : AudioServiceActivity() { methodChannel.setMethodCallHandler { call, result -> if (call.method == "back") { back() + } else if (call.method == "biliSendCommAntifraud") { + val action = call.argument("action") ?: 0 + val oid = call.argument("oid") ?: 0L + val type = call.argument("type") ?: 0 + val rpid = call.argument("rpid") ?: 0L + val root = call.argument("root") ?: 0L + val parent = call.argument("parent") ?: 0L + val ctime = call.argument("ctime") ?: 0L + val commentText = call.argument("comment_text") ?: "" + val pictures = call.argument("pictures") + val sourceId = call.argument("source_id") ?: "" + val uid = call.argument("uid") ?: 0L + val cookies = call.argument>("cookies") ?: emptyList() + + val intent = Intent().apply { + component = ComponentName("icu.freedomIntrovert.biliSendCommAntifraud", "icu.freedomIntrovert.biliSendCommAntifraud.ByXposedLaunchedActivity") + putExtra("action", action) + putExtra("oid", oid.toLong()) + putExtra("type", type) + putExtra("rpid", rpid.toLong()) + putExtra("root", root.toLong()) + putExtra("parent", parent.toLong()) + putExtra("ctime", ctime.toLong()) + putExtra("comment_text", commentText) + if(pictures != null) + putExtra("pictures", pictures) + putExtra("source_id", sourceId) + putExtra("uid", uid.toLong()) + putStringArrayListExtra("cookies", ArrayList(cookies)) + } + startActivity(intent) } else { result.notImplemented() } diff --git a/lib/pages/common/reply_controller.dart b/lib/pages/common/reply_controller.dart index 06711e79a..70d5d716c 100644 --- a/lib/pages/common/reply_controller.dart +++ b/lib/pages/common/reply_controller.dart @@ -13,7 +13,6 @@ import 'package:PiliPlus/pages/video/detail/reply_new/reply_page.dart'; import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/global_data.dart'; import 'package:PiliPlus/utils/utils.dart'; -import 'package:android_intent_plus/android_intent.dart'; import 'package:easy_debounce/easy_throttle.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; @@ -337,14 +336,12 @@ abstract class ReplyController extends CommonController { try { List cookies = await Request.cookieManager.cookieJar .loadForRequest(Uri.parse(HttpString.apiBaseUrl)); - final List cookieString = cookies + final String cookieString = cookies .map((Cookie cookie) => '${cookie.name}=${cookie.value}') - .toList(); - AndroidIntent intent = AndroidIntent( - package: 'icu.freedomIntrovert.biliSendCommAntifraud', - componentName: - 'icu.freedomIntrovert.biliSendCommAntifraud.ByXposedLaunchedActivity', - arguments: { + .join(';'); + Utils.channel.invokeMethod( + 'biliSendCommAntifraud', + { 'action': 0, 'oid': oid, 'type': replyType, @@ -356,10 +353,9 @@ abstract class ReplyController extends CommonController { if (pictures.isNotEmpty == true) 'pictures': jsonEncode(pictures), 'source_id': sourceId, 'uid': mid, - 'cookies': cookieString, + 'cookies': [cookieString], }, ); - intent.launch(); } catch (e) { debugPrint('biliSendCommAntifraud: $e'); } diff --git a/pubspec.lock b/pubspec.lock index 0a666cfe2..26dbc1322 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -22,14 +22,6 @@ packages: url: "https://pub.dev" source: hosted version: "6.7.0" - android_intent_plus: - dependency: "direct main" - description: - name: android_intent_plus - sha256: dfc1fd3a577205ae8f11e990fb4ece8c90cceabbee56fcf48e463ecf0bd6aae3 - url: "https://pub.dev" - source: hosted - version: "5.3.0" animations: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 956067871..8e9a8cd58 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -182,7 +182,6 @@ dependencies: flex_seed_scheme: ^3.4.1 live_photo_maker: ^0.0.6 fl_chart: ^0.69.2 - android_intent_plus: ^5.3.0 dependency_overrides: screen_brightness: ^2.0.1