Melon 1 éve
szülő
commit
703f3a1cf5

BIN
android/app/libs/device_sdk.aar


+ 2 - 1
lib/global.dart

@@ -105,7 +105,8 @@ abstract class Global {
   }
 
   static Future<void> _initDevices() async {
-    await VnoteDevicePluginPlatform.instance.init();
+    // TODO: 后续改成按后门配置开启
+    await VnoteDevicePluginPlatform.instance.init(true);
 
     final List<_DeviceStatusTipsHandler> statusHandlers = [];
     for (int status in DeviceConsts.STATUS_DESC_MAP.keys) {

+ 36 - 0
lib/pages/admin/controller.dart

@@ -0,0 +1,36 @@
+import 'dart:io';
+
+import 'package:path_provider/path_provider.dart';
+import 'package:vitalapp/architecture/defines.dart';
+
+import 'state.dart';
+
+class AdminController extends FControllerBase {
+  final state = AdminState();
+
+  @override
+  void onReady() {
+    // TODO: implement onReady
+    super.onReady();
+  }
+
+  void cpDbFileLoki() async {
+    var sPath = "/data/user/0/com.vinno.vitalapp/databases/vital.db";
+    final directory = await getExternalStorageDirectory();
+    final path = directory?.path;
+    final sourceFile = File(sPath);
+    final destFile = File('$path/vital.db');
+
+    await destFile.create(recursive: true);
+    await sourceFile.copy(destFile.path);
+  }
+
+  void cpDbFileFinlay() async {
+    var sPath = "/data/user/0/com.vinno.vitalapp/databases/vital.db";
+    final directory = await getExternalStorageDirectory();
+    final path = directory?.path;
+    final destFile = File('$path/vital.db');
+    final sourceFile = File(sPath);
+    await destFile.copy(sourceFile.path);
+  }
+}

+ 1 - 0
lib/pages/admin/state.dart

@@ -0,0 +1 @@
+class AdminState {}

+ 33 - 0
lib/pages/admin/view.dart

@@ -0,0 +1,33 @@
+import 'package:flutter/material.dart';
+import 'package:get/get.dart';
+import 'package:vitalapp/components/appbar.dart';
+
+import 'controller.dart';
+
+class AdminPage extends GetView<AdminController> {
+  const AdminPage({super.key});
+
+  @override
+  Widget build(BuildContext context) {
+    // TODO: 后门页面
+    return Scaffold(
+      appBar: VAppBar(titleText: "系统管理"),
+      body: ListView(
+        padding: const EdgeInsets.symmetric(horizontal: 40),
+        children: [
+          const Text("欢迎补充", style: TextStyle(fontSize: 26)),
+          const SizedBox(height: 8),
+          ElevatedButton(
+            onPressed: controller.cpDbFileLoki,
+            child: const Text("Loki DB CP"),
+          ),
+          const SizedBox(height: 8),
+          ElevatedButton(
+            onPressed: controller.cpDbFileFinlay,
+            child: const Text("Finlay DB CP"),
+          ),
+        ],
+      ),
+    );
+  }
+}

+ 10 - 18
lib/pages/home/view.dart

@@ -257,6 +257,7 @@ class HomePage extends GetView<HomeController> {
   }
 
   Widget _buildHeaderCenter() {
+    int clickCount = 0;
     return Row(
       mainAxisSize: MainAxisSize.min,
       crossAxisAlignment: CrossAxisAlignment.center,
@@ -266,25 +267,16 @@ class HomePage extends GetView<HomeController> {
           mainAxisAlignment: MainAxisAlignment.center,
           children: [
             GestureDetector(
-              onDoubleTap: () async {
-                var sPath =
-                    "/data/user/0/com.vinno.vitalapp/databases/vital.db";
-                final directory = await getExternalStorageDirectory();
-                final path = directory?.path;
-                final sourceFile = File(sPath);
-                final destFile = File('$path/vital.db');
-
-                await destFile.create(recursive: true);
-                await sourceFile.copy(destFile.path);
-              },
               onTap: () async {
-                var sPath =
-                    "/data/user/0/com.vinno.vitalapp/databases/vital.db";
-                final directory = await getExternalStorageDirectory();
-                final path = directory?.path;
-                final destFile = File('$path/vital.db');
-                final sourceFile = File(sPath);
-                await destFile.copy(sourceFile.path);
+                if (clickCount >= 10) {
+                  clickCount = 0;
+                  Get.toNamed("/admin");
+                } else {
+                  if (clickCount > 5) {
+                    PromptBox.toast("Click count: $clickCount!");
+                  }
+                  clickCount++;
+                }
               },
               child: const Text(
                 "杏聆荟健康平台",

+ 11 - 0
lib/routes/routes.dart

@@ -1,4 +1,6 @@
 import 'package:get/get.dart';
+import 'package:vitalapp/pages/admin/controller.dart';
+import 'package:vitalapp/pages/admin/view.dart';
 import 'package:vitalapp/pages/contract/package_list/widgets/capture_portrait.dart';
 import 'package:vitalapp/pages/contract/package_list/widgets/family_doctor_service_package.dart';
 import 'package:vitalapp/pages/contract/package_list/widgets/personal_information.dart';
@@ -64,6 +66,15 @@ class Routes {
   static Map<String, dynamic> parameters = {};
 
   static final routes = [
+    VRouteSetting(
+      '/admin',
+      () => const AdminPage(),
+      binding: BindingsBuilder(
+        () {
+          Get.put(AdminController());
+        },
+      ),
+    ),
     VRouteSetting(
       '/redirect',
       () => const RedirectPage(),

+ 2 - 2
pubspec.lock

@@ -937,8 +937,8 @@ packages:
     dependency: "direct main"
     description:
       path: "."
-      ref: "8192ac50c9"
-      resolved-ref: "8192ac50c958792c8bcc6853d4c44eedde74c1c8"
+      ref: db9fdd33af
+      resolved-ref: db9fdd33af572187fd218f42b410cba2e02983b5
       url: "http://git.ius.plus/Project-Vital/FlutterDevicePlugin.git"
     source: git
     version: "0.0.1"

+ 1 - 1
pubspec.yaml

@@ -51,7 +51,7 @@ dependencies:
   vnote_device_plugin:
     git:
       url: http://git.ius.plus/Project-Vital/FlutterDevicePlugin.git
-      ref: 8192ac50c9
+      ref: db9fdd33af
     # path: ..\FlutterDevicePlugin
   vital_local_database:
     git: