mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-11 20:00:12 +08:00
Compare commits
4 Commits
8309be9ca9
...
c2ceb9ec73
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c2ceb9ec73 | ||
|
|
99a950b049 | ||
|
|
87914a267a | ||
|
|
dd85aba8a9 |
@@ -22,7 +22,6 @@ import 'package:PiliPlus/pages/main_reply/view.dart';
|
||||
import 'package:PiliPlus/pages/sponsor_block/block_mixin.dart';
|
||||
import 'package:PiliPlus/pages/video/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/introduction/ugc/widgets/triple_mixin.dart';
|
||||
import 'package:PiliPlus/pages/video/pay_coins/view.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/controller.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/play_status.dart';
|
||||
@@ -86,6 +85,7 @@ class AudioController extends GetxController
|
||||
|
||||
late final Rx<PlayRepeat> playMode = Pref.audioPlayMode.obs;
|
||||
|
||||
@override
|
||||
late final isLogin = Accounts.main.isLogin;
|
||||
|
||||
Duration? _start;
|
||||
@@ -462,36 +462,11 @@ class AudioController extends GetxController
|
||||
}
|
||||
}
|
||||
|
||||
void actionCoinVideo() {
|
||||
final audioItem = this.audioItem.value;
|
||||
if (audioItem == null) {
|
||||
return;
|
||||
}
|
||||
@override
|
||||
int get copyright => audioItem.value?.arc.copyright ?? 1;
|
||||
|
||||
if (!isLogin) {
|
||||
SmartDialog.showToast('账号未登录');
|
||||
return;
|
||||
}
|
||||
|
||||
final int copyright = audioItem.arc.copyright;
|
||||
if ((copyright != 1 && coinNum.value >= 1) || coinNum.value >= 2) {
|
||||
SmartDialog.showToast('达到投币上限啦~');
|
||||
return;
|
||||
}
|
||||
|
||||
if (GlobalData().coins != null && GlobalData().coins! < 1) {
|
||||
SmartDialog.showToast('硬币不足');
|
||||
// return;
|
||||
}
|
||||
|
||||
PayCoinsPage.toPayCoinsPage(
|
||||
onPayCoin: _onPayCoin,
|
||||
hasCoin: coinNum.value == 1,
|
||||
copyright: copyright,
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> _onPayCoin(int coin, bool coinWithLike) async {
|
||||
@override
|
||||
Future<void> onPayCoin(int coin, bool coinWithLike) async {
|
||||
final res = await AudioGrpc.audioCoinAdd(
|
||||
oid: oid,
|
||||
subId: subId,
|
||||
|
||||
@@ -43,6 +43,7 @@ abstract class CommonIntroController extends GetxController
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
late final isLogin = Accounts.main.isLogin;
|
||||
|
||||
StatDetail? getStat();
|
||||
@@ -59,7 +60,6 @@ abstract class CommonIntroController extends GetxController
|
||||
bool prevPlay();
|
||||
bool nextPlay();
|
||||
|
||||
void actionCoinVideo();
|
||||
void actionShareVideo(BuildContext context);
|
||||
|
||||
// 同时观看
|
||||
@@ -119,7 +119,8 @@ abstract class CommonIntroController extends GetxController
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
Future<void> coinVideo(int coin, [bool selectLike = false]) async {
|
||||
@override
|
||||
Future<void> onPayCoin(int coin, bool coinWithLike) async {
|
||||
final stat = getStat();
|
||||
if (stat == null) {
|
||||
return;
|
||||
@@ -127,14 +128,14 @@ abstract class CommonIntroController extends GetxController
|
||||
final res = await VideoHttp.coinVideo(
|
||||
bvid: bvid,
|
||||
multiply: coin,
|
||||
selectLike: selectLike ? 1 : 0,
|
||||
selectLike: coinWithLike ? 1 : 0,
|
||||
);
|
||||
if (res.isSuccess) {
|
||||
SmartDialog.showToast('投币成功');
|
||||
coinNum.value += coin;
|
||||
GlobalData().afterCoin(coin);
|
||||
stat.coin += coin;
|
||||
if (selectLike && !hasLike.value) {
|
||||
if (coinWithLike && !hasLike.value) {
|
||||
stat.like++;
|
||||
hasLike.value = true;
|
||||
}
|
||||
|
||||
@@ -184,8 +184,10 @@ class FavDetailController
|
||||
folderInfo
|
||||
..value.favState = isFav ? 0 : 1
|
||||
..refresh();
|
||||
SmartDialog.showToast('${isFav ? '取消' : ''}收藏成功');
|
||||
} else {
|
||||
res.toast();
|
||||
}
|
||||
res.toast();
|
||||
}
|
||||
|
||||
Future<void> cleanFav() async {
|
||||
|
||||
@@ -15,7 +15,7 @@ class LocalIntroController extends CommonIntroController {
|
||||
void queryVideoIntro() {}
|
||||
|
||||
@override
|
||||
void actionCoinVideo() {}
|
||||
int get copyright => throw UnimplementedError();
|
||||
|
||||
@override
|
||||
void actionLikeVideo() {}
|
||||
|
||||
@@ -16,7 +16,6 @@ import 'package:PiliPlus/models_new/video/video_detail/episode.dart'
|
||||
import 'package:PiliPlus/models_new/video/video_detail/stat_detail.dart';
|
||||
import 'package:PiliPlus/pages/common/common_intro_controller.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_repost/view.dart';
|
||||
import 'package:PiliPlus/pages/video/pay_coins/view.dart';
|
||||
import 'package:PiliPlus/pages/video/reply/controller.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
||||
import 'package:PiliPlus/services/service_locator.dart';
|
||||
@@ -114,29 +113,8 @@ class PgcIntroController extends CommonIntroController {
|
||||
}
|
||||
}
|
||||
|
||||
// 投币
|
||||
@override
|
||||
void actionCoinVideo() {
|
||||
if (!isLogin) {
|
||||
SmartDialog.showToast('账号未登录');
|
||||
return;
|
||||
}
|
||||
|
||||
if (coinNum.value >= 2) {
|
||||
SmartDialog.showToast('达到投币上限啦~');
|
||||
return;
|
||||
}
|
||||
|
||||
if (GlobalData().coins != null && GlobalData().coins! < 1) {
|
||||
SmartDialog.showToast('硬币不足');
|
||||
// return;
|
||||
}
|
||||
|
||||
PayCoinsPage.toPayCoinsPage(
|
||||
onPayCoin: coinVideo,
|
||||
hasCoin: coinNum.value == 1,
|
||||
);
|
||||
}
|
||||
int get copyright => 1;
|
||||
|
||||
// 分享视频
|
||||
@override
|
||||
|
||||
@@ -24,7 +24,6 @@ import 'package:PiliPlus/models_new/video/video_detail/stat_detail.dart';
|
||||
import 'package:PiliPlus/models_new/video/video_detail/ugc_season.dart';
|
||||
import 'package:PiliPlus/pages/common/common_intro_controller.dart';
|
||||
import 'package:PiliPlus/pages/dynamics_repost/view.dart';
|
||||
import 'package:PiliPlus/pages/video/pay_coins/view.dart';
|
||||
import 'package:PiliPlus/pages/video/related/controller.dart';
|
||||
import 'package:PiliPlus/pages/video/reply/controller.dart';
|
||||
import 'package:PiliPlus/plugin/pl_player/models/play_repeat.dart';
|
||||
@@ -276,31 +275,8 @@ class UgcIntroController extends CommonIntroController with ReloadMixin {
|
||||
}
|
||||
}
|
||||
|
||||
// 投币
|
||||
@override
|
||||
void actionCoinVideo() {
|
||||
if (!isLogin) {
|
||||
SmartDialog.showToast('账号未登录');
|
||||
return;
|
||||
}
|
||||
|
||||
int copyright = videoDetail.value.copyright ?? 1;
|
||||
if ((copyright != 1 && coinNum.value >= 1) || coinNum.value >= 2) {
|
||||
SmartDialog.showToast('达到投币上限啦~');
|
||||
return;
|
||||
}
|
||||
|
||||
if (GlobalData().coins != null && GlobalData().coins! < 1) {
|
||||
SmartDialog.showToast('硬币不足');
|
||||
// return;
|
||||
}
|
||||
|
||||
PayCoinsPage.toPayCoinsPage(
|
||||
onPayCoin: coinVideo,
|
||||
copyright: copyright,
|
||||
hasCoin: coinNum.value == 1,
|
||||
);
|
||||
}
|
||||
int get copyright => videoDetail.value.copyright ?? 1;
|
||||
|
||||
@override
|
||||
(Object, int) get getFavRidType => (IdUtils.bv2av(bvid), 2);
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:PiliPlus/pages/video/pay_coins/view.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
import 'package:PiliPlus/utils/platform_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -18,6 +20,46 @@ mixin TripleMixin on GetxController, TickerProvider {
|
||||
|
||||
bool get hasTriple => hasLike.value && hasCoin && hasFav.value;
|
||||
|
||||
bool get isLogin;
|
||||
|
||||
bool isHasCopyright(int copyright) {
|
||||
return copyright != 2;
|
||||
}
|
||||
|
||||
bool reachCoinLimit(bool hasCopyRight, num coinNum) {
|
||||
return (!hasCopyRight && coinNum >= 1) || coinNum >= 2;
|
||||
}
|
||||
|
||||
int get copyright;
|
||||
|
||||
void onPayCoin(int coin, bool coinWithLike);
|
||||
|
||||
void actionCoinVideo() {
|
||||
if (!isLogin) {
|
||||
SmartDialog.showToast('账号未登录');
|
||||
return;
|
||||
}
|
||||
|
||||
final coinNum = this.coinNum.value;
|
||||
final copyright = this.copyright;
|
||||
final hasCopyright = isHasCopyright(copyright);
|
||||
if (reachCoinLimit(hasCopyright, coinNum)) {
|
||||
SmartDialog.showToast('达到投币上限啦~');
|
||||
return;
|
||||
}
|
||||
|
||||
if (GlobalData().coins != null && GlobalData().coins! < 1) {
|
||||
SmartDialog.showToast('硬币不足');
|
||||
// return;
|
||||
}
|
||||
|
||||
PayCoinsPage.toPayCoinsPage(
|
||||
onPayCoin: onPayCoin,
|
||||
hasCoin: coinNum == 1,
|
||||
hasCopyright: hasCopyright,
|
||||
);
|
||||
}
|
||||
|
||||
void actionTriple();
|
||||
void actionLikeVideo();
|
||||
|
||||
|
||||
@@ -15,33 +15,35 @@ import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
typedef OnPayCoin = Function(int coin, bool coinWithLike);
|
||||
|
||||
class PayCoinsPage extends StatefulWidget {
|
||||
const PayCoinsPage({
|
||||
super.key,
|
||||
required this.onPayCoin,
|
||||
int copyright = 1,
|
||||
this.hasCoin = false,
|
||||
}) : hasCopyright = copyright == 1;
|
||||
required this.hasCoin,
|
||||
required this.hasCopyright,
|
||||
});
|
||||
|
||||
final Function(int coin, bool coinWithLike) onPayCoin;
|
||||
final bool hasCopyright;
|
||||
final OnPayCoin onPayCoin;
|
||||
final bool hasCoin;
|
||||
final bool hasCopyright;
|
||||
|
||||
@override
|
||||
State<PayCoinsPage> createState() => _PayCoinsPageState();
|
||||
|
||||
static void toPayCoinsPage({
|
||||
required Function(int coin, bool coinWithLike) onPayCoin,
|
||||
int copyright = 1,
|
||||
bool hasCoin = false,
|
||||
required OnPayCoin onPayCoin,
|
||||
required bool hasCoin,
|
||||
required bool hasCopyright,
|
||||
}) {
|
||||
Get.key.currentState!.push(
|
||||
PublishRoute(
|
||||
pageBuilder: (buildContext, animation, secondaryAnimation) {
|
||||
return PayCoinsPage(
|
||||
onPayCoin: onPayCoin,
|
||||
copyright: copyright,
|
||||
hasCoin: hasCoin,
|
||||
hasCopyright: hasCopyright,
|
||||
);
|
||||
},
|
||||
transitionDuration: const Duration(milliseconds: 225),
|
||||
@@ -200,38 +202,38 @@ class _PayCoinsPageState extends State<PayCoinsPage>
|
||||
|
||||
Widget _buildCoinWidget(int index, double factor) {
|
||||
final filter = _getPayFilter(index);
|
||||
final boxSize = 70 + (factor * 30);
|
||||
final coinSize = 35 + (factor * 15);
|
||||
return Center(
|
||||
child: SizedBox.square(
|
||||
dimension: 70 + (factor * 30),
|
||||
child: ColorFiltered(
|
||||
colorFilter: ColorFilter.mode(
|
||||
filter,
|
||||
BlendMode.srcATop,
|
||||
),
|
||||
child: Stack(
|
||||
clipBehavior: Clip.none,
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
SlideTransition(
|
||||
position: _boxAnim,
|
||||
child: Image.asset(Assets.payBox),
|
||||
),
|
||||
SlideTransition(
|
||||
position: _coinSlideAnim,
|
||||
child: FadeTransition(
|
||||
opacity: _coinFadeAnim,
|
||||
child: Image.asset(
|
||||
height: coinSize,
|
||||
width: coinSize,
|
||||
index == 0 ? Assets.coinsOne : Assets.coinsTwo,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
return Stack(
|
||||
alignment: .center,
|
||||
clipBehavior: .none,
|
||||
children: [
|
||||
SlideTransition(
|
||||
position: _boxAnim,
|
||||
child: Image.asset(
|
||||
Assets.payBox,
|
||||
color: filter,
|
||||
width: boxSize,
|
||||
height: boxSize,
|
||||
cacheWidth: 100.cacheSize(context),
|
||||
colorBlendMode: .srcATop,
|
||||
),
|
||||
),
|
||||
),
|
||||
SlideTransition(
|
||||
position: _coinSlideAnim,
|
||||
child: FadeTransition(
|
||||
opacity: _coinFadeAnim,
|
||||
child: Image.asset(
|
||||
height: coinSize,
|
||||
width: coinSize,
|
||||
cacheWidth: 50.cacheSize(context),
|
||||
color: filter,
|
||||
colorBlendMode: .srcATop,
|
||||
index == 0 ? Assets.coinsOne : Assets.coinsTwo,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
49
pubspec.lock
49
pubspec.lock
@@ -237,10 +237,11 @@ packages:
|
||||
catcher_2:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: catcher_2
|
||||
sha256: ac9dd03230fa4058d14d46450335ca3c40564f734d793e52f81053f3cbf95009
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
path: "."
|
||||
ref: dev
|
||||
resolved-ref: a20878e9fe5375252c9ea22697d4dc4823544b1a
|
||||
url: "https://github.com/bggRGjQaUbCoE/catcher_2.git"
|
||||
source: git
|
||||
version: "2.1.9"
|
||||
characters:
|
||||
dependency: "direct main"
|
||||
@@ -287,10 +288,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: code_assets
|
||||
sha256: "83ccdaa064c980b5596c35dd64a8d3ecc68620174ab9b90b6343b753aa721687"
|
||||
sha256: dad6bf6b9f4f378b0a69edbf42584d336efd1a9ce15deb1ba591cbb1b5ff440f
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.0"
|
||||
version: "1.1.0"
|
||||
collection:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -522,10 +523,10 @@ packages:
|
||||
description:
|
||||
path: "."
|
||||
ref: dev
|
||||
resolved-ref: c4672374956fa28d117ef7a55a6e708daddbf462
|
||||
resolved-ref: f6c2ab82ce7539dc26e6c16e1455b435fd2ded09
|
||||
url: "https://github.com/bggRGjQaUbCoE/flutter_file_picker.git"
|
||||
source: git
|
||||
version: "12.0.0-beta.4"
|
||||
version: "12.0.0-beta.5"
|
||||
file_selector_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -710,10 +711,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: flutter_mailer
|
||||
sha256: "149e51d4e3ba12f8b61e1923ff4304f308acb856b92e9d09326bec6a1ad943d6"
|
||||
sha256: e1c0b4425e3cc789f8dd914fd08b5da660c3ac46c8ebf3e7db183d39775a8fa6
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "3.0.2"
|
||||
flutter_native_splash:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@@ -774,14 +775,6 @@ packages:
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
fluttertoast:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fluttertoast
|
||||
sha256: "144ddd74d49c865eba47abe31cbc746c7b311c82d6c32e571fd73c4264b740e2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.0.0"
|
||||
font_awesome_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -844,10 +837,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: hooks
|
||||
sha256: "025f060e86d2d4c3c47b56e33caf7f93bf9283340f26d23424ebcfccf34f621e"
|
||||
sha256: a41af4e8fc687cd6d33de9751eb936c8c0204ebe2bcb6c15ecf707504bf47f31
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.3"
|
||||
version: "2.0.0"
|
||||
html:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -1257,14 +1250,6 @@ packages:
|
||||
url: "https://github.com/bggRGjQaUbCoE/flutter_native_device_orientation.git"
|
||||
source: git
|
||||
version: "2.0.5"
|
||||
native_toolchain_c:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: native_toolchain_c
|
||||
sha256: "6ba77bb18063eebe9de401f5e6437e95e1438af0a87a3a39084fbd37c90df572"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.17.6"
|
||||
nm:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1277,10 +1262,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: objective_c
|
||||
sha256: "02f4ff97ac95fa4abe561242eb033239e08e8903a46eaecf61b047761b89fe1f"
|
||||
sha256: "6cb691c686fa2838c6deb34980d426145c2a5d537491cb83d463c33cdbc726ed"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "9.4.0"
|
||||
version: "9.4.1"
|
||||
octo_image:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -2044,10 +2029,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: win32
|
||||
sha256: a1fc9eb9248baa05dfc12ed5b66e377b3e23f095eec078e0371622b9033810d9
|
||||
sha256: ba6f4bba816c8d7e3c1580e170f3786d216951cc6b94babc3b814c08d2cb2738
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.2.0"
|
||||
version: "6.3.0"
|
||||
win32_registry:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -46,7 +46,10 @@ dependencies:
|
||||
git:
|
||||
url: https://github.com/bggRGjQaUbCoE/canvas_danmaku.git
|
||||
ref: main
|
||||
catcher_2: ^2.1.0
|
||||
catcher_2:
|
||||
git:
|
||||
url: https://github.com/bggRGjQaUbCoE/catcher_2.git
|
||||
ref: dev
|
||||
characters: ^1.4.1
|
||||
chat_bottom_container:
|
||||
git:
|
||||
|
||||
Reference in New Issue
Block a user