Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/pr_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
run: flutter pub get

- name: Generate code
run: dart run lean_builder build --delete-conflicting-outputs
run: dart run lean_builder build

- name: Analyze
run: flutter analyze --no-fatal-infos
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
run: flutter pub get

- name: Generate code
run: dart run lean_builder build --delete-conflicting-outputs
run: dart run lean_builder build

- name: Analyze
run: flutter analyze --no-fatal-infos
Expand Down Expand Up @@ -135,7 +135,7 @@ jobs:
run: flutter pub get

- name: Generate code
run: dart run lean_builder build --delete-conflicting-outputs
run: dart run lean_builder build

- name: Analyze
run: flutter analyze --no-fatal-infos
Expand Down
17 changes: 3 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ jobs:

| Platform | Asset | Description |
| :--- | :--- | :--- |
| **Windows (Setup)** | [EXE](https://github.com/${{ github.repository }}/releases/download/${{ github.event_name == 'workflow_dispatch' && format('v{0}', steps.get_version.outputs.version) || github.ref_name }}/flutter_agent_panel-${{ steps.get_version.outputs.version }}-windows-x86_64-setup.exe) | Standard Windows Installer |
| **Windows (MSIX)** | [MSIX](https://github.com/${{ github.repository }}/releases/download/${{ github.event_name == 'workflow_dispatch' && format('v{0}', steps.get_version.outputs.version) || github.ref_name }}/flutter_agent_panel-${{ steps.get_version.outputs.version }}-windows-x86_64.msix) | Windows Store / Modern Package |
| **Windows** | [EXE](https://github.com/${{ github.repository }}/releases/download/${{ github.event_name == 'workflow_dispatch' && format('v{0}', steps.get_version.outputs.version) || github.ref_name }}/flutter_agent_panel-${{ steps.get_version.outputs.version }}-windows-x86_64-setup.exe) | Standard Windows Installer |
| **macOS** | [DMG](https://github.com/${{ github.repository }}/releases/download/${{ github.event_name == 'workflow_dispatch' && format('v{0}', steps.get_version.outputs.version) || github.ref_name }}/flutter_agent_panel-${{ steps.get_version.outputs.version }}-macos-universal.dmg) | Universal Apple Disk Image |
| **Linux** | [Tarball](https://github.com/${{ github.repository }}/releases/download/${{ github.event_name == 'workflow_dispatch' && format('v{0}', steps.get_version.outputs.version) || github.ref_name }}/flutter_agent_panel-${{ steps.get_version.outputs.version }}-linux-x86_64.tar.gz) | Gzipped Bundle |

Expand Down Expand Up @@ -111,27 +110,17 @@ jobs:
with:
path: windows/installer.iss

- name: Create MSIX
run: dart run msix:create --build-windows false

- name: Rename output files with version
run: |
$version = "${{ needs.create-release.outputs.version }}"
Rename-Item -Path "build/windows/x64/runner/Release/Output/flutter_agent_panel_setup.exe" -NewName "flutter_agent_panel-$version-windows-x86_64-setup.exe"
Rename-Item -Path "build/windows/x64/runner/Release/flutter_agent_panel.msix" -NewName "flutter_agent_panel-$version-windows-x86_64.msix"

- name: Upload Release Asset (EXE)
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event_name == 'workflow_dispatch' && format('v{0}', needs.create-release.outputs.version) || github.ref_name }}
files: build/windows/x64/runner/Release/Output/flutter_agent_panel-${{ needs.create-release.outputs.version }}-windows-x86_64-setup.exe

- name: Upload Release Asset (MSIX)
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.event_name == 'workflow_dispatch' && format('v{0}', needs.create-release.outputs.version) || github.ref_name }}
files: build/windows/x64/runner/Release/flutter_agent_panel-${{ needs.create-release.outputs.version }}-windows-x86_64.msix

build-macos:
name: Build macOS
needs: create-release
Expand Down Expand Up @@ -162,7 +151,7 @@ jobs:
run: flutter pub get

- name: Generate code
run: dart run lean_builder build --delete-conflicting-outputs
run: dart run lean_builder build

- name: Analyze
run: flutter analyze --no-fatal-infos
Expand Down Expand Up @@ -230,7 +219,7 @@ jobs:
run: flutter pub get

- name: Generate code
run: dart run lean_builder build --delete-conflicting-outputs
run: dart run lean_builder build

- name: Analyze
run: flutter analyze --no-fatal-infos
Expand Down
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ analyzer:
exclude:
- packages/flutter_pty/**
- packages/xterm/**
- lib/core/l10n/**.dart
- lib/core/router/**.gr.dart

include: package:flutter_lints/flutter.yaml

Expand Down
2 changes: 2 additions & 0 deletions assets/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"cmd": "Command Prompt",
"wsl": "WSL",
"gitBash": "Git Bash",
"zsh": "Zsh",
"bash": "Bash",
"appearance": "Appearance",
"theme": "Theme",
"appFontFamily": "App Font Family",
Expand Down
2 changes: 2 additions & 0 deletions assets/l10n/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"cmd": "命令提示字元",
"wsl": "WSL",
"gitBash": "Git Bash",
"zsh": "Zsh",
"bash": "Bash",
"appearance": "外觀",
"theme": "主題",
"appFontFamily": "App 字型系列",
Expand Down
2 changes: 2 additions & 0 deletions assets/l10n/app_zh_CN.arb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
"cmd": "命令提示符",
"wsl": "WSL",
"gitBash": "Git Bash",
"zsh": "Zsh",
"bash": "Bash",
"appearance": "外观",
"theme": "主题",
"appFontFamily": "App 字体系列",
Expand Down
12 changes: 12 additions & 0 deletions lib/core/l10n/app_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,18 @@ abstract class AppLocalizations {
/// **'Git Bash'**
String get gitBash;

/// No description provided for @zsh.
///
/// In en, this message translates to:
/// **'Zsh'**
String get zsh;

/// No description provided for @bash.
///
/// In en, this message translates to:
/// **'Bash'**
String get bash;

/// No description provided for @appearance.
///
/// In en, this message translates to:
Expand Down
6 changes: 6 additions & 0 deletions lib/core/l10n/app_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ class AppLocalizationsEn extends AppLocalizations {
@override
String get gitBash => 'Git Bash';

@override
String get zsh => 'Zsh';

@override
String get bash => 'Bash';

@override
String get appearance => 'Appearance';

Expand Down
12 changes: 12 additions & 0 deletions lib/core/l10n/app_localizations_zh.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get gitBash => 'Git Bash';

@override
String get zsh => 'Zsh';

@override
String get bash => 'Bash';

@override
String get appearance => '外觀';

Expand Down Expand Up @@ -468,6 +474,12 @@ class AppLocalizationsZhCn extends AppLocalizationsZh {
@override
String get gitBash => 'Git Bash';

@override
String get zsh => 'Zsh';

@override
String get bash => 'Bash';

@override
String get appearance => '外观';

Expand Down
24 changes: 12 additions & 12 deletions lib/core/router/app_router.gr.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 33 additions & 2 deletions lib/core/services/app_version_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class AppVersionService {
static final AppVersionService instance = AppVersionService._();

PackageInfo? _packageInfo;
Map<String, dynamic>? _latestReleaseJson;

/// Gets the package info (cached after first call).
Future<PackageInfo> getPackageInfo() async {
Expand Down Expand Up @@ -61,6 +62,7 @@ class AppVersionService {
if (response.statusCode == 200) {
final body = await response.transform(utf8.decoder).join();
final json = jsonDecode(body) as Map<String, dynamic>;
_latestReleaseJson = json;
final tagName = json['tag_name'] as String?;
if (tagName != null) {
// Remove 'Release v' or 'v' prefix if present
Expand Down Expand Up @@ -157,7 +159,37 @@ class AppVersionService {

/// Gets the download URL for the binary based on current platform.
Future<String> getBinaryUrl(String version) async {
// Clean version string to ensure it matches GitHub release tag format
// If we have cached release info, try to find the best asset
// Verify that the cached release tag matches the requested version
final cachedTag = _latestReleaseJson?['tag_name'] as String?;
final cleanCachedTag =
cachedTag?.replaceFirst('Release v', '').replaceFirst('v', '').trim();

if (_latestReleaseJson != null && cleanCachedTag == version) {
final assets = _latestReleaseJson!['assets'] as List<dynamic>?;
if (assets != null) {
final assetUrls =
assets.map((a) => a['browser_download_url'] as String).toList();

switch (Platform.operatingSystem) {
case 'windows':
final setupExe = assetUrls
.where((url) => url.endsWith('-setup.exe'))
.firstOrNull;
if (setupExe != null) return setupExe;
case 'macos':
final dmg =
assetUrls.where((url) => url.endsWith('.dmg')).firstOrNull;
if (dmg != null) return dmg;
case 'linux':
final tarGz =
assetUrls.where((url) => url.endsWith('.tar.gz')).firstOrNull;
if (tarGz != null) return tarGz;
}
}
}

// Fallback if no assets found or no cache
final cleanVersion = version.split('+')[0].split('-')[0];
final baseUrl =
'https://github.com/$_githubOwner/$_githubRepo/releases/download/v$cleanVersion';
Expand All @@ -170,7 +202,6 @@ class AppVersionService {
return '$baseUrl/flutter_agent_panel-$cleanVersion-linux-x86_64.tar.gz';
}

// Default to Windows
return '$baseUrl/flutter_agent_panel-$cleanVersion-windows-x86_64-setup.exe';
}

Expand Down
2 changes: 1 addition & 1 deletion lib/features/settings/bloc/settings_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class SettingsBloc extends HydratedBloc<SettingsEvent, SettingsState> {
SettingsBloc()
: super(
SettingsState(
settings: const AppSettings().copyWith(
settings: AppSettings().copyWith(
agents: AppSettings.getDefaultAgents(),
),
),
Expand Down
6 changes: 3 additions & 3 deletions lib/features/settings/bloc/settings_state.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
part of 'settings_bloc.dart';

class SettingsState extends Equatable {
const SettingsState({
this.settings = const AppSettings(),
SettingsState({
AppSettings? settings,
this.isLoading = false,
this.error,
});
}) : settings = settings ?? AppSettings();
final AppSettings settings;
final bool isLoading;
final String? error;
Expand Down
8 changes: 4 additions & 4 deletions lib/features/settings/models/app_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ String? _migrateTerminalThemeName(String? oldName) {

/// Application settings model
class AppSettings extends Equatable {
const AppSettings({
AppSettings({
this.appTheme = AppTheme.dark,
this.terminalThemeName = 'OneDark',
this.customTerminalThemeJson,
this.fontSettings = const TerminalFontSettings(),
this.defaultShell = ShellType.pwsh7,
ShellType? defaultShell,
this.customShells = const [],
this.selectedCustomShellId,
this.locale = 'en',
this.terminalCursorBlink = true,
this.agents = const [],
this.appFontFamily,
this.globalEnvironmentVariables = const {},
});
}) : defaultShell = defaultShell ?? ShellType.platformDefault;

factory AppSettings.fromJson(Map<String, dynamic> json) {
// Handle migration from old customShellPath to new customShells list
Expand Down Expand Up @@ -76,7 +76,7 @@ class AppSettings extends Equatable {
: const TerminalFontSettings(),
defaultShell: ShellType.values.firstWhere(
(e) => e.name == json['defaultShell'],
orElse: () => ShellType.pwsh7,
orElse: () => ShellType.platformDefault,
),
customShells: customShells,
selectedCustomShellId: json['selectedCustomShellId'] as String?,
Expand Down
Loading
Loading