Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
mylxsw committed Jan 26, 2024
2 parents 6384293 + 2b2fbe1 commit cfab714
Show file tree
Hide file tree
Showing 37 changed files with 1,369 additions and 458 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/build_windows_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ jobs:
flutter-version: "3.13.2" # Set flutter version here

- name: Build Windows app
run: flutter build windows --release
#run: flutter build windows --release
run: dart run msix:create --release -v --output-path build/windows/runner --output-name AIdea

- name: Copy dependencies
run: copy .\windows\sqlite3.dll .\build\windows\runner\Release\
# - name: Copy dependencies
# run: copy .\windows\sqlite3.dll .\build\windows\runner\Release\

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: aidea
path: build/windows/runner/Release
path: build/windows/runner/AIdea.msix
21 changes: 18 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@ build-all: build-android ipa
build-android:
flutter build apk --release --no-tree-shake-icons
# open build/app/outputs/flutter-apk
mv build/app/outputs/flutter-apk/app-release.apk /Users/mylxsw/ResilioSync/ResilioSync/临时文件/
mv build/app/outputs/flutter-apk/app-release.apk /Users/mylxsw/ResilioSync/ResilioSync/临时文件/aidea-release.apk

build-macos:
flutter build macos --no-tree-shake-icons --release
codesign -f -s "Developer ID Application: YIYAO GUAN (N95437SZ2A)" build/macos/Build/Products/Release/AIdea.app
open build/macos/Build/Products/Release/

build-appimage:
flutter build linux --no-tree-shake-icons --release
Expand All @@ -27,6 +26,22 @@ build-appimage:
cp askaide.desktop aidea_app.AppDir/
appimagetool aidea_app.AppDir/

build-dmg: build-macos
rm -fr build/macos/Build/Products/Package
mkdir -p build/macos/Build/Products/Package && cp -r build/macos/Build/Products/Release/AIdea.app build/macos/Build/Products/Package
create-dmg --volname "AIdea Installer" \
--volicon "install.icns" \
--background "assets/background-discovery.png" \
--window-pos 200 120 \
--window-size 600 320 \
--icon-size 100 \
--icon "AIdea.app" 170 130 \
--hide-extension "AIdea.app" \
--app-drop-link 430 130 \
"build/macos/Build/Products/Package/AIdea-Installer.dmg" \
"build/macos/Build/Products/Package"
open build/macos/Build/Products/Package/

build-web:
flutter build web --web-renderer canvaskit --release --dart-define=FLUTTER_WEB_CANVASKIT_URL=https://resources.aicode.cc/canvaskit/
cd scripts && go run main.go ../build/web/main.dart.js && cd ..
Expand All @@ -45,4 +60,4 @@ deploy-web: build-web
ssh huawei-1 "cd /data/webroot && tar -zxvf web.tar.gz && rm -rf web.tar.gz app && mv web app"
rm -fr build/web.tar.gz

