Skip to content

Commit

Permalink
Merge pull request #104 from mylxsw/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mylxsw authored Apr 7, 2024
2 parents eaf5453 + 6836951 commit a004107
Show file tree
Hide file tree
Showing 110 changed files with 8,025 additions and 925 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build_windows_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- develop

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ build-dmg: build-macos
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" \
--background "assets/background-dark-s1.jpg" \
--window-pos 200 120 \
--window-size 600 320 \
--icon-size 100 \
Expand Down
5 changes: 5 additions & 0 deletions android/app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivity$g
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Args
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter$Error
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningActivityStarter
-dontwarn com.stripe.android.pushProvisioning.PushProvisioningEphemeralKeyProvider
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cc.aicode.flutter.askaide.askaide

import io.flutter.embedding.android.FlutterActivity
import io.flutter.embedding.android.FlutterFragmentActivity

class MainActivity: FlutterActivity() {

}
class MainActivity: FlutterFragmentActivity() {
}
4 changes: 2 additions & 2 deletions android/app/src/main/res/values-night/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<style name="LaunchTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
Expand All @@ -12,7 +12,7 @@
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<style name="NormalTheme" parent="Theme.MaterialComponents">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
4 changes: 2 additions & 2 deletions android/app/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<style name="LaunchTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Show a splash screen on the activity. Automatically removed when
the Flutter engine draws its first frame -->
<item name="android:windowBackground">@drawable/launch_background</item>
Expand All @@ -16,7 +16,7 @@
running.
This Theme is only used starting with V2 of Flutter's Android embedding. -->
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<style name="NormalTheme" parent="Theme.MaterialComponents">
<item name="android:windowBackground">?android:colorBackground</item>
</style>
</resources>
Binary file added assets/apple.webp
Binary file not shown.
Binary file removed assets/background-creative-island-dark.webp
Binary file not shown.
Binary file added assets/background-creative-island.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/background-creative-island.webp
Binary file not shown.
Binary file added assets/background-dark-s1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/background-dark-s3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/background-dark.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/background-dark.png
Binary file not shown.
Binary file added assets/background-discovery-dark.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/background-discovery-dark.webp
Binary file not shown.
Binary file removed assets/background-discovery.png
Binary file not shown.
Binary file added assets/background-light-s1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/background-team-dark.png
Binary file not shown.
Binary file added assets/background-team.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/background-team.png
Binary file not shown.
Binary file added assets/background.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/background.png
Binary file not shown.
Binary file added assets/stripe.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 added assets/wechat-pay.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 added assets/zhifubao.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion build-win.bat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dart run msix:create --release -v --output-path build/windows/runner --output-name AIdea
flutter build windows --release
6 changes: 1 addition & 5 deletions docker-build.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
#!/usr/bin/env bash

VERSION=1.0.13
VERSION=1.0.13.1

rm -fr build/web

flutter build web --web-renderer canvaskit --release --dart-define=API_SERVER_URL=/
cd scripts && go run main.go ../build/web/main.dart.js && cd ..
rm -fr build/web/fonts/ && mkdir build/web/fonts
cp -r scripts/s build/web/fonts/s

docker buildx build --platform=linux/amd64,linux/arm64 -t mylxsw/aidea-web:$VERSION . --push

166 changes: 83 additions & 83 deletions install.iss

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '12.0'
platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
58 changes: 57 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,42 @@ PODS:
- sqflite (0.0.3):
- Flutter
- FlutterMacOS
- Stripe (23.22.1):
- StripeApplePay (= 23.22.1)
- StripeCore (= 23.22.1)
- StripePayments (= 23.22.1)
- StripePaymentsUI (= 23.22.1)
- StripeUICore (= 23.22.1)
- stripe_ios (0.0.1):
- Flutter
- Stripe (~> 23.22.0)
- StripeApplePay (~> 23.22.0)
- StripeFinancialConnections (~> 23.22.0)
- StripePayments (~> 23.22.0)
- StripePaymentSheet (~> 23.22.0)
- StripePaymentsUI (~> 23.22.0)
- StripeApplePay (23.22.1):
- StripeCore (= 23.22.1)
- StripeCore (23.22.1)
- StripeFinancialConnections (23.22.1):
- StripeCore (= 23.22.1)
- StripeUICore (= 23.22.1)
- StripePayments (23.22.1):
- StripeCore (= 23.22.1)
- StripePayments/Stripe3DS2 (= 23.22.1)
- StripePayments/Stripe3DS2 (23.22.1):
- StripeCore (= 23.22.1)
- StripePaymentSheet (23.22.1):
- StripeApplePay (= 23.22.1)
- StripeCore (= 23.22.1)
- StripePayments (= 23.22.1)
- StripePaymentsUI (= 23.22.1)
- StripePaymentsUI (23.22.1):
- StripeCore (= 23.22.1)
- StripePayments (= 23.22.1)
- StripeUICore (= 23.22.1)
- StripeUICore (23.22.1):
- StripeCore (= 23.22.1)
- SwiftyGif (5.4.4)
- tobias (0.0.1):
- Flutter
Expand Down Expand Up @@ -138,6 +174,7 @@ DEPENDENCIES:
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sign_in_with_apple (from `.symlinks/plugins/sign_in_with_apple/ios`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- stripe_ios (from `.symlinks/plugins/stripe_ios/ios`)
- tobias (from `.symlinks/plugins/tobias/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- volume_controller (from `.symlinks/plugins/volume_controller/ios`)
Expand All @@ -151,6 +188,14 @@ SPEC REPOS:
- Mantle
- SDWebImage
- SDWebImageWebPCoder
- Stripe
- StripeApplePay
- StripeCore
- StripeFinancialConnections
- StripePayments
- StripePaymentSheet
- StripePaymentsUI
- StripeUICore
- SwiftyGif
- WechatOpenSDK-XCFramework

Expand Down Expand Up @@ -201,6 +246,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/sign_in_with_apple/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/darwin"
stripe_ios:
:path: ".symlinks/plugins/stripe_ios/ios"
tobias:
:path: ".symlinks/plugins/tobias/ios"
url_launcher_ios:
Expand Down Expand Up @@ -240,13 +287,22 @@ SPEC CHECKSUMS:
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
sign_in_with_apple: f3bf75217ea4c2c8b91823f225d70230119b8440
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
Stripe: b65e9f748f8f51b51e015b0d72f5474dc0708788
stripe_ios: 433385aa051f8965915d495744946ee5a5d657db
StripeApplePay: 4a2fef6cd4e1e9b2c0849919fc7b3a9c5c3684b1
StripeCore: e1f6cd91d1487c0f6b5db81b42aec860420f75c9
StripeFinancialConnections: d223a44613e6982cedd552c5950edc9b4901c90a
StripePayments: 76144e9e6b5fee859954238a175f859043562659
StripePaymentSheet: a25d920bb3bb5e2580696476482dc7df9cb5e4e2
StripePaymentsUI: 66088abec88754bbdd522ef227dfdbb2265a653e
StripeUICore: b193c7d35e9cd1b04bc9ed4a6fb8c548fcee83fa
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
tobias: 2aded9b83e3663b907360a800d8e3c13284f25c5
url_launcher_ios: 6116280ddcfe98ab8820085d8d76ae7449447586
volume_controller: 531ddf792994285c9b17f9d8a7e4dcdd29b3eae9
wakelock_plus: 8b09852c8876491e4b6d179e17dfe2a0b5f60d47
WechatOpenSDK-XCFramework: acdeeda129efbef9532bca8a10c24e1b4b8c7d69

PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048
PODFILE CHECKSUM: cc1f88378b4bfcf93a6ce00d2c587857c6008d3b

COCOAPODS: 1.14.3
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -540,7 +540,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -589,7 +589,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
21 changes: 21 additions & 0 deletions lib/bloc/admin_payment_bloc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:askaide/repo/api/admin/payment.dart';
import 'package:askaide/repo/api/page.dart';
import 'package:askaide/repo/api_server.dart';
import 'package:bloc/bloc.dart';
import 'package:meta/meta.dart';

part 'admin_payment_event.dart';
part 'admin_payment_state.dart';

class AdminPaymentBloc extends Bloc<AdminPaymentEvent, AdminPaymentState> {
AdminPaymentBloc() : super(AdminPaymentInitial()) {
on<AdminPaymentHistoriesLoadEvent>((event, emit) async {
final histories = await APIServer().adminPaymentHistories(
page: event.page,
perPage: event.perPage,
keyword: event.keyword,
);
emit(AdminPaymentHistoriesLoaded(histories));
});
}
}
16 changes: 16 additions & 0 deletions lib/bloc/admin_payment_event.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
part of 'admin_payment_bloc.dart';

@immutable
sealed class AdminPaymentEvent {}

class AdminPaymentHistoriesLoadEvent extends AdminPaymentEvent {
final int page;
final int perPage;
final String? keyword;

AdminPaymentHistoriesLoadEvent({
this.page = 1,
this.perPage = 20,
this.keyword,
});
}
19 changes: 19 additions & 0 deletions lib/bloc/admin_payment_state.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
part of 'admin_payment_bloc.dart';

@immutable
sealed class AdminPaymentState {}

final class AdminPaymentInitial extends AdminPaymentState {}

class AdminPaymentOperationResult extends AdminPaymentState {
final bool success;
final String message;

AdminPaymentOperationResult(this.success, this.message);
}

class AdminPaymentHistoriesLoaded extends AdminPaymentState {
final PagedData<AdminPaymentHistory> histories;

AdminPaymentHistoriesLoaded(this.histories);
}
56 changes: 56 additions & 0 deletions lib/bloc/channel_bloc.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import 'package:askaide/repo/api/admin/channels.dart';
import 'package:askaide/repo/api_server.dart';
import 'package:bloc/bloc.dart';
import 'package:meta/meta.dart';

part 'channel_event.dart';
part 'channel_state.dart';

class ChannelBloc extends Bloc<ChannelEvent, ChannelState> {
ChannelBloc() : super(ChannelInitial()) {
/// 加载所有渠道
on<ChannelsLoadEvent>((event, emit) async {
final channels = await APIServer().adminChannels();
emit(ChannelsLoaded(channels));
});

/// 加载单个渠道
on<ChannelLoadEvent>((event, emit) async {
final channel = await APIServer().adminChannel(id: event.channelId);
emit(ChannelLoaded(channel));
});

/// 创建渠道
on<ChannelCreateEvent>((event, emit) async {
try {
await APIServer().adminCreateChannel(event.req);
emit(ChannelOperationResult(true, '创建成功'));
} catch (e) {
emit(ChannelOperationResult(false, e.toString()));
}
});

/// 更新渠道
on<ChannelUpdateEvent>((event, emit) async {
try {
await APIServer().adminUpdateChannel(
id: event.channelId,
req: event.req,
);
emit(ChannelOperationResult(true, '更新成功'));
} catch (e) {
emit(ChannelOperationResult(false, e.toString()));
}
});

/// 删除渠道
on<ChannelDeleteEvent>((event, emit) async {
try {
await APIServer().adminDeleteChannel(id: event.channelId);
emit(ChannelOperationResult(true, '删除成功'));
} catch (e) {
emit(ChannelOperationResult(false, e.toString()));
}
});
}
}
31 changes: 31 additions & 0 deletions lib/bloc/channel_event.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
part of 'channel_bloc.dart';

@immutable
sealed class ChannelEvent {}

class ChannelsLoadEvent extends ChannelEvent {}

class ChannelLoadEvent extends ChannelEvent {
final int channelId;

ChannelLoadEvent(this.channelId);
}

class ChannelCreateEvent extends ChannelEvent {
final AdminChannelAddReq req;

ChannelCreateEvent(this.req);
}

class ChannelUpdateEvent extends ChannelEvent {
final int channelId;
final AdminChannelUpdateReq req;

ChannelUpdateEvent(this.channelId, this.req);
}

class ChannelDeleteEvent extends ChannelEvent {
final int channelId;

ChannelDeleteEvent(this.channelId);
}
25 changes: 25 additions & 0 deletions lib/bloc/channel_state.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
part of 'channel_bloc.dart';

@immutable
sealed class ChannelState {}

final class ChannelInitial extends ChannelState {}

class ChannelsLoaded extends ChannelState {
final List<AdminChannel> channels;

ChannelsLoaded(this.channels);
}

class ChannelLoaded extends ChannelState {
final AdminChannel channel;

ChannelLoaded(this.channel);
}

class ChannelOperationResult extends ChannelState {
final bool success;
final String message;

ChannelOperationResult(this.success, this.message);
}
Loading

0 comments on commit a004107

Please sign in to comment.