update flutter and make connection more smooth
This commit is contained in:
2
Makefile
2
Makefile
@@ -58,7 +58,7 @@ prepare:
|
||||
@echo make macos-prepare
|
||||
@echo make ios-prepare
|
||||
|
||||
windows-prepare: get-geo-assets get gen translate windows-libs
|
||||
windows-prepare: get gen translate windows-libs
|
||||
|
||||
ios-prepare: get-geo-assets get gen translate ios-libs
|
||||
macos-prepare: get-geo-assets get gen translate macos-libs
|
||||
|
||||
@@ -22,13 +22,13 @@ enum NotificationType {
|
||||
}
|
||||
|
||||
class InAppNotificationController with AppLogger {
|
||||
void showToast(
|
||||
ToastificationItem showToast(
|
||||
BuildContext context,
|
||||
String message, {
|
||||
NotificationType type = NotificationType.info,
|
||||
Duration duration = const Duration(seconds: 3),
|
||||
}) {
|
||||
toastification.show(
|
||||
return toastification.show(
|
||||
context: context,
|
||||
title: Text(message),
|
||||
type: type._toastificationType,
|
||||
@@ -43,13 +43,13 @@ class InAppNotificationController with AppLogger {
|
||||
);
|
||||
}
|
||||
|
||||
void showErrorToast(String message) {
|
||||
ToastificationItem? showErrorToast(String message) {
|
||||
final context = RootScaffold.stateKey.currentContext;
|
||||
if (context == null) {
|
||||
loggy.warning("context is null");
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
showToast(
|
||||
return showToast(
|
||||
context,
|
||||
message,
|
||||
type: NotificationType.error,
|
||||
@@ -57,26 +57,26 @@ class InAppNotificationController with AppLogger {
|
||||
);
|
||||
}
|
||||
|
||||
void showSuccessToast(String message) {
|
||||
ToastificationItem? showSuccessToast(String message) {
|
||||
final context = RootScaffold.stateKey.currentContext;
|
||||
if (context == null) {
|
||||
loggy.warning("context is null");
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
showToast(
|
||||
return showToast(
|
||||
context,
|
||||
message,
|
||||
type: NotificationType.success,
|
||||
);
|
||||
}
|
||||
|
||||
void showInfoToast(String message) {
|
||||
ToastificationItem? showInfoToast(String message, {Duration duration = const Duration(seconds: 3)}) {
|
||||
final context = RootScaffold.stateKey.currentContext;
|
||||
if (context == null) {
|
||||
loggy.warning("context is null");
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
showToast(context, message);
|
||||
return showToast(context, message, duration: duration);
|
||||
}
|
||||
|
||||
Future<void> showErrorDialog(PresentableError error) async {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:combine/combine.dart';
|
||||
import 'package:fluentui_system_icons/fluentui_system_icons.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -161,9 +162,7 @@ class AddProfileModal extends HookConsumerWidget {
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: InkWell(
|
||||
onTap: () async {
|
||||
Future.microtask(() async {
|
||||
addProfileModal(context, ref);
|
||||
});
|
||||
await addProfileModal(context, ref);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -239,41 +238,44 @@ class AddProfileModal extends HookConsumerWidget {
|
||||
);
|
||||
}
|
||||
|
||||
void addProfileModal(BuildContext context, WidgetRef ref) async {
|
||||
Future<void> addProfileModal(BuildContext context, WidgetRef ref) async {
|
||||
final _prefs = ref.read(sharedPreferencesProvider).requireValue;
|
||||
final _warp = ref.read(warpOptionNotifierProvider.notifier);
|
||||
final _profile = ref.read(addProfileProvider.notifier);
|
||||
final consent = _prefs.getBool(warpConsentGiven) ?? false;
|
||||
final consent = false && (_prefs.getBool(warpConsentGiven) ?? false);
|
||||
context.pop();
|
||||
Future.microtask(() async {
|
||||
final t = ref.read(translationsProvider);
|
||||
final notification = ref.read(inAppNotificationControllerProvider);
|
||||
|
||||
if (!consent) {
|
||||
final agreed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => const WarpLicenseAgreementModal(),
|
||||
);
|
||||
final t = ref.read(translationsProvider);
|
||||
final notification = ref.read(inAppNotificationControllerProvider);
|
||||
|
||||
if (agreed ?? false) {
|
||||
await _prefs.setBool(warpConsentGiven, true);
|
||||
notification.showInfoToast(t.profile.add.addingWarpMsg);
|
||||
await _warp.generateWarpConfig();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if (!consent) {
|
||||
final agreed = await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) => const WarpLicenseAgreementModal(),
|
||||
);
|
||||
|
||||
if (agreed ?? false) {
|
||||
await _prefs.setBool(warpConsentGiven, true);
|
||||
final toast = notification.showInfoToast(t.profile.add.addingWarpMsg, duration: const Duration(milliseconds: 100));
|
||||
toast?.pause();
|
||||
await _warp.generateWarpConfig();
|
||||
toast?.start();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final accountId = _prefs.getString("warp2-account-id");
|
||||
final accessToken = _prefs.getString("warp2-access-token");
|
||||
final hasWarp2Config = accountId != null && accessToken != null;
|
||||
final accountId = _prefs.getString("warp2-account-id");
|
||||
final accessToken = _prefs.getString("warp2-access-token");
|
||||
final hasWarp2Config = accountId != null && accessToken != null;
|
||||
|
||||
if (!hasWarp2Config) {
|
||||
notification.showInfoToast(t.profile.add.addingWarpMsg);
|
||||
await _warp.generateWarp2Config();
|
||||
}
|
||||
await _profile.add("#profile-title: Hiddify WARP\nwarp://p1@auto#National&&detour=warp://p2@auto#WoW"); //
|
||||
});
|
||||
if (!hasWarp2Config || true) {
|
||||
final toast = notification.showInfoToast(t.profile.add.addingWarpMsg, duration: const Duration(milliseconds: 100));
|
||||
toast?.pause();
|
||||
await _warp.generateWarp2Config();
|
||||
toast?.start();
|
||||
}
|
||||
await _profile.add("#profile-title: Hiddify WARP\nwarp://p1@auto#National&&detour=warp://p2@auto#WoW"); //
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'dart:convert';
|
||||
import 'dart:ffi';
|
||||
import 'dart:io';
|
||||
import 'dart:isolate';
|
||||
|
||||
import 'package:combine/combine.dart';
|
||||
import 'package:ffi/ffi.dart';
|
||||
import 'package:fpdart/fpdart.dart';
|
||||
import 'package:hiddify/core/model/directories.dart';
|
||||
@@ -65,8 +65,8 @@ class FFISingboxService with InfraLogger implements SingboxService {
|
||||
) {
|
||||
final port = _statusReceiver.sendPort.nativePort;
|
||||
return TaskEither(
|
||||
() => Future.microtask(
|
||||
() async {
|
||||
() => CombineWorker().execute(
|
||||
() {
|
||||
_box.setupOnce(NativeApi.initializeApiDLData);
|
||||
final err = _box
|
||||
.setup(
|
||||
@@ -94,8 +94,8 @@ class FFISingboxService with InfraLogger implements SingboxService {
|
||||
bool debug,
|
||||
) {
|
||||
return TaskEither(
|
||||
() => Future.microtask(
|
||||
() async {
|
||||
() => CombineWorker().execute(
|
||||
() {
|
||||
final err = _box
|
||||
.parse(
|
||||
path.toNativeUtf8().cast(),
|
||||
@@ -116,8 +116,8 @@ class FFISingboxService with InfraLogger implements SingboxService {
|
||||
@override
|
||||
TaskEither<String, Unit> changeOptions(SingboxConfigOption options) {
|
||||
return TaskEither(
|
||||
() => Future.microtask(
|
||||
() async {
|
||||
() => CombineWorker().execute(
|
||||
() {
|
||||
final json = jsonEncode(options.toJson());
|
||||
final err = _box.changeConfigOptions(json.toNativeUtf8().cast()).cast<Utf8>().toDartString();
|
||||
if (err.isNotEmpty) {
|
||||
@@ -134,8 +134,8 @@ class FFISingboxService with InfraLogger implements SingboxService {
|
||||
String path,
|
||||
) {
|
||||
return TaskEither(
|
||||
() => Future.microtask(
|
||||
() async {
|
||||
() => CombineWorker().execute(
|
||||
() {
|
||||
final response = _box
|
||||
.generateConfig(
|
||||
path.toNativeUtf8().cast(),
|
||||
@@ -159,8 +159,8 @@ class FFISingboxService with InfraLogger implements SingboxService {
|
||||
) {
|
||||
loggy.debug("starting, memory limit: [${!disableMemoryLimit}]");
|
||||
return TaskEither(
|
||||
() => Future.microtask(
|
||||
() async {
|
||||
() => CombineWorker().execute(
|
||||
() {
|
||||
final err = _box
|
||||
.start(
|
||||
configPath.toNativeUtf8().cast(),
|
||||
@@ -180,8 +180,8 @@ class FFISingboxService with InfraLogger implements SingboxService {
|
||||
@override
|
||||
TaskEither<String, Unit> stop() {
|
||||
return TaskEither(
|
||||
() => Future.microtask(
|
||||
() async {
|
||||
() => CombineWorker().execute(
|
||||
() {
|
||||
final err = _box.stop().cast<Utf8>().toDartString();
|
||||
if (err.isNotEmpty) {
|
||||
return left(err);
|
||||
@@ -200,8 +200,8 @@ class FFISingboxService with InfraLogger implements SingboxService {
|
||||
) {
|
||||
loggy.debug("restarting, memory limit: [${!disableMemoryLimit}]");
|
||||
return TaskEither(
|
||||
() => Future.microtask(
|
||||
() async {
|
||||
() => CombineWorker().execute(
|
||||
() {
|
||||
final err = _box
|
||||
.restart(
|
||||
configPath.toNativeUtf8().cast(),
|
||||
@@ -360,8 +360,8 @@ class FFISingboxService with InfraLogger implements SingboxService {
|
||||
@override
|
||||
TaskEither<String, Unit> selectOutbound(String groupTag, String outboundTag) {
|
||||
return TaskEither(
|
||||
() => Future.microtask(
|
||||
() async {
|
||||
() => CombineWorker().execute(
|
||||
() {
|
||||
final err = _box
|
||||
.selectOutbound(
|
||||
groupTag.toNativeUtf8().cast(),
|
||||
@@ -381,8 +381,8 @@ class FFISingboxService with InfraLogger implements SingboxService {
|
||||
@override
|
||||
TaskEither<String, Unit> urlTest(String groupTag) {
|
||||
return TaskEither(
|
||||
() => Future.microtask(
|
||||
() async {
|
||||
() => CombineWorker().execute(
|
||||
() {
|
||||
final err = _box.urlTest(groupTag.toNativeUtf8().cast()).cast<Utf8>().toDartString();
|
||||
if (err.isNotEmpty) {
|
||||
return left(err);
|
||||
@@ -410,8 +410,8 @@ class FFISingboxService with InfraLogger implements SingboxService {
|
||||
@override
|
||||
TaskEither<String, Unit> clearLogs() {
|
||||
return TaskEither(
|
||||
() => Future.microtask(
|
||||
() async {
|
||||
() => CombineWorker().execute(
|
||||
() {
|
||||
_logBuffer.clear();
|
||||
return right(unit);
|
||||
},
|
||||
@@ -444,8 +444,8 @@ class FFISingboxService with InfraLogger implements SingboxService {
|
||||
}) {
|
||||
loggy.debug("generating warp config");
|
||||
return TaskEither(
|
||||
() => Future.microtask(
|
||||
() async {
|
||||
() => CombineWorker().execute(
|
||||
() {
|
||||
final response = _box
|
||||
.generateWarpConfig(
|
||||
licenseKey.toNativeUtf8().cast(),
|
||||
|
||||
57
pubspec.lock
57
pubspec.lock
@@ -218,6 +218,14 @@ packages:
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
combine:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: combine
|
||||
sha256: c16464b55d140871fbab5b37909e1808c2f020e46f9ba7deca59d40faabb6008
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.7"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -793,11 +801,12 @@ packages:
|
||||
humanizer:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: humanizer
|
||||
sha256: "08728a4b6d62accd7d09e668bd54e81e6e09a82c8cfda30553224b3eb868d4f2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
path: "."
|
||||
ref: up-version
|
||||
resolved-ref: "8ae61d68357fae197be7ee71d67ccb9498b9d5c7"
|
||||
url: "https://github.com/alex-relov/humanizer"
|
||||
source: git
|
||||
version: "2.3.0"
|
||||
iconsax_flutter:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -842,10 +851,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: intl
|
||||
sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d"
|
||||
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.18.1"
|
||||
version: "0.19.0"
|
||||
io:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -914,26 +923,26 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker
|
||||
sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa"
|
||||
sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "10.0.0"
|
||||
version: "10.0.4"
|
||||
leak_tracker_flutter_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_flutter_testing
|
||||
sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0
|
||||
sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
version: "3.0.3"
|
||||
leak_tracker_testing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: leak_tracker_testing
|
||||
sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47
|
||||
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.1"
|
||||
version: "3.0.1"
|
||||
lint:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
@@ -994,10 +1003,10 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: meta
|
||||
sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04
|
||||
sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.11.0"
|
||||
version: "1.12.0"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1695,26 +1704,26 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test
|
||||
sha256: a1f7595805820fcc05e5c52e3a231aedd0b72972cb333e8c738a8b1239448b6f
|
||||
sha256: "7ee446762c2c50b3bd4ea96fe13ffac69919352bd3b4b17bac3f3465edc58073"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.24.9"
|
||||
version: "1.25.2"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b"
|
||||
sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.6.1"
|
||||
version: "0.7.0"
|
||||
test_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_core
|
||||
sha256: a757b14fc47507060a162cc2530d9a4a2f92f5100a952c7443b5cad5ef5b106a
|
||||
sha256: "2bc4b4ecddd75309300d8096f781c0e3280ca1ef85beda558d33fcbedc2eead4"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.5.9"
|
||||
version: "0.6.0"
|
||||
time:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1927,10 +1936,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957
|
||||
sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "13.0.0"
|
||||
version: "14.2.1"
|
||||
watcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -2029,4 +2038,4 @@ packages:
|
||||
version: "2.1.1"
|
||||
sdks:
|
||||
dart: ">=3.3.0 <4.0.0"
|
||||
flutter: ">=3.19.0"
|
||||
flutter: ">=3.22.2"
|
||||
|
||||
16
pubspec.yaml
16
pubspec.yaml
@@ -5,7 +5,7 @@ version: 1.6.0+10600
|
||||
|
||||
environment:
|
||||
sdk: ">=3.3.0 <4.0.0"
|
||||
flutter: ">=3.19.0 <3.22.0"
|
||||
flutter: ">=3.19.0 <3.22.3"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
@@ -13,13 +13,13 @@ dependencies:
|
||||
flutter_localizations:
|
||||
sdk: flutter
|
||||
cupertino_icons: ^1.0.6
|
||||
intl: ^0.18.1
|
||||
humanizer: ^2.2.0
|
||||
intl: ^0.19.0
|
||||
# humanizer: ^2.2.0
|
||||
# intl: ^0.19.0
|
||||
# humanizer:
|
||||
# git:
|
||||
# url: https://github.com/alex-relov/humanizer
|
||||
# ref: up-version
|
||||
humanizer:
|
||||
git:
|
||||
url: https://github.com/alex-relov/humanizer
|
||||
ref: up-version
|
||||
slang: ^3.30.1
|
||||
slang_flutter: ^3.30.0
|
||||
fpdart: ^1.1.0
|
||||
@@ -47,7 +47,7 @@ dependencies:
|
||||
launch_at_startup: ^0.2.2
|
||||
sentry_flutter: ^7.16.1
|
||||
sentry_dart_plugin: ^1.7.1
|
||||
|
||||
combine: ^0.5.7
|
||||
path: ^1.8.3
|
||||
loggy: ^2.0.3
|
||||
flutter_loggy: ^2.0.2
|
||||
|
||||
Reference in New Issue
Block a user