.PHONY: run build-android build-macos ipa build-web-samehost build-web deploy-web
.PHONY: run build-android build-macos ipa build-web-samehost build-web deploy-web build-dmg
1 change: 1 addition & 0 deletions build-win.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dart run msix:create --release -v --output-path build/windows/runner --output-name AIdea
Binary file added install.icns
Binary file not shown.
21 changes: 11 additions & 10 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ PODS:
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- record (0.0.1):
- record_darwin (1.0.0):
- Flutter
- FlutterMacOS
- screen_brightness_ios (0.1.0):
- Flutter
- SDWebImage (5.15.5):
Expand Down Expand Up @@ -134,7 +135,7 @@ DEPENDENCIES:
- media_kit_video (from `.symlinks/plugins/media_kit_video/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- record (from `.symlinks/plugins/record/ios`)
- record_darwin (from `.symlinks/plugins/record_darwin/ios`)
- screen_brightness_ios (from `.symlinks/plugins/screen_brightness_ios/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
Expand Down Expand Up @@ -192,8 +193,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
record:
:path: ".symlinks/plugins/record/ios"
record_darwin:
:path: ".symlinks/plugins/record_darwin/ios"
screen_brightness_ios:
:path: ".symlinks/plugins/screen_brightness_ios/ios"
share_plus:
Expand Down Expand Up @@ -228,25 +229,25 @@ SPEC CHECKSUMS:
fluwx: e9e728cfdb80e82dac5f4ff974b1901a7939dcd0
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
image_gallery_saver: 259eab68fb271cfd57d599904f7acdc7832e7ef2
in_app_purchase_storekit: 4fb7ee9e824b1f09107fbfbbce8c4b276366dc43
in_app_purchase_storekit: 9e9931234f0adcf71ae323f8c83785b96030edf1
libwebp: f62cb61d0a484ba548448a4bd52aabf150ff6eef
Mantle: c5aa8794a29a022dfbbfc9799af95f477a69b62d
media_kit_libs_ios_video: a5fe24bc7875ccd6378a0978c13185e1344651c1
media_kit_native_event_loop: e6b2ab20cf0746eb1c33be961fcf79667304fa2a
media_kit_video: 5da63f157170e5bf303bf85453b7ef6971218a2e
package_info_plus: 115f4ad11e0698c8c1c5d8a689390df880f47e85
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
record: cae05d8dd3cdb1dea3511b20e5a5811a1ae00d0d
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
record_darwin: 1f6619f2abac4d1ca91d3eeab038c980d76f1517
screen_brightness_ios: 715ca807df953bf676d339f11464e438143ee625
SDWebImage: fd7e1a22f00303e058058278639bf6196ee431fe
SDWebImageWebPCoder: 295a6573c512f54ad2dd58098e64e17dcf008499
share_plus: c3fef564749587fc939ef86ffb283ceac0baf9f5
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
sqflite: 50a33e1d72bd59ee092a519a35d107502757ebed
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
tobias: 2aded9b83e3663b907360a800d8e3c13284f25c5
url_launcher_ios: 08a3dfac5fb39e8759aeb0abbd5d9480f30fc8b4
url_launcher_ios: bbd758c6e7f9fd7b5b1d4cde34d2b95fcce5e812
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
WechatOpenSDK-XCFramework: acdeeda129efbef9532bca8a10c24e1b4b8c7d69
Expand Down
6 changes: 0 additions & 6 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,6 @@
"-framework",
"\"path_provider_foundation\"",
"-framework",
"\"record\"",
"-framework",
"\"share_plus\"",
"-framework",
"\"shared_preferences_foundation\"",
Expand Down Expand Up @@ -701,8 +699,6 @@
"-framework",
"\"path_provider_foundation\"",
"-framework",
"\"record\"",
"-framework",
"\"share_plus\"",
"-framework",
"\"shared_preferences_foundation\"",
Expand Down Expand Up @@ -824,8 +820,6 @@
"-framework",
"\"path_provider_foundation\"",
"-framework",
"\"record\"",
"-framework",
"\"share_plus\"",
"-framework",
"\"shared_preferences_foundation\"",
Expand Down
2 changes: 2 additions & 0 deletions lib/bloc/bloc_manager.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// ignore_for_file: must_call_super

import 'package:askaide/bloc/chat_message_bloc.dart';
import 'package:askaide/helper/lru.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down
4 changes: 3 additions & 1 deletion lib/helper/constant.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';

// 客户端应用版本号
const clientVersion = '1.0.11';
const clientVersion = '1.0.12';
// 本地数据库版本号
const databaseVersion = 26;

Expand All @@ -12,6 +12,8 @@ const settingAPIServerToken = 'api-token';
const settingUserInfo = 'user-info';
const settingUsingGuestMode = 'using-guest-mode';

const settingForceShowLab = 'force-show-lab';

const chatAnywhereModel = 'openai:gpt-3.5-turbo';
const chatAnywhereRoomId = 1;

Expand Down
15 changes: 0 additions & 15 deletions lib/helper/env.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import 'dart:io' show Platform;

import 'package:askaide/helper/platform.dart';

/// 默认 API 服务器地址
/// 注意:当你使用自己的服务器时,请修改该地址为你自己的服务器地址
const defaultAPIServerURL = 'https://ai-api.aicode.cc';
Expand All @@ -20,14 +16,3 @@ String get apiServerURL {

return url;
}

String get getHomePath {
Map<String, String> envVars = Platform.environment;
if (PlatformTool.isMacOS() || PlatformTool.isLinux()) {
return '${envVars['HOME'] ?? ''}/.aidea';
} else if (PlatformTool.isWindows()) {
return '${envVars['UserProfile'] ?? ''}/.aidea';
}

return '.aidea';
}
4 changes: 2 additions & 2 deletions lib/helper/logger.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:io';

import 'package:askaide/helper/env.dart';
import 'package:askaide/helper/path.dart';
import 'package:askaide/helper/platform.dart';
import 'package:logger/logger.dart' as logger;

Expand All @@ -17,7 +17,7 @@ class Logger {
logger.ConsoleOutput(),
if (!PlatformTool.isWeb())
logger.FileOutput(
file: File('$getHomePath/aidea.log'),
file: File(PathHelper().getLogfilePath),
overrideExisting: true,
),
],
Expand Down
79 changes: 79 additions & 0 deletions lib/helper/path.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import 'dart:io' show Directory, Platform;
import 'package:askaide/helper/platform.dart';
import 'package:path_provider/path_provider.dart';

class PathHelper {
late final String cachePath;
late final String documentsPath;
late final String supportPath;

init() async {
try {
cachePath =
(await getApplicationCacheDirectory()).path.replaceAll('\\', '/');
} catch (e) {
cachePath = '';
}

try {
documentsPath =
(await getApplicationDocumentsDirectory()).path.replaceAll('\\', '/');
} catch (e) {
documentsPath = '';
}

try {
supportPath =
(await getApplicationSupportDirectory()).path.replaceAll('\\', '/');
} catch (e) {
supportPath = '';
}

// 确保 .aidea 目录存在
try {
Directory(getHomePath).create(recursive: true);
} catch (e) {
print('创建 $getHomePath 目录失败: $e');
}
}

String get getHomePath {
Map<String, String> envVars = Platform.environment;
if (PlatformTool.isMacOS() || PlatformTool.isLinux()) {
return '${envVars['HOME'] ?? ''}/.aidea'.replaceAll('\\', '/');
} else if (PlatformTool.isWindows()) {
return '${envVars['UserProfile'] ?? ''}/.aidea'.replaceAll('\\', '/');
} else if (PlatformTool.isAndroid() || PlatformTool.isIOS()) {
return '$documentsPath/.aidea'.replaceAll('\\', '/');
}

return '.aidea';
}

String get getLogfilePath {
return '$getHomePath/aidea.log';
}

String get getCachePath {
return getHomePath;
}

/// 单例
static final PathHelper _instance = PathHelper._internal();
PathHelper._internal();

factory PathHelper() {
return _instance;
}

Map<String, String> toMap() {
return {
'cachePath': cachePath,
'cachePathReal': getCachePath,
'documentsPath': documentsPath,
'supportPath': supportPath,
'homePath': getHomePath,
'logfilePath': getLogfilePath,
};
}
}
2 changes: 1 addition & 1 deletion lib/lang/lang.dart
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ mixin AppLocale {
keywordsSeparatedByCommas: '你想象画面的关键词,以逗号隔开。',
originalImage: '原始图片',
superResolution: '高清修复',
colorizeImage: '图片上色',
colorizeImage: '旧照片上色',
errorLog: '故障诊断',
report: '上报',
latestVersion: '当前已是最新版本',
Expand Down
33 changes: 28 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'package:askaide/helper/path.dart';
import 'package:askaide/page/creative_island/draw/artistic_wordart.dart';
import 'package:path/path.dart';

import 'package:askaide/bloc/account_bloc.dart';
Expand All @@ -19,7 +21,7 @@ import 'package:askaide/helper/platform.dart';
import 'package:askaide/lang/lang.dart';
import 'package:askaide/data/migrate.dart';
import 'package:askaide/page/balance/quota_usage_details.dart';
import 'package:askaide/page/creative_island/draw/artistic_text.dart';
import 'package:askaide/page/creative_island/draw/artistic_qr.dart';
import 'package:askaide/page/setting/account_security.dart';
import 'package:askaide/page/app_scaffold.dart';
import 'package:askaide/page/lab/avatar_selector.dart';
Expand Down Expand Up @@ -104,13 +106,14 @@ import 'package:askaide/helper/http.dart' as httpx;
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:media_kit/media_kit.dart';

import 'package:askaide/helper/env.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
MediaKit.ensureInitialized();
httpx.HttpClient.init();

// 初始化路径,获取到系统相关的文档、缓存目录
await PathHelper().init();

FlutterError.onError = (FlutterErrorDetails details) {
if (details.library == 'rendering library' ||
details.library == 'image resource service') {
Expand All @@ -133,7 +136,7 @@ void main() async {
PlatformTool.isMacOS()) {
sqfliteFfiInit();
databaseFactory = databaseFactoryFfi;
var path = absolute(join(getHomePath, 'databases'));
var path = absolute(join(PathHelper().getHomePath, 'databases'));
databaseFactory.setDatabasesPath(path);
}
}
Expand Down Expand Up @@ -714,7 +717,7 @@ class MyApp extends StatefulWidget {
providers: [
BlocProvider.value(value: galleryBloc),
],
child: ArtisticTextScreen(
child: ArtisticQRScreen(
setting: settingRepo,
galleryCopyId: int.tryParse(
state.queryParameters['gallery_copy_id'] ?? '',
Expand All @@ -726,6 +729,26 @@ class MyApp extends StatefulWidget {
),
),
),
GoRoute(
name: 'creative-artistic-wordart',
path: '/creative-draw/artistic-wordart',
parentNavigatorKey: _shellNavigatorKey,
pageBuilder: (context, state) => transitionResolver(
MultiBlocProvider(
providers: [
BlocProvider.value(value: galleryBloc),
],
child: ArtisticWordArtScreen(
setting: settingRepo,
galleryCopyId: int.tryParse(
state.queryParameters['gallery_copy_id'] ?? '',
),
id: state.queryParameters['id']!,
note: state.queryParameters['note'],
),
),
),
),
GoRoute(
name: 'creative-island-history-all',
path: '/creative-island/history',
Expand Down
Loading

0 comments on commit cfab714

Please sign in to comment.