Add TabView for authenticated users

Signed-off-by: Billy Brawner <billy@wbrawner.com>
This commit is contained in:
Billy Brawner 2019-09-29 20:49:03 -07:00
parent 2f076d5c58
commit 1053fa91f8
5 changed files with 42 additions and 6 deletions

View file

@ -519,13 +519,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"Budget/Preview Content\"";
DEVELOPMENT_TEAM = VJ33S6H7W7;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = Budget/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.wbrawner.Budget;
PRODUCT_BUNDLE_IDENTIFIER = com.wbrawner.budget.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
@ -538,13 +539,14 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"Budget/Preview Content\"";
DEVELOPMENT_TEAM = VJ33S6H7W7;
ENABLE_PREVIEWS = YES;
INFOPLIST_FILE = Budget/Info.plist;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = com.wbrawner.Budget;
PRODUCT_BUNDLE_IDENTIFIER = com.wbrawner.budget.ios;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";

View file

@ -12,11 +12,16 @@ import SwiftUI
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
let baseUrl = "http://localhost:8080"
let userRepository: UserRepository
override init() {
// TODO: Dependency injection?
#if DEBUG
// let baseUrl = "http://localhost:8080"
let baseUrl = "https://budget-api.intra.wbrawner.com"
#else
let baseUrl = "https://budget-api.intra.wbrawner.com"
#endif
let requestHelper = RequestHelper(baseUrl: baseUrl)
let apiService = BudgetApiService(requestHelper: requestHelper)
userRepository = UserRepository(apiService: apiService)
@ -30,7 +35,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
// Create the SwiftUI view that provides the window contents.
let contentView = ContentView(UserDataStore(self.userRepository))
// Use a UIHostingController as window root view controller.
if let windowScene = scene as? UIWindowScene {
let window = UIWindow(windowScene: windowScene)

View file

@ -10,9 +10,27 @@ import SwiftUI
struct TabbedBudgetView: View {
@ObservedObject var userData: UserDataStore
var body: some View {
Text("You're authenticated as \(userData.currentUser!.username)")
NavigationView {
TabView {
Text("Transactions here")
.tabItem {
Image(systemName: "dollarsign.circle")
Text("transactions")
}
Text("Budgets here")
.tabItem {
Image(systemName: "chart.pie.fill")
Text("budgets")
}
Text("Profile here")
.tabItem {
Image(systemName: "person")
Text("profile")
}
}
}
}
init (_ userData: UserDataStore) {

View file

@ -13,3 +13,9 @@
"action_login" = "Login";
"loading_login" = "Logging in...";
"loading_default" = "Loading...";
// MARK: Transactions
"transactions" = "Transactions";
// MARK: Budgets
"budgets" = "Budgets";

View file

@ -13,3 +13,9 @@
"action_login" = "Inicia sesión";
"loading_login" = "Iniciando sesión...";
"loading_default" = "Cargando...";
// MARK: Transactions
"transactions" = "Transacciones";
// MARK: Budgets
"budgets" = "Presupuestos";