Skip to content

Commit

Permalink
Update platform requirements; add UI and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcprux committed Jan 8, 2024
1 parent d5584a9 commit 51bd397
Show file tree
Hide file tree
Showing 8 changed files with 282 additions and 54 deletions.
9 changes: 0 additions & 9 deletions Darwin/Assets.xcassets/AccentColor.colorset/Contents.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0.167",
"green" : "0.317",
"red" : "1.000"
}
},
"idiom" : "universal"
}
],
Expand Down
6 changes: 6 additions & 0 deletions Darwin/FireSide.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,10 @@
isa = XCBuildConfiguration;
buildSettings = {
ENABLE_PREVIEWS = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.0;
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -231,8 +233,10 @@
isa = XCBuildConfiguration;
buildSettings = {
ENABLE_PREVIEWS = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.0;
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -245,8 +249,10 @@
isa = XCBuildConfiguration;
buildSettings = {
ENABLE_PREVIEWS = YES;
IPHONEOS_DEPLOYMENT_TARGET = 17.0;
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 14.0;
SDKROOT = auto;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator macosx";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
84 changes: 84 additions & 0 deletions Darwin/FireSide.xcodeproj/xcshareddata/xcschemes/FireSide.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1510"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "499CD4382AC5B799001AE8D8"
BuildableName = "FireSide.app"
BlueprintName = "FireSide"
ReferencedContainer = "container:FireSide.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</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 = "499CD4382AC5B799001AE8D8"
BuildableName = "FireSide.app"
BlueprintName = "FireSide"
ReferencedContainer = "container:FireSide.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<EnvironmentVariables>
<EnvironmentVariable
key = "ANDROID_SERIAL"
value = "19091FDF600BAY"
isEnabled = "NO">
</EnvironmentVariable>
</EnvironmentVariables>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "499CD4382AC5B799001AE8D8"
BuildableName = "FireSide.app"
BlueprintName = "FireSide"
ReferencedContainer = "container:FireSide.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import PackageDescription
let package = Package(
name: "skipapp-fireside",
defaultLocalization: "en",
platforms: [.iOS(.v16), .macOS(.v13), .tvOS(.v16), .watchOS(.v9), .macCatalyst(.v16)],
platforms: [.iOS(.v17), .macOS(.v14), .tvOS(.v16), .watchOS(.v9), .macCatalyst(.v17)],
products: [
.library(name: "FireSideApp", type: .dynamic, targets: ["FireSide"]),
.library(name: "FireSideModel", targets: ["FireSideModel"]),
Expand Down
92 changes: 75 additions & 17 deletions Sources/FireSide/ContentView.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import SwiftUI
import FireSideModel

let fireSide = try! FireSideStore()
let firestore = try! FireSideStore()

public struct ContentView: View {
@AppStorage("setting") var setting = true
Expand All @@ -24,17 +24,7 @@ public struct ContentView: View {
}

NavigationStack {
List {
ForEach(1..<1_000) { i in
NavigationLink("Home \(i)", value: i)
}
}
.navigationTitle("Navigation")
.navigationDestination(for: Int.self) { i in
Text("Destination \(i)")
.font(.title)
.navigationTitle("Navigation \(i)")
}
MessagesListView()
}
.tag(1)
.tabItem { Label("Home", systemImage: "house.fill") }
Expand All @@ -50,6 +40,70 @@ public struct ContentView: View {
}
}

struct MessagesListView : View {
@State var messageList: MessageList? = nil

var body: some View {
VStack {
List {
if let messageList = messageList {
ForEach(messageList.messages) { m in
NavigationLink(value: m) {
HStack {
Text(m.message)
.font(.title)
Text(m.time.description)
.font(Font.callout)
}
}
}
}
}
.navigationTitle("Navigation")
.navigationDestination(for: Message.self) { msg in
VStack {
Text(msg.message)
.font(.title)
.navigationTitle("Message")
}
}

HStack {
ForEach(["♥️", "💙", "💜", "💛", "💚"], id: \.self) { emoji in
Button(emoji) {
Task.detached {
let isJava = ProcessInfo.processInfo.environment["java.io.tmpdir"] != nil
let msg = emoji + " from " + (isJava ? "Android" : "iOS")
await sendMessage(msg)
}
}
.buttonStyle(.bordered)
}
}
.padding()
}
.task {
do {
let messageList = try await firestore.watchMessageList()
self.messageList = messageList
} catch {
logger.error("error getting message list: \(error)")
}
}
}

func sendMessage(_ message: String) async {
logger.log("sendMessage: \(message)")
do {
let msg = try await firestore.sendMessage(message)
logger.error("sent message: \(msg)")
} catch {
logger.error("error sending message: \(error)")
}

}
}

let chatKeyCount = 8

struct JoinChatView : View {
Expand Down Expand Up @@ -108,10 +162,10 @@ struct JoinChatView : View {
self.lastError = nil // clear the most recent error
if chatKey.count == chatKeyCount {
logger.log("joinChat: \(chatKey)")
try await fireSide.joinChat(chatKey: chatKey)
try await firestore.joinChat(chatKey: chatKey)
} else {
logger.log("startNewChat")
chatKey = try await fireSide.startNewChat()
chatKey = try await firestore.startNewChat()
}
} catch {
logger.log("joinChat error: \(error)")
Expand All @@ -120,6 +174,10 @@ struct JoinChatView : View {
}
}

#Preview {
ContentView()
}
//#Preview {
// if #available(iOS 17.0, *) {
// ContentView()
// } else {
// // Fallback on earlier versions
// }
//}
10 changes: 2 additions & 8 deletions Sources/FireSide/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,17 @@
"strings" : {
"Chat Key" : {

},
"Destination %lld" : {

},
"Home" : {

},
"Home %lld" : {

},
"Join Chat" : {

},
"Navigation" : {
"Message" : {

},
"Navigation %lld" : {
"Navigation" : {

},
"New Chat" : {
Expand Down
Loading

0 comments on commit 51bd397

Please sign in to comment.