Skip to content

Commit

Permalink
deprecate infotableview
Browse files Browse the repository at this point in the history
  • Loading branch information
guanlisheng committed Sep 19, 2024
1 parent d262c82 commit 57a186b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 80 deletions.
12 changes: 0 additions & 12 deletions MMEX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
A37E7D922C9AC60000B4ECFC /* ContactSupportView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A37E7D912C9AC60000B4ECFC /* ContactSupportView.swift */; };
A37E7D942C9B217500B4ECFC /* Infotable.swift in Sources */ = {isa = PBXBuildFile; fileRef = A37E7D932C9B217500B4ECFC /* Infotable.swift */; };
A37E7D962C9B219400B4ECFC /* InfotableRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = A37E7D952C9B219400B4ECFC /* InfotableRepository.swift */; };
A37E7D982C9B22B700B4ECFC /* InfoTableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A37E7D972C9B22B700B4ECFC /* InfoTableView.swift */; };
A37E7D9A2C9BC28900B4ECFC /* Row.swift in Sources */ = {isa = PBXBuildFile; fileRef = A37E7D992C9BC28900B4ECFC /* Row.swift */; };
A39B1B322C99A084003E5562 /* CurrencyAddView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A39B1B312C99A084003E5562 /* CurrencyAddView.swift */; };
A39B1B342C99A0A8003E5562 /* CurrencyDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A39B1B332C99A0A8003E5562 /* CurrencyDetailView.swift */; };
Expand Down Expand Up @@ -86,7 +85,6 @@
A37E7D912C9AC60000B4ECFC /* ContactSupportView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContactSupportView.swift; sourceTree = "<group>"; };
A37E7D932C9B217500B4ECFC /* Infotable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Infotable.swift; sourceTree = "<group>"; };
A37E7D952C9B219400B4ECFC /* InfotableRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfotableRepository.swift; sourceTree = "<group>"; };
A37E7D972C9B22B700B4ECFC /* InfoTableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InfoTableView.swift; sourceTree = "<group>"; };
A37E7D992C9BC28900B4ECFC /* Row.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Row.swift; sourceTree = "<group>"; };
A39B1B312C99A084003E5562 /* CurrencyAddView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyAddView.swift; sourceTree = "<group>"; };
A39B1B332C99A0A8003E5562 /* CurrencyDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyDetailView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -157,14 +155,6 @@
path = Export;
sourceTree = "<group>";
};
A37E7D7E2C9ABEA900B4ECFC /* Info */ = {
isa = PBXGroup;
children = (
A37E7D972C9B22B700B4ECFC /* InfoTableView.swift */,
);
path = Info;
sourceTree = "<group>";
};
A39B1B392C9A668F003E5562 /* Accounts */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -309,7 +299,6 @@
A3C142452C89CB1600D3CEC0 /* Views */ = {
isa = PBXGroup;
children = (
A37E7D7E2C9ABEA900B4ECFC /* Info */,
A39B1B3E2C9A6714003E5562 /* Settings */,
A39B1B3D2C9A66F7003E5562 /* Currencies */,
A39B1B3C2C9A66E6003E5562 /* Categories */,
Expand Down Expand Up @@ -448,7 +437,6 @@
A3C142652C8ED8EA00D3CEC0 /* AccountEditView.swift in Sources */,
A3C142632C8ED8C000D3CEC0 /* AccountAddView.swift in Sources */,
A3C142A22C90267F00D3CEC0 /* CategoryRepository.swift in Sources */,
A37E7D982C9B22B700B4ECFC /* InfoTableView.swift in Sources */,
A37E7D862C9AC2D000B4ECFC /* AboutView.swift in Sources */,
A3363EE92C9326A1004696C7 /* CategoryListView.swift in Sources */,
A3C142A02C9025D600D3CEC0 /* Category.swift in Sources */,
Expand Down
63 changes: 0 additions & 63 deletions MMEX/Views/Info/InfoTableView.swift

This file was deleted.

23 changes: 18 additions & 5 deletions MMEX/Views/ManagementView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ struct ManagementView: View {

@State private var currencies: [Currency] = []
@State private var accounts: [Account] = []
@State private var schemaVersion: Int32 = 0
@State private var dateFormat: String = ""
@State private var baseCurrencyID: Int64 = 0
@State private var defaultAccountID: Int64 = 0

Expand All @@ -35,12 +37,19 @@ struct ManagementView: View {
Text("Manage Currencies")
}
}
Section(header: Text("Database Level Info")) {
InfoTableView(databaseURL: databaseURL)
}


// Section: Default Behavior Setting
Section(header: Text("Behavior")) {
Section(header: Text("Per-Database Data")) {
HStack {
Text("Schema Version")
Spacer()
Text("\(schemaVersion)")
}
HStack {
Text("Date Format")
Spacer()
Text("\(dateFormat)")
}
Picker("Base Currency", selection: $baseCurrencyID) {
ForEach(currencies) { currency in
Text(currency.name).tag(currency.id) // Use currency.name to display and tag by id
Expand Down Expand Up @@ -78,6 +87,10 @@ struct ManagementView: View {
loadAccounts()
loadCurrencies()
let repository = DataManager(databaseURL: databaseURL).getInfotableRepository()
schemaVersion = repository.db?.userVersion ?? 0
if let storedDateFormat = repository.getValue(for: InfoKey.dateFormat.id, as: String.self) {
dateFormat = storedDateFormat
}
if let storedBaseCurrency = repository.getValue(for:InfoKey.baseCurrencyID.id, as: Int64.self) {
baseCurrencyID = storedBaseCurrency
}
Expand Down

0 comments on commit 57a186b

Please sign in to comment.