From 88193be298daab8feba279eec616e6faccfc06a2 Mon Sep 17 00:00:00 2001 From: Peter Hajas Date: Tue, 10 May 2022 20:20:20 -0600 Subject: [PATCH] initial commit --- .gitignore | 63 ++ Kordophone/Kordophone--macOS--Info.plist | 11 + .../Kordophone.xcodeproj/project.pbxproj | 778 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../AccentColor.colorset/Contents.json | 11 + .../AppIcon.appiconset/Contents.json | 148 ++++ .../Shared/Assets.xcassets/Contents.json | 6 + Kordophone/Shared/ContentView.swift | 56 ++ Kordophone/Shared/ConversationList.swift | 48 ++ Kordophone/Shared/ConversationRow.swift | 38 + Kordophone/Shared/ConversationView.swift | 46 ++ Kordophone/Shared/KordophoneApp.swift | 20 + Kordophone/Shared/LoginView.swift | 32 + Kordophone/Shared/MessageView.swift | 16 + Kordophone/Tests iOS/Tests_iOS.swift | 41 + .../Tests iOS/Tests_iOSLaunchTests.swift | 32 + Kordophone/Tests macOS/Tests_macOS.swift | 41 + .../Tests macOS/Tests_macOSLaunchTests.swift | 32 + Kordophone/macOS/macOS.entitlements | 14 + KordophoneKit/.gitignore | 9 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + KordophoneKit/Package.swift | 32 + KordophoneKit/README.md | 3 + .../Sources/KordophoneKit/Connection.swift | 114 +++ .../Sources/KordophoneKit/Conversation.swift | 48 ++ .../KordophoneKit/Date+KordophoneKit.swift | 18 + .../Sources/KordophoneKit/KordophoneKit.swift | 6 + .../Sources/KordophoneKit/Message.swift | 36 + .../KordophoneKitTests.swift | 11 + 30 files changed, 1733 insertions(+) create mode 100644 .gitignore create mode 100644 Kordophone/Kordophone--macOS--Info.plist create mode 100644 Kordophone/Kordophone.xcodeproj/project.pbxproj create mode 100644 Kordophone/Kordophone.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 Kordophone/Kordophone.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 Kordophone/Shared/Assets.xcassets/AccentColor.colorset/Contents.json create mode 100644 Kordophone/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 Kordophone/Shared/Assets.xcassets/Contents.json create mode 100644 Kordophone/Shared/ContentView.swift create mode 100644 Kordophone/Shared/ConversationList.swift create mode 100644 Kordophone/Shared/ConversationRow.swift create mode 100644 Kordophone/Shared/ConversationView.swift create mode 100644 Kordophone/Shared/KordophoneApp.swift create mode 100644 Kordophone/Shared/LoginView.swift create mode 100644 Kordophone/Shared/MessageView.swift create mode 100644 Kordophone/Tests iOS/Tests_iOS.swift create mode 100644 Kordophone/Tests iOS/Tests_iOSLaunchTests.swift create mode 100644 Kordophone/Tests macOS/Tests_macOS.swift create mode 100644 Kordophone/Tests macOS/Tests_macOSLaunchTests.swift create mode 100644 Kordophone/macOS/macOS.entitlements create mode 100644 KordophoneKit/.gitignore create mode 100644 KordophoneKit/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 KordophoneKit/Package.swift create mode 100644 KordophoneKit/README.md create mode 100644 KordophoneKit/Sources/KordophoneKit/Connection.swift create mode 100644 KordophoneKit/Sources/KordophoneKit/Conversation.swift create mode 100644 KordophoneKit/Sources/KordophoneKit/Date+KordophoneKit.swift create mode 100644 KordophoneKit/Sources/KordophoneKit/KordophoneKit.swift create mode 100644 KordophoneKit/Sources/KordophoneKit/Message.swift create mode 100644 KordophoneKit/Tests/KordophoneKitTests/KordophoneKitTests.swift diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3e0e814 --- /dev/null +++ b/.gitignore @@ -0,0 +1,63 @@ +# Xcode +# +# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore + +## Build generated +build/ +DerivedData/ + +## Various settings +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +xcuserdata/ + +## Other +*.moved-aside +*.xcuserstate + +## Obj-C/Swift specific +*.hmap +*.ipa + +## Playgrounds +timeline.xctimeline +playground.xcworkspace + +# Swift Package Manager +# +# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. +# Packages/ +.build/ + +# CocoaPods +# +# We recommend against adding the Pods directory to your .gitignore. However +# you should judge for yourself, the pros and cons are mentioned at: +# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control +# +# Pods/ + +# Carthage +# +# Add this line if you want to avoid checking in source code from Carthage dependencies. +# Carthage/Checkouts + +Carthage/Build + +# fastlane +# +# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the +# screenshots whenever they are needed. +# For more information about the recommended setup visit: +# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md + +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output diff --git a/Kordophone/Kordophone--macOS--Info.plist b/Kordophone/Kordophone--macOS--Info.plist new file mode 100644 index 0000000..6a6654d --- /dev/null +++ b/Kordophone/Kordophone--macOS--Info.plist @@ -0,0 +1,11 @@ + + + + + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + + + diff --git a/Kordophone/Kordophone.xcodeproj/project.pbxproj b/Kordophone/Kordophone.xcodeproj/project.pbxproj new file mode 100644 index 0000000..616448a --- /dev/null +++ b/Kordophone/Kordophone.xcodeproj/project.pbxproj @@ -0,0 +1,778 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 55; + objects = { + +/* Begin PBXBuildFile section */ + 4F48B6A2282A14F0001B669B /* KordophoneKit in Frameworks */ = {isa = PBXBuildFile; productRef = 4F48B6A1282A14F0001B669B /* KordophoneKit */; }; + 4F48B6A4282A14F4001B669B /* KordophoneKit in Frameworks */ = {isa = PBXBuildFile; productRef = 4F48B6A3282A14F4001B669B /* KordophoneKit */; }; + 4F48B6A7282A3559001B669B /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F48B6A6282A3559001B669B /* LoginView.swift */; }; + 4F48B6A8282A3559001B669B /* LoginView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F48B6A6282A3559001B669B /* LoginView.swift */; }; + 4F48B6AA282A365B001B669B /* ConversationList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F48B6A9282A365B001B669B /* ConversationList.swift */; }; + 4F48B6AB282A365B001B669B /* ConversationList.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F48B6A9282A365B001B669B /* ConversationList.swift */; }; + 4F48B6AD282A3D00001B669B /* ConversationRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F48B6AC282A3D00001B669B /* ConversationRow.swift */; }; + 4F48B6AE282A3D00001B669B /* ConversationRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F48B6AC282A3D00001B669B /* ConversationRow.swift */; }; + 4F48B6B0282AD977001B669B /* ConversationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F48B6AF282AD977001B669B /* ConversationView.swift */; }; + 4F48B6B1282AD977001B669B /* ConversationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F48B6AF282AD977001B669B /* ConversationView.swift */; }; + 4F48B6B3282AF3A6001B669B /* MessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F48B6B2282AF3A6001B669B /* MessageView.swift */; }; + 4F48B6B4282AF3A6001B669B /* MessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F48B6B2282AF3A6001B669B /* MessageView.swift */; }; + 4F8A65FC280A93B0007A7431 /* Tests_iOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F8A65FB280A93B0007A7431 /* Tests_iOS.swift */; }; + 4F8A65FE280A93B0007A7431 /* Tests_iOSLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F8A65FD280A93B0007A7431 /* Tests_iOSLaunchTests.swift */; }; + 4F8A6608280A93B0007A7431 /* Tests_macOS.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F8A6607280A93B0007A7431 /* Tests_macOS.swift */; }; + 4F8A660A280A93B0007A7431 /* Tests_macOSLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F8A6609280A93B0007A7431 /* Tests_macOSLaunchTests.swift */; }; + 4F8A660B280A93B0007A7431 /* KordophoneApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F8A65E3280A93AE007A7431 /* KordophoneApp.swift */; }; + 4F8A660C280A93B0007A7431 /* KordophoneApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F8A65E3280A93AE007A7431 /* KordophoneApp.swift */; }; + 4F8A660D280A93B0007A7431 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F8A65E4280A93AE007A7431 /* ContentView.swift */; }; + 4F8A660E280A93B0007A7431 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F8A65E4280A93AE007A7431 /* ContentView.swift */; }; + 4F8A660F280A93B0007A7431 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4F8A65E5280A93AF007A7431 /* Assets.xcassets */; }; + 4F8A6610280A93B0007A7431 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4F8A65E5280A93AF007A7431 /* Assets.xcassets */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 4F8A65F8280A93B0007A7431 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4F8A65DE280A93AE007A7431 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4F8A65E9280A93AF007A7431; + remoteInfo = "Kordophone (iOS)"; + }; + 4F8A6604280A93B0007A7431 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4F8A65DE280A93AE007A7431 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 4F8A65EF280A93B0007A7431; + remoteInfo = "Kordophone (macOS)"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 4F0F235E280A96FD00E71C9C /* KordophoneKit */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = KordophoneKit; path = ../KordophoneKit; sourceTree = ""; }; + 4F48B6A5282A1569001B669B /* Kordophone--macOS--Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "Kordophone--macOS--Info.plist"; sourceTree = ""; }; + 4F48B6A6282A3559001B669B /* LoginView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginView.swift; sourceTree = ""; }; + 4F48B6A9282A365B001B669B /* ConversationList.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationList.swift; sourceTree = ""; }; + 4F48B6AC282A3D00001B669B /* ConversationRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationRow.swift; sourceTree = ""; }; + 4F48B6AF282AD977001B669B /* ConversationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConversationView.swift; sourceTree = ""; }; + 4F48B6B2282AF3A6001B669B /* MessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MessageView.swift; sourceTree = ""; }; + 4F8A65E3280A93AE007A7431 /* KordophoneApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KordophoneApp.swift; sourceTree = ""; }; + 4F8A65E4280A93AE007A7431 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = ""; }; + 4F8A65E5280A93AF007A7431 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 4F8A65EA280A93AF007A7431 /* Kordophone.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Kordophone.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 4F8A65F0280A93B0007A7431 /* Kordophone.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Kordophone.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 4F8A65F2280A93B0007A7431 /* macOS.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = macOS.entitlements; sourceTree = ""; }; + 4F8A65F7280A93B0007A7431 /* Tests iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 4F8A65FB280A93B0007A7431 /* Tests_iOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests_iOS.swift; sourceTree = ""; }; + 4F8A65FD280A93B0007A7431 /* Tests_iOSLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests_iOSLaunchTests.swift; sourceTree = ""; }; + 4F8A6603280A93B0007A7431 /* Tests macOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Tests macOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 4F8A6607280A93B0007A7431 /* Tests_macOS.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests_macOS.swift; sourceTree = ""; }; + 4F8A6609280A93B0007A7431 /* Tests_macOSLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tests_macOSLaunchTests.swift; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 4F8A65E7280A93AF007A7431 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4F48B6A2282A14F0001B669B /* KordophoneKit in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F8A65ED280A93B0007A7431 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 4F48B6A4282A14F4001B669B /* KordophoneKit in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F8A65F4280A93B0007A7431 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F8A6600280A93B0007A7431 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 4F0F235D280A96FD00E71C9C /* Packages */ = { + isa = PBXGroup; + children = ( + 4F0F235E280A96FD00E71C9C /* KordophoneKit */, + ); + name = Packages; + sourceTree = ""; + }; + 4F48B6A0282A14F0001B669B /* Frameworks */ = { + isa = PBXGroup; + children = ( + ); + name = Frameworks; + sourceTree = ""; + }; + 4F8A65DD280A93AE007A7431 = { + isa = PBXGroup; + children = ( + 4F48B6A5282A1569001B669B /* Kordophone--macOS--Info.plist */, + 4F0F235D280A96FD00E71C9C /* Packages */, + 4F8A65E2280A93AE007A7431 /* Shared */, + 4F8A65F1280A93B0007A7431 /* macOS */, + 4F8A65FA280A93B0007A7431 /* Tests iOS */, + 4F8A6606280A93B0007A7431 /* Tests macOS */, + 4F8A65EB280A93AF007A7431 /* Products */, + 4F48B6A0282A14F0001B669B /* Frameworks */, + ); + sourceTree = ""; + }; + 4F8A65E2280A93AE007A7431 /* Shared */ = { + isa = PBXGroup; + children = ( + 4F8A65E3280A93AE007A7431 /* KordophoneApp.swift */, + 4F8A65E4280A93AE007A7431 /* ContentView.swift */, + 4F48B6A6282A3559001B669B /* LoginView.swift */, + 4F48B6A9282A365B001B669B /* ConversationList.swift */, + 4F48B6AC282A3D00001B669B /* ConversationRow.swift */, + 4F48B6AF282AD977001B669B /* ConversationView.swift */, + 4F48B6B2282AF3A6001B669B /* MessageView.swift */, + 4F8A65E5280A93AF007A7431 /* Assets.xcassets */, + ); + path = Shared; + sourceTree = ""; + }; + 4F8A65EB280A93AF007A7431 /* Products */ = { + isa = PBXGroup; + children = ( + 4F8A65EA280A93AF007A7431 /* Kordophone.app */, + 4F8A65F0280A93B0007A7431 /* Kordophone.app */, + 4F8A65F7280A93B0007A7431 /* Tests iOS.xctest */, + 4F8A6603280A93B0007A7431 /* Tests macOS.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 4F8A65F1280A93B0007A7431 /* macOS */ = { + isa = PBXGroup; + children = ( + 4F8A65F2280A93B0007A7431 /* macOS.entitlements */, + ); + path = macOS; + sourceTree = ""; + }; + 4F8A65FA280A93B0007A7431 /* Tests iOS */ = { + isa = PBXGroup; + children = ( + 4F8A65FB280A93B0007A7431 /* Tests_iOS.swift */, + 4F8A65FD280A93B0007A7431 /* Tests_iOSLaunchTests.swift */, + ); + path = "Tests iOS"; + sourceTree = ""; + }; + 4F8A6606280A93B0007A7431 /* Tests macOS */ = { + isa = PBXGroup; + children = ( + 4F8A6607280A93B0007A7431 /* Tests_macOS.swift */, + 4F8A6609280A93B0007A7431 /* Tests_macOSLaunchTests.swift */, + ); + path = "Tests macOS"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 4F8A65E9280A93AF007A7431 /* Kordophone (iOS) */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4F8A6613280A93B0007A7431 /* Build configuration list for PBXNativeTarget "Kordophone (iOS)" */; + buildPhases = ( + 4F8A65E6280A93AF007A7431 /* Sources */, + 4F8A65E7280A93AF007A7431 /* Frameworks */, + 4F8A65E8280A93AF007A7431 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "Kordophone (iOS)"; + packageProductDependencies = ( + 4F48B6A1282A14F0001B669B /* KordophoneKit */, + ); + productName = "Kordophone (iOS)"; + productReference = 4F8A65EA280A93AF007A7431 /* Kordophone.app */; + productType = "com.apple.product-type.application"; + }; + 4F8A65EF280A93B0007A7431 /* Kordophone (macOS) */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4F8A6616280A93B0007A7431 /* Build configuration list for PBXNativeTarget "Kordophone (macOS)" */; + buildPhases = ( + 4F8A65EC280A93B0007A7431 /* Sources */, + 4F8A65ED280A93B0007A7431 /* Frameworks */, + 4F8A65EE280A93B0007A7431 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 4F8A6627280A95CD007A7431 /* PBXTargetDependency */, + ); + name = "Kordophone (macOS)"; + packageProductDependencies = ( + 4F48B6A3282A14F4001B669B /* KordophoneKit */, + ); + productName = "Kordophone (macOS)"; + productReference = 4F8A65F0280A93B0007A7431 /* Kordophone.app */; + productType = "com.apple.product-type.application"; + }; + 4F8A65F6280A93B0007A7431 /* Tests iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4F8A6619280A93B0007A7431 /* Build configuration list for PBXNativeTarget "Tests iOS" */; + buildPhases = ( + 4F8A65F3280A93B0007A7431 /* Sources */, + 4F8A65F4280A93B0007A7431 /* Frameworks */, + 4F8A65F5280A93B0007A7431 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 4F8A65F9280A93B0007A7431 /* PBXTargetDependency */, + ); + name = "Tests iOS"; + productName = "Tests iOS"; + productReference = 4F8A65F7280A93B0007A7431 /* Tests iOS.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; + 4F8A6602280A93B0007A7431 /* Tests macOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 4F8A661C280A93B0007A7431 /* Build configuration list for PBXNativeTarget "Tests macOS" */; + buildPhases = ( + 4F8A65FF280A93B0007A7431 /* Sources */, + 4F8A6600280A93B0007A7431 /* Frameworks */, + 4F8A6601280A93B0007A7431 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 4F8A6605280A93B0007A7431 /* PBXTargetDependency */, + ); + name = "Tests macOS"; + productName = "Tests macOS"; + productReference = 4F8A6603280A93B0007A7431 /* Tests macOS.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 4F8A65DE280A93AE007A7431 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + LastSwiftUpdateCheck = 1330; + LastUpgradeCheck = 1330; + TargetAttributes = { + 4F8A65E9280A93AF007A7431 = { + CreatedOnToolsVersion = 13.3.1; + }; + 4F8A65EF280A93B0007A7431 = { + CreatedOnToolsVersion = 13.3.1; + }; + 4F8A65F6280A93B0007A7431 = { + CreatedOnToolsVersion = 13.3.1; + TestTargetID = 4F8A65E9280A93AF007A7431; + }; + 4F8A6602280A93B0007A7431 = { + CreatedOnToolsVersion = 13.3.1; + TestTargetID = 4F8A65EF280A93B0007A7431; + }; + }; + }; + buildConfigurationList = 4F8A65E1280A93AE007A7431 /* Build configuration list for PBXProject "Kordophone" */; + compatibilityVersion = "Xcode 13.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 4F8A65DD280A93AE007A7431; + productRefGroup = 4F8A65EB280A93AF007A7431 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 4F8A65E9280A93AF007A7431 /* Kordophone (iOS) */, + 4F8A65EF280A93B0007A7431 /* Kordophone (macOS) */, + 4F8A65F6280A93B0007A7431 /* Tests iOS */, + 4F8A6602280A93B0007A7431 /* Tests macOS */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 4F8A65E8280A93AF007A7431 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4F8A660F280A93B0007A7431 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F8A65EE280A93B0007A7431 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4F8A6610280A93B0007A7431 /* Assets.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F8A65F5280A93B0007A7431 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F8A6601280A93B0007A7431 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 4F8A65E6280A93AF007A7431 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4F48B6AA282A365B001B669B /* ConversationList.swift in Sources */, + 4F48B6A7282A3559001B669B /* LoginView.swift in Sources */, + 4F8A660D280A93B0007A7431 /* ContentView.swift in Sources */, + 4F48B6AD282A3D00001B669B /* ConversationRow.swift in Sources */, + 4F8A660B280A93B0007A7431 /* KordophoneApp.swift in Sources */, + 4F48B6B3282AF3A6001B669B /* MessageView.swift in Sources */, + 4F48B6B0282AD977001B669B /* ConversationView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F8A65EC280A93B0007A7431 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4F48B6AB282A365B001B669B /* ConversationList.swift in Sources */, + 4F48B6A8282A3559001B669B /* LoginView.swift in Sources */, + 4F8A660E280A93B0007A7431 /* ContentView.swift in Sources */, + 4F48B6AE282A3D00001B669B /* ConversationRow.swift in Sources */, + 4F8A660C280A93B0007A7431 /* KordophoneApp.swift in Sources */, + 4F48B6B4282AF3A6001B669B /* MessageView.swift in Sources */, + 4F48B6B1282AD977001B669B /* ConversationView.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F8A65F3280A93B0007A7431 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4F8A65FE280A93B0007A7431 /* Tests_iOSLaunchTests.swift in Sources */, + 4F8A65FC280A93B0007A7431 /* Tests_iOS.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 4F8A65FF280A93B0007A7431 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 4F8A660A280A93B0007A7431 /* Tests_macOSLaunchTests.swift in Sources */, + 4F8A6608280A93B0007A7431 /* Tests_macOS.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 4F8A65F9280A93B0007A7431 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4F8A65E9280A93AF007A7431 /* Kordophone (iOS) */; + targetProxy = 4F8A65F8280A93B0007A7431 /* PBXContainerItemProxy */; + }; + 4F8A6605280A93B0007A7431 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 4F8A65EF280A93B0007A7431 /* Kordophone (macOS) */; + targetProxy = 4F8A6604280A93B0007A7431 /* PBXContainerItemProxy */; + }; + 4F8A6627280A95CD007A7431 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + productRef = 4F8A6626280A95CD007A7431 /* KordophoneKit */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 4F8A6611280A93B0007A7431 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + }; + name = Debug; + }; + 4F8A6612280A93B0007A7431 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + }; + name = Release; + }; + 4F8A6614280A93B0007A7431 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.4; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = peterhajas.Kordophone; + PRODUCT_NAME = Kordophone; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 4F8A6615280A93B0007A7431 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES; + INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES; + INFOPLIST_KEY_UILaunchScreen_Generation = YES; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight"; + IPHONEOS_DEPLOYMENT_TARGET = 15.4; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = peterhajas.Kordophone; + PRODUCT_NAME = Kordophone; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 4F8A6617280A93B0007A7431 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = macOS/macOS.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Kordophone--macOS--Info.plist"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 12.3; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = peterhajas.Kordophone; + PRODUCT_NAME = Kordophone; + SDKROOT = macosx; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Debug; + }; + 4F8A6618280A93B0007A7431 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; + CODE_SIGN_ENTITLEMENTS = macOS/macOS.entitlements; + CODE_SIGN_STYLE = Automatic; + COMBINE_HIDPI_IMAGES = YES; + CURRENT_PROJECT_VERSION = 1; + ENABLE_PREVIEWS = YES; + GENERATE_INFOPLIST_FILE = YES; + INFOPLIST_FILE = "Kordophone--macOS--Info.plist"; + INFOPLIST_KEY_NSHumanReadableCopyright = ""; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/../Frameworks", + ); + MACOSX_DEPLOYMENT_TARGET = 12.3; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = peterhajas.Kordophone; + PRODUCT_NAME = Kordophone; + SDKROOT = macosx; + SWIFT_EMIT_LOC_STRINGS = YES; + SWIFT_VERSION = 5.0; + }; + name = Release; + }; + 4F8A661A280A93B0007A7431 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.4; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "peterhajas.Tests-iOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = "Kordophone (iOS)"; + }; + name = Debug; + }; + 4F8A661B280A93B0007A7431 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 15.4; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "peterhajas.Tests-iOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + TEST_TARGET_NAME = "Kordophone (iOS)"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 4F8A661D280A93B0007A7431 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MACOSX_DEPLOYMENT_TARGET = 12.3; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "peterhajas.Tests-macOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TEST_TARGET_NAME = "Kordophone (macOS)"; + }; + name = Debug; + }; + 4F8A661E280A93B0007A7431 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + CURRENT_PROJECT_VERSION = 1; + GENERATE_INFOPLIST_FILE = YES; + MACOSX_DEPLOYMENT_TARGET = 12.3; + MARKETING_VERSION = 1.0; + PRODUCT_BUNDLE_IDENTIFIER = "peterhajas.Tests-macOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SWIFT_EMIT_LOC_STRINGS = NO; + SWIFT_VERSION = 5.0; + TEST_TARGET_NAME = "Kordophone (macOS)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 4F8A65E1280A93AE007A7431 /* Build configuration list for PBXProject "Kordophone" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4F8A6611280A93B0007A7431 /* Debug */, + 4F8A6612280A93B0007A7431 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4F8A6613280A93B0007A7431 /* Build configuration list for PBXNativeTarget "Kordophone (iOS)" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4F8A6614280A93B0007A7431 /* Debug */, + 4F8A6615280A93B0007A7431 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4F8A6616280A93B0007A7431 /* Build configuration list for PBXNativeTarget "Kordophone (macOS)" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4F8A6617280A93B0007A7431 /* Debug */, + 4F8A6618280A93B0007A7431 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4F8A6619280A93B0007A7431 /* Build configuration list for PBXNativeTarget "Tests iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4F8A661A280A93B0007A7431 /* Debug */, + 4F8A661B280A93B0007A7431 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 4F8A661C280A93B0007A7431 /* Build configuration list for PBXNativeTarget "Tests macOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 4F8A661D280A93B0007A7431 /* Debug */, + 4F8A661E280A93B0007A7431 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCSwiftPackageProductDependency section */ + 4F48B6A1282A14F0001B669B /* KordophoneKit */ = { + isa = XCSwiftPackageProductDependency; + productName = KordophoneKit; + }; + 4F48B6A3282A14F4001B669B /* KordophoneKit */ = { + isa = XCSwiftPackageProductDependency; + productName = KordophoneKit; + }; + 4F8A6626280A95CD007A7431 /* KordophoneKit */ = { + isa = XCSwiftPackageProductDependency; + productName = KordophoneKit; + }; +/* End XCSwiftPackageProductDependency section */ + }; + rootObject = 4F8A65DE280A93AE007A7431 /* Project object */; +} diff --git a/Kordophone/Kordophone.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Kordophone/Kordophone.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/Kordophone/Kordophone.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/Kordophone/Kordophone.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Kordophone/Kordophone.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Kordophone/Kordophone.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Kordophone/Shared/Assets.xcassets/AccentColor.colorset/Contents.json b/Kordophone/Shared/Assets.xcassets/AccentColor.colorset/Contents.json new file mode 100644 index 0000000..eb87897 --- /dev/null +++ b/Kordophone/Shared/Assets.xcassets/AccentColor.colorset/Contents.json @@ -0,0 +1,11 @@ +{ + "colors" : [ + { + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Kordophone/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json b/Kordophone/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 0000000..c136eaf --- /dev/null +++ b/Kordophone/Shared/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,148 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "20x20" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "29x29" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "40x40" + }, + { + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "40x40" + }, + { + "idiom" : "ipad", + "scale" : "1x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "76x76" + }, + { + "idiom" : "ipad", + "scale" : "2x", + "size" : "83.5x83.5" + }, + { + "idiom" : "ios-marketing", + "scale" : "1x", + "size" : "1024x1024" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "idiom" : "mac", + "scale" : "1x", + "size" : "512x512" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Kordophone/Shared/Assets.xcassets/Contents.json b/Kordophone/Shared/Assets.xcassets/Contents.json new file mode 100644 index 0000000..73c0059 --- /dev/null +++ b/Kordophone/Shared/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Kordophone/Shared/ContentView.swift b/Kordophone/Shared/ContentView.swift new file mode 100644 index 0000000..cf94910 --- /dev/null +++ b/Kordophone/Shared/ContentView.swift @@ -0,0 +1,56 @@ +// +// ContentView.swift +// Shared +// +// Created by Peter Hajas on 4/16/22. +// + +import SwiftUI +import KordophoneKit + +struct ContentView: View { + @EnvironmentObject private var connection: Connection + @State private var selectedConversation: Conversation? + + @ViewBuilder + private var loginOverlay: some View { + if !connection.authenticated { + LoginView { info in + Task { + await connection.connect(info: info) + } + } + } + } + + @ViewBuilder + private var content: some View { + if !connection.authenticated { + LoginView { info in + Task { + await connection.connect(info: info) + } + } + } + else { + NavigationView { + ConversationListWrapper(selectedConversation: $selectedConversation) + selectedConversation.map { + ConversationViewWrapper(conversation: $0) + } + } + } + } + + var body: some View { + content + .environmentObject(connection) + .frame(maxWidth: .infinity, maxHeight: .infinity) + } +} + +struct ContentView_Previews: PreviewProvider { + static var previews: some View { + ContentView() + } +} diff --git a/Kordophone/Shared/ConversationList.swift b/Kordophone/Shared/ConversationList.swift new file mode 100644 index 0000000..922ae04 --- /dev/null +++ b/Kordophone/Shared/ConversationList.swift @@ -0,0 +1,48 @@ + +import KordophoneKit +import SwiftUI + +struct ConversationList : View { + @Binding var selectedConversation: Conversation? + var conversations: [Conversation] + + var sortedConversations: [Conversation] { + conversations + .sorted { a, b in + a.date > b.date + } + } + + var body: some View { + List { + ForEach(sortedConversations) { convo in + ConversationRow(conversation: convo) + .contentShape(Rectangle()) + .onTapGesture { + selectedConversation = convo + } + } + } + .navigationTitle("Kordophone") + } +} + +struct ConversationListWrapper : View { + @Binding var selectedConversation: Conversation? + + @State private var conversations = [Conversation]() + @EnvironmentObject private var connection: Connection + + private func refresh() { + Task { + self.conversations = await connection.conversations() ?? .init() + } + } + + var body: some View { + ConversationList(selectedConversation: $selectedConversation, conversations: conversations) + .onAppear { + refresh() + } + } +} diff --git a/Kordophone/Shared/ConversationRow.swift b/Kordophone/Shared/ConversationRow.swift new file mode 100644 index 0000000..3b52824 --- /dev/null +++ b/Kordophone/Shared/ConversationRow.swift @@ -0,0 +1,38 @@ + +import SwiftUI +import KordophoneKit + +struct ConversationRow : View { + var conversation: Conversation + var body: some View { + HStack { + Circle() + .frame(width: 10, height: 10) + .padding(4) + .opacity(conversation.unreadCount > 0 ? 1.0 : 0.0) + .foregroundColor(.accentColor) + VStack { + HStack { + Text(conversation.effectiveDisplayName) + Spacer() + Text(conversation.date, style: .time) + } + HStack { + Text(conversation.lastMessagePreview) + .multilineTextAlignment(.leading) + Spacer() + } + } + } + } +} + +struct ConversationRow_Previews : PreviewProvider { + static var previews: some View { + Group { + ForEach(Conversation.samples) { convo in + ConversationRow(conversation: convo) + } + } + } +} diff --git a/Kordophone/Shared/ConversationView.swift b/Kordophone/Shared/ConversationView.swift new file mode 100644 index 0000000..c5e3923 --- /dev/null +++ b/Kordophone/Shared/ConversationView.swift @@ -0,0 +1,46 @@ + +import SwiftUI +import KordophoneKit + +struct ConversationView : View { + var conversation: Conversation + var messages: [Message] + + var body: some View { + ScrollView { + LazyVStack { + ForEach(messages) { message in + if message.sentByMe { + Spacer() + } + MessageView(message: message) + if !message.sentByMe { + Spacer() + } + } + } + } + } +} + +struct ConversationViewWrapper : View { + var conversation: Conversation + @State private var messages = [Message]() + @EnvironmentObject private var connection: Connection + + private func refresh() { + Task { + self.messages = await connection.messages(in: conversation) ?? .init() + } + } + + var body: some View { + ConversationView(conversation: conversation, messages: messages) + .onChange(of: conversation, perform: { newValue in + refresh() + }) + .onAppear { + refresh() + } + } +} diff --git a/Kordophone/Shared/KordophoneApp.swift b/Kordophone/Shared/KordophoneApp.swift new file mode 100644 index 0000000..90abefd --- /dev/null +++ b/Kordophone/Shared/KordophoneApp.swift @@ -0,0 +1,20 @@ +// +// KordophoneApp.swift +// Shared +// +// Created by Peter Hajas on 4/16/22. +// + +import SwiftUI +import KordophoneKit + +@main +struct KordophoneApp: App { + @StateObject var connection = Connection() + var body: some Scene { + WindowGroup { + ContentView() + .environmentObject(connection) + } + } +} diff --git a/Kordophone/Shared/LoginView.swift b/Kordophone/Shared/LoginView.swift new file mode 100644 index 0000000..c6fd60d --- /dev/null +++ b/Kordophone/Shared/LoginView.swift @@ -0,0 +1,32 @@ + +import SwiftUI +import KordophoneKit + +struct LoginView : View { + @AppStorage("serverAddress") var serverAddress: String = "" + @AppStorage("username") var username: String = "" + @AppStorage("password") var password: String = "" + + var onLogin: (ConnectionInfo) -> Void = { _ in } + + var body: some View { + VStack { + TextField("server", text: $serverAddress) + TextField("username", text: $username) + SecureField("password", text: $password) + Button("Login") { + onLogin(ConnectionInfo(serverAddress: serverAddress, + credentials: Credentials(username: username, + password: password))) + } + } + } +} + +struct LoginView_Previews : PreviewProvider { + static var previews: some View { + Group { + LoginView() + } + } +} diff --git a/Kordophone/Shared/MessageView.swift b/Kordophone/Shared/MessageView.swift new file mode 100644 index 0000000..7bdb5ee --- /dev/null +++ b/Kordophone/Shared/MessageView.swift @@ -0,0 +1,16 @@ + +import SwiftUI +import KordophoneKit + +struct MessageView : View { + var message: Message + var body: some View { + HStack { + Text(message.text) + .multilineTextAlignment(.leading) + } + .padding() + .background(Color.blue) + .padding() + } +} diff --git a/Kordophone/Tests iOS/Tests_iOS.swift b/Kordophone/Tests iOS/Tests_iOS.swift new file mode 100644 index 0000000..26d4130 --- /dev/null +++ b/Kordophone/Tests iOS/Tests_iOS.swift @@ -0,0 +1,41 @@ +// +// Tests_iOS.swift +// Tests iOS +// +// Created by Peter Hajas on 4/16/22. +// + +import XCTest + +class Tests_iOS: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/Kordophone/Tests iOS/Tests_iOSLaunchTests.swift b/Kordophone/Tests iOS/Tests_iOSLaunchTests.swift new file mode 100644 index 0000000..249639c --- /dev/null +++ b/Kordophone/Tests iOS/Tests_iOSLaunchTests.swift @@ -0,0 +1,32 @@ +// +// Tests_iOSLaunchTests.swift +// Tests iOS +// +// Created by Peter Hajas on 4/16/22. +// + +import XCTest + +class Tests_iOSLaunchTests: XCTestCase { + + override class var runsForEachTargetApplicationUIConfiguration: Bool { + true + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + + func testLaunch() throws { + let app = XCUIApplication() + app.launch() + + // Insert steps here to perform after app launch but before taking a screenshot, + // such as logging into a test account or navigating somewhere in the app + + let attachment = XCTAttachment(screenshot: app.screenshot()) + attachment.name = "Launch Screen" + attachment.lifetime = .keepAlways + add(attachment) + } +} diff --git a/Kordophone/Tests macOS/Tests_macOS.swift b/Kordophone/Tests macOS/Tests_macOS.swift new file mode 100644 index 0000000..0979f91 --- /dev/null +++ b/Kordophone/Tests macOS/Tests_macOS.swift @@ -0,0 +1,41 @@ +// +// Tests_macOS.swift +// Tests macOS +// +// Created by Peter Hajas on 4/16/22. +// + +import XCTest + +class Tests_macOS: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/Kordophone/Tests macOS/Tests_macOSLaunchTests.swift b/Kordophone/Tests macOS/Tests_macOSLaunchTests.swift new file mode 100644 index 0000000..c2c01ae --- /dev/null +++ b/Kordophone/Tests macOS/Tests_macOSLaunchTests.swift @@ -0,0 +1,32 @@ +// +// Tests_macOSLaunchTests.swift +// Tests macOS +// +// Created by Peter Hajas on 4/16/22. +// + +import XCTest + +class Tests_macOSLaunchTests: XCTestCase { + + override class var runsForEachTargetApplicationUIConfiguration: Bool { + true + } + + override func setUpWithError() throws { + continueAfterFailure = false + } + + func testLaunch() throws { + let app = XCUIApplication() + app.launch() + + // Insert steps here to perform after app launch but before taking a screenshot, + // such as logging into a test account or navigating somewhere in the app + + let attachment = XCTAttachment(screenshot: app.screenshot()) + attachment.name = "Launch Screen" + attachment.lifetime = .keepAlways + add(attachment) + } +} diff --git a/Kordophone/macOS/macOS.entitlements b/Kordophone/macOS/macOS.entitlements new file mode 100644 index 0000000..40b639e --- /dev/null +++ b/Kordophone/macOS/macOS.entitlements @@ -0,0 +1,14 @@ + + + + + com.apple.security.app-sandbox + + com.apple.security.files.user-selected.read-only + + com.apple.security.network.client + + com.apple.security.network.server + + + diff --git a/KordophoneKit/.gitignore b/KordophoneKit/.gitignore new file mode 100644 index 0000000..3b29812 --- /dev/null +++ b/KordophoneKit/.gitignore @@ -0,0 +1,9 @@ +.DS_Store +/.build +/Packages +/*.xcodeproj +xcuserdata/ +DerivedData/ +.swiftpm/config/registries.json +.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata +.netrc diff --git a/KordophoneKit/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/KordophoneKit/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/KordophoneKit/.swiftpm/xcode/package.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/KordophoneKit/Package.swift b/KordophoneKit/Package.swift new file mode 100644 index 0000000..4d843d9 --- /dev/null +++ b/KordophoneKit/Package.swift @@ -0,0 +1,32 @@ +// swift-tools-version: 5.6 +// The swift-tools-version declares the minimum version of Swift required to build this package. + +import PackageDescription + +let package = Package( + name: "KordophoneKit", + platforms: [ + .macOS(.v12), + .iOS(.v15), + ], + products: [ + // Products define the executables and libraries a package produces, and make them visible to other packages. + .library( + name: "KordophoneKit", + targets: ["KordophoneKit"]), + ], + dependencies: [ + // Dependencies declare other packages that this package depends on. + // .package(url: /* package url */, from: "1.0.0"), + ], + targets: [ + // Targets are the basic building blocks of a package. A target can define a module or a test suite. + // Targets can depend on other targets in this package, and on products in packages this package depends on. + .target( + name: "KordophoneKit", + dependencies: []), + .testTarget( + name: "KordophoneKitTests", + dependencies: ["KordophoneKit"]), + ] +) diff --git a/KordophoneKit/README.md b/KordophoneKit/README.md new file mode 100644 index 0000000..2a26748 --- /dev/null +++ b/KordophoneKit/README.md @@ -0,0 +1,3 @@ +# KordophoneKit + +A description of this package. diff --git a/KordophoneKit/Sources/KordophoneKit/Connection.swift b/KordophoneKit/Sources/KordophoneKit/Connection.swift new file mode 100644 index 0000000..3b947d7 --- /dev/null +++ b/KordophoneKit/Sources/KordophoneKit/Connection.swift @@ -0,0 +1,114 @@ + +import Foundation + +public class Connection { + private var endpoint: URL? + private var token: String? + + @Published public var authenticated = false + + public init() { } + + private func authenticatedGET(service: String, + queryItems: [String : String] = .init()) + async -> Data? { + guard let token = token else { + return nil + } + + let url = apiURL(service) + var urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false)! + urlComponents.queryItems = queryItems.map({ (key, string) in + URLQueryItem(name: key, value: string) + }) + let finalURL = urlComponents.url! + + var request = URLRequest(url: finalURL) + request.httpMethod = "GET" + request.setValue("Bearer: \(token)", forHTTPHeaderField: "Authorization") + + return try? await URLSession.shared.data(for: request).0 + } + + public func connect(info: ConnectionInfo) async { + self.token = nil + self.endpoint = URL(string: info.serverAddress) + self.authenticated = false + let body = try? JSONEncoder().encode(info.credentials) + + var request = URLRequest(url: apiURL("authenticate")) + request.httpMethod = "POST" + request.httpBody = body + request.addValue("application/json", forHTTPHeaderField: "Content-Type") + request.addValue("application/json", forHTTPHeaderField: "Accept") + + if let result = try? await URLSession.shared.data(for: request) { + if let response = result.1 as? HTTPURLResponse { + if let token = response.value(forHTTPHeaderField: "Set-Cookie") { + self.token = token.replacingOccurrences(of: "auth_token=", with: "") + DispatchQueue.main.async { + self.authenticated = true + } + } + } + } + } + + public func conversations() async -> [Conversation]? { + if let data = await authenticatedGET(service: "conversations") { + if let conversations = try? JSONDecoder().decode([RawConversation].self, from: data) { + return conversations.map { + $0.conversation + } + } + } + + return nil + } + + public func messages(in conversation: Conversation) async -> [Message]? { + if let data = await authenticatedGET(service: "messages", queryItems: ["guid" : conversation.guid]) { + if let messages = try? JSONDecoder().decode([RawMessage].self, from: data) { + return messages.map { + $0.message + } + } + } + + return nil + } +} + +extension Connection { + private func apiURL(_ suffix: String) -> URL { + endpoint? + .appendingPathComponent("api") + .appendingPathComponent(suffix) + ?? + .init(fileURLWithPath: "") + } +} + +extension Connection : ObservableObject { + +} + +public struct ConnectionInfo : Hashable, Codable { + public var serverAddress: String + public var credentials: Credentials + + public init(serverAddress: String, credentials: Credentials) { + self.serverAddress = serverAddress + self.credentials = credentials + } +} + +public struct Credentials : Hashable, Codable { + public var username: String = "" + public var password: String = "" + + public init(username: String, password: String) { + self.username = username + self.password = password + } +} diff --git a/KordophoneKit/Sources/KordophoneKit/Conversation.swift b/KordophoneKit/Sources/KordophoneKit/Conversation.swift new file mode 100644 index 0000000..eb1ab7a --- /dev/null +++ b/KordophoneKit/Sources/KordophoneKit/Conversation.swift @@ -0,0 +1,48 @@ + +import Foundation + +struct RawConversation : Codable { + var date: String + var displayName: String? + var guid: String + public var lastMessagePreview: String + var participantDisplayNames: [String] + var unreadCount: Int + + var conversation: Conversation { + let convo = Conversation(guid: guid, + date: .from(kordophoneDate: date), + participants: participantDisplayNames, + displayName: displayName, + lastMessagePreview: lastMessagePreview, + unreadCount: unreadCount) + + return convo + } +} + +public struct Conversation { + var guid: String = UUID().uuidString + public var date: Date = .now + public var participants: [String] = .init() + public var displayName: String? + public var lastMessagePreview: String = "" + public var unreadCount: Int = 0 + + public var effectiveDisplayName: String { + displayName ?? participants.joined(separator: ",") + } +} + +extension Conversation : Hashable, Identifiable { + public var id: String { guid } +} + +extension Conversation { + public static var samples: [Conversation] { + [ + Conversation(date: .init(timeIntervalSinceNow: -3600), lastMessagePreview: "3600s ago"), + Conversation(date: .now, lastMessagePreview: "unread now", unreadCount: 1) + ] + } +} diff --git a/KordophoneKit/Sources/KordophoneKit/Date+KordophoneKit.swift b/KordophoneKit/Sources/KordophoneKit/Date+KordophoneKit.swift new file mode 100644 index 0000000..3fa8d9b --- /dev/null +++ b/KordophoneKit/Sources/KordophoneKit/Date+KordophoneKit.swift @@ -0,0 +1,18 @@ +// +// File.swift +// +// +// Created by Peter Hajas on 5/10/22. +// + +import Foundation + +extension Date { + static func from(kordophoneDate: String) -> Date { + // 2022-02-22T17:37:57+00:00 + let formatter = DateFormatter() + formatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ssZ" + return formatter.date(from: kordophoneDate) ?? .now + } +} + diff --git a/KordophoneKit/Sources/KordophoneKit/KordophoneKit.swift b/KordophoneKit/Sources/KordophoneKit/KordophoneKit.swift new file mode 100644 index 0000000..894e1c8 --- /dev/null +++ b/KordophoneKit/Sources/KordophoneKit/KordophoneKit.swift @@ -0,0 +1,6 @@ +public struct KordophoneKit { + public private(set) var text = "Hello, World!" + + public init() { + } +} diff --git a/KordophoneKit/Sources/KordophoneKit/Message.swift b/KordophoneKit/Sources/KordophoneKit/Message.swift new file mode 100644 index 0000000..357f9af --- /dev/null +++ b/KordophoneKit/Sources/KordophoneKit/Message.swift @@ -0,0 +1,36 @@ + +import Foundation + +struct RawMessage : Codable { + var date: String + var guid: String + var sender: String? + var text: String + var fileTransferGUIDs: [String]? + + var message: Message { + let message = Message(guid: guid, + date: .from(kordophoneDate: date), + sender: sender, + text: text) + + return message + } +} + +public struct Message { + var guid: String = UUID().uuidString + public var date: Date = .now + public var sender: String? + public var text: String +} + +extension Message { + public var sentByMe: Bool { + sender == nil + } +} + +extension Message : Codable, Hashable, Identifiable { + public var id: String { guid } +} diff --git a/KordophoneKit/Tests/KordophoneKitTests/KordophoneKitTests.swift b/KordophoneKit/Tests/KordophoneKitTests/KordophoneKitTests.swift new file mode 100644 index 0000000..101f3e0 --- /dev/null +++ b/KordophoneKit/Tests/KordophoneKitTests/KordophoneKitTests.swift @@ -0,0 +1,11 @@ +import XCTest +@testable import KordophoneKit + +final class KordophoneKitTests: XCTestCase { + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct + // results. + XCTAssertEqual(KordophoneKit().text, "Hello, World!") + } +}