Compare commits
1 commit
master
...
Caching-Fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
976bf512fa |
6 changed files with 202 additions and 16 deletions
|
|
@ -12,10 +12,10 @@
|
||||||
D517F68126C5771D002996E8 /* FillerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D517F68026C5771D002996E8 /* FillerView.swift */; };
|
D517F68126C5771D002996E8 /* FillerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D517F68026C5771D002996E8 /* FillerView.swift */; };
|
||||||
D5199A2F28DD16F100ACC34C /* BleContentTransfer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5199A2E28DD16F100ACC34C /* BleContentTransfer.swift */; };
|
D5199A2F28DD16F100ACC34C /* BleContentTransfer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5199A2E28DD16F100ACC34C /* BleContentTransfer.swift */; };
|
||||||
D51D1413293A53BD0028AEDD /* WifiCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D51D1412293A53BD0028AEDD /* WifiCellViewModel.swift */; };
|
D51D1413293A53BD0028AEDD /* WifiCellViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D51D1412293A53BD0028AEDD /* WifiCellViewModel.swift */; };
|
||||||
|
D520D69029D4C9380022048D /* WifiServiceCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D520D68F29D4C9380022048D /* WifiServiceCellView.swift */; };
|
||||||
|
D520D69229D4C9900022048D /* WifiServiceCellSubView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D520D69129D4C9900022048D /* WifiServiceCellSubView.swift */; };
|
||||||
D5267411292E902700D4C79E /* Networking.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5267410292E902700D4C79E /* Networking.swift */; };
|
D5267411292E902700D4C79E /* Networking.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5267410292E902700D4C79E /* Networking.swift */; };
|
||||||
D5269C00291960A300C0CE4B /* WifiSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5269BFF291960A300C0CE4B /* WifiSelection.swift */; };
|
D5269C00291960A300C0CE4B /* WifiSelection.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5269BFF291960A300C0CE4B /* WifiSelection.swift */; };
|
||||||
D5269C02291997DE00C0CE4B /* WifiServiceCellView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5269C01291997DE00C0CE4B /* WifiServiceCellView.swift */; };
|
|
||||||
D5269C042919985400C0CE4B /* WifiServiceCellSubView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5269C032919985400C0CE4B /* WifiServiceCellSubView.swift */; };
|
|
||||||
D5269C08291AB75800C0CE4B /* WifiPairingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5269C07291AB75800C0CE4B /* WifiPairingView.swift */; };
|
D5269C08291AB75800C0CE4B /* WifiPairingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5269C07291AB75800C0CE4B /* WifiPairingView.swift */; };
|
||||||
D52A926D29071DF400973B6B /* SelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52A926C29071DF400973B6B /* SelectionView.swift */; };
|
D52A926D29071DF400973B6B /* SelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52A926C29071DF400973B6B /* SelectionView.swift */; };
|
||||||
D52A926F29078E0A00973B6B /* WifiServiceSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52A926E29078E0A00973B6B /* WifiServiceSelectionView.swift */; };
|
D52A926F29078E0A00973B6B /* WifiServiceSelectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D52A926E29078E0A00973B6B /* WifiServiceSelectionView.swift */; };
|
||||||
|
|
@ -119,10 +119,10 @@
|
||||||
D517F68026C5771D002996E8 /* FillerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FillerView.swift; sourceTree = "<group>"; };
|
D517F68026C5771D002996E8 /* FillerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FillerView.swift; sourceTree = "<group>"; };
|
||||||
D5199A2E28DD16F100ACC34C /* BleContentTransfer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BleContentTransfer.swift; sourceTree = "<group>"; };
|
D5199A2E28DD16F100ACC34C /* BleContentTransfer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BleContentTransfer.swift; sourceTree = "<group>"; };
|
||||||
D51D1412293A53BD0028AEDD /* WifiCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WifiCellViewModel.swift; sourceTree = "<group>"; };
|
D51D1412293A53BD0028AEDD /* WifiCellViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WifiCellViewModel.swift; sourceTree = "<group>"; };
|
||||||
|
D520D68F29D4C9380022048D /* WifiServiceCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WifiServiceCellView.swift; sourceTree = "<group>"; };
|
||||||
|
D520D69129D4C9900022048D /* WifiServiceCellSubView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WifiServiceCellSubView.swift; sourceTree = "<group>"; };
|
||||||
D5267410292E902700D4C79E /* Networking.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Networking.swift; sourceTree = "<group>"; };
|
D5267410292E902700D4C79E /* Networking.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Networking.swift; sourceTree = "<group>"; };
|
||||||
D5269BFF291960A300C0CE4B /* WifiSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WifiSelection.swift; path = "PyLeap/Views/Unpaired View/WifiSelection.swift"; sourceTree = SOURCE_ROOT; };
|
D5269BFF291960A300C0CE4B /* WifiSelection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WifiSelection.swift; path = "PyLeap/Views/Unpaired View/WifiSelection.swift"; sourceTree = SOURCE_ROOT; };
|
||||||
D5269C01291997DE00C0CE4B /* WifiServiceCellView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WifiServiceCellView.swift; path = ../../../../../../Desktop/WifiServiceCellView.swift; sourceTree = "<group>"; };
|
|
||||||
D5269C032919985400C0CE4B /* WifiServiceCellSubView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = WifiServiceCellSubView.swift; path = ../../../../../../Desktop/WifiServiceCellSubView.swift; sourceTree = "<group>"; };
|
|
||||||
D5269C07291AB75800C0CE4B /* WifiPairingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WifiPairingView.swift; sourceTree = "<group>"; };
|
D5269C07291AB75800C0CE4B /* WifiPairingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WifiPairingView.swift; sourceTree = "<group>"; };
|
||||||
D52A926C29071DF400973B6B /* SelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionView.swift; sourceTree = "<group>"; };
|
D52A926C29071DF400973B6B /* SelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectionView.swift; sourceTree = "<group>"; };
|
||||||
D52A926E29078E0A00973B6B /* WifiServiceSelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WifiServiceSelectionView.swift; sourceTree = "<group>"; };
|
D52A926E29078E0A00973B6B /* WifiServiceSelectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WifiServiceSelectionView.swift; sourceTree = "<group>"; };
|
||||||
|
|
@ -388,8 +388,8 @@
|
||||||
D5269C07291AB75800C0CE4B /* WifiPairingView.swift */,
|
D5269C07291AB75800C0CE4B /* WifiPairingView.swift */,
|
||||||
D52A926E29078E0A00973B6B /* WifiServiceSelectionView.swift */,
|
D52A926E29078E0A00973B6B /* WifiServiceSelectionView.swift */,
|
||||||
D5269BFF291960A300C0CE4B /* WifiSelection.swift */,
|
D5269BFF291960A300C0CE4B /* WifiSelection.swift */,
|
||||||
D5269C01291997DE00C0CE4B /* WifiServiceCellView.swift */,
|
D520D68F29D4C9380022048D /* WifiServiceCellView.swift */,
|
||||||
D5269C032919985400C0CE4B /* WifiServiceCellSubView.swift */,
|
D520D69129D4C9900022048D /* WifiServiceCellSubView.swift */,
|
||||||
D5BA1F7E28B66F280012FC62 /* WifiServiceManager.swift */,
|
D5BA1F7E28B66F280012FC62 /* WifiServiceManager.swift */,
|
||||||
D5DD39A628D11817000FAEB8 /* WifiFileTransfer.swift */,
|
D5DD39A628D11817000FAEB8 /* WifiFileTransfer.swift */,
|
||||||
D5DD39A828D11962000FAEB8 /* WifiTransferService.swift */,
|
D5DD39A828D11962000FAEB8 /* WifiTransferService.swift */,
|
||||||
|
|
@ -659,6 +659,7 @@
|
||||||
D5D1F4B827ED2F4F0040E2BF /* FileManagerCheck.swift in Sources */,
|
D5D1F4B827ED2F4F0040E2BF /* FileManagerCheck.swift in Sources */,
|
||||||
D52BE82A26A0660200630900 /* KeyboardUtils.swift in Sources */,
|
D52BE82A26A0660200630900 /* KeyboardUtils.swift in Sources */,
|
||||||
D58182FB27F732E40091C43B /* SubCellViewModel.swift in Sources */,
|
D58182FB27F732E40091C43B /* SubCellViewModel.swift in Sources */,
|
||||||
|
D520D69229D4C9900022048D /* WifiServiceCellSubView.swift in Sources */,
|
||||||
D5D5BB3928DD19F000E5D93F /* BleContentCommands.swift in Sources */,
|
D5D5BB3928DD19F000E5D93F /* BleContentCommands.swift in Sources */,
|
||||||
D544A1D2281B9BB70038D483 /* Buttons.swift in Sources */,
|
D544A1D2281B9BB70038D483 /* Buttons.swift in Sources */,
|
||||||
D5D1F4AE27ECFDA10040E2BF /* GifImage.swift in Sources */,
|
D5D1F4AE27ECFDA10040E2BF /* GifImage.swift in Sources */,
|
||||||
|
|
@ -678,7 +679,6 @@
|
||||||
D56F640C270242CA000E5975 /* UIColor+LightAndDark.swift in Sources */,
|
D56F640C270242CA000E5975 /* UIColor+LightAndDark.swift in Sources */,
|
||||||
D5F53CED2694B7A9007634C2 /* OnboardingBackgroundView.swift in Sources */,
|
D5F53CED2694B7A9007634C2 /* OnboardingBackgroundView.swift in Sources */,
|
||||||
D5D1F4B227ECFF760040E2BF /* ProjectsModel.swift in Sources */,
|
D5D1F4B227ECFF760040E2BF /* ProjectsModel.swift in Sources */,
|
||||||
D5269C02291997DE00C0CE4B /* WifiServiceCellView.swift in Sources */,
|
|
||||||
D5BA1F7A28B52A490012FC62 /* WifiListDetailView.swift in Sources */,
|
D5BA1F7A28B52A490012FC62 /* WifiListDetailView.swift in Sources */,
|
||||||
D52F7E742672F4C400911D43 /* PyLeapApp.swift in Sources */,
|
D52F7E742672F4C400911D43 /* PyLeapApp.swift in Sources */,
|
||||||
D567E2B628B81B730009F768 /* Queue.swift in Sources */,
|
D567E2B628B81B730009F768 /* Queue.swift in Sources */,
|
||||||
|
|
@ -743,13 +743,13 @@
|
||||||
D56B75D4294BAAB400D008E7 /* BLESettingsView.swift in Sources */,
|
D56B75D4294BAAB400D008E7 /* BLESettingsView.swift in Sources */,
|
||||||
D52BE7EE269DF36E00630900 /* DownloadViewModel.swift in Sources */,
|
D52BE7EE269DF36E00630900 /* DownloadViewModel.swift in Sources */,
|
||||||
D59E31AA281B8DD300D24211 /* DownloadState.swift in Sources */,
|
D59E31AA281B8DD300D24211 /* DownloadState.swift in Sources */,
|
||||||
|
D520D69029D4C9380022048D /* WifiServiceCellView.swift in Sources */,
|
||||||
D5BA1F7F28B66F280012FC62 /* WifiServiceManager.swift in Sources */,
|
D5BA1F7F28B66F280012FC62 /* WifiServiceManager.swift in Sources */,
|
||||||
D5C74DF327EB92FA00730505 /* View+Extensions.swift in Sources */,
|
D5C74DF327EB92FA00730505 /* View+Extensions.swift in Sources */,
|
||||||
D5AA27F828CA785B001CCE25 /* CircuitPythonType.swift in Sources */,
|
D5AA27F828CA785B001CCE25 /* CircuitPythonType.swift in Sources */,
|
||||||
D5199A2F28DD16F100ACC34C /* BleContentTransfer.swift in Sources */,
|
D5199A2F28DD16F100ACC34C /* BleContentTransfer.swift in Sources */,
|
||||||
D535E21628E1FA910096E548 /* ScrollRefreshableView.swift in Sources */,
|
D535E21628E1FA910096E548 /* ScrollRefreshableView.swift in Sources */,
|
||||||
D5640216271B54BF00AE1519 /* MainSelectionView.swift in Sources */,
|
D5640216271B54BF00AE1519 /* MainSelectionView.swift in Sources */,
|
||||||
D5269C042919985400C0CE4B /* WifiServiceCellSubView.swift in Sources */,
|
|
||||||
D505B99C2755323C00386E9F /* NetworkMonitor.swift in Sources */,
|
D505B99C2755323C00386E9F /* NetworkMonitor.swift in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
|
@ -881,7 +881,7 @@
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = PyLeap/PyLeap.entitlements;
|
CODE_SIGN_ENTITLEMENTS = PyLeap/PyLeap.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 0;
|
CURRENT_PROJECT_VERSION = 2;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"PyLeap/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"PyLeap/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = 2X94RM7457;
|
DEVELOPMENT_TEAM = 2X94RM7457;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
|
|
@ -891,11 +891,12 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 2.1.1;
|
MARKETING_VERSION = 2.1.2;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.adafruit.PyLeap;
|
PRODUCT_BUNDLE_IDENTIFIER = com.adafruit.PyLeap;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
|
||||||
SUPPORTS_MACCATALYST = NO;
|
SUPPORTS_MACCATALYST = NO;
|
||||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "PyLeap/Views/Wifi View/PyLeap-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "PyLeap/Views/Wifi View/PyLeap-Bridging-Header.h";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
|
@ -911,7 +912,7 @@
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = PyLeap/PyLeap.entitlements;
|
CODE_SIGN_ENTITLEMENTS = PyLeap/PyLeap.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 0;
|
CURRENT_PROJECT_VERSION = 2;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"PyLeap/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"PyLeap/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = 2X94RM7457;
|
DEVELOPMENT_TEAM = 2X94RM7457;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
|
|
@ -921,11 +922,12 @@
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 2.1.1;
|
MARKETING_VERSION = 2.1.2;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.adafruit.PyLeap;
|
PRODUCT_BUNDLE_IDENTIFIER = com.adafruit.PyLeap;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
|
||||||
SUPPORTS_MACCATALYST = NO;
|
SUPPORTS_MACCATALYST = NO;
|
||||||
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
|
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "PyLeap/Views/Wifi View/PyLeap-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "PyLeap/Views/Wifi View/PyLeap-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
|
|
||||||
Binary file not shown.
BIN
PyLeap/Views/.DS_Store
vendored
BIN
PyLeap/Views/.DS_Store
vendored
Binary file not shown.
|
|
@ -16,8 +16,6 @@ struct WifiHeaderView: View {
|
||||||
|
|
||||||
VStack {
|
VStack {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
HStack (alignment: .center, spacing: 0) {
|
HStack (alignment: .center, spacing: 0) {
|
||||||
|
|
||||||
Image(systemName: "gearshape")
|
Image(systemName: "gearshape")
|
||||||
|
|
|
||||||
99
PyLeap/Views/Wifi View/WifiServiceCellSubView.swift
Normal file
99
PyLeap/Views/Wifi View/WifiServiceCellSubView.swift
Normal file
|
|
@ -0,0 +1,99 @@
|
||||||
|
//
|
||||||
|
// WifiServiceCellSubView.swift
|
||||||
|
// PyLeap
|
||||||
|
//
|
||||||
|
// Created by Trevor Beaton on 3/29/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
struct WifiServiceCellSubView: View {
|
||||||
|
let resolvedService: ResolvedService
|
||||||
|
|
||||||
|
@EnvironmentObject var rootViewModel: RootViewModel
|
||||||
|
|
||||||
|
let userDefaults = UserDefaults.standard
|
||||||
|
private let kPrefix = Bundle.main.bundleIdentifier!
|
||||||
|
|
||||||
|
|
||||||
|
func storeResolvedAddress(service: ResolvedService) {
|
||||||
|
print("Storing resolved address")
|
||||||
|
userDefaults.set(service.ipAddress, forKey: kPrefix+".storeResolvedAddress.ipAddress" )
|
||||||
|
userDefaults.set(service.hostName, forKey: kPrefix+".storeResolvedAddress.hostName" )
|
||||||
|
userDefaults.set(service.device, forKey: kPrefix+".storeResolvedAddress.device" )
|
||||||
|
|
||||||
|
print("Stored UserDefaults")
|
||||||
|
|
||||||
|
print(userDefaults.object(forKey: kPrefix+".storeResolvedAddress.ipAddress"))
|
||||||
|
print(userDefaults.object(forKey: kPrefix+".storeResolvedAddress.hostName"))
|
||||||
|
print(userDefaults.object(forKey: kPrefix+".storeResolvedAddress.device"))
|
||||||
|
}
|
||||||
|
|
||||||
|
func showConfirmationPrompt(service: ResolvedService, hostName: String) {
|
||||||
|
comfirmationAlertMessage(title: "Would you like to connect to \(hostName)?", exitTitle: "Cancel", primaryTitle: "Connect") {
|
||||||
|
storeResolvedAddress(service: service)
|
||||||
|
rootViewModel.goToWifiView()
|
||||||
|
} cancel: {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
|
||||||
|
VStack {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
VStack {
|
||||||
|
|
||||||
|
Text("Device ID: \(resolvedService.hostName)")
|
||||||
|
.font(Font.custom("ReadexPro-Regular", size: 18))
|
||||||
|
.multilineTextAlignment(.leading)
|
||||||
|
.minimumScaleFactor(0.1)
|
||||||
|
|
||||||
|
Text("Device IP: \(resolvedService.ipAddress)")
|
||||||
|
.font(Font.custom("ReadexPro-Regular", size: 18))
|
||||||
|
.multilineTextAlignment(.leading)
|
||||||
|
.minimumScaleFactor(0.1)
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
}
|
||||||
|
.padding(.horizontal, 30)
|
||||||
|
.padding(.vertical, 30)
|
||||||
|
|
||||||
|
HStack (
|
||||||
|
alignment: .center,
|
||||||
|
spacing: 0
|
||||||
|
) {
|
||||||
|
Spacer()
|
||||||
|
Button {
|
||||||
|
showConfirmationPrompt(service: resolvedService, hostName: resolvedService.hostName)
|
||||||
|
|
||||||
|
} label: {
|
||||||
|
Text("Connect")
|
||||||
|
.font(Font.custom("ReadexPro-Regular", size: 25))
|
||||||
|
.foregroundColor(Color.white)
|
||||||
|
.frame(width: 270, height: 50, alignment: .center)
|
||||||
|
.background(Color("pyleap_pink"))
|
||||||
|
.clipShape(Capsule())
|
||||||
|
.padding(.bottom, 30)
|
||||||
|
}
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//struct WifiServiceCellSubView_Previews: PreviewProvider {
|
||||||
|
// static var previews: some View {
|
||||||
|
// WifiServiceCellSubView(resolvedService: .con)
|
||||||
|
// }
|
||||||
|
//}
|
||||||
87
PyLeap/Views/Wifi View/WifiServiceCellView.swift
Normal file
87
PyLeap/Views/Wifi View/WifiServiceCellView.swift
Normal file
|
|
@ -0,0 +1,87 @@
|
||||||
|
//
|
||||||
|
// WifiServiceCellView.swift
|
||||||
|
// PyLeap
|
||||||
|
//
|
||||||
|
// Created by Trevor Beaton on 11/7/22.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SwiftUI
|
||||||
|
|
||||||
|
struct WifiServiceCellView: View {
|
||||||
|
|
||||||
|
let resolvedService: ResolvedService
|
||||||
|
|
||||||
|
@State private var isExpanded: Bool = false {
|
||||||
|
didSet {
|
||||||
|
onViewGeometryChanged()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let onViewGeometryChanged: ()->Void
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
content
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
}
|
||||||
|
|
||||||
|
private var content: some View {
|
||||||
|
VStack(alignment: .leading, spacing: 8) {
|
||||||
|
header
|
||||||
|
|
||||||
|
if isExpanded {
|
||||||
|
|
||||||
|
Group {
|
||||||
|
WifiServiceCellSubView(resolvedService: resolvedService)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func removeAdafruitString(text: String) -> String {
|
||||||
|
if text.contains("Adafruit") {
|
||||||
|
let parsed = text.replacingOccurrences(of: "Adafruit", with: "")
|
||||||
|
return parsed
|
||||||
|
} else {
|
||||||
|
return text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var header: some View {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
HStack {
|
||||||
|
Text(removeAdafruitString(text:resolvedService.device))
|
||||||
|
.font(Font.custom("ReadexPro-Regular", size: 24))
|
||||||
|
.minimumScaleFactor(0.1)
|
||||||
|
.lineLimit(1)
|
||||||
|
// .padding(.horizontal, 30)
|
||||||
|
.foregroundColor(.white)
|
||||||
|
|
||||||
|
Spacer()
|
||||||
|
|
||||||
|
Image(systemName: "chevron.down")
|
||||||
|
.resizable()
|
||||||
|
.frame(width: 30, height: 15, alignment: .center)
|
||||||
|
.foregroundColor(.white)
|
||||||
|
.padding(.trailing, 30)
|
||||||
|
}
|
||||||
|
|
||||||
|
//.padding(.vertical, 5)
|
||||||
|
.padding(.leading)
|
||||||
|
.frame(maxWidth: .infinity)
|
||||||
|
.frame(height: 50)
|
||||||
|
.background(Color("alt-gray"))
|
||||||
|
.onTapGesture { isExpanded.toggle() }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//struct WifiServiceCellView_Previews: PreviewProvider {
|
||||||
|
// static var previews: some View {
|
||||||
|
// WifiServiceCellView()
|
||||||
|
// }
|
||||||
|
//}
|
||||||
Loading…
Reference in a new issue