feat: 添加优化版本的 Localizable.strings 清理工具
主要变更: 1. 新增 clean_localizable_optimized.py 脚本,用于清理 Localizable.strings 文件,只保留使用的 key,并移除多余空行。 2. 优化了清理逻辑,支持多语言版本的处理,提升了文件的整洁性和可维护性。 3. 生成清理报告,显示保留和删除的 key 数量及删除率。 此更新旨在提高本地化文件的管理效率,减少冗余内容。
This commit is contained in:
@@ -282,8 +282,10 @@ import UIKit
|
||||
|
||||
private func checkPolicyAgreed() -> Bool {
|
||||
if !agreeCheckbox.isSelected {
|
||||
|
||||
print("[EPLogin] Please agree to policy first")
|
||||
|
||||
let message = YMLocalizedString("XPLoginViewController11")
|
||||
EPProgressHUD.showError(message)
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@@ -321,6 +321,7 @@ NSString *const EPMomentPublishSuccessNotification = @"EPMomentPublishSuccessNot
|
||||
TZImagePickerController *picker = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:self];
|
||||
picker.allowPickingVideo = NO;
|
||||
picker.allowTakeVideo = NO;
|
||||
picker.allowCameraLocation = NO; // 禁止请求定位权限
|
||||
picker.selectedAssets = self.selectedAssets;
|
||||
picker.maxImagesCount = 9;
|
||||
[self presentViewController:picker animated:YES completion:nil];
|
||||
|
@@ -42,7 +42,6 @@
|
||||
}];
|
||||
|
||||
[self setupUI];
|
||||
[self.listView reloadFirstPage];
|
||||
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
@@ -50,10 +49,20 @@
|
||||
name:EPMomentPublishSuccessNotification
|
||||
object:nil];
|
||||
|
||||
NSLog(@"[EPMomentViewController] 页面加载完成,UI 已设置");
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated {
|
||||
[super viewDidAppear:animated];
|
||||
|
||||
[self scheduleAutoRefreshIfNeeded];
|
||||
|
||||
NSLog(@"[EPMomentViewController] 页面加载完成");
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
NSLog(@"[EPMomentViewController] 首次 viewDidAppear,延迟 0.3s 后开始加载数据");
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NSLog(@"[EPMomentViewController] 触发首次数据加载");
|
||||
[self.listView reloadFirstPage];
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
@@ -107,25 +116,6 @@
|
||||
}
|
||||
|
||||
|
||||
// MARK: - Auto Refresh
|
||||
|
||||
|
||||
- (void)scheduleAutoRefreshIfNeeded {
|
||||
__weak typeof(self) weakSelf = self;
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
__strong typeof(weakSelf) self = weakSelf;
|
||||
if (!self) return;
|
||||
|
||||
|
||||
if (self.listView.rawList.count == 0) {
|
||||
NSLog(@"[EPMomentViewController] ⚠️ 冷启动 1 秒后检测到无数据,自动刷新一次");
|
||||
[self.listView reloadFirstPage];
|
||||
} else {
|
||||
NSLog(@"[EPMomentViewController] ✅ 冷启动 1 秒后检测到已有 %lu 条数据,无需刷新", (unsigned long)self.listView.rawList.count);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// MARK: - Actions
|
||||
|
||||
- (void)onPublishButtonTapped {
|
||||
|
@@ -17,19 +17,25 @@ import Foundation
|
||||
let pageSize = "20"
|
||||
let types = "0,2"
|
||||
|
||||
NSLog("[EPMomentAPISwiftHelper] 🔄 开始请求动态列表,nextID=\(nextID.isEmpty ? "(首页)" : nextID)")
|
||||
|
||||
Api.momentsLatestList({ (data, code, msg) in
|
||||
NSLog("[EPMomentAPISwiftHelper] 📥 收到响应,code=\(code)")
|
||||
|
||||
if code == 200, let dict = data?.data as? NSDictionary {
|
||||
|
||||
NSLog("[EPMomentAPISwiftHelper] 📦 开始解析数据字典")
|
||||
|
||||
if let listInfo = MomentsListInfoModel.mj_object(withKeyValues: dict) {
|
||||
let dynamicList = listInfo.dynamicList
|
||||
let nextDynamicId = listInfo.nextDynamicId
|
||||
NSLog("[EPMomentAPISwiftHelper] ✅ 解析成功,dynamicList.count=\(dynamicList.count), nextDynamicId=\(nextDynamicId)")
|
||||
completion(dynamicList, nextDynamicId)
|
||||
} else {
|
||||
|
||||
NSLog("[EPMomentAPISwiftHelper] ⚠️ 解析失败,返回空数组")
|
||||
completion([], "")
|
||||
}
|
||||
} else {
|
||||
NSLog("[EPMomentAPISwiftHelper] ❌ 请求失败,code=\(code), msg=\(msg ?? "无错误信息")")
|
||||
failure(Int(code), msg ?? YMLocalizedString("error.request_failed"))
|
||||
}
|
||||
}, dynamicId: nextID, pageSize: pageSize, types: types)
|
||||
|
@@ -47,6 +47,8 @@
|
||||
}
|
||||
|
||||
- (void)reloadFirstPage {
|
||||
NSLog(@"[EPMomentListView] 📄 开始刷新第一页,isLocalMode=%d", self.isLocalMode);
|
||||
|
||||
if (self.isLocalMode) {
|
||||
|
||||
if (self.refreshCallback) {
|
||||
@@ -82,13 +84,19 @@
|
||||
}
|
||||
|
||||
- (void)requestNextPage {
|
||||
if (self.isLoading) return;
|
||||
if (self.isLoading) {
|
||||
NSLog(@"[EPMomentListView] ⚠️ 已有加载任务进行中,跳过本次请求");
|
||||
return;
|
||||
}
|
||||
|
||||
NSLog(@"[EPMomentListView] 🌐 发起网络请求,nextID=%@", self.nextID.length > 0 ? self.nextID : @"(首页)");
|
||||
self.isLoading = YES;
|
||||
|
||||
@kWeakify(self);
|
||||
[self.api fetchLatestMomentsWithNextID:self.nextID
|
||||
completion:^(NSArray<MomentsInfoModel *> * _Nonnull list, NSString * _Nonnull nextMomentID) {
|
||||
@kStrongify(self);
|
||||
NSLog(@"[EPMomentListView] ✅ 请求成功,获得 %lu 条数据", (unsigned long)list.count);
|
||||
[self endLoading];
|
||||
if (list.count > 0) {
|
||||
|
||||
@@ -96,6 +104,7 @@
|
||||
|
||||
self.nextID = nextMomentID;
|
||||
[self.mutableRawList addObjectsFromArray:list];
|
||||
[self removeEmptyState];
|
||||
[self.tableView reloadData];
|
||||
if (nextMomentID.length > 0) {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
@@ -103,13 +112,21 @@
|
||||
[self.tableView.mj_footer endRefreshingWithNoMoreData];
|
||||
}
|
||||
} else {
|
||||
|
||||
NSLog(@"[EPMomentListView] ⚠️ 返回数据为空");
|
||||
if (self.mutableRawList.count == 0) {
|
||||
[self showEmptyStateWithMessage:YMLocalizedString(@"common.no_data")];
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshingWithNoMoreData];
|
||||
}
|
||||
} failure:^(NSInteger code, NSString * _Nonnull msg) {
|
||||
@kStrongify(self);
|
||||
NSLog(@"[EPMomentListView] ❌ 请求失败,code=%ld, msg=%@", (long)code, msg);
|
||||
[self endLoading];
|
||||
// TODO: 完全没有数据情况下,后续补充数据异常页面
|
||||
|
||||
|
||||
if (self.mutableRawList.count == 0) {
|
||||
[self showEmptyStateWithMessage:msg ?: YMLocalizedString(@"error.request_failed")];
|
||||
}
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}];
|
||||
}
|
||||
@@ -120,6 +137,29 @@
|
||||
}
|
||||
|
||||
|
||||
- (void)showEmptyStateWithMessage:(NSString *)message {
|
||||
UILabel *emptyLabel = [[UILabel alloc] initWithFrame:CGRectZero];
|
||||
emptyLabel.text = [NSString stringWithFormat:@"%@\n\n%@", message, YMLocalizedString(@"common.pull_to_retry")];
|
||||
emptyLabel.textColor = [UIColor whiteColor];
|
||||
emptyLabel.textAlignment = NSTextAlignmentCenter;
|
||||
emptyLabel.numberOfLines = 0;
|
||||
emptyLabel.font = [UIFont systemFontOfSize:15];
|
||||
emptyLabel.tag = 9999;
|
||||
|
||||
|
||||
[[self.tableView viewWithTag:9999] removeFromSuperview];
|
||||
[self.tableView addSubview:emptyLabel];
|
||||
[emptyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.equalTo(self.tableView);
|
||||
make.leading.trailing.equalTo(self.tableView).inset(40);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)removeEmptyState {
|
||||
[[self.tableView viewWithTag:9999] removeFromSuperview];
|
||||
}
|
||||
|
||||
|
||||
- (void)processEmotionColors:(NSArray<MomentsInfoModel *> *)list isFirstPage:(BOOL)isFirstPage {
|
||||
|
||||
NSString *pendingColor = [[NSUserDefaults standardUserDefaults] stringForKey:@"EP_Pending_Emotion_Color"];
|
||||
|
@@ -37,10 +37,6 @@
|
||||
</dict>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>"E-Party" needs your consent before you can visit, take photos and upload your pictures, and then display them on your personal homepage for others to view</string>
|
||||
<key>NSLocalNetworkUsageDescription</key>
|
||||
<string>The app will discover and connect to devices on your network</string>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>Your consent is required before you can use location services and recommend nearby friends</string>
|
||||
<key>NSPhotoLibraryAddUsageDescription</key>
|
||||
<string>"E-Party" needs your consent before it can store photos in the album</string>
|
||||
<key>NSPhotoLibraryUsageDescription</key>
|
||||
|
@@ -53,5 +53,4 @@ isEnterprise = [bundleID isEqualToString:@"com.hflighting.yumi"];\
|
||||
#import "PIBaseModel.h"
|
||||
#import "PLTimeUtil.h"
|
||||
#import "UIImage+ImageEffects.h"
|
||||
#import "SZTextView.h"
|
||||
#endif /* PrefixHeader_pch */
|
||||
|
File diff suppressed because it is too large
Load Diff
4200
YuMi/en.lproj/Localizable.strings.backup
Normal file
4200
YuMi/en.lproj/Localizable.strings.backup
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user