@@ -7,9 +7,9 @@ class DataRecordSettingsViewController: UIViewController, UITableViewDelegate, U
77
88 private let settingsUtils = SettingsUtils . instance
99
10- private let tableTitleList = [ nil , NSLocalizedString ( " RecordFrequencySettings " , comment: " 记录频率设置 " ) , nil ]
10+ private let tableTitleList = [ nil , NSLocalizedString ( " RecordFrequencySettings " , comment: " 记录频率设置 " ) , nil , nil ]
1111
12- private let tableCellList = [ [ NSLocalizedString ( " Enable " , comment: " 启用 " ) , NSLocalizedString ( " HistoryRecordViewInHomeView " , comment: " 在主界面显示历史记录界面 " ) ] , [ NSLocalizedString ( " Automatic " , comment: " " ) , NSLocalizedString ( " DataChanged " , comment: " " ) , NSLocalizedString ( " EveryDay " , comment: " " ) , NSLocalizedString ( " Manual " , comment: " " ) ] , [ NSLocalizedString ( " DeleteAllRecords " , comment: " " ) ] ]
12+ private let tableCellList = [ [ NSLocalizedString ( " Enable " , comment: " 启用 " ) , NSLocalizedString ( " HistoryRecordViewInHomeView " , comment: " 在主界面显示历史记录界面 " ) ] , [ NSLocalizedString ( " Automatic " , comment: " " ) , NSLocalizedString ( " DataChanged " , comment: " " ) , NSLocalizedString ( " EveryDay " , comment: " " ) , NSLocalizedString ( " Manual " , comment: " " ) ] , [ NSLocalizedString ( " ExportAllRecordsToCSV " , comment : " " ) ] , [ NSLocalizedString ( " DeleteAllRecords " , comment: " " ) ] ]
1313
1414 private var reloadMainTabBar = false
1515
@@ -94,6 +94,9 @@ class DataRecordSettingsViewController: UIViewController, UITableViewDelegate, U
9494 cell. accessoryType = . none
9595 }
9696 } else if indexPath. section == 2 {
97+ cell. textLabel? . textAlignment = . center
98+ cell. textLabel? . textColor = . systemBlue
99+ } else if indexPath. section == 3 {
97100 cell. textLabel? . textAlignment = . center
98101 cell. textLabel? . textColor = . systemRed
99102 }
@@ -113,6 +116,12 @@ class DataRecordSettingsViewController: UIViewController, UITableViewDelegate, U
113116 // 设置当前的cell选中状态
114117 tableView. cellForRow ( at: indexPath) ? . accessoryType = . checkmark
115118 } else if indexPath. section == 2 {
119+ // 导出记录为CSV
120+ if let csvFileURL = BatteryRecordDatabaseManager . shared. exportToCSV ( ) {
121+ let activityVC = UIActivityViewController ( activityItems: [ csvFileURL] , applicationActivities: nil )
122+ present ( activityVC, animated: true , completion: nil )
123+ }
124+ } else if indexPath. section == 3 {
116125 // 删除全部数据的按钮
117126 let alert = UIAlertController (
118127 title: NSLocalizedString ( " DeleteAllRecordsTitle " , comment: " 确定要删除所有数据吗? " ) ,
0 commit comments