About app view & splash screen
This commit is contained in:
parent
b17cd82d21
commit
47151e602d
18 changed files with 587 additions and 7 deletions
|
@ -12,11 +12,14 @@
|
|||
5C1794BC25E8FE19007AD91A /* settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C1794BB25E8FE19007AD91A /* settings.swift */; };
|
||||
5C1794C025E8FE27007AD91A /* about.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C1794BF25E8FE27007AD91A /* about.swift */; };
|
||||
5C1794CD25E90DBD007AD91A /* KeychainAccess in Frameworks */ = {isa = PBXBuildFile; productRef = 5C1794CC25E90DBD007AD91A /* KeychainAccess */; };
|
||||
5C1CFA7A25EA32AE0047286F /* ghImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C1CFA7925EA32AE0047286F /* ghImage.swift */; };
|
||||
5C2D331025E64F3C000253AC /* grades.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C2D330F25E64F3C000253AC /* grades.swift */; };
|
||||
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 */; };
|
||||
5C478F3525DC742100ABEFB7 /* VulcanStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C478F3425DC742100ABEFB7 /* VulcanStore.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 */; };
|
||||
5CC2EAA525E516F100B6183E /* dashboard.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CC2EAA425E516F100B6183E /* dashboard.swift */; };
|
||||
5CC2EAAE25E526B500B6183E /* navigation.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CC2EAAD25E526B500B6183E /* navigation.swift */; };
|
||||
|
@ -75,11 +78,13 @@
|
|||
5C1794B725E8FE08007AD91A /* notes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = notes.swift; sourceTree = "<group>"; };
|
||||
5C1794BB25E8FE19007AD91A /* settings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = settings.swift; sourceTree = "<group>"; };
|
||||
5C1794BF25E8FE27007AD91A /* about.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = about.swift; sourceTree = "<group>"; };
|
||||
5C1CFA7925EA32AE0047286F /* ghImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ghImage.swift; sourceTree = "<group>"; };
|
||||
5C2D330F25E64F3C000253AC /* grades.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = grades.swift; sourceTree = "<group>"; };
|
||||
5C2D331325E650EC000253AC /* exams.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = exams.swift; sourceTree = "<group>"; };
|
||||
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>"; };
|
||||
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>"; };
|
||||
5CC2EAA425E516F100B6183E /* dashboard.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = dashboard.swift; sourceTree = "<group>"; };
|
||||
|
@ -108,6 +113,7 @@
|
|||
5C9B6F4925D6C08D00C3F5F5 /* Sdk in Frameworks */,
|
||||
5CCAE31625DA4CDD00D87580 /* OpenSSL in Frameworks */,
|
||||
5C1794CD25E90DBD007AD91A /* KeychainAccess in Frameworks */,
|
||||
5C89C90625EA7996000B5816 /* SwiftUIEKtensions in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -142,6 +148,7 @@
|
|||
5CC2EAAC25E5269E00B6183E /* Navigation */,
|
||||
5CC2EAA325E516DD00B6183E /* Content */,
|
||||
5C1B849F25E1B7A30074F29D /* Login */,
|
||||
5C1CFA7925EA32AE0047286F /* ghImage.swift */,
|
||||
);
|
||||
path = Views;
|
||||
sourceTree = "<group>";
|
||||
|
@ -182,6 +189,7 @@
|
|||
5C1794B725E8FE08007AD91A /* notes.swift */,
|
||||
5C1794BB25E8FE19007AD91A /* settings.swift */,
|
||||
5C1794BF25E8FE27007AD91A /* about.swift */,
|
||||
5C89C8F425EA6AA4000B5816 /* licenses.swift */,
|
||||
);
|
||||
path = Content;
|
||||
sourceTree = "<group>";
|
||||
|
@ -278,6 +286,7 @@
|
|||
5C9B6F4825D6C08D00C3F5F5 /* Sdk */,
|
||||
5CCAE31525DA4CDD00D87580 /* OpenSSL */,
|
||||
5C1794CC25E90DBD007AD91A /* KeychainAccess */,
|
||||
5C89C90525EA7996000B5816 /* SwiftUIEKtensions */,
|
||||
);
|
||||
productName = wulkanowy;
|
||||
productReference = F4C6D9042544E17400F8903A /* wulkanowy.app */;
|
||||
|
@ -354,6 +363,7 @@
|
|||
packageReferences = (
|
||||
5CCAE31025DA4CCA00D87580 /* XCRemoteSwiftPackageReference "OpenSSL" */,
|
||||
5C1794CB25E90DBD007AD91A /* XCRemoteSwiftPackageReference "KeychainAccess" */,
|
||||
5C89C90425EA7996000B5816 /* XCRemoteSwiftPackageReference "SwiftUIEKtensions" */,
|
||||
);
|
||||
productRefGroup = F4C6D9052544E17400F8903A /* Products */;
|
||||
projectDirPath = "";
|
||||
|
@ -400,11 +410,13 @@
|
|||
files = (
|
||||
5C2D331425E650EC000253AC /* exams.swift in Sources */,
|
||||
5C478F3525DC742100ABEFB7 /* VulcanStore.swift in Sources */,
|
||||
5C1CFA7A25EA32AE0047286F /* ghImage.swift in Sources */,
|
||||
5C1794BC25E8FE19007AD91A /* settings.swift in Sources */,
|
||||
5C2D331025E64F3C000253AC /* grades.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 */,
|
||||
5C2D331825E651C4000253AC /* homework.swift in Sources */,
|
||||
5C1794B425E8FDFB007AD91A /* messages.swift in Sources */,
|
||||
|
@ -748,6 +760,14 @@
|
|||
minimumVersion = 4.2.1;
|
||||
};
|
||||
};
|
||||
5C89C90425EA7996000B5816 /* XCRemoteSwiftPackageReference "SwiftUIEKtensions" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/EnesKaraosman/SwiftUIEKtensions";
|
||||
requirement = {
|
||||
kind = upToNextMajorVersion;
|
||||
minimumVersion = 0.1.8;
|
||||
};
|
||||
};
|
||||
5CCAE31025DA4CCA00D87580 /* XCRemoteSwiftPackageReference "OpenSSL" */ = {
|
||||
isa = XCRemoteSwiftPackageReference;
|
||||
repositoryURL = "https://github.com/krzyzanowskim/OpenSSL";
|
||||
|
@ -764,6 +784,11 @@
|
|||
package = 5C1794CB25E90DBD007AD91A /* XCRemoteSwiftPackageReference "KeychainAccess" */;
|
||||
productName = KeychainAccess;
|
||||
};
|
||||
5C89C90525EA7996000B5816 /* SwiftUIEKtensions */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
package = 5C89C90425EA7996000B5816 /* XCRemoteSwiftPackageReference "SwiftUIEKtensions" */;
|
||||
productName = SwiftUIEKtensions;
|
||||
};
|
||||
5C9B6F4825D6C08D00C3F5F5 /* Sdk */ = {
|
||||
isa = XCSwiftPackageProductDependency;
|
||||
productName = Sdk;
|
||||
|
|
|
@ -18,6 +18,15 @@
|
|||
"revision": "389296819a8d025ac10ddc9f22135a5518991fdc",
|
||||
"version": "1.1.180"
|
||||
}
|
||||
},
|
||||
{
|
||||
"package": "SwiftUIEKtensions",
|
||||
"repositoryURL": "https://github.com/EnesKaraosman/SwiftUIEKtensions",
|
||||
"state": {
|
||||
"branch": null,
|
||||
"revision": "cafd7ad82796528b392107874f07a7279dec7fcd",
|
||||
"version": "0.1.8"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
BIN
wulkanowy/.DS_Store
vendored
BIN
wulkanowy/.DS_Store
vendored
Binary file not shown.
|
@ -23,9 +23,9 @@
|
|||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0.184",
|
||||
"green" : "0.184",
|
||||
"red" : "0.827"
|
||||
"blue" : "0x2E",
|
||||
"green" : "0x2E",
|
||||
"red" : "0xD2"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
|
|
|
@ -2,5 +2,8 @@
|
|||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"compression-type" : "automatic"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x2E",
|
||||
"green" : "0x2E",
|
||||
"red" : "0xD2"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "0x2E",
|
||||
"green" : "0x2E",
|
||||
"red" : "0xD2"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
"colors" : [
|
||||
{
|
||||
"color" : {
|
||||
"platform" : "ios",
|
||||
"reference" : "darkTextColor"
|
||||
},
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"appearances" : [
|
||||
{
|
||||
"appearance" : "luminosity",
|
||||
"value" : "dark"
|
||||
}
|
||||
],
|
||||
"color" : {
|
||||
"color-space" : "srgb",
|
||||
"components" : {
|
||||
"alpha" : "1.000",
|
||||
"blue" : "1.000",
|
||||
"green" : "1.000",
|
||||
"red" : "1.000"
|
||||
}
|
||||
},
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
21
wulkanowy/Assets.xcassets/Logo.imageset/Contents.json
vendored
Normal file
21
wulkanowy/Assets.xcassets/Logo.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "logo.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
wulkanowy/Assets.xcassets/Logo.imageset/logo.png
vendored
Normal file
BIN
wulkanowy/Assets.xcassets/Logo.imageset/logo.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
24
wulkanowy/Assets.xcassets/splash.imageset/Contents.json
vendored
Normal file
24
wulkanowy/Assets.xcassets/splash.imageset/Contents.json
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "wulkanowy-logo.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"compression-type" : "automatic"
|
||||
}
|
||||
}
|
BIN
wulkanowy/Assets.xcassets/splash.imageset/wulkanowy-logo.png
vendored
Normal file
BIN
wulkanowy/Assets.xcassets/splash.imageset/wulkanowy-logo.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -1,13 +1,24 @@
|
|||
{
|
||||
"images" : [
|
||||
{
|
||||
"filename" : "wulkanowy-1.svg",
|
||||
"filename" : "wulkanowy.svg",
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
},
|
||||
"properties" : {
|
||||
"template-rendering-intent" : "original"
|
||||
}
|
||||
}
|
||||
|
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
|
@ -45,7 +45,12 @@
|
|||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
<key>UILaunchScreen</key>
|
||||
<dict/>
|
||||
<dict>
|
||||
<key>UIColorName</key>
|
||||
<string>LaunchColor</string>
|
||||
<key>UIImageName</key>
|
||||
<string>splash</string>
|
||||
</dict>
|
||||
<key>UIRequiredDeviceCapabilities</key>
|
||||
<array>
|
||||
<string>armv7</string>
|
||||
|
|
|
@ -5,11 +5,109 @@
|
|||
// Created by Tomasz on 26/02/2021.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
import UIKit
|
||||
import Combine
|
||||
import MessageUI
|
||||
import SwiftUIEKtensions
|
||||
|
||||
struct AboutView: View {
|
||||
@State private var result: Result<MFMailComposeResult, Error>? = nil
|
||||
@State private var isShowingMailView = false
|
||||
|
||||
var body: some View {
|
||||
Text("Here are some info about application (in my imagination)")
|
||||
Form {
|
||||
Section {
|
||||
DisclosureGroup("App version") {
|
||||
Text("You actually version is alpha 0.1")
|
||||
.font(.system(.body, design: .monospaced))
|
||||
}
|
||||
|
||||
DisclosureGroup("Contributors") {
|
||||
HStack {
|
||||
AsyncImage(url: URL(string: "https://avatars.githubusercontent.com/u/55411338?s=460&v=4")!,
|
||||
placeholder: { Image(systemName: "circle.dashed") },
|
||||
image: { Image(uiImage: $0).resizable() })
|
||||
.frame(width: 38, height: 38)
|
||||
Link("Pengwius", destination: URL(string: "https://github.com/pengwius")!)
|
||||
.foregroundColor(Color("customControlColor"))
|
||||
}
|
||||
|
||||
HStack {
|
||||
AsyncImage(url: URL(string: "https://avatars.githubusercontent.com/u/23171377?s=460&u=ce615ffdaaea96b191b1c27fb915fd18d25eaebd&v=4")!,
|
||||
placeholder: { Image(systemName: "circle.dashed") },
|
||||
image: { Image(uiImage: $0).resizable() })
|
||||
.frame(width: 38, height: 38)
|
||||
Link("rrroyal", destination: URL(string: "https://github.com/rrroyal")!)
|
||||
.foregroundColor(Color("customControlColor"))
|
||||
}
|
||||
|
||||
HStack {
|
||||
AsyncImage(url: URL(string: "https://avatars.githubusercontent.com/u/20373275?s=400&u=a59e3ca4656a7113a0021682b6733c27e6742e73&v=4")!,
|
||||
placeholder: { Image(systemName: "circle.dashed") },
|
||||
image: { Image(uiImage: $0).resizable() })
|
||||
.frame(width: 38, height: 38)
|
||||
Link("Karol Z.", destination: URL(string: "https://github.com/szakes1")!)
|
||||
.foregroundColor(Color("customControlColor"))
|
||||
}
|
||||
}
|
||||
|
||||
NavigationLink(destination: LicensesView()) {
|
||||
Text("Licenses")
|
||||
}
|
||||
|
||||
Link("FAQ", destination: URL(string: "https://wulkanowy.github.io/czesto-zadawane-pytania")!)
|
||||
.foregroundColor(Color("customControlColor"))
|
||||
|
||||
Link("Privacy policy", destination: URL(string: "https://wulkanowy.github.io/polityka-prywatnosci")!)
|
||||
.foregroundColor(Color("customControlColor"))
|
||||
}
|
||||
Section {
|
||||
Link("Join the Discord serwer", destination: URL(string: "https://discord.com/invite/vccAQBr")!)
|
||||
.foregroundColor(Color("customControlColor"))
|
||||
|
||||
Link("Facebook fanpage", destination: URL(string: "https://www.facebook.com/wulkanowy")!)
|
||||
.foregroundColor(Color("customControlColor"))
|
||||
|
||||
Link("Reddit", destination: URL(string: "https://www.reddit.com/r/wulkanowy/")!)
|
||||
.foregroundColor(Color("customControlColor"))
|
||||
}
|
||||
|
||||
Section {
|
||||
Button(action: {
|
||||
if MFMailComposeViewController.canSendMail() {
|
||||
self.isShowingMailView.toggle()
|
||||
} else {
|
||||
print("Can't send emails from this device")
|
||||
}
|
||||
if result != nil {
|
||||
print("Result: \(String(describing: result))")
|
||||
}
|
||||
}) {
|
||||
HStack {
|
||||
Text("Report a bug")
|
||||
.foregroundColor(Color("customControlColor"))
|
||||
}
|
||||
}
|
||||
// .disabled(!MFMailComposeViewController.canSendMail())
|
||||
}
|
||||
.sheet(isPresented: $isShowingMailView) {
|
||||
MailView(result: $result) { composer in
|
||||
composer.setSubject("")
|
||||
composer.setToRecipients(["wulkanowyinc@gmail.com"])
|
||||
}
|
||||
}
|
||||
|
||||
Link("Homepage", destination: URL(string: "https://wulkanowy.github.io/")!)
|
||||
.foregroundColor(Color("customControlColor"))
|
||||
|
||||
Link("Github", destination: URL(string: "https://github.com/wulkanowy/wulkanowy-ios")!)
|
||||
.foregroundColor(Color("customControlColor"))
|
||||
|
||||
Link("Donate us!", destination: URL(string: "https://www.paypal.com/paypalme/wulkanowy")!)
|
||||
.foregroundColor(Color("customControlColor"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
190
wulkanowy/Views/Content/licenses.swift
Normal file
190
wulkanowy/Views/Content/licenses.swift
Normal file
|
@ -0,0 +1,190 @@
|
|||
//
|
||||
// licenses.swift
|
||||
// wulkanowy
|
||||
//
|
||||
// Created by Tomasz on 27/02/2021.
|
||||
//
|
||||
|
||||
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 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 OpenSSLLicense: String = """
|
||||
LICENSE ISSUES
|
||||
==============
|
||||
|
||||
The OpenSSL toolkit stays under a dual license, i.e. both the conditions of
|
||||
the OpenSSL License and the original SSLeay license apply to the toolkit.
|
||||
See below for the actual license texts. Actually both licenses are BSD-style
|
||||
Open Source licenses. In case of any license issues related to OpenSSL
|
||||
please contact openssl-core@openssl.org.
|
||||
|
||||
OpenSSL License
|
||||
---------------
|
||||
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2008 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
*
|
||||
* 3. All advertising materials mentioning features or use of this
|
||||
* software must display the following acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
|
||||
*
|
||||
* 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
|
||||
* endorse or promote products derived from this software without
|
||||
* prior written permission. For written permission, please contact
|
||||
* openssl-core@openssl.org.
|
||||
*
|
||||
* 5. Products derived from this software may not be called "OpenSSL"
|
||||
* nor may "OpenSSL" appear in their names without prior written
|
||||
* permission of the OpenSSL Project.
|
||||
*
|
||||
* 6. Redistributions of any form whatsoever must retain the following
|
||||
* acknowledgment:
|
||||
* "This product includes software developed by the OpenSSL Project
|
||||
* for use in the OpenSSL Toolkit (http://www.openssl.org/)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
|
||||
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
|
||||
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
||||
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* ====================================================================
|
||||
*
|
||||
* This product includes cryptographic software written by Eric Young
|
||||
* (eay@cryptsoft.com). This product includes software written by Tim
|
||||
* Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
*/
|
||||
|
||||
Original SSLeay License
|
||||
-----------------------
|
||||
|
||||
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
|
||||
* All rights reserved.
|
||||
*
|
||||
* This package is an SSL implementation written
|
||||
* by Eric Young (eay@cryptsoft.com).
|
||||
* The implementation was written so as to conform with Netscapes SSL.
|
||||
*
|
||||
* This library is free for commercial and non-commercial use as long as
|
||||
* the following conditions are aheared to. The following conditions
|
||||
* apply to all code found in this distribution, be it the RC4, RSA,
|
||||
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
|
||||
* included with this distribution is covered by the same copyright terms
|
||||
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
|
||||
*
|
||||
* Copyright remains Eric Young's, and as such any Copyright notices in
|
||||
* the code are not to be removed.
|
||||
* If this package is used in a product, Eric Young should be given attribution
|
||||
* as the author of the parts of the library used.
|
||||
* This can be in the form of a textual message at program startup or
|
||||
* in documentation (online or textual) provided with the package.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* "This product includes cryptographic software written by
|
||||
* Eric Young (eay@cryptsoft.com)"
|
||||
* The word 'cryptographic' can be left out if the rouines from the library
|
||||
* being used are not cryptographic related :-).
|
||||
* 4. If you include any Windows specific code (or a derivative thereof) from
|
||||
* the apps directory (application code) you must include an acknowledgement:
|
||||
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* The licence and distribution terms for any publically available version or
|
||||
* derivative of this code cannot be changed. i.e. this code cannot simply be
|
||||
* copied and put under another distribution licence
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
"""
|
||||
|
||||
var body: some View {
|
||||
List {
|
||||
// KeychainAccess
|
||||
DisclosureGroup("KeychainAccess") {
|
||||
Text(KeychainAccessLicense)
|
||||
.font(.system(.body, design: .monospaced))
|
||||
.onTapGesture {
|
||||
guard let url = KeychainAccessURL else { return }
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
.padding(.vertical)
|
||||
|
||||
// OpenSSL
|
||||
DisclosureGroup("OpenSSL") {
|
||||
Text(OpenSSLLicense)
|
||||
.font(.system(.body, design: .monospaced))
|
||||
.onTapGesture {
|
||||
guard let url = OpenSSLURL else { return }
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
.padding(.vertical)
|
||||
|
||||
// SwiftUIEKtensions
|
||||
DisclosureGroup("SwiftUIEKtensions") {
|
||||
Text("No license")
|
||||
.font(.system(.body, design: .monospaced))
|
||||
.onTapGesture {
|
||||
guard let url = SwiftUIEKtensionsURL else { return }
|
||||
UIApplication.shared.open(url)
|
||||
}
|
||||
}
|
||||
.padding(.vertical)
|
||||
}
|
||||
.listStyle(InsetGroupedListStyle())
|
||||
.navigationTitle(Text("Libraries"))
|
||||
}
|
||||
}
|
||||
|
||||
struct LicensesView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
LicensesView()
|
||||
}
|
||||
}
|
123
wulkanowy/Views/ghImage.swift
Normal file
123
wulkanowy/Views/ghImage.swift
Normal file
|
@ -0,0 +1,123 @@
|
|||
//
|
||||
// ghImage.swift
|
||||
// wulkanowy
|
||||
//
|
||||
// Created by Tomasz on 27/02/2021.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
import UIKit
|
||||
import Combine
|
||||
|
||||
struct AsyncImage<Placeholder: View>: View {
|
||||
@StateObject private var loader: ImageLoader
|
||||
private let placeholder: Placeholder
|
||||
private let image: (UIImage) -> Image
|
||||
|
||||
init(
|
||||
url: URL,
|
||||
@ViewBuilder placeholder: () -> Placeholder,
|
||||
@ViewBuilder image: @escaping (UIImage) -> Image = Image.init(uiImage:)
|
||||
) {
|
||||
self.placeholder = placeholder()
|
||||
self.image = image
|
||||
_loader = StateObject(wrappedValue: ImageLoader(url: url, cache: Environment(\.imageCache).wrappedValue))
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
content
|
||||
.onAppear(perform: loader.load)
|
||||
}
|
||||
|
||||
private var content: some View {
|
||||
Group {
|
||||
if loader.image != nil {
|
||||
image(loader.image!)
|
||||
} else {
|
||||
placeholder
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protocol ImageCache {
|
||||
subscript(_ url: URL) -> UIImage? { get set }
|
||||
}
|
||||
|
||||
struct TemporaryImageCache: ImageCache {
|
||||
private let cache = NSCache<NSURL, UIImage>()
|
||||
|
||||
subscript(_ key: URL) -> UIImage? {
|
||||
get { cache.object(forKey: key as NSURL) }
|
||||
set { newValue == nil ? cache.removeObject(forKey: key as NSURL) : cache.setObject(newValue!, forKey: key as NSURL) }
|
||||
}
|
||||
}
|
||||
|
||||
class ImageLoader: ObservableObject {
|
||||
@Published var image: UIImage?
|
||||
|
||||
private(set) var isLoading = false
|
||||
|
||||
private let url: URL
|
||||
private var cache: ImageCache?
|
||||
private var cancellable: AnyCancellable?
|
||||
|
||||
private static let imageProcessingQueue = DispatchQueue(label: "image-processing")
|
||||
|
||||
init(url: URL, cache: ImageCache? = nil) {
|
||||
self.url = url
|
||||
self.cache = cache
|
||||
}
|
||||
|
||||
deinit {
|
||||
cancel()
|
||||
}
|
||||
|
||||
func load() {
|
||||
guard !isLoading else { return }
|
||||
|
||||
if let image = cache?[url] {
|
||||
self.image = image
|
||||
return
|
||||
}
|
||||
|
||||
cancellable = URLSession.shared.dataTaskPublisher(for: url)
|
||||
.map { UIImage(data: $0.data) }
|
||||
.replaceError(with: nil)
|
||||
.handleEvents(receiveSubscription: { [weak self] _ in self?.onStart() },
|
||||
receiveOutput: { [weak self] in self?.cache($0) },
|
||||
receiveCompletion: { [weak self] _ in self?.onFinish() },
|
||||
receiveCancel: { [weak self] in self?.onFinish() })
|
||||
.subscribe(on: Self.imageProcessingQueue)
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { [weak self] in self?.image = $0 }
|
||||
}
|
||||
|
||||
func cancel() {
|
||||
cancellable?.cancel()
|
||||
}
|
||||
|
||||
private func onStart() {
|
||||
isLoading = true
|
||||
}
|
||||
|
||||
private func onFinish() {
|
||||
isLoading = false
|
||||
}
|
||||
|
||||
private func cache(_ image: UIImage?) {
|
||||
image.map { cache?[url] = $0 }
|
||||
}
|
||||
}
|
||||
|
||||
struct ImageCacheKey: EnvironmentKey {
|
||||
static let defaultValue: ImageCache = TemporaryImageCache()
|
||||
}
|
||||
|
||||
extension EnvironmentValues {
|
||||
var imageCache: ImageCache {
|
||||
get { self[ImageCacheKey.self] }
|
||||
set { self[ImageCacheKey.self] = newValue }
|
||||
}
|
||||
}
|
|
@ -54,7 +54,7 @@ final class VulcanStore: ObservableObject {
|
|||
keychain[string: "privateKey"] = base64Encoded
|
||||
|
||||
let key = keychain["privateKey"]
|
||||
print("Encoded: \(key)")
|
||||
print("Encoded: \(String(describing: key))")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue