Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,18 @@ target/

/target
Cargo.lock

## iOS
## User settings
xcuserdata/

# Xcode
*.xcworkspace
*.xcuserstate
*.xccheckout

# Swift Package Manager
/.build

# CocoaPods
Pods/
956 changes: 956 additions & 0 deletions iroh-console-ios/IrohConsole.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1500"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "42F69E3D2A1C5002006F772D"
BuildableName = "IrohConsole.app"
BlueprintName = "IrohConsole"
ReferencedContainer = "container:IrohConsole.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "42F69E4D2A1C5003006F772D"
BuildableName = "IrohConsoleTests.xctest"
BlueprintName = "IrohConsoleTests"
ReferencedContainer = "container:IrohConsole.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "42F69E572A1C5003006F772D"
BuildableName = "IrohConsoleUITests.xctest"
BlueprintName = "IrohConsoleUITests"
ReferencedContainer = "container:IrohConsole.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "42F69E3D2A1C5002006F772D"
BuildableName = "IrohConsole.app"
BlueprintName = "IrohConsole"
ReferencedContainer = "container:IrohConsole.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "RUST_LOG"
value = "debug"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "RUST_BACKTRACE"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "42F69E3D2A1C5002006F772D"
BuildableName = "IrohConsole.app"
BlueprintName = "IrohConsole"
ReferencedContainer = "container:IrohConsole.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
6 changes: 6 additions & 0 deletions iroh-console-ios/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

# Iroh Console

This is the code for "iroh console", an iOS app for working directly with the iroh protocol. It's also an example of using [swift FFI bindings](https://github.com/n0-computer/iroh-ffi)

This currently requires building & running iroh-ffi locally.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xFF",
"green" : "0x7C",
"red" : "0x7C"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"images" : [
{
"filename" : "AppIcon.png",
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions iroh-console-ios/iroh/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"images" : [
{
"filename" : "iroh logo purple.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "iroh logo [email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "iroh logo [email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "iroh_kv_1.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 58 additions & 0 deletions iroh-console-ios/iroh/ContentView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//
// ContentView.swift
// iroh
//
// Created by Brendan O'Brien on 5/22/23.
//

import SwiftUI
import IrohLib

struct ContentView: View {
@StateObject private var sessionInfo = UserSession()
@ObservedObject var anchor: NetworkModelController = NetworkModelController(anchor: networks[0])

var body: some View {
TabView {
NodeHome()
.tabItem {
Label("Node", systemImage: "macpro.gen2.fill")
}
Console()
.tabItem {
Label("Console", systemImage: "terminal")
}
// AnchorHome()
// .tabItem {
// Label("Anchor", systemImage: "scalemass.fill")
// }
}.environmentObject(sessionInfo)
}
}

extension UIApplication {
func handleKeyboard() {
guard let window = windows.first else { return }
let tapRecognizer = UITapGestureRecognizer(target: window, action: #selector(UIView.endEditing))
tapRecognizer.cancelsTouchesInView = false
tapRecognizer.delegate = self
window.addGestureRecognizer(tapRecognizer)
}
}

extension UIApplication: UIGestureRecognizerDelegate {
public func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool {
return false
}
}


struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
.environmentObject(IrohNodeManager.shared)
.onAppear() {
IrohNodeManager.shared.start()
}
}
}
2 changes: 2 additions & 0 deletions iroh-console-ios/iroh/Data/DocEvents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[
]
29 changes: 29 additions & 0 deletions iroh-console-ios/iroh/Data/Networks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[
{
"network_id": "6e182172-95b8-4a0f-9e4e-f8f881eea7fd",
"created_by": "667ebcea-2d5a-402f-a15c-046134467a52",
"created_at": "2023-06-13T19:32:37.628630Z",
"updated_at": "2023-06-13T19:32:37.628630Z",
"pretty_name": "Default Iroh Network",
"name": "default",
"anchor_url": "https://default.iroh.network"
},
{
"network_id": "778fbd90-4497-4f81-98be-2dab68ae6acb",
"created_by": "667ebcea-2d5a-402f-a15c-046134467a52",
"created_at": "2023-06-13T19:32:37.628630Z",
"updated_at": "2023-06-13T19:32:37.628630Z",
"pretty_name": "bananas",
"name": "bananas",
"anchor_url": "https://bananas.iroh.network"
},
{
"network_id": "fc4e626c-787e-4cdf-8e29-d18375f0492b",
"created_by": "667ebcea-2d5a-402f-a15c-046134467a52",
"created_at": "2023-06-15T12:36:13.081136Z",
"updated_at": "2023-06-15T12:36:13.081136Z",
"pretty_name": "rust memes only",
"name": "rust-memes-only",
"anchor_url": "https://rust-memes-only.iroh.network"
}
]
21 changes: 21 additions & 0 deletions iroh-console-ios/iroh/Extensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// Extensions.swift
// IrohApp
//
// Created by Brendan O'Brien on 9/13/23.
//

import Foundation

extension String {
/*
Truncates the string to the specified length number of characters and appends an optional trailing string if longer.
- Parameter length: Desired maximum lengths of a string
- Parameter trailing: A 'String' that will be appended after the truncation.

- Returns: 'String' object.
*/
func trunc(length: Int, trailing: String = "…") -> String {
return (self.count > length) ? self.prefix(length) + trailing : self
}
}
Binary file added iroh-console-ios/iroh/Fonts/SpaceGrotesk-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added iroh-console-ios/iroh/Fonts/SpaceMono-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file added iroh-console-ios/iroh/Fonts/SpaceMono-Italic.ttf
Binary file not shown.
Binary file added iroh-console-ios/iroh/Fonts/SpaceMono-Regular.ttf
Binary file not shown.
Binary file added iroh-console-ios/iroh/Images/AppIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added iroh-console-ios/iroh/Images/iroh logo purple.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions iroh-console-ios/iroh/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UIAppFonts</key>
<array>
<string>SpaceMono-Regular.ttf</string>
<string>SpaceMono-Bold.ttf</string>
<string>SpaceGrotesk-Regular.ttf</string>
<string>SpaceGrotesk-SemiBold.ttf</string>
<string>SpaceGrotesk-Bold.ttf</string>
</array>
<key>UILaunchScreen</key>
<dict>
<key>UIImageName</key>
<string>launch_screen</string>
</dict>
</dict>
</plist>
Loading