Add appcast

This commit is contained in:
problematicconsumer
2023-11-06 22:00:44 +03:30
parent 5b262cbf00
commit e404732559
8 changed files with 129 additions and 32 deletions

33
appcast.xml Normal file
View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle">
<channel>
<title>Release</title>
<item>
<title>Version 0.10.0</title>
<pubDate>Sat, 28 Oct 2023 12:00:00 +0000</pubDate>
<enclosure url="https://play.google.com/store/apps/details?id=app.hiddify.com"
sparkle:version="0.10.0" sparkle:os="android" />
</item>
<item>
<title>Version 0.10.0</title>
<pubDate>Sat, 28 Oct 2023 12:00:00 +0000</pubDate>
<enclosure
url="https://github.com/hiddify/hiddify-next/releases/download/v0.10.0/hiddify-windows-x64-setup.zip"
sparkle:version="0.10.0" sparkle:os="windows" />
</item>
<item>
<title>Version 0.10.0</title>
<pubDate>Sat, 28 Oct 2023 12:00:00 +0000</pubDate>
<enclosure
url="https://github.com/hiddify/hiddify-next/releases/download/v0.10.0/hiddify-macos-universal.zip"
sparkle:version="0.10.0" sparkle:os="macos" />
</item>
<item>
<title>Version 0.10.0</title>
<pubDate>Sat, 28 Oct 2023 12:00:00 +0000</pubDate>
<enclosure
url="https://github.com/hiddify/hiddify-next/releases/download/v0.10.0/hiddify-linux-x64.zip"
sparkle:version="0.10.0" sparkle:os="linux" />
</item>
</channel>
</rss>

View File

@@ -5,9 +5,11 @@ import 'package:hiddify/core/core_providers.dart';
import 'package:hiddify/core/prefs/prefs.dart';
import 'package:hiddify/core/router/router.dart';
import 'package:hiddify/domain/constants.dart';
import 'package:hiddify/features/common/app_update_notifier.dart';
import 'package:hiddify/features/common/common_controllers.dart';
import 'package:hiddify/utils/utils.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:upgrader/upgrader.dart';
class AppView extends HookConsumerWidget with PresLogger {
const AppView({super.key});
@@ -20,6 +22,8 @@ class AppView extends HookConsumerWidget with PresLogger {
ref.watch(commonControllersProvider);
final upgrader = ref.watch(upgraderProvider);
return MaterialApp.router(
// builder: (context, child) {
// return AccessibilityTools(
@@ -37,13 +41,16 @@ class AppView extends HookConsumerWidget with PresLogger {
theme: theme.light(),
darkTheme: theme.dark(),
title: Constants.appName,
// https://github.com/ponnamkarthik/FlutterToast/issues/393
builder: (context, child) => Overlay(
initialEntries: [
if (child != null) ...[
OverlayEntry(
builder: (context) => child,
builder: (context) => UpgradeAlert(
upgrader: upgrader,
navigatorKey: router.routerDelegate.navigatorKey,
child: child,
),
),
],
],

View File

@@ -9,6 +9,8 @@ abstract class Constants {
"https://api.github.com/repos/hiddify/hiddify-next/releases";
static const githubLatestReleaseUrl =
"https://github.com/hiddify/hiddify-next/releases/latest";
static const appCastUrl =
"https://github.com/hiddify/hiddify-next/appcast.xml";
static const telegramChannelUrl = "https://t.me/hiddify";
static const privacyPolicyUrl = "https://hiddify.com/en/privacy-policy/";
static const termsAndConditionsUrl = "https://hiddify.com/terms/";

View File

@@ -1,18 +1,30 @@
import 'package:flutter/foundation.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:hiddify/core/core_providers.dart';
import 'package:hiddify/core/prefs/prefs.dart';
import 'package:hiddify/core/router/router.dart';
import 'package:hiddify/data/data_providers.dart';
import 'package:hiddify/domain/app/app.dart';
import 'package:hiddify/features/common/new_version_dialog.dart';
import 'package:hiddify/services/service_providers.dart';
import 'package:hiddify/domain/constants.dart';
import 'package:hiddify/utils/pref_notifier.dart';
import 'package:hiddify/utils/utils.dart';
import 'package:riverpod_annotation/riverpod_annotation.dart';
import 'package:upgrader/upgrader.dart';
part 'app_update_notifier.freezed.dart';
part 'app_update_notifier.g.dart';
const _debugUpgrader = true;
@riverpod
Upgrader upgrader(UpgraderRef ref) => Upgrader(
appcastConfig: AppcastConfiguration(url: Constants.appCastUrl),
debugLogging: _debugUpgrader && kDebugMode,
durationUntilAlertAgain: const Duration(hours: 12),
messages: UpgraderMessages(
code: ref.watch(localeNotifierProvider).languageCode,
),
);
@freezed
class AppUpdateState with _$AppUpdateState {
const factory AppUpdateState.initial() = AppUpdateStateInitial;
@@ -30,7 +42,7 @@ class AppUpdateState with _$AppUpdateState {
class AppUpdateNotifier extends _$AppUpdateNotifier with AppLogger {
@override
AppUpdateState build() {
_schedule();
// _schedule();
return const AppUpdateState.initial();
}
@@ -85,25 +97,25 @@ class AppUpdateNotifier extends _$AppUpdateNotifier with AppLogger {
state = AppUpdateStateIgnored(versionInfo);
}
Future<void> _schedule() async {
loggy.debug("scheduling app update checker");
return ref.read(cronServiceProvider).schedule(
key: 'app_update',
duration: const Duration(hours: 8),
callback: () async {
await Future.delayed(const Duration(seconds: 5));
final updateState = await check();
final context = rootNavigatorKey.currentContext;
if (context != null && context.mounted) {
if (updateState
case AppUpdateStateAvailable(:final versionInfo)) {
await NewVersionDialog(
ref.read(appInfoProvider).presentVersion,
versionInfo,
).show(context);
}
}
},
);
}
// Future<void> _schedule() async {
// loggy.debug("scheduling app update checker");
// return ref.read(cronServiceProvider).schedule(
// key: 'app_update',
// duration: const Duration(hours: 8),
// callback: () async {
// await Future.delayed(const Duration(seconds: 5));
// final updateState = await check();
// final context = rootNavigatorKey.currentContext;
// if (context != null && context.mounted) {
// if (updateState
// case AppUpdateStateAvailable(:final versionInfo)) {
// await NewVersionDialog(
// ref.read(appInfoProvider).presentVersion,
// versionInfo,
// ).show(context);
// }
// }
// },
// );
// }
}

View File

@@ -28,11 +28,11 @@ void commonControllers(CommonControllersRef ref) {
(previous, next) {},
fireImmediately: true,
);
ref.listen(
appUpdateNotifierProvider,
(previous, next) {},
fireImmediately: true,
);
// ref.listen(
// appUpdateNotifierProvider,
// (previous, next) {},
// fireImmediately: true,
// );
ref.listen(
profilesUpdateNotifierProvider,
(previous, next) {},

View File

@@ -5,6 +5,7 @@
import FlutterMacOS
import Foundation
import device_info_plus
import mobile_scanner
import package_info_plus
import path_provider_foundation
@@ -19,6 +20,7 @@ import url_launcher_macos
import window_manager
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))

View File

@@ -313,6 +313,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.3.3"
device_info_plus:
dependency: transitive
description:
name: device_info_plus
sha256: "7035152271ff67b072a211152846e9f1259cf1be41e34cd3e0b5463d2d6b8419"
url: "https://pub.dev"
source: hosted
version: "9.1.0"
device_info_plus_platform_interface:
dependency: transitive
description:
name: device_info_plus_platform_interface
sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64
url: "https://pub.dev"
source: hosted
version: "7.0.0"
dio:
dependency: "direct main"
description:
@@ -797,6 +813,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.1"
os_detect:
dependency: transitive
description:
name: os_detect
sha256: faf3bcf39515e64da8ff76b2f2805b20a6ff47ae515393e535f8579ff91d6b7f
url: "https://pub.dev"
source: hosted
version: "2.0.1"
package_config:
dependency: transitive
description:
@@ -1394,6 +1418,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.2"
upgrader:
dependency: "direct main"
description:
name: upgrader
sha256: "889c1ece7af143df32e8ee2126f2ef17b2ab6bb7ed8fc3b1b022d7faa4fdab20"
url: "https://pub.dev"
source: hosted
version: "8.2.0"
url_launcher:
dependency: "direct main"
description:
@@ -1506,6 +1538,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
version:
dependency: transitive
description:
name: version
sha256: "3d4140128e6ea10d83da32fef2fa4003fccbf6852217bb854845802f04191f94"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
vm_service:
dependency: transitive
description:

View File

@@ -66,6 +66,7 @@ dependencies:
sliver_tools: ^0.2.12
flutter_adaptive_scaffold: ^0.1.7+1
humanizer: ^2.2.0
upgrader: ^8.2.0
dev_dependencies:
flutter_test: