Skip to content

Commit

Permalink
new: ssh tab
Browse files Browse the repository at this point in the history
  • Loading branch information
lollipopkit committed Nov 12, 2023
1 parent 8693ce0 commit 7908129
Show file tree
Hide file tree
Showing 8 changed files with 195 additions and 101 deletions.
36 changes: 18 additions & 18 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 634;
CURRENT_PROJECT_VERSION = 636;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
Expand All @@ -596,7 +596,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.634;
MARKETING_VERSION = 1.0.636;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand Down Expand Up @@ -720,7 +720,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 634;
CURRENT_PROJECT_VERSION = 636;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
Expand All @@ -730,7 +730,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.634;
MARKETING_VERSION = 1.0.636;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand All @@ -748,7 +748,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CURRENT_PROJECT_VERSION = 634;
CURRENT_PROJECT_VERSION = 636;
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = "Runner/Info-$(CONFIGURATION).plist";
Expand All @@ -758,7 +758,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.634;
MARKETING_VERSION = 1.0.636;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
Expand All @@ -779,7 +779,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 634;
CURRENT_PROJECT_VERSION = 636;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -792,7 +792,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.634;
MARKETING_VERSION = 1.0.636;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
Expand All @@ -818,7 +818,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 634;
CURRENT_PROJECT_VERSION = 636;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -831,7 +831,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.634;
MARKETING_VERSION = 1.0.636;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -854,7 +854,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 634;
CURRENT_PROJECT_VERSION = 636;
DEVELOPMENT_TEAM = BA88US33G6;
GCC_C_LANGUAGE_STANDARD = gnu11;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -867,7 +867,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 1.0.634;
MARKETING_VERSION = 1.0.636;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.StatusWidget;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -890,7 +890,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 634;
CURRENT_PROJECT_VERSION = 636;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES;
Expand All @@ -902,7 +902,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.634;
MARKETING_VERSION = 1.0.636;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
Expand Down Expand Up @@ -931,7 +931,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 634;
CURRENT_PROJECT_VERSION = 636;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES;
Expand All @@ -943,7 +943,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.634;
MARKETING_VERSION = 1.0.636;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox;
Expand All @@ -969,7 +969,7 @@
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 634;
CURRENT_PROJECT_VERSION = 636;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = BA88US33G6;
ENABLE_PREVIEWS = YES;
Expand All @@ -981,7 +981,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0.634;
MARKETING_VERSION = 1.0.636;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox.WatchEnd;
PRODUCT_NAME = ServerBox;
Expand Down
2 changes: 1 addition & 1 deletion lib/core/route.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:toolbox/view/page/server/detail.dart';
import 'package:toolbox/view/page/setting/android.dart';
import 'package:toolbox/view/page/setting/ios.dart';
import 'package:toolbox/view/page/snippet/result.dart';
import 'package:toolbox/view/page/ssh_term.dart';
import 'package:toolbox/view/page/ssh/page.dart';
import 'package:toolbox/view/page/setting/virt_key.dart';
import 'package:toolbox/view/page/storage/local.dart';

Expand Down
9 changes: 5 additions & 4 deletions lib/data/model/app/tab.dart
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
import 'package:flutter/material.dart';
import 'package:toolbox/view/page/ping.dart';
import 'package:toolbox/view/page/server/tab.dart';
import 'package:toolbox/view/page/snippet/list.dart';
import 'package:toolbox/view/page/ssh/tab.dart';

enum AppTab {
server,
ssh,
snippet,
ping;
;

Widget get page {
switch (this) {
case server:
return const ServerPage();
case snippet:
return const SnippetListPage();
case ping:
return const PingPage();
case ssh:
return const SSHTabPage();
}
}
}
6 changes: 2 additions & 4 deletions lib/data/provider/server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ import '../model/server/snippet.dart';
import '../model/server/try_limiter.dart';
import '../res/status.dart';

typedef ServersMap = Map<String, Server>;

class ServerProvider extends ChangeNotifier {
final ServersMap _servers = {};
final Map<String, Server> _servers = {};
Iterable<Server> get servers => _servers.values;
final Order<String> _serverOrder = [];
Order<String> get serverOrder => _serverOrder;
Expand Down Expand Up @@ -102,7 +100,7 @@ class ServerProvider extends ChangeNotifier {
}

Server genServer(ServerPrivateInfo spi) {
return Server(spi, InitStatus.status, null, ServerState.disconnected);
return Server(spi, InitStatus.status, ServerState.disconnected);
}

/// if [spi] is specificed then only refresh this server
Expand Down
6 changes: 3 additions & 3 deletions lib/data/res/build_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

class BuildData {
static const String name = "ServerBox";
static const int build = 634;
static const int build = 636;
static const String engine = "3.13.8";
static const String buildAt = "2023-11-03 22:14:11";
static const String buildAt = "2023-11-07 19:05:38";
static const int modifications = 2;
static const int script = 25;
static const int script = 26;
}
52 changes: 15 additions & 37 deletions lib/view/page/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,16 @@ class _HomePageState extends State<HomePage>

return Scaffold(
drawer: _buildDrawer(),
appBar: _buildAppBar(),
appBar: CustomAppBar(
title: const Text(BuildData.name),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.developer_mode, size: 23),
tooltip: l10n.debug,
onPressed: () => AppRoute.debug().go(context),
),
],
),
body: PageView.builder(
controller: _pageController,
itemCount: AppTab.values.length,
Expand All @@ -129,37 +138,6 @@ class _HomePageState extends State<HomePage>
);
}

PreferredSizeWidget _buildAppBar() {
final actions = <Widget>[
IconButton(
icon: const Icon(Icons.developer_mode, size: 23),
tooltip: l10n.debug,
onPressed: () => AppRoute.debug().go(context),
),
];
if (isDesktop && _selectIndex.value == AppTab.server.index) {
actions.add(
ValueBuilder(
listenable: _selectIndex,
build: () {
if (_selectIndex.value != AppTab.server.index) {
return const SizedBox();
}
return IconButton(
icon: const Icon(Icons.refresh, size: 23),
tooltip: 'Refresh',
onPressed: () => Pros.server.refreshData(onlyFailed: true),
);
},
),
);
}
return CustomAppBar(
title: const Text(BuildData.name),
actions: actions,
);
}

Widget _buildBottomBar() {
return NavigationBar(
selectedIndex: _selectIndex.value,
Expand All @@ -185,16 +163,16 @@ class _HomePageState extends State<HomePage>
label: l10n.server,
selectedIcon: const Icon(Icons.cloud),
),
const NavigationDestination(
icon: Icon(Icons.terminal_outlined),
label: 'SSH',
selectedIcon: Icon(Icons.terminal),
),
NavigationDestination(
icon: const Icon(Icons.snippet_folder_outlined),
label: l10n.snippet,
selectedIcon: const Icon(Icons.snippet_folder),
),
const NavigationDestination(
icon: Icon(Icons.network_check_outlined),
label: 'Ping',
selectedIcon: Icon(Icons.network_check),
),
],
);
}
Expand Down
Loading

0 comments on commit 7908129

Please sign in to comment.