Skip to content
This repository has been archived by the owner on Dec 31, 2024. It is now read-only.

Commit

Permalink
🔖 0.3.7+1
Browse files Browse the repository at this point in the history
  • Loading branch information
uiYzzi committed Mar 10, 2024
1 parent f66ba7d commit e24cc32
Show file tree
Hide file tree
Showing 18 changed files with 150 additions and 10 deletions.
62 changes: 54 additions & 8 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,52 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

def keystoreProperties = new Properties()
def keystorePropertiesFile = rootProject.file('key.properties')
if (keystorePropertiesFile.exists()) {
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
}

android {
namespace "com.yoyo.yolx"
compileSdkVersion flutter.compileSdkVersion
flavorDimensions "abi"
ndkVersion flutter.ndkVersion

productFlavors {
dev {
dimension "abi"
ndk { abiFilter "arm64-v8a" }
resValue "string", "app_name", "Alga Dev"
}
arm {
dimension "abi"
ndk { abiFilter "armeabi-v7a" }
resValue "string", "app_name", "Alga"
}
arm64 {
dimension "abi"
ndk { abiFilter "arm64-v8a" }
resValue "string", "app_name", "Alga"
}
x86_64 {
dimension "abi"
applicationId "tech.laihz.alga"
ndk { abiFilter "x86_64" }
resValue "string", "app_name", "Alga"
}
universal {
dimension "abi"
applicationId "tech.laihz.alga"
resValue "string", "app_name", "Alga"
}
aab {
dimension "abi"
applicationId "tech.laihz.alga"
resValue "string", "app_name", "Alga"
}
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -61,16 +102,21 @@ android {
ndk {}
}

signingConfigs {
release {
keyAlias keystoreProperties['keyAlias']
keyPassword keystoreProperties['keyPassword']
storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
storePassword keystoreProperties['storePassword']
}
}

buildTypes {
debug {
ndk {
// abiFilters "x86"
}
}
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#Flutter Wrapper
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }
-keep class de.prosiebensat1digital.** { *; }
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions distribute_options.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,48 @@
output: dist/
artifact_name: "{{name}}-{{platform}}{{#flavor}}-{{flavor}}{{/flavor}}{{#channel}}-{{channel}}{{/channel}}-{{version}}{{#is_installer}}-setup{{/is_installer}}.{{ext}}"
releases:
- name: android
jobs:
- name: arm
package:
platform: android
target: apk
build_args:
flavor: arm
obfuscate:
split-debug-info: symbols
- name: arm64
package:
platform: android
target: apk
build_args:
flavor: arm64
obfuscate:
split-debug-info: symbols
- name: x86_64
package:
platform: android
target: apk
build_args:
flavor: x86_64
obfuscate:
split-debug-info: symbols
- name: universal
package:
platform: android
target: apk
build_args:
flavor: universal
obfuscate:
split-debug-info: symbols
- name: aab
package:
platform: android
target: aab
build_args:
flavor: aab
obfuscate:
split-debug-info: symbols
- name: windows
jobs:
- name: exe
Expand Down
8 changes: 7 additions & 1 deletion lib/common/global.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'dart:io';

import 'package:device_info_plus/device_info_plus.dart';
import 'package:fluent_ui/fluent_ui.dart';
import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
Expand Down Expand Up @@ -60,7 +61,12 @@ class Global {
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36';
proxy = prefs.getString('Proxy') ?? '';
bypassProxy = prefs.getString('BypassProxy') ?? '';
Directory? dir = await getDownloadsDirectory();
Directory? dir;
if (Platform.isAndroid) {
dir = Directory('/storage/emulated/0/Download');
} else {
dir = await getDownloadsDirectory();
}
downloadPath = (prefs.getString('DownloadPath') ?? dir?.path)!;
rememberWindowSize = prefs.getBool('RememberWindowSize') ?? true;
isAutoUpdateTrackerList = prefs.getBool('IsAutoUpdateTrackerList') ?? true;
Expand Down
9 changes: 9 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:io';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:tray_manager/tray_manager.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_single_instance/flutter_single_instance.dart';
Expand All @@ -20,6 +21,7 @@ import 'package:window_manager/window_manager.dart';
import 'package:yolx/utils/aria2_manager.dart';
import 'package:yolx/utils/common_utils.dart';
import 'package:yolx/utils/log.dart';
import 'package:yolx/utils/permission_util.dart';

import 'theme.dart';

Expand Down Expand Up @@ -74,6 +76,13 @@ void main() async {
);
await trayManager.setContextMenu(menu);
}
if (Platform.isAndroid) {
bool isGranted = await checkStoragePermission();
if (!isGranted) {
EasyLoading.showToast('没有存储权限');
return;
}
}
await Aria2Manager().initAria2Conf();
Aria2Manager().startServer();

Expand Down
22 changes: 22 additions & 0 deletions lib/utils/permission_util.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import 'package:device_info_plus/device_info_plus.dart';
import 'package:permission_handler/permission_handler.dart';

import 'native_channel_utils.dart';

Future<bool> checkStoragePermission() async {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
if (androidInfo.version.sdkInt >= 30) {
bool isGranted = await requestPermission();
return isGranted;
} else {
PermissionStatus storageStatus = await Permission.storage.status;
if (storageStatus.isDenied) {
return true;
}
if ((await Permission.storage.request()).isGranted) {
return true;
}
}
return false;
}
5 changes: 4 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: An aria2 client

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 0.3.6+1
version: 0.3.7+1

environment:
sdk: '>=2.17.0 <3.0.0'
Expand Down Expand Up @@ -31,6 +31,9 @@ dependencies:
desktop_drop: ^0.4.4
dotted_decoration: ^2.0.0
flutter_svg: ^2.0.10+1
device_info_plus: ^9.1.2
permission_handler: ^11.3.0
flutter_easyloading: ^3.0.5

dev_dependencies:
flutter_test:
Expand Down
Binary file added symbols/app.android-arm.symbols
Binary file not shown.
Binary file added symbols/app.android-arm64.symbols
Binary file not shown.
Binary file added symbols/app.android-x64.symbols
Binary file not shown.
3 changes: 3 additions & 0 deletions windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <desktop_drop/desktop_drop_plugin.h>
#include <file_selector_windows/file_selector_windows.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <system_theme/system_theme_plugin.h>
#include <tray_manager/tray_manager_plugin.h>
Expand All @@ -19,6 +20,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("DesktopDropPlugin"));
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
ScreenRetrieverPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenRetrieverPlugin"));
SystemThemePluginRegisterWithRegistrar(
Expand Down
1 change: 1 addition & 0 deletions windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
desktop_drop
file_selector_windows
permission_handler_windows
screen_retriever
system_theme
tray_manager
Expand Down

0 comments on commit e24cc32

Please sign in to comment.