Skip to content

Commit

Permalink
Merge pull request #492 from xiaoyaocz/dev
Browse files Browse the repository at this point in the history
Release 1.7.2 / TV 1.1.8
  • Loading branch information
xiaoyaocz authored Aug 13, 2024
2 parents 5a8ccdb + 7455857 commit cbaaad8
Show file tree
Hide file tree
Showing 69 changed files with 3,100 additions and 555 deletions.
6 changes: 3 additions & 3 deletions assets/app_version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "1.6.5",
"version_num": 10605,
"version_desc": "- 修复抖音弹幕连接失败问题 #458\n- 修复弹幕不消失问题 #454\n- 恢复抖音直播间搜索",
"version": "1.7.2",
"version_num": 10702,
"version_desc": "- - 修复斗鱼分类无法加载 #485\n- 修复哔哩哔哩直播加载失败 #489\n- 支持远程同步数据\n- 支持导入导出应用设置\n- 支持手动输入Cookie登录哔哩哔哩 #463\n- 支持定时自动更新关注列表 #453",
"prerelease":false,
"download_url": "https://github.com/xiaoyaocz/dart_simple_live/releases"
}
6 changes: 3 additions & 3 deletions assets/tv_app_version.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"version": "1.1.2",
"version_num": 10102,
"version_desc": "- 修复抖音弹幕连接失败问题 #458\n- 修复弹幕不消失问题 #454\n- 恢复抖音直播间搜索",
"version": "1.1.8",
"version_num": 10108,
"version_desc": "- 修复斗鱼分类无法加载\n- 修复哔哩哔哩直播加载失败\n- 支持定时自动更新关注列表",
"prerelease":true,
"download_url": "https://github.com/xiaoyaocz/dart_simple_live/releases"
}
30 changes: 30 additions & 0 deletions simple_live_app/lib/app/controller/app_settings_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ class AppSettingsController extends GetxController {
Platform.isAndroid ? "auto-safe" : "auto",
);

autoUpdateFollowEnable.value = LocalStorageService.instance
.getValue(LocalStorageService.kAutoUpdateFollowEnable, true);

autoUpdateFollowDuration.value = LocalStorageService.instance
.getValue(LocalStorageService.kAutoUpdateFollowEnable, 10);

updateFollowThreadCount.value = LocalStorageService.instance
.getValue(LocalStorageService.kUpdateFollowThreadCount, 4);

initSiteSort();
initHomeSort();
super.onInit();
Expand Down Expand Up @@ -469,4 +478,25 @@ class AppSettingsController extends GetxController {
LocalStorageService.instance
.setValue(LocalStorageService.kVideoHardwareDecoder, e);
}

var autoUpdateFollowEnable = false.obs;
void setAutoUpdateFollowEnable(bool e) {
autoUpdateFollowEnable.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kAutoUpdateFollowEnable, e);
}

var autoUpdateFollowDuration = 10.obs;
void setAutoUpdateFollowDuration(int e) {
autoUpdateFollowDuration.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kAutoUpdateFollowEnable, e);
}

var updateFollowThreadCount = 4.obs;
void setUpdateFollowThreadCount(int e) {
updateFollowThreadCount.value = e;
LocalStorageService.instance
.setValue(LocalStorageService.kUpdateFollowThreadCount, e);
}
}
26 changes: 18 additions & 8 deletions simple_live_app/lib/app/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import 'package:simple_live_app/app/log.dart';
import 'package:simple_live_app/requests/common_request.dart';
import 'package:url_launcher/url_launcher_string.dart';

typedef TextValidate = bool Function(String text);

class Utils {
static late PackageInfo packageInfo;
static DateFormat dateFormat = DateFormat("MM-dd HH:mm");
Expand Down Expand Up @@ -182,12 +184,12 @@ class Utils {
SmartDialog.dismiss(status: SmartStatus.allCustom);
}

static void showBottomSheet({
static Future showBottomSheet({
required String title,
required Widget child,
double maxWidth = 600,
}) {
showModalBottomSheet(
}) async {
var result = await showModalBottomSheet(
context: Get.context!,
constraints: BoxConstraints(
maxWidth: maxWidth,
Expand Down Expand Up @@ -216,18 +218,22 @@ class Utils {
],
),
);
return result;
}

/// 文本编辑的弹窗
/// - `content` 编辑框默认的内容
/// - `title` 弹窗标题
/// - `confirm` 确认按钮内容
/// - `cancel` 取消按钮内容
static Future<String?> showEditTextDialog(String content,
{String title = '',
String? hintText,
String confirm = '',
String cancel = ''}) async {
static Future<String?> showEditTextDialog(
String content, {
String title = '',
String? hintText,
String confirm = '',
String cancel = '',
TextValidate? validate,
}) async {
final TextEditingController textEditingController =
TextEditingController(text: content);
var result = await Get.dialog(
Expand Down Expand Up @@ -256,6 +262,10 @@ class Utils {
),
TextButton(
onPressed: () {
if (validate != null && !validate(textEditingController.text)) {
return;
}

Get.back(result: textEditingController.text);
},
child: const Text("确定"),
Expand Down
3 changes: 3 additions & 0 deletions simple_live_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import 'package:simple_live_app/routes/app_pages.dart';
import 'package:simple_live_app/routes/route_path.dart';
import 'package:simple_live_app/services/bilibili_account_service.dart';
import 'package:simple_live_app/services/db_service.dart';
import 'package:simple_live_app/services/follow_service.dart';
import 'package:simple_live_app/services/local_storage_service.dart';
import 'package:simple_live_app/services/sync_service.dart';
import 'package:simple_live_app/widgets/status/app_loadding_widget.dart';
Expand Down Expand Up @@ -129,6 +130,8 @@ Future initServices() async {

Get.put(SyncService());

Get.put(FollowService());

initCoreLog();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';

import 'package:get/get.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/modules/categoty_detail/category_detail_controller.dart';
import 'package:simple_live_app/modules/category/detail/category_detail_controller.dart';
import 'package:simple_live_app/widgets/keep_alive_wrapper.dart';
import 'package:simple_live_app/widgets/live_room_card.dart';
import 'package:simple_live_app/widgets/page_grid_view.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
// ignore_for_file: invalid_use_of_protected_member

import 'dart:async';
import 'package:get/get.dart';
import 'package:simple_live_app/app/controller/base_controller.dart';
import 'package:simple_live_app/app/event_bus.dart';
import 'package:simple_live_app/app/utils.dart';
import 'package:simple_live_app/models/db/follow_user.dart';
import 'package:simple_live_app/services/db_service.dart';
import 'package:simple_live_app/services/follow_service.dart';

class FollowUserController extends BasePageController<FollowUser> {
StreamSubscription<dynamic>? onUpdatedIndexedStream;
StreamSubscription<dynamic>? onUpdatedListStream;

/// 0:全部 1:直播中 2:未直播
var filterMode = 0.obs;

@override
void onInit() {
onUpdatedIndexedStream = EventBus.instance.listen(
EventBus.kBottomNavigationBarClicked,
(index) {
if (index == 1) {
scrollToTopOrRefresh();
}
},
);
onUpdatedListStream =
FollowService.instance.updatedListStream.listen((event) {
filterData();
});
super.onInit();
}

@override
Future refreshData() async {
await FollowService.instance.loadData();
super.refreshData();
}

@override
Future<List<FollowUser>> getData(int page, int pageSize) async {
if (page > 1) {
return Future.value([]);
}
if (filterMode.value == 0) {
return FollowService.instance.followList.value;
} else if (filterMode.value == 1) {
return FollowService.instance.liveList.value;
} else {
return FollowService.instance.notLiveList.value;
}
}

void filterData() {
if (filterMode.value == 0) {
list.assignAll(FollowService.instance.followList.value);
} else if (filterMode.value == 1) {
list.assignAll(FollowService.instance.liveList.value);
} else if (filterMode.value == 2) {
list.assignAll(FollowService.instance.notLiveList.value);
}
}

void setFilterMode(int mode) {
filterMode.value = mode;
filterData();
}

void removeItem(FollowUser item) async {
var result =
await Utils.showAlertDialog("确定要取消关注${item.userName}吗?", title: "取消关注");
if (!result) {
return;
}
await DBService.instance.followBox.delete(item.id);
refreshData();
}

@override
void onClose() {
onUpdatedIndexedStream?.cancel();
super.onClose();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import 'package:get/get.dart';
import 'package:remixicon/remixicon.dart';
import 'package:simple_live_app/app/app_style.dart';
import 'package:simple_live_app/app/sites.dart';
import 'package:simple_live_app/modules/user/follow_user/follow_user_controller.dart';
import 'package:simple_live_app/modules/follow_user/follow_user_controller.dart';
import 'package:simple_live_app/routes/app_navigation.dart';
import 'package:simple_live_app/services/follow_service.dart';
import 'package:simple_live_app/widgets/filter_button.dart';
import 'package:simple_live_app/widgets/follow_user_item.dart';
import 'package:simple_live_app/widgets/page_grid_view.dart';
Expand All @@ -14,7 +15,6 @@ class FollowUserPage extends GetView<FollowUserController> {

@override
Widget build(BuildContext context) {
controller.filterMode.value = 0;
var count = MediaQuery.of(context).size.width ~/ 500;
if (count < 1) count = 1;
return Scaffold(
Expand Down Expand Up @@ -72,13 +72,13 @@ class FollowUserPage extends GetView<FollowUserController> {
},
onSelected: (value) {
if (value == 0) {
controller.exportFile();
FollowService.instance.exportFile();
} else if (value == 1) {
controller.inputFile();
FollowService.instance.inputFile();
} else if (value == 2) {
controller.exportText();
FollowService.instance.exportText();
} else if (value == 3) {
controller.inputText();
FollowService.instance.inputText();
}
},
),
Expand Down Expand Up @@ -122,7 +122,7 @@ class FollowUserPage extends GetView<FollowUserController> {
),
),
Obx(
() => controller.updating.value
() => FollowService.instance.updating.value
? TextButton.icon(
onPressed: null,
icon: const SizedBox(
Expand Down Expand Up @@ -150,7 +150,7 @@ class FollowUserPage extends GetView<FollowUserController> {
crossAxisSpacing: 12,
crossAxisCount: count,
pageController: controller,
//firstRefresh: true,
firstRefresh: true,
showPCRefreshButton: false,
itemBuilder: (_, i) {
var item = controller.list[i];
Expand Down
8 changes: 4 additions & 4 deletions simple_live_app/lib/modules/indexed/indexed_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import 'package:simple_live_app/modules/category/category_controller.dart';
import 'package:simple_live_app/modules/category/category_page.dart';
import 'package:simple_live_app/modules/home/home_controller.dart';
import 'package:simple_live_app/modules/home/home_page.dart';
import 'package:simple_live_app/modules/user/follow_user/follow_user_controller.dart';
import 'package:simple_live_app/modules/user/follow_user/follow_user_page.dart';
import 'package:simple_live_app/modules/user/user_page.dart';
import 'package:simple_live_app/modules/follow_user/follow_user_controller.dart';
import 'package:simple_live_app/modules/follow_user/follow_user_page.dart';
import 'package:simple_live_app/modules/mine/mine_page.dart';

class IndexedController extends GetxController {
RxList<HomePageItem> items = RxList<HomePageItem>([]);
Expand Down Expand Up @@ -40,7 +40,7 @@ class IndexedController extends GetxController {
pages[i] = const CategoryPage();
break;
case 3:
pages[i] = const UserPage();
pages[i] = const MinePage();
break;
default:
}
Expand Down
Loading

0 comments on commit cbaaad8

Please sign in to comment.