Skip to content

Commit

Permalink
commit some code
Browse files Browse the repository at this point in the history
  • Loading branch information
mengyanshou committed Sep 8, 2022
1 parent 9c81616 commit 347332b
Show file tree
Hide file tree
Showing 34 changed files with 149 additions and 426 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@ on:

env:
# APP名称
APP_NAME: ADBTool
APP_NAME: ADBKIT

jobs:
# build-linux:
# runs-on: ubuntu-latest
# steps:
build-linux:
runs-on: ubuntu-latest
steps:

# - name: Checkout the code
# uses: actions/checkout@v2
- name: Checkout the code
uses: actions/checkout@v3

# - name: Install and set Flutter version
# uses: subosito/flutter-action@v2
# with:
# channel: 'stable'
- name: Install and set Flutter version
uses: subosito/flutter-action@v2
with:
channel: 'stable'

# - run: |
# sudo apt-get update -y
# sudo apt-get install -y ninja-build libgtk-3-dev
# - run: flutter config --enable-linux-desktop
- run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev
- run: flutter config --enable-linux-desktop

# - name: Building
# run: flutter build linux
- name: Building
run: flutter build linux

# - name: Packaging
# run: ./scripts/build/generate_linux.sh
- name: Packaging
run: ./scripts/build/generate_linux.sh

# - name: Release
# run: |
# curl --upload-file ${{ env.APP_NAME }}.deb https://transfer.sh/${{ env.APP_NAME }}.deb
- name: Release
run: |
curl --upload-file "${{ env.ZIP_NAME }}.deb" https://transfer.sh/${{ env.APP_NAME }}.deb
build-mac:
# The type of runner that the job will run on
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 1.3.7
- 修复文件无法选择的bug
- 优化手机端横屏布局
-

## 1.3.6
- 修复安卓端设备终端启动失败的问题
- 修复安卓端上传文件失败的问题
Expand Down
1 change: 0 additions & 1 deletion lib/adbkit_entrypoint.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// 把init从main函数移动到这儿是有原因的
import 'dart:typed_data';

import 'package:app_manager/app_manager.dart';
import 'package:flutter/material.dart';
Expand Down
15 changes: 7 additions & 8 deletions lib/app/controller/devices_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import 'dart:async';

import 'package:adb_tool/app/modules/overview/list/devices_item.dart';
import 'package:adb_tool/utils/plugin_util.dart';
import 'package:adb_tool/utils/so_util.dart';
import 'package:adbutil/adbutil.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:global_repository/global_repository.dart';

import 'history_controller.dart';
import 'package:adbutil/adbutil.dart';

class DevicesEntity {
DevicesEntity(this.serial, this.stat);
Expand Down Expand Up @@ -54,9 +54,7 @@ class DevicesEntity {

// ro.product.model
class DevicesController extends GetxController {
DevicesController() {
Log.i('设备管理控制器 Create');
}
DevicesController() {}
final GlobalKey<AnimatedListState> listKey = GlobalKey<AnimatedListState>();

Future<void> init() async {
Expand All @@ -78,12 +76,13 @@ class DevicesController extends GetxController {
});
await startAdb();
AdbUtil.addListener(handleResult);
String libPath = await const MethodChannel('adb').invokeMethod(
'get_lib_path',
);
String libPath;
if (GetPlatform.isAndroid) {
libPath = await getLibPath();
}
AdbUtil.setLibraryPath(libPath);
AdbUtil.startPoolingListDevices(
duration: const Duration(seconds: 1),
libPath: libPath,
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/app/modules/about/about_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class AboutPage extends StatelessWidget {
size: 16.w,
),
onTap: () {
Get.to(PrivacyPage());
Get.to(const PrivacyPage());
},
),
SettingItem(
Expand Down
3 changes: 2 additions & 1 deletion lib/app/modules/developer_tool/dash_board.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:adb_tool/global/widget/item_header.dart';
import 'package:adb_tool/global/widget/xterm_wrapper.dart';
import 'package:adb_tool/themes/theme.dart';
import 'package:adb_tool/utils/terminal_utill.dart';
import 'package:adbutil/adbutil.dart';
import 'package:animations/animations.dart';
import 'package:file_selector/file_selector.dart';
import 'package:file_selector_nightmare/file_selector_nightmare.dart';
Expand Down Expand Up @@ -73,7 +74,7 @@ class _DashboardState extends State<Dashboard> with WindowListener {
);
} else {
adbShell = Pty.start(
'adb',
adb,
arguments: ['-s', widget.entity.serial, 'shell'],
environment: envir(),
workingDirectory: '/',
Expand Down
1 change: 1 addition & 0 deletions lib/app/modules/developer_tool/developer_tool.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class _DeveloperToolState extends State<DeveloperTool>
appBar: PreferredSize(
preferredSize: Size.fromHeight(48.w),
child: SafeArea(
left: false,
child: Row(
children: [
SizedBox(
Expand Down
1 change: 1 addition & 0 deletions lib/app/modules/drawer/desktop_phone_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class _DesktopPhoneDrawerState<T> extends State<DesktopPhoneDrawer> {
builder: (context, orientation) {
return DesktopSafeArea(
child: SafeArea(
left: false,
child: SizedBox(
width: width,
height: MediaQuery.of(context).size.height,
Expand Down
3 changes: 2 additions & 1 deletion lib/app/modules/drawer/tablet_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class _TabletDrawerState extends State<TabletDrawer> {
),
child: DesktopSafeArea(
child: SafeArea(
left: false,
child: SizedBox(
height: MediaQuery.of(context).size.height,
child: Builder(
Expand All @@ -52,7 +53,7 @@ class _TabletDrawerState extends State<TabletDrawer> {
return buildBody(context);
}
return SingleChildScrollView(
physics: const NeverScrollableScrollPhysics(),
// physics: const NeverScrollableScrollPhysics(),
child: buildBody(context),
);
},
Expand Down
1 change: 1 addition & 0 deletions lib/app/modules/exec_cmd_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class _ExecCmdPageState extends State<ExecCmdPage> {
return Scaffold(
appBar: appBar,
body: SafeArea(
left: false,
child: Padding(
padding: EdgeInsets.symmetric(
vertical: 8.w,
Expand Down
1 change: 1 addition & 0 deletions lib/app/modules/history/history_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class HistoryPage extends GetView<HistoryController> {
);
}
return SafeArea(
left: false,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 8.w),
child: Stack(
Expand Down
1 change: 1 addition & 0 deletions lib/app/modules/install/adb_insys_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class _AdbInstallToSystemPageState extends State<AdbInstallToSystemPage> {
return Scaffold(
appBar: appBar,
body: SafeArea(
left: false,
child: Stack(
alignment: Alignment.topCenter,
children: [
Expand Down
1 change: 1 addition & 0 deletions lib/app/modules/log_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class _LogPageState extends State<LogPage> {
return Scaffold(
appBar: appBar,
body: SafeArea(
left: false,
child: Padding(
padding: EdgeInsets.fromLTRB(12.w, 0, 12.w, 0.w),
child: Column(
Expand Down
1 change: 1 addition & 0 deletions lib/app/modules/net_debug/remote_debug_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class _RemoteDebugPageState extends State<RemoteDebugPage> {
return Scaffold(
appBar: appBar,
body: SafeArea(
left: false,
child: SingleChildScrollView(
padding: EdgeInsets.zero,
child: Padding(
Expand Down
1 change: 1 addition & 0 deletions lib/app/modules/overview/pages/overview_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ class _OverviewPageState extends State<OverviewPage> {
// padding: EdgeInsets.only(bottom: 100.w),
physics: const BouncingScrollPhysics(),
child: SafeArea(
left: false,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand Down
1 change: 1 addition & 0 deletions lib/app/modules/privacy_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class _PrivacyPageState extends State<PrivacyPage> {
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
left: false,
child: Markdown(
controller: ScrollController(),
selectable: true,
Expand Down
1 change: 1 addition & 0 deletions lib/app/modules/search_ip_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class _SearchIpPageState extends State<SearchIpPage> {
return Scaffold(
appBar: appBar,
body: SafeArea(
left: false,
child: Container(
margin: EdgeInsets.all(8.w),
decoration: BoxDecoration(
Expand Down
1 change: 1 addition & 0 deletions lib/app/modules/setting/setting_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class _SettingsPageState extends State<SettingsPage>
);
}
return SafeArea(
left: false,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 12.w),
child: SingleChildScrollView(
Expand Down
59 changes: 25 additions & 34 deletions lib/global/instance/global.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import 'package:adb_tool/app/controller/controller.dart';
import 'package:adb_tool/app/modules/home/bindings/home_binding.dart';
import 'package:adb_tool/config/config.dart';
import 'package:adb_tool/utils/unique_util.dart';
import 'package:adb_tool/utils/utils.dart';
import 'package:adbutil/adbutil.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -58,10 +59,10 @@ class Global {
Pty pty;
Terminal terminal = Terminal();
core.Future<void> initTerminal() async {
String libPath = await const MethodChannel('adb').invokeMethod(
'get_lib_path',
);
RuntimeEnvir.put("PATH", '$libPath:${RuntimeEnvir.path}');
if (Platform.isAndroid) {
String libPath = await getLibPath();
RuntimeEnvir.put("PATH", '$libPath:${RuntimeEnvir.path}');
}
Map<String, String> envir = RuntimeEnvir.envir();
// 设置HOME变量到应用内路径会引发异常
// 例如 neofetch命令
Expand Down Expand Up @@ -176,38 +177,28 @@ class Global {
if (kIsWeb) {
return true;
}
String libPath = await const MethodChannel('adb').invokeMethod(
'get_lib_path',
);
File("${RuntimeEnvir.binPath}/adb").writeAsStringSync(
'$libPath/adb.so \$@',
);
Future.delayed(const Duration(seconds: 3), () {
pty.writeString('cd "$libPath"\n');
});
// RuntimeEnvir.put(key, value)
// Platform.
// Log.i('libPath:$libPath');
for (final String fileName in androidFiles) {
final targetPath = '$libPath/$fileName.so';
String filePath = '${RuntimeEnvir.binPath}/$fileName';
Log.w('filePath -> $filePath');
Log.w('targetPath -> $targetPath');
Link link = Link(filePath);
if (link.existsSync()) {
link.deleteSync();
}
try {
link.createSync(targetPath);
} catch (e) {
Log.e(e);
if (GetPlatform.isAndroid) {
String libPath = await getLibPath();
File("${RuntimeEnvir.binPath}/adb").writeAsStringSync(
'$libPath/adb.so \$@',
);
for (final String fileName in androidFiles) {
final targetPath = '$libPath/$fileName.so';
String filePath = '${RuntimeEnvir.binPath}/$fileName';
Link link = Link(filePath);
if (link.existsSync()) {
link.deleteSync();
}
try {
link.createSync(targetPath);
} catch (e) {
Log.e(e);
}
// Log.d(
// '更改文件权限 $fileName 输出 stdout:${result.stdout} stderr;${result.stderr}',
// );
}
// Log.d(
// '更改文件权限 $fileName 输出 stdout:${result.stdout} stderr;${result.stderr}',
// );
}
List<FileSystemEntity> files = Directory(RuntimeEnvir.binPath).listSync();
Log.w(files);
AssetsManager.copyFiles(
localPath: '${RuntimeEnvir.binPath}/',
android: [],
Expand Down
2 changes: 0 additions & 2 deletions lib/global/widget/xterm_wrapper.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import 'dart:async';
import 'dart:convert';

import 'package:adb_tool/global/instance/global.dart';
import 'package:flutter/material.dart';
import 'package:flutter_pty/flutter_pty.dart';
import 'package:get/utils.dart';
import 'package:global_repository/global_repository.dart';
import 'package:xterm/next.dart';
import 'package:xterm/next/ui/terminal_theme.dart';

Expand Down
10 changes: 0 additions & 10 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
library adb_tool;

import 'dart:async';
import 'dart:typed_data';
import 'package:adb_tool/app/controller/devices_controller.dart';
import 'package:adb_tool/global/instance/plugin_manager.dart';
import 'package:adb_tool/global/widget/mac_safearea.dart';
import 'package:file_manager_view/file_manager_view.dart' hide Config;
import 'package:flutter/services.dart';
import 'package:flutter_acrylic/flutter_acrylic.dart';
import 'package:adb_tool/app/controller/config_controller.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:global_repository/global_repository.dart';
import 'package:app_manager/app_manager.dart' as am;
import 'package:path_provider/path_provider.dart';
import 'package:screenshot/screenshot.dart';
import 'package:window_manager/window_manager.dart';
import 'app/modules/home/views/adaptive_view.dart';
import 'material_entrypoint.dart';
import 'config/config.dart';
import 'core/impl/plugin.dart';
import 'global/instance/global.dart';
import 'themes/lib_color_schemes.g.dart';

// 这个值由shell去替换
Expand Down
9 changes: 6 additions & 3 deletions lib/material_entrypoint.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,12 @@ class _MaterialAppWrapperState extends State<MaterialAppWrapper>
ResponsiveWrapper.builder(
Builder(
builder: (context) {
if (ResponsiveWrapper.of(context).isDesktop) {
if (ResponsiveWrapper.of(context).isDesktop ||
ResponsiveWrapper.of(context).isTablet) {
Log.i('isDesktop');
ScreenAdapter.init(896);
} else {
Log.i('is not Desktop');
ScreenAdapter.init(414);
}
return Theme(
Expand All @@ -139,9 +142,9 @@ class _MaterialAppWrapperState extends State<MaterialAppWrapper>
defaultScale: false,
defaultName: PHONE,
breakpoints: const [
// ResponsiveBreakpoint.resize(400, name: PHONE),
ResponsiveBreakpoint.resize(300, name: PHONE),
ResponsiveBreakpoint.resize(600, name: TABLET),
ResponsiveBreakpoint.resize(1000, name: DESKTOP),
ResponsiveBreakpoint.resize(800, name: DESKTOP),
],
),
if (GetPlatform.isDesktop)
Expand Down
Loading

0 comments on commit 347332b

Please sign in to comment.