aboutsummaryrefslogtreecommitdiff
path: root/iosApp
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-27 01:14:37 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-27 01:14:37 -0600
commit64c4a58e644229b9d94233b3dd18b7805ffbb8d7 (patch)
tree4e5308546664427389e09f6952b1469ea63a4f39 /iosApp
parentb4cecb08fb3b704733048c02c710dbd9f8205ec6 (diff)
downloadetbsa-trackermap-mobile-64c4a58e644229b9d94233b3dd18b7805ffbb8d7.tar.gz
etbsa-trackermap-mobile-64c4a58e644229b9d94233b3dd18b7805ffbb8d7.tar.bz2
etbsa-trackermap-mobile-64c4a58e644229b9d94233b3dd18b7805ffbb8d7.zip
Renamed LoginView to RootView and implemented LoadingView
Diffstat (limited to 'iosApp')
-rw-r--r--iosApp/iosApp.xcodeproj/project.pbxproj20
-rw-r--r--iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/avalos.xcuserdatad/UserInterfaceState.xcuserstatebin38983 -> 43210 bytes
-rw-r--r--iosApp/iosApp/Session/RootView.swift (renamed from iosApp/iosApp/Session/LoginView.swift)8
-rw-r--r--iosApp/iosApp/Session/RootViewModel.swift (renamed from iosApp/iosApp/Session/LoginViewModel.swift)2
-rw-r--r--iosApp/iosApp/Shared/LoadingView.swift19
5 files changed, 36 insertions, 13 deletions
diff --git a/iosApp/iosApp.xcodeproj/project.pbxproj b/iosApp/iosApp.xcodeproj/project.pbxproj
index 71d898c..d2f7787 100644
--- a/iosApp/iosApp.xcodeproj/project.pbxproj
+++ b/iosApp/iosApp.xcodeproj/project.pbxproj
@@ -10,11 +10,12 @@
058557BB273AAA24004C7B11 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557BA273AAA24004C7B11 /* Assets.xcassets */; };
058557D9273AAEEB004C7B11 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */; };
2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2152FB032600AC8F00CF470E /* iOSApp.swift */; };
- 7555FF83242A565900829871 /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* LoginView.swift */; };
+ 7555FF83242A565900829871 /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7555FF82242A565900829871 /* RootView.swift */; };
E38F241527A242870069FC45 /* Inject.swift in Sources */ = {isa = PBXBuildFile; fileRef = E38F241427A242870069FC45 /* Inject.swift */; };
E38F241727A242C70069FC45 /* Resolver.swift in Sources */ = {isa = PBXBuildFile; fileRef = E38F241627A242C70069FC45 /* Resolver.swift */; };
- E38F241C27A26DD70069FC45 /* LoginViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E38F241B27A26DD70069FC45 /* LoginViewModel.swift */; };
+ E38F241C27A26DD70069FC45 /* RootViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E38F241B27A26DD70069FC45 /* RootViewModel.swift */; };
E38F241E27A270D50069FC45 /* UnitsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E38F241D27A270D50069FC45 /* UnitsView.swift */; };
+ E38F242027A27B550069FC45 /* LoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E38F241F27A27B550069FC45 /* LoadingView.swift */; };
E3E77EDF279D2B5A00150070 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = E3E77EDE279D2B5A00150070 /* Localizable.strings */; };
E3E77EE6279E6CE400150070 /* FlowCollector.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3E77EE5279E6CE400150070 /* FlowCollector.swift */; };
/* End PBXBuildFile section */
@@ -37,12 +38,13 @@
058557D8273AAEEB004C7B11 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
2152FB032600AC8F00CF470E /* iOSApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = iOSApp.swift; sourceTree = "<group>"; };
7555FF7B242A565900829871 /* iosApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = iosApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
- 7555FF82242A565900829871 /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = "<group>"; };
+ 7555FF82242A565900829871 /* RootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = "<group>"; };
7555FF8C242A565B00829871 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E38F241427A242870069FC45 /* Inject.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Inject.swift; sourceTree = "<group>"; };
E38F241627A242C70069FC45 /* Resolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Resolver.swift; sourceTree = "<group>"; };
- E38F241B27A26DD70069FC45 /* LoginViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginViewModel.swift; sourceTree = "<group>"; };
+ E38F241B27A26DD70069FC45 /* RootViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewModel.swift; sourceTree = "<group>"; };
E38F241D27A270D50069FC45 /* UnitsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnitsView.swift; sourceTree = "<group>"; };
+ E38F241F27A27B550069FC45 /* LoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingView.swift; sourceTree = "<group>"; };
E3E77EDE279D2B5A00150070 /* Localizable.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = "<group>"; };
E3E77EE5279E6CE400150070 /* FlowCollector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FlowCollector.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
@@ -116,8 +118,8 @@
E3E77EE0279D43B400150070 /* Session */ = {
isa = PBXGroup;
children = (
- 7555FF82242A565900829871 /* LoginView.swift */,
- E38F241B27A26DD70069FC45 /* LoginViewModel.swift */,
+ 7555FF82242A565900829871 /* RootView.swift */,
+ E38F241B27A26DD70069FC45 /* RootViewModel.swift */,
);
path = Session;
sourceTree = "<group>";
@@ -128,6 +130,7 @@
E3E77EE5279E6CE400150070 /* FlowCollector.swift */,
E38F241427A242870069FC45 /* Inject.swift */,
E38F241627A242C70069FC45 /* Resolver.swift */,
+ E38F241F27A27B550069FC45 /* LoadingView.swift */,
);
path = Shared;
sourceTree = "<group>";
@@ -231,11 +234,12 @@
files = (
E38F241727A242C70069FC45 /* Resolver.swift in Sources */,
E38F241527A242870069FC45 /* Inject.swift in Sources */,
- E38F241C27A26DD70069FC45 /* LoginViewModel.swift in Sources */,
+ E38F241C27A26DD70069FC45 /* RootViewModel.swift in Sources */,
E3E77EE6279E6CE400150070 /* FlowCollector.swift in Sources */,
2152FB042600AC8F00CF470E /* iOSApp.swift in Sources */,
+ E38F242027A27B550069FC45 /* LoadingView.swift in Sources */,
E38F241E27A270D50069FC45 /* UnitsView.swift in Sources */,
- 7555FF83242A565900829871 /* LoginView.swift in Sources */,
+ 7555FF83242A565900829871 /* RootView.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/avalos.xcuserdatad/UserInterfaceState.xcuserstate b/iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/avalos.xcuserdatad/UserInterfaceState.xcuserstate
index 7b173a3..257d7c0 100644
--- a/iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/avalos.xcuserdatad/UserInterfaceState.xcuserstate
+++ b/iosApp/iosApp.xcodeproj/project.xcworkspace/xcuserdata/avalos.xcuserdatad/UserInterfaceState.xcuserstate
Binary files differ
diff --git a/iosApp/iosApp/Session/LoginView.swift b/iosApp/iosApp/Session/RootView.swift
index 0637ff2..1be724a 100644
--- a/iosApp/iosApp/Session/LoginView.swift
+++ b/iosApp/iosApp/Session/RootView.swift
@@ -2,22 +2,22 @@ import SwiftUI
import shared
struct RootView: View {
- @StateObject private var loginViewModel = LoginViewModel()
+ @StateObject private var rootViewModel = RootViewModel()
@State private var username = ""
@State private var password = ""
@State private var server = ""
var body: some View {
- switch loginViewModel.loginState {
+ switch rootViewModel.loginState {
case is SessionController.LoginStateLoading:
- Text("loading")
+ LoadingView()
case is SessionController.LoginStateSuccess:
UnitsView()
default:
LoginContentView(username: $username,
password: $password,
server: $server,
- onLogin: loginViewModel.login)
+ onLogin: rootViewModel.login)
}
}
}
diff --git a/iosApp/iosApp/Session/LoginViewModel.swift b/iosApp/iosApp/Session/RootViewModel.swift
index ee3038e..9c664ef 100644
--- a/iosApp/iosApp/Session/LoginViewModel.swift
+++ b/iosApp/iosApp/Session/RootViewModel.swift
@@ -9,7 +9,7 @@
import Foundation
import shared
-class LoginViewModel: ObservableObject {
+class RootViewModel: ObservableObject {
@Inject private var sessionController: SessionController
@Published var loginState: SessionController.LoginState = SessionController.LoginStateNothing()
diff --git a/iosApp/iosApp/Shared/LoadingView.swift b/iosApp/iosApp/Shared/LoadingView.swift
new file mode 100644
index 0000000..1825113
--- /dev/null
+++ b/iosApp/iosApp/Shared/LoadingView.swift
@@ -0,0 +1,19 @@
+//
+// LoadingView.swift
+// iosApp
+//
+// Created by Iván on 27/01/22.
+// Copyright © 2022 orgName. All rights reserved.
+//
+
+import SwiftUI
+
+struct LoadingView: UIViewRepresentable {
+ func makeUIView(context: Context) -> UIActivityIndicatorView {
+ return UIActivityIndicatorView(style: .large)
+ }
+
+ func updateUIView(_ uiView: UIActivityIndicatorView, context: Context) {
+ uiView.startAnimating()
+ }
+}