Skip to content

Commit

Permalink
内存优化,加解密
Browse files Browse the repository at this point in the history
  • Loading branch information
lyming99 committed May 27, 2024
1 parent dca89ee commit b409cbb
Show file tree
Hide file tree
Showing 20 changed files with 182 additions and 208 deletions.
20 changes: 18 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

def keyProperties = new Properties()
def keyPropertiesFile = rootProject.file('key.properties')
if (keyPropertiesFile.exists()) {
keyPropertiesFile.withReader('UTF-8') { reader ->
keyProperties.load(reader)
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
Expand Down Expand Up @@ -52,13 +58,23 @@ android {
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
signingConfigs {
release {
keyAlias keyProperties.getProperty('keyAlias')
keyPassword keyProperties.getProperty('keyPassword')
storeFile file(keyProperties.getProperty('storeFile'))
storePassword keyProperties.getProperty('storePassword')
v1SigningEnabled true
v2SigningEnabled true
}
}
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig signingConfigs.debug
signingConfig signingConfigs.release
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions lib/app/mobile/view/card/study/mobile_study_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ class MobileStudyController extends ServiceManagerController {
playCount = 3;
} else if (playMode == PlayTtsMode.playAll.name) {
playCount = 100000000;
} else if (playMode == PlayTtsMode.none.name) {
playCount = 0;
} else {
playCount = 1;
}
Expand Down
21 changes: 0 additions & 21 deletions lib/app/mobile/view/user/mobile_user_forget_password_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -169,27 +169,6 @@ class MobileUserForgetPasswordPage
"assets/images/app_logo.png",
),
),
Container(
alignment: Alignment.topLeft,
width: 60,
height: 60,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 4,
),
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(4),
),
child: Text(
"预览版",
style: TextStyle(
fontSize: 10,
color: Colors.white,
),
),
),
)
],
);
}
Expand Down
15 changes: 1 addition & 14 deletions lib/app/mobile/view/user/mobile_user_info_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,7 @@ class MobileUserHeaderWidget extends MvcView<MobileUserHeaderController> {
SizedBox(
width: 4,
),
Container(
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(4),
),
padding: EdgeInsets.symmetric(horizontal: 2),
child: Text(
"预览版",
style: TextStyle(
fontSize: 11,
color: Colors.white,
),
),
),

],
),
SizedBox(
Expand Down
21 changes: 0 additions & 21 deletions lib/app/mobile/view/user/mobile_user_login_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,6 @@ class MobileUserLoginPage extends MvcView<MobileUserLoginController> {
"assets/images/app_logo.png",
),
),
Container(
alignment: Alignment.topLeft,
width: 60,
height: 60,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 4,
),
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(4),
),
child: Text(
"预览版",
style: TextStyle(
fontSize: 10,
color: Colors.white,
),
),
),
)
],
),
SizedBox(
Expand Down
39 changes: 1 addition & 38 deletions lib/app/mobile/view/user/mobile_user_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,43 +45,6 @@ class MobileUserPage extends MvcView<MobileUserController> {
Widget buildMenu(BuildContext context) {
return Column(
children: [
// 会员
buildMenuGroup(
context,
ListTile.divideTiles(context: context, tiles: [
// fluent.FluentIcons.crown,
ListTile(
tileColor: MobileTheme.of(context).mobileNavBgColor,
leading: Icon(
fluent.FluentIcons.info,
size: 24,
),
title: Text("预览版"),
trailing: Icon(Icons.arrow_forward_ios_outlined),
onTap: () {
// controller.openBakView(context);
// controller.openLifelongLearningPage();
showDialog(
context: context,
builder: (context) {
return fluent.ContentDialog(
constraints: BoxConstraints(maxWidth: 300,),
content: Text("预览版,有些功能可能无法正常使用,不过可以加QQ群(568359924)反馈你想要用的功能~"),
title: Text("预览版"),
actions: [
fluent.FilledButton(
onPressed: () {
context.pop();
},
child: Text("知道了"),
)
],
);
});
},
),
]),
),
//关于
buildMenuGroup(
context,
Expand Down Expand Up @@ -139,7 +102,7 @@ class MobileUserPage extends MvcView<MobileUserController> {
showAboutDialog(
context: context,
applicationName: "温知笔记",
applicationVersion: "1.0.beta(预览版)",
applicationVersion: "1.0",
applicationIcon: SizedBox(
width: 60,
height: 60,
Expand Down
21 changes: 0 additions & 21 deletions lib/app/mobile/view/user/mobile_user_sign_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,6 @@ class MobileUserSignPage extends MvcView<MobileUserSignController> {
"assets/images/app_logo.png",
),
),
Container(
alignment: Alignment.topLeft,
width: 60,
height: 60,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 4,
),
decoration: BoxDecoration(
color: Colors.red,
borderRadius: BorderRadius.circular(4),
),
child: Text(
"预览版",
style: TextStyle(
fontSize: 10,
color: Colors.white,
),
),
),
)
],
),
SizedBox(
Expand Down
4 changes: 4 additions & 0 deletions lib/app/windows/controller/card/win_card_set_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class WinCardSetController extends ServiceManagerController {
cardSetSubscription?.cancel();
}

void refresh() {
fetchData();
}

Future<void> fetchData() async {
var cardSets = await cardSetService.queryCardSetList();
var showItems = <WinCardSetItemVO>[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ class WinCardStudyController extends WinEditTabController {
playCount = 3;
} else if (playMode == PlayTtsMode.playAll.name) {
playCount = 100000000;
} else if (playMode == PlayTtsMode.none.name) {
playCount = 0;
} else {
playCount = 1;
}
Expand Down
4 changes: 4 additions & 0 deletions lib/app/windows/controller/doc/win_doc_list_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ class WinDocListController extends ServiceManagerController {
docListService.moveToDir(dir, list.map((e) => e.doc ?? e.dir).toList());
}

void refresh(){
searchDoc(docPageController.searchContent.value);
}

Future<void> searchDoc(String text) async {
searchTask?.cancel = true;
searchResultList.clear();
Expand Down
6 changes: 3 additions & 3 deletions lib/app/windows/view/card/win_card_set_config_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import 'package:fluent_ui/fluent_ui.dart' as fluent;
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:wenznote/app/windows/controller/card/win_card_set_config_tab_controller.dart';
import 'package:wenznote/commons/mvc/view.dart';
import 'package:wenznote/editor/theme/theme.dart';
import 'package:wenznote/editor/widget/drop_menu.dart';
import 'package:wenznote/editor/widget/toggle_item.dart';
import 'package:window_manager/window_manager.dart';

class WinCardSetConfigTab extends StatelessWidget {
final WinCardSetConfigTabController controller;
class WinCardSetConfigTab extends MvcView<WinCardSetConfigTabController> {

const WinCardSetConfigTab({
super.key,
required this.controller,
required super.controller,
});

@override
Expand Down
22 changes: 22 additions & 0 deletions lib/app/windows/view/card/win_card_set_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,28 @@ class WinCardSetPage extends MvcView<WinCardSetController> {
child: Column(
children: [
buildSearch(context),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 10.0),
child: Row(
children: [
Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Icon(
Icons.folder,
color: Colors.grey,
),
),
Expanded(child: fluent.Text("我的卡片")),
// 刷新按钮
fluent.IconButton(
icon: Icon(Icons.refresh,size: 16,),
onPressed: () {
controller.refresh();
},
),
],
),
),
Expanded(child: buildContent(context)),
],
),
Expand Down
44 changes: 25 additions & 19 deletions lib/app/windows/view/card/win_create_card_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:convert';
import 'package:fluent_ui/fluent_ui.dart' as fluent;
import 'package:flutter/material.dart';
import 'package:future_progress_dialog/future_progress_dialog.dart';
import 'package:get/get.dart';
import 'package:wenznote/editor/block/element/element.dart';
import 'package:wenznote/editor/block/text/text.dart';
import 'package:wenznote/editor/crdt/doc_utils.dart';
Expand All @@ -16,20 +17,7 @@ import 'package:uuid/uuid.dart';
void showGenerateCardDialog(
BuildContext context, String cardName, List<DocPO> docList) async {
List<String> cats = ["标题1", "标题2", "标题3", "标题4", "标题5", "标题6"];
String? spliteTitle = "标题2";
var box = fluent.ComboBox<String>(
value: "标题2",
items: cats.map<fluent.ComboBoxItem<String>>((e) {
return fluent.ComboBoxItem<String>(
child: Text(e),
value: e,
);
}).toList(),
onChanged: (val) {
spliteTitle = val;
},
placeholder: const Text('Select a cat breed'),
);
var splitTitle = "标题2".obs;
var cardNameController = TextEditingController(text: cardName);
showDialog(
context: context,
Expand All @@ -48,7 +36,22 @@ void showGenerateCardDialog(
Row(
children: [
Text("分割类型: "),
Expanded(child: box),
Expanded(
child: Obx(
() => fluent.ComboBox<String>(
placeholder: Text("请选择分割类型 "),
value: splitTitle.value,
items: cats.map<fluent.ComboBoxItem<String>>((e) {
return fluent.ComboBoxItem<String>(
child: Text(e),
value: e,
);
}).toList(),
onChanged: (val) {
splitTitle.value = val ?? "";
},
),
)),
],
),
SizedBox(
Expand Down Expand Up @@ -86,8 +89,11 @@ void showGenerateCardDialog(
builder: (context) => FutureProgressDialog(
message: const Text("正在生成中..."),
() async {
await _generateCard(context, cardNameController.text,
docList, spliteTitle);
await _generateCard(
context,
cardNameController.text,
docList,
splitTitle.value);
}(),
));
},
Expand Down Expand Up @@ -159,7 +165,7 @@ Future<void> _generateCard(
}
await createCard(serviceManager.cardService, cardSet, saveList, current);
if (saveList.isNotEmpty) {
await serviceManager.cardService.insertCards(cardSet.uuid,saveList);
await serviceManager.cardService.insertCards(cardSet.uuid, saveList);
saveList.clear();
}
}
Expand All @@ -180,7 +186,7 @@ Future<void> createCard(CardService cardService, CardSetPO set,
updateTime: DateTime.now().millisecondsSinceEpoch,
));
if (saveList.length > 1000) {
await cardService.insertCards(set.uuid,saveList);
await cardService.insertCards(set.uuid, saveList);
saveList.clear();
}
}
7 changes: 7 additions & 0 deletions lib/app/windows/view/doc/win_doc_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ class WinDocListView extends MvcView<WinDocListController> {
),
),
Expanded(child: buildPath(context)),
// 刷新按钮
fluent.IconButton(
icon: Icon(Icons.refresh,size: 16,),
onPressed: () {
controller.refresh();
},
),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/app/windows/view/home/win_home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ class WinHomePage extends MvcView<WinHomeController> {
showAboutDialog(
context: context,
applicationName: "温知笔记",
applicationVersion: "1.0.beta(预览版)",
applicationVersion: "1.0",
applicationIcon: SizedBox(
width: 60,
height: 60,
Expand Down
Loading

0 comments on commit b409cbb

Please sign in to comment.