Adding account
This commit is contained in:
parent
f1dcc9016d
commit
1b3b563af6
17 changed files with 531 additions and 144 deletions
12
sdk/Sources/Sdk/Extensions/api.swift
Normal file
12
sdk/Sources/Sdk/Extensions/api.swift
Normal file
|
@ -0,0 +1,12 @@
|
|||
//
|
||||
// api.swift
|
||||
//
|
||||
//
|
||||
// Created by Tomasz on 02/03/2021.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
func apiRequest(endpointURL: URL) {
|
||||
print("dupa")
|
||||
}
|
|
@ -10,12 +10,13 @@ import Foundation
|
|||
import Combine
|
||||
import os
|
||||
import KeychainAccess
|
||||
import SwiftyJSON
|
||||
|
||||
@available (iOS 14, macOS 11, watchOS 7, tvOS 14, *)
|
||||
public class Sdk {
|
||||
static private let libraryVersion: String = "0.0.1"
|
||||
|
||||
private let loggerSubsystem: String = "com.wulkanowy-ios.Sdk"
|
||||
private let loggerSubsystem: String = "io.wulkanowy-ios.Sdk"
|
||||
private var cancellables: Set<AnyCancellable> = []
|
||||
|
||||
var firebaseToken: String!
|
||||
|
@ -259,7 +260,12 @@ public class Sdk {
|
|||
print(error)
|
||||
} else if let data = data {
|
||||
// Handle HTTP request response
|
||||
print(String(data: data, encoding: String.Encoding.utf8) as Any)
|
||||
let responseBody = String(data: data, encoding: String.Encoding.utf8)
|
||||
|
||||
|
||||
let keychain = Keychain()
|
||||
keychain["students"] = responseBody
|
||||
|
||||
} else {
|
||||
// Handle unexpected error
|
||||
}
|
||||
|
|
|
@ -6,7 +6,11 @@
|
|||
//
|
||||
|
||||
import Foundation
|
||||
import KeychainAccess
|
||||
|
||||
public func getLuckyNumber() -> Int {
|
||||
/*let keychain = Keychain()
|
||||
endpointURL = keychain["endpointURL"]
|
||||
luckyNumber = apiRequest(endpointURL: endpointURL)*/
|
||||
return 7
|
||||
}
|
||||
|
|
|
@ -17,16 +17,19 @@
|
|||
5C2D331425E650EC000253AC /* exams.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C2D331325E650EC000253AC /* exams.swift */; };
|
||||
5C2D331825E651C4000253AC /* homework.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C2D331725E651C4000253AC /* homework.swift */; };
|
||||
5C2D331C25E651FB000253AC /* more.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C2D331B25E651FB000253AC /* more.swift */; };
|
||||
5C42E2A225EE656E0048DDCD /* SwiftyJSON in Frameworks */ = {isa = PBXBuildFile; productRef = 5C42E2A125EE656E0048DDCD /* SwiftyJSON */; };
|
||||
5C478F3525DC742100ABEFB7 /* VulcanStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C478F3425DC742100ABEFB7 /* VulcanStore.swift */; };
|
||||
5C75212125EF814400D75CE3 /* CustomButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C75212025EF814400D75CE3 /* CustomButtonView.swift */; };
|
||||
5C89C8F525EA6AA4000B5816 /* licenses.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C89C8F425EA6AA4000B5816 /* licenses.swift */; };
|
||||
5C89C90625EA7996000B5816 /* SwiftUIEKtensions in Frameworks */ = {isa = PBXBuildFile; productRef = 5C89C90525EA7996000B5816 /* SwiftUIEKtensions */; };
|
||||
5C9B6F4925D6C08D00C3F5F5 /* Sdk in Frameworks */ = {isa = PBXBuildFile; productRef = 5C9B6F4825D6C08D00C3F5F5 /* Sdk */; };
|
||||
5CB9907225EE4A3200AA405C /* CustomButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CB9907125EE4A3200AA405C /* CustomButtonView.swift */; };
|
||||
5CB9907625EE4A3B00AA405C /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CB9907525EE4A3B00AA405C /* OnboardingView.swift */; };
|
||||
5CC2EAA525E516F100B6183E /* dashboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CC2EAA425E516F100B6183E /* dashboard.swift */; };
|
||||
5CC2EAAE25E526B500B6183E /* navigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CC2EAAD25E526B500B6183E /* navigation.swift */; };
|
||||
5CCAE31625DA4CDD00D87580 /* OpenSSL in Frameworks */ = {isa = PBXBuildFile; productRef = 5CCAE31525DA4CDD00D87580 /* OpenSSL */; };
|
||||
5CCB276325EF9C4A00482F4A /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CCB276225EF9C4A00482F4A /* OnboardingView.swift */; };
|
||||
5CEA516B25D540B900DB45BD /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 5CEA516D25D540B900DB45BD /* Localizable.strings */; };
|
||||
5CF095AD25F053B10068F2C6 /* accountManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF095AC25F053B10068F2C6 /* accountManager.swift */; };
|
||||
5CF6695F25EEE2FD00AC0A86 /* chooseStudent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CF6695E25EEE2FD00AC0A86 /* chooseStudent.swift */; };
|
||||
F4C6D9082544E17400F8903A /* wulkanowyApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4C6D9072544E17400F8903A /* wulkanowyApp.swift */; };
|
||||
F4C6D90A2544E17400F8903A /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F4C6D9092544E17400F8903A /* LoginView.swift */; };
|
||||
F4C6D90C2544E17500F8903A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F4C6D90B2544E17500F8903A /* Assets.xcassets */; };
|
||||
|
@ -86,14 +89,16 @@
|
|||
5C2D331725E651C4000253AC /* homework.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = homework.swift; sourceTree = "<group>"; };
|
||||
5C2D331B25E651FB000253AC /* more.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = more.swift; sourceTree = "<group>"; };
|
||||
5C478F3425DC742100ABEFB7 /* VulcanStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VulcanStore.swift; sourceTree = "<group>"; };
|
||||
5C75212025EF814400D75CE3 /* CustomButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomButtonView.swift; sourceTree = "<group>"; };
|
||||
5C89C8F425EA6AA4000B5816 /* licenses.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = licenses.swift; sourceTree = "<group>"; };
|
||||
5C9B6E4925D6ADFB00C3F5F5 /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; };
|
||||
5C9B6F4525D6C06D00C3F5F5 /* Sdk */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Sdk; sourceTree = "<group>"; };
|
||||
5CB9907125EE4A3200AA405C /* CustomButtonView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CustomButtonView.swift; path = ../../../../../../Shared/CustomButtonView.swift; sourceTree = "<group>"; };
|
||||
5CB9907525EE4A3B00AA405C /* OnboardingView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = OnboardingView.swift; path = ../../../../../../Onboarding/OnboardingView.swift; sourceTree = "<group>"; };
|
||||
5CC2EAA425E516F100B6183E /* dashboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dashboard.swift; sourceTree = "<group>"; };
|
||||
5CC2EAAD25E526B500B6183E /* navigation.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = navigation.swift; sourceTree = "<group>"; };
|
||||
5CCB276225EF9C4A00482F4A /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = "<group>"; };
|
||||
5CEA516C25D540B900DB45BD /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = "<group>"; };
|
||||
5CF095AC25F053B10068F2C6 /* accountManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = accountManager.swift; sourceTree = "<group>"; };
|
||||
5CF6695E25EEE2FD00AC0A86 /* chooseStudent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = chooseStudent.swift; sourceTree = "<group>"; };
|
||||
5CF81BD725D9D44400B12C4C /* pl-PL */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pl-PL"; path = "pl-PL.lproj/Localizable.strings"; sourceTree = "<group>"; };
|
||||
F4C6D9042544E17400F8903A /* wulkanowy.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = wulkanowy.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F4C6D9072544E17400F8903A /* wulkanowyApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = wulkanowyApp.swift; sourceTree = "<group>"; };
|
||||
|
@ -117,6 +122,7 @@
|
|||
5C9B6F4925D6C08D00C3F5F5 /* Sdk in Frameworks */,
|
||||
5CCAE31625DA4CDD00D87580 /* OpenSSL in Frameworks */,
|
||||
5C1794CD25E90DBD007AD91A /* KeychainAccess in Frameworks */,
|
||||
5C42E2A225EE656E0048DDCD /* SwiftyJSON in Frameworks */,
|
||||
5C89C90625EA7996000B5816 /* SwiftUIEKtensions in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -170,6 +176,7 @@
|
|||
5C1B849F25E1B7A30074F29D /* Login */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5CF6695E25EEE2FD00AC0A86 /* chooseStudent.swift */,
|
||||
F4C6D9092544E17400F8903A /* LoginView.swift */,
|
||||
);
|
||||
path = Login;
|
||||
|
@ -186,7 +193,7 @@
|
|||
5CB9906F25EE4A1C00AA405C /* Onboarding */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5CB9907525EE4A3B00AA405C /* OnboardingView.swift */,
|
||||
5CCB276225EF9C4A00482F4A /* OnboardingView.swift */,
|
||||
);
|
||||
path = Onboarding;
|
||||
sourceTree = "<group>";
|
||||
|
@ -194,7 +201,7 @@
|
|||
5CB9907025EE4A2400AA405C /* Shared */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
5CB9907125EE4A3200AA405C /* CustomButtonView.swift */,
|
||||
5C75212025EF814400D75CE3 /* CustomButtonView.swift */,
|
||||
);
|
||||
path = Shared;
|
||||
sourceTree = "<group>";
|
||||
|
@ -212,6 +219,7 @@
|
|||
5C1794BB25E8FE19007AD91A /* settings.swift */,
|
||||
5C1794BF25E8FE27007AD91A /* about.swift */,
|
||||
5C89C8F425EA6AA4000B5816 /* licenses.swift */,
|
||||
5CF095AC25F053B10068F2C6 /* accountManager.swift */,
|
||||
);
|
||||
path = Content;
|
||||
sourceTree = "<group>";
|
||||
|
@ -309,6 +317,7 @@
|
|||
5CCAE31525DA4CDD00D87580 /* OpenSSL */,
|
||||
5C1794CC25E90DBD007AD91A /* KeychainAccess */,
|
||||
5C89C90525EA7996000B5816 /* SwiftUIEKtensions */,
|
||||
5C42E2A125EE656E0048DDCD /* SwiftyJSON */,
|
||||
);
|
||||
productName = wulkanowy;
|
||||
productReference = F4C6D9042544E17400F8903A /* wulkanowy.app */;
|
||||
|
@ -386,6 +395,7 @@
|
|||
5CCAE31025DA4CCA00D87580 /* XCRemoteSwiftPackageReference "OpenSSL" */,
|
||||
5C1794CB25E90DBD007AD91A /* XCRemoteSwiftPackageReference "KeychainAccess" */,
|
||||
5C89C90425EA7996000B5816 /* XCRemoteSwiftPackageReference "SwiftUIEKtensions" */,
|
||||
5C42E2A025EE656E0048DDCD /* XCRemoteSwiftPackageReference "SwiftyJSON" */,
|
||||
);
|
||||
productRefGroup = F4C6D9052544E17400F8903A /* Products */;
|
||||
projectDirPath = "";
|
||||
|
@ -433,19 +443,21 @@
|
|||
5C2D331425E650EC000253AC /* exams.swift in Sources */,
|
||||
5C478F3525DC742100ABEFB7 /* VulcanStore.swift in Sources */,
|
||||
5C1CFA7A25EA32AE0047286F /* ghImage.swift in Sources */,
|
||||
5CB9907225EE4A3200AA405C /* CustomButtonView.swift in Sources */,
|
||||
5CCB276325EF9C4A00482F4A /* OnboardingView.swift in Sources */,
|
||||
5C75212125EF814400D75CE3 /* CustomButtonView.swift in Sources */,
|
||||
5C1794BC25E8FE19007AD91A /* settings.swift in Sources */,
|
||||
5C2D331025E64F3C000253AC /* grades.swift in Sources */,
|
||||
5CF6695F25EEE2FD00AC0A86 /* chooseStudent.swift in Sources */,
|
||||
5C2D331C25E651FB000253AC /* more.swift in Sources */,
|
||||
5C1794C025E8FE27007AD91A /* about.swift in Sources */,
|
||||
F4C6D90A2544E17400F8903A /* LoginView.swift in Sources */,
|
||||
5C89C8F525EA6AA4000B5816 /* licenses.swift in Sources */,
|
||||
5CC2EAAE25E526B500B6183E /* navigation.swift in Sources */,
|
||||
5CF095AD25F053B10068F2C6 /* accountManager.swift in Sources */,
|
||||
5C2D331825E651C4000253AC /* homework.swift in Sources */,
|
||||
5C1794B425E8FDFB007AD91A /* messages.swift in Sources */,
|
||||
5CC2EAA525E516F100B6183E /* dashboard.swift in Sources */,
|
||||
5C1794B825E8FE08007AD91A /* notes.swift in Sources */,
|
||||
5CB9907625EE4A3B00AA405C /* OnboardingView.swift in Sources */,
|
||||
F4C6D9082544E17400F8903A /* wulkanowyApp.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -786,6 +798,14 @@
|
|||
minimumVersion = 4.2.1;
|
||||
};
|
||||
};
|
||||
5C42E2A025EE656E0048DDCD /* XCRemoteSwiftPackageReference "SwiftyJSON" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/SwiftyJSON/SwiftyJSON";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 5.0.0;
|
||||
};
|
||||
};
|
||||
5C89C90425EA7996000B5816 /* XCRemoteSwiftPackageReference "SwiftUIEKtensions" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/EnesKaraosman/SwiftUIEKtensions";
|
||||
|
@ -810,6 +830,11 @@
|
|||
package = 5C1794CB25E90DBD007AD91A /* XCRemoteSwiftPackageReference "KeychainAccess" */;
|
||||
productName = KeychainAccess;
|
||||
};
|
||||
5C42E2A125EE656E0048DDCD /* SwiftyJSON */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 5C42E2A025EE656E0048DDCD /* XCRemoteSwiftPackageReference "SwiftyJSON" */;
|
||||
productName = SwiftyJSON;
|
||||
};
|
||||
5C89C90525EA7996000B5816 /* SwiftUIEKtensions */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 5C89C90425EA7996000B5816 /* XCRemoteSwiftPackageReference "SwiftUIEKtensions" */;
|
||||
|
|
34
wulkanowy/Views/Content/accountManager.swift
Normal file
34
wulkanowy/Views/Content/accountManager.swift
Normal file
|
@ -0,0 +1,34 @@
|
|||
//
|
||||
// accountManager.swift
|
||||
// wulkanowy
|
||||
//
|
||||
// Created by Tomasz on 04/03/2021.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
|
||||
struct AccountManagerView: View {
|
||||
@State private var showModal = false
|
||||
@AppStorage("isLogged") private var isLogged: Bool = false
|
||||
|
||||
var body: some View {
|
||||
if(isLogged == false){
|
||||
VStack {
|
||||
Text("No accounts added")
|
||||
}.padding()
|
||||
} else {
|
||||
Text("Here is account manager (in my imagination)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct AccountManagerView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Group {
|
||||
AccountManagerView()
|
||||
}
|
||||
.preferredColorScheme(.dark)
|
||||
}
|
||||
}
|
|
@ -18,15 +18,22 @@ struct DashboardView: View {
|
|||
print(luckyNumber)
|
||||
|
||||
}
|
||||
@State private var showModal = false
|
||||
@AppStorage("isLogged") private var isLogged: Bool = false
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
if(isLogged == false){
|
||||
VStack {
|
||||
Text("You are not logged in (dashboard)")
|
||||
NavigationLink(destination: LoginView()) {
|
||||
Text("Log in")
|
||||
Text("You are not logged in")
|
||||
Button("Log in") {self.showModal = true}
|
||||
.sheet(isPresented: $showModal, onDismiss: {
|
||||
print(self.showModal)
|
||||
}) {
|
||||
LoginView()
|
||||
}
|
||||
}.padding()
|
||||
} else {
|
||||
Text("Here is dashboard (in my imagination)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,16 +6,26 @@
|
|||
//
|
||||
|
||||
import SwiftUI
|
||||
import KeychainAccess
|
||||
import Sdk
|
||||
|
||||
struct ExamsView: View {
|
||||
@State private var showModal = false
|
||||
@AppStorage("isLogged") private var isLogged: Bool = false
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
if(isLogged == false){
|
||||
VStack {
|
||||
Text("You are not logged in (exams)")
|
||||
NavigationLink(destination: LoginView()) {
|
||||
Text("Log in")
|
||||
Text("You are not logged in")
|
||||
Button("Log in") {self.showModal = true}
|
||||
.sheet(isPresented: $showModal, onDismiss: {
|
||||
print(self.showModal)
|
||||
}) {
|
||||
LoginView()
|
||||
}
|
||||
}.padding()
|
||||
} else {
|
||||
Text("Here is exams (in my imagination)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,16 +6,26 @@
|
|||
//
|
||||
|
||||
import SwiftUI
|
||||
import KeychainAccess
|
||||
import Sdk
|
||||
|
||||
struct GradesView: View {
|
||||
@State private var showModal = false
|
||||
@AppStorage("isLogged") private var isLogged: Bool = false
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
if(isLogged == false){
|
||||
VStack {
|
||||
Text("You are not logged in (grades)")
|
||||
NavigationLink(destination: LoginView()) {
|
||||
Text("Log in")
|
||||
Text("You are not logged in")
|
||||
Button("Log in") {self.showModal = true}
|
||||
.sheet(isPresented: $showModal, onDismiss: {
|
||||
print(self.showModal)
|
||||
}) {
|
||||
LoginView()
|
||||
}
|
||||
}.padding()
|
||||
} else {
|
||||
Text("Here is grades (in my imagination)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,16 +6,26 @@
|
|||
//
|
||||
|
||||
import SwiftUI
|
||||
import KeychainAccess
|
||||
import Sdk
|
||||
|
||||
struct HomeworksView: View {
|
||||
@State private var showModal = false
|
||||
@AppStorage("isLogged") private var isLogged: Bool = false
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
if(isLogged == false){
|
||||
VStack {
|
||||
Text("You are not logged in (homeworks)")
|
||||
NavigationLink(destination: LoginView()) {
|
||||
Text("Log in")
|
||||
Text("You are not logged in")
|
||||
Button("Log in") {self.showModal = true}
|
||||
.sheet(isPresented: $showModal, onDismiss: {
|
||||
print(self.showModal)
|
||||
}) {
|
||||
LoginView()
|
||||
}
|
||||
}.padding()
|
||||
} else {
|
||||
Text("Here is homeworks (in my imagination)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,12 +9,39 @@ import SwiftUI
|
|||
|
||||
struct LicensesView: View {
|
||||
let KeychainAccessLicense: String = "The MIT License (MIT)\nCopyright (c) 2014 kishikawa katsumi\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE."
|
||||
|
||||
let SwiftyJSONLicense: String = """
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Ruoyu Fu
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
"""
|
||||
|
||||
let KeychainAccessURL: URL? = URL(string: "https://github.com/kishikawakatsumi/KeychainAccess")!
|
||||
|
||||
let OpenSSLURL: URL? = URL(string: "https://github.com/krzyzanowskim/OpenSSL")!
|
||||
|
||||
let SwiftUIEKtensionsURL: URL? = URL(string: "https://github.com/EnesKaraosman/SwiftUIEKtensions")!
|
||||
|
||||
let SwiftyJSONURL: URL? = URL(string: "https://github.com/SwiftyJSON/SwiftyJSON")!
|
||||
|
||||
let OpenSSLLicense: String = """
|
||||
LICENSE ISSUES
|
||||
==============
|
||||
|
@ -177,6 +204,17 @@ struct LicensesView: View {
|
|||
}
|
||||
}
|
||||
.padding(.vertical)
|
||||
|
||||
// SwiftyJSON
|
||||
DisclosureGroup("SwiftyJSON") {
|
||||
Text(SwiftyJSONLicense)
|
||||
.font(.system(.body, design: .monospaced))
|
||||
.onTapGesture {
|
||||
guard let url = SwiftyJSONURL else { return }
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
.padding(.vertical)
|
||||
}
|
||||
.listStyle(InsetGroupedListStyle())
|
||||
.navigationTitle(Text("Libraries"))
|
||||
|
|
|
@ -8,14 +8,24 @@
|
|||
import SwiftUI
|
||||
|
||||
struct MessagesView: View {
|
||||
@State private var showModal = false
|
||||
@AppStorage("isLogged") private var isLogged: Bool = false
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
if(isLogged == false){
|
||||
VStack {
|
||||
Text("You are not logged in (messages)")
|
||||
NavigationLink(destination: LoginView()) {
|
||||
Text("Log in")
|
||||
Button("Log in") {self.showModal = true}
|
||||
.sheet(isPresented: $showModal, onDismiss: {
|
||||
print(self.showModal)
|
||||
}) {
|
||||
LoginView()
|
||||
}
|
||||
}.padding()
|
||||
} else {
|
||||
Text("Here are messages (in my imagination)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,14 +8,24 @@
|
|||
import SwiftUI
|
||||
|
||||
struct NotesView: View {
|
||||
@State private var showModal = false
|
||||
@AppStorage("isLogged") private var isLogged: Bool = false
|
||||
|
||||
var body: some View {
|
||||
NavigationView {
|
||||
if(isLogged == false){
|
||||
VStack {
|
||||
Text("You are not logged in (notes)")
|
||||
NavigationLink(destination: LoginView()) {
|
||||
Text("Log in")
|
||||
Button("Log in") {self.showModal = true}
|
||||
.sheet(isPresented: $showModal, onDismiss: {
|
||||
print(self.showModal)
|
||||
}) {
|
||||
LoginView()
|
||||
}
|
||||
}.padding()
|
||||
} else {
|
||||
Text("Here is notes (in my imagination)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,13 @@ enum AvailableEndpoints: String, CaseIterable {
|
|||
case fakelog = "Fakelog"
|
||||
}
|
||||
|
||||
open class Navigation: ObservableObject {
|
||||
let window: UIWindow
|
||||
|
||||
public init(window: UIWindow) {
|
||||
self.window = window
|
||||
}
|
||||
}
|
||||
|
||||
struct LoginView: View {
|
||||
|
||||
|
@ -27,10 +34,11 @@ struct LoginView: View {
|
|||
@State private var buttonValue = String(format: NSLocalizedString("loginButton", comment: "loginButton"))
|
||||
@State private var loginStatus: String = ""
|
||||
@State private var willMoveToNextScreen = false
|
||||
@State private var success = false
|
||||
|
||||
let cellHeight: CGFloat = 55
|
||||
let cornerRadius: CGFloat = 12
|
||||
let cellBackground: Color = Color(UIColor.systemGray6).opacity(0.5)
|
||||
let cellBackground: Color = Color(UIColor.systemGray5).opacity(0.5)
|
||||
|
||||
let nullColor: Color = Color.accentColor.opacity(0.4)
|
||||
|
||||
|
@ -55,10 +63,9 @@ struct LoginView: View {
|
|||
}
|
||||
} else {
|
||||
print("success")
|
||||
success = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +109,13 @@ struct LoginView: View {
|
|||
}
|
||||
|
||||
var body: some View {
|
||||
if(success == true) {
|
||||
ChooseStudentView()
|
||||
}
|
||||
else
|
||||
{
|
||||
VStack {
|
||||
Spacer()
|
||||
Image("wulkanowy")
|
||||
.renderingMode(.template)
|
||||
.resizable()
|
||||
|
@ -183,6 +196,7 @@ struct LoginView: View {
|
|||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct LoginView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
|
|
99
wulkanowy/Views/Login/chooseStudent.swift
Normal file
99
wulkanowy/Views/Login/chooseStudent.swift
Normal file
|
@ -0,0 +1,99 @@
|
|||
//
|
||||
// chooseStudent.swift
|
||||
// wulkanowy
|
||||
//
|
||||
// Created by Tomasz on 02/03/2021.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
import KeychainAccess
|
||||
import SwiftyJSON
|
||||
|
||||
struct ChooseStudentView: View {
|
||||
@Environment(\.presentationMode) var presentation
|
||||
@AppStorage("isLogged") private var isLogged: Bool = false
|
||||
|
||||
let keychain = Keychain()
|
||||
var displayStudents: Array<String> = Array()
|
||||
|
||||
@State private var selectedStudent: String = ""
|
||||
|
||||
init() {
|
||||
let responseBody = keychain["students"]
|
||||
let json = getJsonFromString(body: responseBody!)
|
||||
var i: Int = 0
|
||||
while true {
|
||||
if (String(describing: json["Envelope"][i]) == "null") {
|
||||
break
|
||||
}
|
||||
else {
|
||||
displayStudents.append(String(describing: json["Envelope"][i]["Login"]["DisplayName"]))
|
||||
displayStudents.append("dupa")
|
||||
i += 1
|
||||
}
|
||||
}
|
||||
selectedStudent = displayStudents[0]
|
||||
}
|
||||
|
||||
private func getJsonFromString(body: String) -> JSON {
|
||||
let data = Data(body.utf8)
|
||||
|
||||
let json = try! JSON(data: data)
|
||||
return json
|
||||
}
|
||||
|
||||
private func saveStudent() {
|
||||
isLogged = true
|
||||
let responseBody = keychain["students"]
|
||||
let json = getJsonFromString(body: responseBody!)
|
||||
var i: Int = 0
|
||||
while true {
|
||||
if (String(describing: json["Envelope"][i]["Login"]["DisplayName"]) == selectedStudent) {
|
||||
keychain["acctualStudent"] = "\(json["Envelope"][i])"
|
||||
break
|
||||
}
|
||||
i += 1
|
||||
}
|
||||
isLogged = true
|
||||
presentation.wrappedValue.dismiss()
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
VStack {
|
||||
Spacer()
|
||||
Text(selectedStudent)
|
||||
Text("Wybierz ucznia")
|
||||
.font(.title)
|
||||
.padding(.top)
|
||||
Picker(selection: $selectedStudent, label: Text("Wybierz ucznia:")) {
|
||||
ForEach(displayStudents, id: \.self) { student in
|
||||
Text(student)
|
||||
}
|
||||
}
|
||||
Spacer()
|
||||
//NavigationLink(destination: NavigationBarView()){
|
||||
Button("Zarejestruj") {saveStudent()}
|
||||
.font(.headline)
|
||||
.multilineTextAlignment(.center)
|
||||
.padding(.horizontal)
|
||||
.frame(height: 55)
|
||||
.frame(maxWidth: .infinity)
|
||||
.background(Color.accentColor.opacity(0.1))
|
||||
.cornerRadius(12)
|
||||
//}
|
||||
|
||||
}.padding()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct ChooseStudentView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Group {
|
||||
ChooseStudentView()
|
||||
}
|
||||
.preferredColorScheme(.dark)
|
||||
}
|
||||
}
|
|
@ -10,25 +10,45 @@ import SwiftUI
|
|||
struct NavigationBarView: View {
|
||||
var body: some View {
|
||||
TabView() {
|
||||
NavigationView {
|
||||
DashboardView()
|
||||
.navigationBarItems(trailing: NavigationLink(destination: AccountManagerView()) {
|
||||
Image(systemName: "person.circle")
|
||||
})
|
||||
}
|
||||
.tabItem {
|
||||
Label("dashboardButton", systemImage: "rectangle.on.rectangle")
|
||||
.accessibility(label: Text("dashboardButton"))
|
||||
}
|
||||
|
||||
NavigationView {
|
||||
GradesView()
|
||||
.navigationBarItems(trailing: NavigationLink(destination: AccountManagerView()) {
|
||||
Image(systemName: "person.circle")
|
||||
})
|
||||
}
|
||||
.tabItem {
|
||||
Label("gradesButton", systemImage: "rosette")
|
||||
.accessibility(label: Text("gradesButton"))
|
||||
}
|
||||
|
||||
NavigationView {
|
||||
ExamsView()
|
||||
.navigationBarItems(trailing: NavigationLink(destination: AccountManagerView()) {
|
||||
Image(systemName: "person.circle")
|
||||
})
|
||||
}
|
||||
.tabItem {
|
||||
Label("examsButton", systemImage: "calendar")
|
||||
.accessibility(label: Text("examsButton"))
|
||||
}
|
||||
|
||||
NavigationView {
|
||||
HomeworksView()
|
||||
.navigationBarItems(trailing: NavigationLink(destination: AccountManagerView()) {
|
||||
Image(systemName: "person.circle")
|
||||
})
|
||||
}
|
||||
.tabItem {
|
||||
Label("homeworkButton", systemImage: "note.text")
|
||||
.accessibility(label: Text("homeworkButton"))
|
||||
|
|
44
wulkanowy/Views/Onboarding/OnboardingView.swift
Normal file
44
wulkanowy/Views/Onboarding/OnboardingView.swift
Normal file
|
@ -0,0 +1,44 @@
|
|||
//
|
||||
// OnboardingView.swift
|
||||
// wulkanowy
|
||||
//
|
||||
// Created by Karol Zientek on 12/02/2021.
|
||||
//
|
||||
import SwiftUI
|
||||
|
||||
struct OnboardingView: View {
|
||||
|
||||
@AppStorage("needsAppOnboarding") private var needsAppOnboarding: Bool = true
|
||||
|
||||
var body: some View {
|
||||
VStack(spacing: 20) {
|
||||
Spacer()
|
||||
Image("wulkanowy-svg")
|
||||
.resizable()
|
||||
.frame(width: 200, height: 200, alignment: .top)
|
||||
.foregroundColor(Color("PrimaryColor"))
|
||||
VStack(spacing: 20) {
|
||||
Text("onboarding.description.title")
|
||||
.font(.headline)
|
||||
.multilineTextAlignment(.center)
|
||||
Text("onboarding.description.content")
|
||||
.font(.subheadline)
|
||||
.multilineTextAlignment(.center)
|
||||
}
|
||||
.padding(.horizontal, 20)
|
||||
Spacer()
|
||||
CustomButtonView(action: {
|
||||
needsAppOnboarding = false
|
||||
}, title: "onboarding.continue")
|
||||
.padding()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct WulkanowyCardView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
Group {
|
||||
OnboardingView().previewLayout(.fixed(width: 320, height: 640))
|
||||
}
|
||||
}
|
||||
}
|
34
wulkanowy/Views/Shared/CustomButtonView.swift
Normal file
34
wulkanowy/Views/Shared/CustomButtonView.swift
Normal file
|
@ -0,0 +1,34 @@
|
|||
//
|
||||
// CustomButtonView.swift
|
||||
// wulkanowy
|
||||
//
|
||||
// Created by Karol Zientek on 12/02/2021.
|
||||
//
|
||||
import SwiftUI
|
||||
|
||||
struct CustomButtonView: View {
|
||||
|
||||
var action: () -> ()
|
||||
var title: String
|
||||
|
||||
var body: some View {
|
||||
Button(action: action, label: {
|
||||
Text(LocalizedStringKey(title))
|
||||
})
|
||||
.padding(10)
|
||||
.frame(minWidth: 0, maxWidth: .infinity)
|
||||
.background(Color("PrimaryColor"))
|
||||
.foregroundColor(.white)
|
||||
.font(.title)
|
||||
.cornerRadius(20)
|
||||
}
|
||||
}
|
||||
|
||||
struct CustomButtonView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
CustomButtonView(action: {
|
||||
print("Button tapped!")
|
||||
}, title: "Test")
|
||||
.previewLayout(.sizeThatFits)
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue