Skip to content

Commit 77220b3

Browse files
Refactor and modularize UI components to third-party package
Moved and reorganized various UI components, utilities, and resources from the main project into the third-party/chewie package for better modularity and code reuse. Removed obsolete files from the main project and updated references accordingly. Added localization support and new settings/navigation screens. This refactor improves maintainability and separation of concerns.
1 parent 65e18cd commit 77220b3

File tree

761 files changed

+74433
-21853
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

761 files changed

+74433
-21853
lines changed

l10n.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
arb-dir: lib/l10n
2+
template-arb-file: intl_en.arb
3+
output-localization-file: app_localizations.dart
4+
output-class: AppLocalizations
5+
output-dir: lib/generated
6+
synthetic-package: false

lib/Api/login_api.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ import 'dart:convert';
22
import 'dart:io';
33
import 'dart:typed_data';
44

5+
import 'package:awesome_chewie/awesome_chewie.dart';
56
import 'package:crypto/crypto.dart' as crypto;
67
import 'package:dart_sm/dart_sm.dart';
78
import 'package:dio/dio.dart';
8-
import 'package:loftify/Utils/crypt_util.dart';
99
import 'package:loftify/Utils/request_util.dart';
1010

11-
import '../Utils/ilogger.dart';
12-
1311
class LoginApi {
1412
static String RSA_PUBLIC_KEY =
1513
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAm4re9B8pjX71Up+b97dvV41bEvNTD0e7aaMyPr8FTHkINSrrGqXjz4pQ6x8AbioULXYIrzcMO3LyXolLcjE/+0Ubx8KMu30CS2D7TVHEkaZKqz5EKOgWFeepAL6++klyjXO+vVWSDjb8R6g1VoQKh9MPxLJGqXoFOh9cDahdDRLH1M4a8XboWwljx4CM+vHAuDAwY7i3R4E+bsE+GW5LI7zt/rnTF4tnt0CFazl65SiXthyPJglwCZOF2SLs8JJCrknVoWeDyGBMmQ/0gghK4VMAyFcxHCs8y4v7HtOEsRvS4fksSzLSpyNkhGGuNKHk5tBm5L5m6vApmvUYP6QSdwIDAQAB";

lib/Api/post_api.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:awesome_chewie/awesome_chewie.dart';
12
import 'package:dio/dio.dart';
23

34
import '../Utils/request_util.dart';
@@ -72,7 +73,7 @@ class PostApi {
7273
"checkpwd": 1,
7374
"needgetpoststat": 1,
7475
};
75-
if (Utils.isNotEmpty(blogDomain)) {
76+
if (StringUtil.isNotEmpty(blogDomain)) {
7677
data.addAll({
7778
"blogdomain": blogDomain,
7879
"blogId": blogId,

lib/Api/server_api.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import 'dart:io';
22

3+
import 'package:awesome_chewie/awesome_chewie.dart';
34
import 'package:dio/dio.dart';
45
import 'package:loftify/Utils/app_provider.dart';
56
import 'package:loftify/Utils/cloud_control_provider.dart';
67
import 'package:loftify/Utils/constant.dart';
78
import 'package:loftify/Utils/hive_util.dart';
8-
import 'package:loftify/Widgets/Dialog/dialog_builder.dart';
99

1010
import '../Models/cloud_control.dart';
11-
import '../Utils/ilogger.dart';
1211
import '../Utils/utils.dart';
1312

1413
class ServerApi {
@@ -23,7 +22,7 @@ class ServerApi {
2322
controlProvider.originalCloudControl = cloudControl;
2423
controlProvider.globalControl = cloudControl;
2524
if (cloudControl.enableAppNotNull) {
26-
if (HiveUtil.getBool(HiveUtil.overrideCloudControlKey,
25+
if (ChewieHiveUtil.getBool(HiveUtil.overrideCloudControlKey,
2726
defaultValue: false)) {
2827
controlProvider.globalControl =
2928
LoftifyControl.getOverridedCloudControl(cloudControl);

lib/Database/database_manager.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
import 'dart:async';
22

3+
import 'package:awesome_chewie/awesome_chewie.dart';
34
import 'package:loftify/Database/create_table_sql.dart';
45
import 'package:path/path.dart';
56
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
67

7-
import '../Utils/responsive_util.dart';
8-
98
class DatabaseManager {
109
static const _dbName = "loftify.db";
1110
static const _dbVersion = 1;

lib/Models/cloud_control.dart

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
// }
3737

3838
import 'package:loftify/Utils/constant.dart' as Constant;
39+
import 'package:awesome_chewie/awesome_chewie.dart' as GlobalConstant;
3940

4041
class LoftifyControl {
4142
final bool? enableApp;
@@ -98,18 +99,18 @@ class LoftifyControl {
9899
String get feedbackBody => contacts?.feedbackBody ?? Constant.feedbackBody;
99100

100101
String get officialWebsite =>
101-
contacts?.officialWebsite ?? Constant.officialWebsite;
102+
contacts?.officialWebsite ?? GlobalConstant.officialWebsite;
102103

103104
String get shareText => contacts?.shareText ?? Constant.shareText;
104105

105106
String get downloadPkgsUrl =>
106-
contacts?.downloadPkgsUrl ?? Constant.downloadPkgsUrl;
107+
contacts?.downloadPkgsUrl ?? GlobalConstant.downloadPkgsUrl;
107108

108-
String get repoUrl => contacts?.repoUrl ?? Constant.repoUrl;
109+
String get repoUrl => contacts?.repoUrl ?? GlobalConstant.repoUrl;
109110

110-
String get releaseUrl => contacts?.releaseUrl ?? Constant.releaseUrl;
111+
String get releaseUrl => contacts?.releaseUrl ?? GlobalConstant.releaseUrl;
111112

112-
String get issueUrl => contacts?.issueUrl ?? Constant.issueUrl;
113+
String get issueUrl => contacts?.issueUrl ?? GlobalConstant.issueUrl;
113114

114115
factory LoftifyControl.fromJson(Map<String, dynamic> json) {
115116
return LoftifyControl(
@@ -151,12 +152,12 @@ class LoftifyControl {
151152
feedbackEmail: Constant.feedbackEmail,
152153
feedbackBody: Constant.feedbackBody,
153154
feedbackSubject: Constant.feedbackSubject,
154-
issueUrl: Constant.issueUrl,
155-
repoUrl: Constant.repoUrl,
156-
officialWebsite: Constant.officialWebsite,
155+
issueUrl: GlobalConstant.issueUrl,
156+
repoUrl: GlobalConstant.repoUrl,
157+
officialWebsite: GlobalConstant.officialWebsite,
157158
shareText: Constant.shareText,
158-
downloadPkgsUrl: Constant.downloadPkgsUrl,
159-
releaseUrl: Constant.releaseUrl,
159+
downloadPkgsUrl: GlobalConstant.downloadPkgsUrl,
160+
releaseUrl: GlobalConstant.releaseUrl,
160161
),
161162
features: Features(
162163
showDress: true,

lib/Models/post_detail_response.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import 'package:awesome_chewie/awesome_chewie.dart';
12
import 'package:loftify/Models/recommend_response.dart';
23

3-
import '../Utils/ilogger.dart';
44
import '../Utils/utils.dart';
55
import 'account_response.dart';
66

@@ -297,9 +297,9 @@ class PostDetail {
297297
required this.valid,
298298
required this.viewRank,
299299
}) {
300-
if (Utils.isNotEmpty(embed)) {
300+
if (StringUtil.isNotEmpty(embed)) {
301301
try {
302-
videoInfo = VideoInfo.fromJson(Utils.parseJson(embed ?? "{}"));
302+
videoInfo = VideoInfo.fromJson(StringUtil.parseJson(embed ?? "{}"));
303303
} catch (e, t) {
304304
ILogger.error("Failed to init videoInfo from $embed", e, t);
305305
}

lib/Models/recommend_response.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:awesome_chewie/awesome_chewie.dart';
12
import 'package:loftify/Models/collection_response.dart';
23

34
import '../Utils/utils.dart';
@@ -950,15 +951,15 @@ class VideoInfo {
950951
factory VideoInfo.fromJson(Map<String, dynamic> json) {
951952
json['type'] = "uservideo";
952953
return VideoInfo(
953-
duration: Utils.parseToInt(json['duration']),
954+
duration: NumberUtil.parseToInt(json['duration']),
954955
flashurl: json['flashurl'] ?? "",
955956
h265Url: json['h265Url'] ?? "",
956957
imgHeight: json['imgHeight'] ?? json['img_height'] ?? "",
957958
imgWidth: json['imgWidth'] ?? json['img_width'] ?? "",
958959
originUrl: json['originUrl'] ?? "",
959-
size: Utils.parseToInt(json['size']),
960+
size: NumberUtil.parseToInt(json['size']),
960961
type: json['type'],
961-
vid: Utils.parseToInt(json['vid']),
962+
vid: NumberUtil.parseToInt(json['vid']),
962963
videoFirstImg: json['videoFirstImg'] ?? json['video_first_img'] ?? "",
963964
videoImgUrl: json['videoImgUrl'] ?? json['video_img_url'] ?? "",
964965
);

lib/Models/user_response.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import 'package:awesome_chewie/awesome_chewie.dart';
12
import 'package:loftify/Models/recommend_response.dart';
23

34
import '../Utils/utils.dart';
@@ -487,7 +488,7 @@ class Blogsetting {
487488
hideCommentLike: json['hideCommentLike'],
488489
interestDomainIds: json['interestDomainIds'] ?? "",
489490
interestDomainIdSet: (json['interestDomainIdSet'] as List)
490-
.map((e) => Utils.parseToInt(e))
491+
.map((e) => NumberUtil.parseToInt(e))
491492
.toList(),
492493
interests: json['interests'] ?? "",
493494
locationFlag: json['locationFlag'] ?? 0,

0 commit comments

Comments
 (0)