mirror of
https://github.com/meshtastic/Meshtastic-Apple.git
synced 2026-04-20 22:13:56 +00:00
Delete Share Channel view
This commit is contained in:
parent
6e5c4787b2
commit
fbdec5808f
3 changed files with 0 additions and 125 deletions
|
|
@ -43,7 +43,6 @@
|
|||
DD6193752862F6E600E59241 /* ExternalNotificationConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6193742862F6E600E59241 /* ExternalNotificationConfig.swift */; };
|
||||
DD6193772862F90F00E59241 /* CannedMessagesConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6193762862F90F00E59241 /* CannedMessagesConfig.swift */; };
|
||||
DD6193792863875F00E59241 /* SerialConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6193782863875F00E59241 /* SerialConfig.swift */; };
|
||||
DD6B85A828009258000ACD6B /* ShareChannel.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD6B85A728009258000ACD6B /* ShareChannel.swift */; };
|
||||
DD73FD1128750779000852D6 /* LocationHistory.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD73FD1028750779000852D6 /* LocationHistory.swift */; };
|
||||
DD8169F9271F1A6100F4AB02 /* MeshLogger.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD8169F8271F1A6100F4AB02 /* MeshLogger.swift */; };
|
||||
DD8169FB271F1F3A00F4AB02 /* MeshLog.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD8169FA271F1F3A00F4AB02 /* MeshLog.swift */; };
|
||||
|
|
@ -157,7 +156,6 @@
|
|||
DD6193742862F6E600E59241 /* ExternalNotificationConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalNotificationConfig.swift; sourceTree = "<group>"; };
|
||||
DD6193762862F90F00E59241 /* CannedMessagesConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CannedMessagesConfig.swift; sourceTree = "<group>"; };
|
||||
DD6193782863875F00E59241 /* SerialConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SerialConfig.swift; sourceTree = "<group>"; };
|
||||
DD6B85A728009258000ACD6B /* ShareChannel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareChannel.swift; sourceTree = "<group>"; };
|
||||
DD73FD1028750779000852D6 /* LocationHistory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocationHistory.swift; sourceTree = "<group>"; };
|
||||
DD8169F8271F1A6100F4AB02 /* MeshLogger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshLogger.swift; sourceTree = "<group>"; };
|
||||
DD8169FA271F1F3A00F4AB02 /* MeshLog.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MeshLog.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -300,7 +298,6 @@
|
|||
DD3501882852FC3B000FC853 /* Settings.swift */,
|
||||
DD4A911D2708C65400501B7E /* AppSettings.swift */,
|
||||
DD8169FA271F1F3A00F4AB02 /* MeshLog.swift */,
|
||||
DD6B85A728009258000ACD6B /* ShareChannel.swift */,
|
||||
DD86D40B287F401000BAEB7A /* SaveChannelQRCode.swift */,
|
||||
DDCE4E2B2869F92900BE9F8F /* UserConfig.swift */,
|
||||
DD0F791A28713C8A00A6FDAD /* AdminMessageList.swift */,
|
||||
|
|
@ -711,7 +708,6 @@
|
|||
DD4C158C2824A91E0032668E /* module_config.pb.swift in Sources */,
|
||||
DDB6ABE828B141AF00384BA1 /* WiFiModes.swift in Sources */,
|
||||
DD4F23CD28779A3C001D37CB /* TelemetryLog.swift in Sources */,
|
||||
DD6B85A828009258000ACD6B /* ShareChannel.swift in Sources */,
|
||||
DDB6ABD628AE742000384BA1 /* BluetoothConfig.swift in Sources */,
|
||||
DDAF8C5326EB1DF10058C060 /* BLEManager.swift in Sources */,
|
||||
DDC4D568275499A500A4208E /* Persistence.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -37,15 +37,6 @@ struct Settings: View {
|
|||
|
||||
Section("Radio Configuration") {
|
||||
|
||||
NavigationLink {
|
||||
ShareChannel(node: nodes.first(where: { $0.num == connectedNodeNum }))
|
||||
} label: {
|
||||
Image(systemName: "qrcode")
|
||||
.symbolRenderingMode(.hierarchical)
|
||||
Text("Share Channel QR Code")
|
||||
}
|
||||
.disabled(bleManager.connectedPeripheral == nil)
|
||||
|
||||
NavigationLink {
|
||||
UserConfig(node: nodes.first(where: { $0.num == connectedNodeNum }))
|
||||
} label: {
|
||||
|
|
|
|||
|
|
@ -1,112 +0,0 @@
|
|||
//
|
||||
// ShareChannel.swift
|
||||
// MeshtasticApple
|
||||
//
|
||||
// Created by Garth Vander Houwen on 4/8/22.
|
||||
//
|
||||
import SwiftUI
|
||||
import CoreData
|
||||
import CoreImage.CIFilterBuiltins
|
||||
|
||||
|
||||
struct QrCodeImage {
|
||||
let context = CIContext()
|
||||
|
||||
func generateQRCode(from text: String) -> UIImage {
|
||||
var qrImage = UIImage(systemName: "xmark.circle") ?? UIImage()
|
||||
let data = Data(text.utf8)
|
||||
let filter = CIFilter.qrCodeGenerator()
|
||||
filter.setValue(data, forKey: "inputMessage")
|
||||
|
||||
let transform = CGAffineTransform(scaleX: 20, y: 20)
|
||||
if let outputImage = filter.outputImage?.transformed(by: transform) {
|
||||
if let image = context.createCGImage(
|
||||
outputImage,
|
||||
from: outputImage.extent) {
|
||||
qrImage = UIImage(cgImage: image)
|
||||
}
|
||||
}
|
||||
|
||||
return qrImage
|
||||
}
|
||||
}
|
||||
|
||||
struct ShareChannel: View {
|
||||
|
||||
@Environment(\.managedObjectContext) var context
|
||||
@EnvironmentObject var bleManager: BLEManager
|
||||
@EnvironmentObject var userSettings: UserSettings
|
||||
|
||||
var node: NodeInfoEntity?
|
||||
|
||||
@State private var text = "https://meshtastic.org/E/#test"
|
||||
var qrCodeImage = QrCodeImage()
|
||||
|
||||
var body: some View {
|
||||
|
||||
VStack {
|
||||
|
||||
GeometryReader { bounds in
|
||||
|
||||
let smallest = min(bounds.size.width, bounds.size.height)
|
||||
|
||||
ScrollView {
|
||||
|
||||
VStack {
|
||||
Text("Scan the QR code below with the Apple or Android device you would like to share your channel settings with.")
|
||||
.fixedSize(horizontal: false, vertical: true)
|
||||
.font(.callout)
|
||||
|
||||
let image = qrCodeImage.generateQRCode(from: text)
|
||||
Image(uiImage: image)
|
||||
.resizable()
|
||||
.scaledToFit()
|
||||
.frame(
|
||||
minWidth: smallest * 0.8,
|
||||
maxWidth: smallest * 0.8,
|
||||
minHeight: smallest * 0.8,
|
||||
maxHeight: smallest * 0.8,
|
||||
alignment: .center
|
||||
)
|
||||
|
||||
if node != nil && node!.loRaConfig != nil {
|
||||
|
||||
HStack {
|
||||
|
||||
let preset = ModemPresets(rawValue: Int(node!.loRaConfig!.modemPreset))
|
||||
Text("Modem Preset \(preset!.description)").font(.title3)
|
||||
}
|
||||
}
|
||||
VStack {
|
||||
|
||||
Text("Number of Channels: \(node!.myInfo!.maxChannels)").font(.title2)
|
||||
|
||||
ForEach(node!.myInfo!.channels?.array.sorted(by: { ($0 as! ChannelEntity).index < ($1 as! ChannelEntity).index }) as! [ChannelEntity], id: \.self) { (channel: ChannelEntity) in
|
||||
|
||||
VStack {
|
||||
|
||||
|
||||
Text("Channel: \(channel.index) Name: \(channel.name ?? "")")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.frame(width: bounds.size.width, height: bounds.size.height)
|
||||
}
|
||||
}
|
||||
.navigationTitle("Share Channel")
|
||||
.navigationBarTitleDisplayMode(.automatic)
|
||||
.navigationBarItems(trailing:
|
||||
|
||||
ZStack {
|
||||
|
||||
ConnectedDevice(bluetoothOn: bleManager.isSwitchedOn, deviceConnected: bleManager.connectedPeripheral != nil, name: (bleManager.connectedPeripheral != nil) ? bleManager.connectedPeripheral.shortName : "????")
|
||||
})
|
||||
.onAppear {
|
||||
|
||||
self.bleManager.context = context
|
||||
}
|
||||
}
|
||||
.navigationViewStyle(StackNavigationViewStyle())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue