mirror of https://github.com/lukechilds/damus.git
William Casarin
3 years ago
commit
f4bb07081f
15 changed files with 1181 additions and 0 deletions
@ -0,0 +1,3 @@ |
|||||
|
dependencies: [ |
||||
|
.Package(url: "https://github.com/daltoniam/Starscream.git", majorVersion: 4) |
||||
|
] |
@ -0,0 +1,623 @@ |
|||||
|
// !$*UTF8*$! |
||||
|
{ |
||||
|
archiveVersion = 1; |
||||
|
classes = { |
||||
|
}; |
||||
|
objectVersion = 55; |
||||
|
objects = { |
||||
|
|
||||
|
/* Begin PBXBuildFile section */ |
||||
|
4CE6DEE727F7A08100C66700 /* damusApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CE6DEE627F7A08100C66700 /* damusApp.swift */; }; |
||||
|
4CE6DEE927F7A08100C66700 /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CE6DEE827F7A08100C66700 /* ContentView.swift */; }; |
||||
|
4CE6DEEB27F7A08200C66700 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4CE6DEEA27F7A08200C66700 /* Assets.xcassets */; }; |
||||
|
4CE6DEEE27F7A08200C66700 /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4CE6DEED27F7A08200C66700 /* Preview Assets.xcassets */; }; |
||||
|
4CE6DEF827F7A08200C66700 /* damusTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CE6DEF727F7A08200C66700 /* damusTests.swift */; }; |
||||
|
4CE6DF0227F7A08200C66700 /* damusUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CE6DF0127F7A08200C66700 /* damusUITests.swift */; }; |
||||
|
4CE6DF0427F7A08200C66700 /* damusUITestsLaunchTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CE6DF0327F7A08200C66700 /* damusUITestsLaunchTests.swift */; }; |
||||
|
4CE6DF1227F7A2B300C66700 /* Starscream in Frameworks */ = {isa = PBXBuildFile; productRef = 4CE6DF1127F7A2B300C66700 /* Starscream */; }; |
||||
|
4CE6DF1427F7A45200C66700 /* WSConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CE6DF1327F7A45200C66700 /* WSConnection.swift */; }; |
||||
|
4CE6DF1627F8DEBF00C66700 /* NostrConnection.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4CE6DF1527F8DEBF00C66700 /* NostrConnection.swift */; }; |
||||
|
/* End PBXBuildFile section */ |
||||
|
|
||||
|
/* Begin PBXContainerItemProxy section */ |
||||
|
4CE6DEF427F7A08200C66700 /* PBXContainerItemProxy */ = { |
||||
|
isa = PBXContainerItemProxy; |
||||
|
containerPortal = 4CE6DEDB27F7A08100C66700 /* Project object */; |
||||
|
proxyType = 1; |
||||
|
remoteGlobalIDString = 4CE6DEE227F7A08100C66700; |
||||
|
remoteInfo = damus; |
||||
|
}; |
||||
|
4CE6DEFE27F7A08200C66700 /* PBXContainerItemProxy */ = { |
||||
|
isa = PBXContainerItemProxy; |
||||
|
containerPortal = 4CE6DEDB27F7A08100C66700 /* Project object */; |
||||
|
proxyType = 1; |
||||
|
remoteGlobalIDString = 4CE6DEE227F7A08100C66700; |
||||
|
remoteInfo = damus; |
||||
|
}; |
||||
|
/* End PBXContainerItemProxy section */ |
||||
|
|
||||
|
/* Begin PBXFileReference section */ |
||||
|
4CE6DEE327F7A08100C66700 /* damus.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = damus.app; sourceTree = BUILT_PRODUCTS_DIR; }; |
||||
|
4CE6DEE627F7A08100C66700 /* damusApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = damusApp.swift; sourceTree = "<group>"; }; |
||||
|
4CE6DEE827F7A08100C66700 /* ContentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentView.swift; sourceTree = "<group>"; }; |
||||
|
4CE6DEEA27F7A08200C66700 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; |
||||
|
4CE6DEED27F7A08200C66700 /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; }; |
||||
|
4CE6DEF327F7A08200C66700 /* damusTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = damusTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; |
||||
|
4CE6DEF727F7A08200C66700 /* damusTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = damusTests.swift; sourceTree = "<group>"; }; |
||||
|
4CE6DEFD27F7A08200C66700 /* damusUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = damusUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; |
||||
|
4CE6DF0127F7A08200C66700 /* damusUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = damusUITests.swift; sourceTree = "<group>"; }; |
||||
|
4CE6DF0327F7A08200C66700 /* damusUITestsLaunchTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = damusUITestsLaunchTests.swift; sourceTree = "<group>"; }; |
||||
|
4CE6DF1327F7A45200C66700 /* WSConnection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WSConnection.swift; sourceTree = "<group>"; }; |
||||
|
4CE6DF1527F8DEBF00C66700 /* NostrConnection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NostrConnection.swift; sourceTree = "<group>"; }; |
||||
|
/* End PBXFileReference section */ |
||||
|
|
||||
|
/* Begin PBXFrameworksBuildPhase section */ |
||||
|
4CE6DEE027F7A08100C66700 /* Frameworks */ = { |
||||
|
isa = PBXFrameworksBuildPhase; |
||||
|
buildActionMask = 2147483647; |
||||
|
files = ( |
||||
|
4CE6DF1227F7A2B300C66700 /* Starscream in Frameworks */, |
||||
|
); |
||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||
|
}; |
||||
|
4CE6DEF027F7A08200C66700 /* Frameworks */ = { |
||||
|
isa = PBXFrameworksBuildPhase; |
||||
|
buildActionMask = 2147483647; |
||||
|
files = ( |
||||
|
); |
||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||
|
}; |
||||
|
4CE6DEFA27F7A08200C66700 /* Frameworks */ = { |
||||
|
isa = PBXFrameworksBuildPhase; |
||||
|
buildActionMask = 2147483647; |
||||
|
files = ( |
||||
|
); |
||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||
|
}; |
||||
|
/* End PBXFrameworksBuildPhase section */ |
||||
|
|
||||
|
/* Begin PBXGroup section */ |
||||
|
4CE6DEDA27F7A08100C66700 = { |
||||
|
isa = PBXGroup; |
||||
|
children = ( |
||||
|
4CE6DEE527F7A08100C66700 /* damus */, |
||||
|
4CE6DEF627F7A08200C66700 /* damusTests */, |
||||
|
4CE6DF0027F7A08200C66700 /* damusUITests */, |
||||
|
4CE6DEE427F7A08100C66700 /* Products */, |
||||
|
); |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
4CE6DEE427F7A08100C66700 /* Products */ = { |
||||
|
isa = PBXGroup; |
||||
|
children = ( |
||||
|
4CE6DEE327F7A08100C66700 /* damus.app */, |
||||
|
4CE6DEF327F7A08200C66700 /* damusTests.xctest */, |
||||
|
4CE6DEFD27F7A08200C66700 /* damusUITests.xctest */, |
||||
|
); |
||||
|
name = Products; |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
4CE6DEE527F7A08100C66700 /* damus */ = { |
||||
|
isa = PBXGroup; |
||||
|
children = ( |
||||
|
4CE6DEE627F7A08100C66700 /* damusApp.swift */, |
||||
|
4CE6DEE827F7A08100C66700 /* ContentView.swift */, |
||||
|
4CE6DEEA27F7A08200C66700 /* Assets.xcassets */, |
||||
|
4CE6DEEC27F7A08200C66700 /* Preview Content */, |
||||
|
4CE6DF1327F7A45200C66700 /* WSConnection.swift */, |
||||
|
4CE6DF1527F8DEBF00C66700 /* NostrConnection.swift */, |
||||
|
); |
||||
|
path = damus; |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
4CE6DEEC27F7A08200C66700 /* Preview Content */ = { |
||||
|
isa = PBXGroup; |
||||
|
children = ( |
||||
|
4CE6DEED27F7A08200C66700 /* Preview Assets.xcassets */, |
||||
|
); |
||||
|
path = "Preview Content"; |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
4CE6DEF627F7A08200C66700 /* damusTests */ = { |
||||
|
isa = PBXGroup; |
||||
|
children = ( |
||||
|
4CE6DEF727F7A08200C66700 /* damusTests.swift */, |
||||
|
); |
||||
|
path = damusTests; |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
4CE6DF0027F7A08200C66700 /* damusUITests */ = { |
||||
|
isa = PBXGroup; |
||||
|
children = ( |
||||
|
4CE6DF0127F7A08200C66700 /* damusUITests.swift */, |
||||
|
4CE6DF0327F7A08200C66700 /* damusUITestsLaunchTests.swift */, |
||||
|
); |
||||
|
path = damusUITests; |
||||
|
sourceTree = "<group>"; |
||||
|
}; |
||||
|
/* End PBXGroup section */ |
||||
|
|
||||
|
/* Begin PBXNativeTarget section */ |
||||
|
4CE6DEE227F7A08100C66700 /* damus */ = { |
||||
|
isa = PBXNativeTarget; |
||||
|
buildConfigurationList = 4CE6DF0727F7A08200C66700 /* Build configuration list for PBXNativeTarget "damus" */; |
||||
|
buildPhases = ( |
||||
|
4CE6DEDF27F7A08100C66700 /* Sources */, |
||||
|
4CE6DEE027F7A08100C66700 /* Frameworks */, |
||||
|
4CE6DEE127F7A08100C66700 /* Resources */, |
||||
|
); |
||||
|
buildRules = ( |
||||
|
); |
||||
|
dependencies = ( |
||||
|
); |
||||
|
name = damus; |
||||
|
packageProductDependencies = ( |
||||
|
4CE6DF1127F7A2B300C66700 /* Starscream */, |
||||
|
); |
||||
|
productName = damus; |
||||
|
productReference = 4CE6DEE327F7A08100C66700 /* damus.app */; |
||||
|
productType = "com.apple.product-type.application"; |
||||
|
}; |
||||
|
4CE6DEF227F7A08200C66700 /* damusTests */ = { |
||||
|
isa = PBXNativeTarget; |
||||
|
buildConfigurationList = 4CE6DF0A27F7A08200C66700 /* Build configuration list for PBXNativeTarget "damusTests" */; |
||||
|
buildPhases = ( |
||||
|
4CE6DEEF27F7A08200C66700 /* Sources */, |
||||
|
4CE6DEF027F7A08200C66700 /* Frameworks */, |
||||
|
4CE6DEF127F7A08200C66700 /* Resources */, |
||||
|
); |
||||
|
buildRules = ( |
||||
|
); |
||||
|
dependencies = ( |
||||
|
4CE6DEF527F7A08200C66700 /* PBXTargetDependency */, |
||||
|
); |
||||
|
name = damusTests; |
||||
|
productName = damusTests; |
||||
|
productReference = 4CE6DEF327F7A08200C66700 /* damusTests.xctest */; |
||||
|
productType = "com.apple.product-type.bundle.unit-test"; |
||||
|
}; |
||||
|
4CE6DEFC27F7A08200C66700 /* damusUITests */ = { |
||||
|
isa = PBXNativeTarget; |
||||
|
buildConfigurationList = 4CE6DF0D27F7A08200C66700 /* Build configuration list for PBXNativeTarget "damusUITests" */; |
||||
|
buildPhases = ( |
||||
|
4CE6DEF927F7A08200C66700 /* Sources */, |
||||
|
4CE6DEFA27F7A08200C66700 /* Frameworks */, |
||||
|
4CE6DEFB27F7A08200C66700 /* Resources */, |
||||
|
); |
||||
|
buildRules = ( |
||||
|
); |
||||
|
dependencies = ( |
||||
|
4CE6DEFF27F7A08200C66700 /* PBXTargetDependency */, |
||||
|
); |
||||
|
name = damusUITests; |
||||
|
productName = damusUITests; |
||||
|
productReference = 4CE6DEFD27F7A08200C66700 /* damusUITests.xctest */; |
||||
|
productType = "com.apple.product-type.bundle.ui-testing"; |
||||
|
}; |
||||
|
/* End PBXNativeTarget section */ |
||||
|
|
||||
|
/* Begin PBXProject section */ |
||||
|
4CE6DEDB27F7A08100C66700 /* Project object */ = { |
||||
|
isa = PBXProject; |
||||
|
attributes = { |
||||
|
BuildIndependentTargetsInParallel = 1; |
||||
|
LastSwiftUpdateCheck = 1330; |
||||
|
LastUpgradeCheck = 1330; |
||||
|
TargetAttributes = { |
||||
|
4CE6DEE227F7A08100C66700 = { |
||||
|
CreatedOnToolsVersion = 13.3; |
||||
|
}; |
||||
|
4CE6DEF227F7A08200C66700 = { |
||||
|
CreatedOnToolsVersion = 13.3; |
||||
|
TestTargetID = 4CE6DEE227F7A08100C66700; |
||||
|
}; |
||||
|
4CE6DEFC27F7A08200C66700 = { |
||||
|
CreatedOnToolsVersion = 13.3; |
||||
|
TestTargetID = 4CE6DEE227F7A08100C66700; |
||||
|
}; |
||||
|
}; |
||||
|
}; |
||||
|
buildConfigurationList = 4CE6DEDE27F7A08100C66700 /* Build configuration list for PBXProject "damus" */; |
||||
|
compatibilityVersion = "Xcode 13.0"; |
||||
|
developmentRegion = en; |
||||
|
hasScannedForEncodings = 0; |
||||
|
knownRegions = ( |
||||
|
en, |
||||
|
Base, |
||||
|
); |
||||
|
mainGroup = 4CE6DEDA27F7A08100C66700; |
||||
|
packageReferences = ( |
||||
|
4CE6DF1027F7A2B300C66700 /* XCRemoteSwiftPackageReference "Starscream" */, |
||||
|
); |
||||
|
productRefGroup = 4CE6DEE427F7A08100C66700 /* Products */; |
||||
|
projectDirPath = ""; |
||||
|
projectRoot = ""; |
||||
|
targets = ( |
||||
|
4CE6DEE227F7A08100C66700 /* damus */, |
||||
|
4CE6DEF227F7A08200C66700 /* damusTests */, |
||||
|
4CE6DEFC27F7A08200C66700 /* damusUITests */, |
||||
|
); |
||||
|
}; |
||||
|
/* End PBXProject section */ |
||||
|
|
||||
|
/* Begin PBXResourcesBuildPhase section */ |
||||
|
4CE6DEE127F7A08100C66700 /* Resources */ = { |
||||
|
isa = PBXResourcesBuildPhase; |
||||
|
buildActionMask = 2147483647; |
||||
|
files = ( |
||||
|
4CE6DEEE27F7A08200C66700 /* Preview Assets.xcassets in Resources */, |
||||
|
4CE6DEEB27F7A08200C66700 /* Assets.xcassets in Resources */, |
||||
|
); |
||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||
|
}; |
||||
|
4CE6DEF127F7A08200C66700 /* Resources */ = { |
||||
|
isa = PBXResourcesBuildPhase; |
||||
|
buildActionMask = 2147483647; |
||||
|
files = ( |
||||
|
); |
||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||
|
}; |
||||
|
4CE6DEFB27F7A08200C66700 /* Resources */ = { |
||||
|
isa = PBXResourcesBuildPhase; |
||||
|
buildActionMask = 2147483647; |
||||
|
files = ( |
||||
|
); |
||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||
|
}; |
||||
|
/* End PBXResourcesBuildPhase section */ |
||||
|
|
||||
|
/* Begin PBXSourcesBuildPhase section */ |
||||
|
4CE6DEDF27F7A08100C66700 /* Sources */ = { |
||||
|
isa = PBXSourcesBuildPhase; |
||||
|
buildActionMask = 2147483647; |
||||
|
files = ( |
||||
|
4CE6DEE927F7A08100C66700 /* ContentView.swift in Sources */, |
||||
|
4CE6DF1427F7A45200C66700 /* WSConnection.swift in Sources */, |
||||
|
4CE6DF1627F8DEBF00C66700 /* NostrConnection.swift in Sources */, |
||||
|
4CE6DEE727F7A08100C66700 /* damusApp.swift in Sources */, |
||||
|
); |
||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||
|
}; |
||||
|
4CE6DEEF27F7A08200C66700 /* Sources */ = { |
||||
|
isa = PBXSourcesBuildPhase; |
||||
|
buildActionMask = 2147483647; |
||||
|
files = ( |
||||
|
4CE6DEF827F7A08200C66700 /* damusTests.swift in Sources */, |
||||
|
); |
||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||
|
}; |
||||
|
4CE6DEF927F7A08200C66700 /* Sources */ = { |
||||
|
isa = PBXSourcesBuildPhase; |
||||
|
buildActionMask = 2147483647; |
||||
|
files = ( |
||||
|
4CE6DF0227F7A08200C66700 /* damusUITests.swift in Sources */, |
||||
|
4CE6DF0427F7A08200C66700 /* damusUITestsLaunchTests.swift in Sources */, |
||||
|
); |
||||
|
runOnlyForDeploymentPostprocessing = 0; |
||||
|
}; |
||||
|
/* End PBXSourcesBuildPhase section */ |
||||
|
|
||||
|
/* Begin PBXTargetDependency section */ |
||||
|
4CE6DEF527F7A08200C66700 /* PBXTargetDependency */ = { |
||||
|
isa = PBXTargetDependency; |
||||
|
target = 4CE6DEE227F7A08100C66700 /* damus */; |
||||
|
targetProxy = 4CE6DEF427F7A08200C66700 /* PBXContainerItemProxy */; |
||||
|
}; |
||||
|
4CE6DEFF27F7A08200C66700 /* PBXTargetDependency */ = { |
||||
|
isa = PBXTargetDependency; |
||||
|
target = 4CE6DEE227F7A08100C66700 /* damus */; |
||||
|
targetProxy = 4CE6DEFE27F7A08200C66700 /* PBXContainerItemProxy */; |
||||
|
}; |
||||
|
/* End PBXTargetDependency section */ |
||||
|
|
||||
|
/* Begin XCBuildConfiguration section */ |
||||
|
4CE6DF0527F7A08200C66700 /* 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; |
||||
|
IPHONEOS_DEPLOYMENT_TARGET = 15.4; |
||||
|
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; |
||||
|
MTL_FAST_MATH = YES; |
||||
|
ONLY_ACTIVE_ARCH = YES; |
||||
|
SDKROOT = iphoneos; |
||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; |
||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; |
||||
|
}; |
||||
|
name = Debug; |
||||
|
}; |
||||
|
4CE6DF0627F7A08200C66700 /* 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; |
||||
|
IPHONEOS_DEPLOYMENT_TARGET = 15.4; |
||||
|
MTL_ENABLE_DEBUG_INFO = NO; |
||||
|
MTL_FAST_MATH = YES; |
||||
|
SDKROOT = iphoneos; |
||||
|
SWIFT_COMPILATION_MODE = wholemodule; |
||||
|
SWIFT_OPTIMIZATION_LEVEL = "-O"; |
||||
|
VALIDATE_PRODUCT = YES; |
||||
|
}; |
||||
|
name = Release; |
||||
|
}; |
||||
|
4CE6DF0827F7A08200C66700 /* Debug */ = { |
||||
|
isa = XCBuildConfiguration; |
||||
|
buildSettings = { |
||||
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
||||
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
||||
|
CODE_SIGN_STYLE = Automatic; |
||||
|
CURRENT_PROJECT_VERSION = 1; |
||||
|
DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\""; |
||||
|
DEVELOPMENT_TEAM = XK7H4JAB3D; |
||||
|
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"; |
||||
|
LD_RUNPATH_SEARCH_PATHS = ( |
||||
|
"$(inherited)", |
||||
|
"@executable_path/Frameworks", |
||||
|
); |
||||
|
MARKETING_VERSION = 1.0; |
||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.jb55.damus; |
||||
|
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||
|
SWIFT_EMIT_LOC_STRINGS = YES; |
||||
|
SWIFT_VERSION = 5.0; |
||||
|
TARGETED_DEVICE_FAMILY = "1,2"; |
||||
|
}; |
||||
|
name = Debug; |
||||
|
}; |
||||
|
4CE6DF0927F7A08200C66700 /* Release */ = { |
||||
|
isa = XCBuildConfiguration; |
||||
|
buildSettings = { |
||||
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
||||
|
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor; |
||||
|
CODE_SIGN_STYLE = Automatic; |
||||
|
CURRENT_PROJECT_VERSION = 1; |
||||
|
DEVELOPMENT_ASSET_PATHS = "\"damus/Preview Content\""; |
||||
|
DEVELOPMENT_TEAM = XK7H4JAB3D; |
||||
|
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"; |
||||
|
LD_RUNPATH_SEARCH_PATHS = ( |
||||
|
"$(inherited)", |
||||
|
"@executable_path/Frameworks", |
||||
|
); |
||||
|
MARKETING_VERSION = 1.0; |
||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.jb55.damus; |
||||
|
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||
|
SWIFT_EMIT_LOC_STRINGS = YES; |
||||
|
SWIFT_VERSION = 5.0; |
||||
|
TARGETED_DEVICE_FAMILY = "1,2"; |
||||
|
}; |
||||
|
name = Release; |
||||
|
}; |
||||
|
4CE6DF0B27F7A08200C66700 /* Debug */ = { |
||||
|
isa = XCBuildConfiguration; |
||||
|
buildSettings = { |
||||
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; |
||||
|
BUNDLE_LOADER = "$(TEST_HOST)"; |
||||
|
CODE_SIGN_STYLE = Automatic; |
||||
|
CURRENT_PROJECT_VERSION = 1; |
||||
|
DEVELOPMENT_TEAM = XK7H4JAB3D; |
||||
|
GENERATE_INFOPLIST_FILE = YES; |
||||
|
IPHONEOS_DEPLOYMENT_TARGET = 15.4; |
||||
|
MARKETING_VERSION = 1.0; |
||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.jb55.damusTests; |
||||
|
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||
|
SWIFT_EMIT_LOC_STRINGS = NO; |
||||
|
SWIFT_VERSION = 5.0; |
||||
|
TARGETED_DEVICE_FAMILY = "1,2"; |
||||
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/damus.app/damus"; |
||||
|
}; |
||||
|
name = Debug; |
||||
|
}; |
||||
|
4CE6DF0C27F7A08200C66700 /* Release */ = { |
||||
|
isa = XCBuildConfiguration; |
||||
|
buildSettings = { |
||||
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; |
||||
|
BUNDLE_LOADER = "$(TEST_HOST)"; |
||||
|
CODE_SIGN_STYLE = Automatic; |
||||
|
CURRENT_PROJECT_VERSION = 1; |
||||
|
DEVELOPMENT_TEAM = XK7H4JAB3D; |
||||
|
GENERATE_INFOPLIST_FILE = YES; |
||||
|
IPHONEOS_DEPLOYMENT_TARGET = 15.4; |
||||
|
MARKETING_VERSION = 1.0; |
||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.jb55.damusTests; |
||||
|
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||
|
SWIFT_EMIT_LOC_STRINGS = NO; |
||||
|
SWIFT_VERSION = 5.0; |
||||
|
TARGETED_DEVICE_FAMILY = "1,2"; |
||||
|
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/damus.app/damus"; |
||||
|
}; |
||||
|
name = Release; |
||||
|
}; |
||||
|
4CE6DF0E27F7A08200C66700 /* Debug */ = { |
||||
|
isa = XCBuildConfiguration; |
||||
|
buildSettings = { |
||||
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; |
||||
|
CODE_SIGN_STYLE = Automatic; |
||||
|
CURRENT_PROJECT_VERSION = 1; |
||||
|
DEVELOPMENT_TEAM = XK7H4JAB3D; |
||||
|
GENERATE_INFOPLIST_FILE = YES; |
||||
|
MARKETING_VERSION = 1.0; |
||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.jb55.damusUITests; |
||||
|
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||
|
SWIFT_EMIT_LOC_STRINGS = NO; |
||||
|
SWIFT_VERSION = 5.0; |
||||
|
TARGETED_DEVICE_FAMILY = "1,2"; |
||||
|
TEST_TARGET_NAME = damus; |
||||
|
}; |
||||
|
name = Debug; |
||||
|
}; |
||||
|
4CE6DF0F27F7A08200C66700 /* Release */ = { |
||||
|
isa = XCBuildConfiguration; |
||||
|
buildSettings = { |
||||
|
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; |
||||
|
CODE_SIGN_STYLE = Automatic; |
||||
|
CURRENT_PROJECT_VERSION = 1; |
||||
|
DEVELOPMENT_TEAM = XK7H4JAB3D; |
||||
|
GENERATE_INFOPLIST_FILE = YES; |
||||
|
MARKETING_VERSION = 1.0; |
||||
|
PRODUCT_BUNDLE_IDENTIFIER = com.jb55.damusUITests; |
||||
|
PRODUCT_NAME = "$(TARGET_NAME)"; |
||||
|
SWIFT_EMIT_LOC_STRINGS = NO; |
||||
|
SWIFT_VERSION = 5.0; |
||||
|
TARGETED_DEVICE_FAMILY = "1,2"; |
||||
|
TEST_TARGET_NAME = damus; |
||||
|
}; |
||||
|
name = Release; |
||||
|
}; |
||||
|
/* End XCBuildConfiguration section */ |
||||
|
|
||||
|
/* Begin XCConfigurationList section */ |
||||
|
4CE6DEDE27F7A08100C66700 /* Build configuration list for PBXProject "damus" */ = { |
||||
|
isa = XCConfigurationList; |
||||
|
buildConfigurations = ( |
||||
|
4CE6DF0527F7A08200C66700 /* Debug */, |
||||
|
4CE6DF0627F7A08200C66700 /* Release */, |
||||
|
); |
||||
|
defaultConfigurationIsVisible = 0; |
||||
|
defaultConfigurationName = Release; |
||||
|
}; |
||||
|
4CE6DF0727F7A08200C66700 /* Build configuration list for PBXNativeTarget "damus" */ = { |
||||
|
isa = XCConfigurationList; |
||||
|
buildConfigurations = ( |
||||
|
4CE6DF0827F7A08200C66700 /* Debug */, |
||||
|
4CE6DF0927F7A08200C66700 /* Release */, |
||||
|
); |
||||
|
defaultConfigurationIsVisible = 0; |
||||
|
defaultConfigurationName = Release; |
||||
|
}; |
||||
|
4CE6DF0A27F7A08200C66700 /* Build configuration list for PBXNativeTarget "damusTests" */ = { |
||||
|
isa = XCConfigurationList; |
||||
|
buildConfigurations = ( |
||||
|
4CE6DF0B27F7A08200C66700 /* Debug */, |
||||
|
4CE6DF0C27F7A08200C66700 /* Release */, |
||||
|
); |
||||
|
defaultConfigurationIsVisible = 0; |
||||
|
defaultConfigurationName = Release; |
||||
|
}; |
||||
|
4CE6DF0D27F7A08200C66700 /* Build configuration list for PBXNativeTarget "damusUITests" */ = { |
||||
|
isa = XCConfigurationList; |
||||
|
buildConfigurations = ( |
||||
|
4CE6DF0E27F7A08200C66700 /* Debug */, |
||||
|
4CE6DF0F27F7A08200C66700 /* Release */, |
||||
|
); |
||||
|
defaultConfigurationIsVisible = 0; |
||||
|
defaultConfigurationName = Release; |
||||
|
}; |
||||
|
/* End XCConfigurationList section */ |
||||
|
|
||||
|
/* Begin XCRemoteSwiftPackageReference section */ |
||||
|
4CE6DF1027F7A2B300C66700 /* XCRemoteSwiftPackageReference "Starscream" */ = { |
||||
|
isa = XCRemoteSwiftPackageReference; |
||||
|
repositoryURL = "https://github.com/daltoniam/Starscream"; |
||||
|
requirement = { |
||||
|
kind = upToNextMajorVersion; |
||||
|
minimumVersion = 4.0.0; |
||||
|
}; |
||||
|
}; |
||||
|
/* End XCRemoteSwiftPackageReference section */ |
||||
|
|
||||
|
/* Begin XCSwiftPackageProductDependency section */ |
||||
|
4CE6DF1127F7A2B300C66700 /* Starscream */ = { |
||||
|
isa = XCSwiftPackageProductDependency; |
||||
|
package = 4CE6DF1027F7A2B300C66700 /* XCRemoteSwiftPackageReference "Starscream" */; |
||||
|
productName = Starscream; |
||||
|
}; |
||||
|
/* End XCSwiftPackageProductDependency section */ |
||||
|
}; |
||||
|
rootObject = 4CE6DEDB27F7A08100C66700 /* Project object */; |
||||
|
} |
@ -0,0 +1,7 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<Workspace |
||||
|
version = "1.0"> |
||||
|
<FileRef |
||||
|
location = "self:"> |
||||
|
</FileRef> |
||||
|
</Workspace> |
@ -0,0 +1,8 @@ |
|||||
|
<?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>IDEDidComputeMac32BitWarning</key> |
||||
|
<true/> |
||||
|
</dict> |
||||
|
</plist> |
@ -0,0 +1,14 @@ |
|||||
|
{ |
||||
|
"pins" : [ |
||||
|
{ |
||||
|
"identity" : "starscream", |
||||
|
"kind" : "remoteSourceControl", |
||||
|
"location" : "https://github.com/daltoniam/Starscream", |
||||
|
"state" : { |
||||
|
"revision" : "df8d82047f6654d8e4b655d1b1525c64e1059d21", |
||||
|
"version" : "4.0.4" |
||||
|
} |
||||
|
} |
||||
|
], |
||||
|
"version" : 2 |
||||
|
} |
@ -0,0 +1,11 @@ |
|||||
|
{ |
||||
|
"colors" : [ |
||||
|
{ |
||||
|
"idiom" : "universal" |
||||
|
} |
||||
|
], |
||||
|
"info" : { |
||||
|
"author" : "xcode", |
||||
|
"version" : 1 |
||||
|
} |
||||
|
} |
@ -0,0 +1,98 @@ |
|||||
|
{ |
||||
|
"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" |
||||
|
} |
||||
|
], |
||||
|
"info" : { |
||||
|
"author" : "xcode", |
||||
|
"version" : 1 |
||||
|
} |
||||
|
} |
@ -0,0 +1,6 @@ |
|||||
|
{ |
||||
|
"info" : { |
||||
|
"author" : "xcode", |
||||
|
"version" : 1 |
||||
|
} |
||||
|
} |
@ -0,0 +1,52 @@ |
|||||
|
// |
||||
|
// ContentView.swift |
||||
|
// damus |
||||
|
// |
||||
|
// Created by William Casarin on 2022-04-01. |
||||
|
// |
||||
|
|
||||
|
import SwiftUI |
||||
|
import Starscream |
||||
|
|
||||
|
struct ContentView: View { |
||||
|
@State var status: String = "Not connected" |
||||
|
@State var events: [NostrEvent] = [] |
||||
|
@State var connection: NostrConnection? = nil |
||||
|
|
||||
|
var body: some View { |
||||
|
ForEach(events, id: \.id) { |
||||
|
Text($0.content) |
||||
|
.padding() |
||||
|
} |
||||
|
.onAppear() { |
||||
|
let url = URL(string: "wss://nostr.bitcoiner.social")! |
||||
|
let conn = NostrConnection(url: url, handleEvent: handle_event) |
||||
|
conn.connect() |
||||
|
self.connection = conn |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
func handle_event(conn_event: NostrConnectionEvent) { |
||||
|
|
||||
|
switch conn_event { |
||||
|
case .ws_event(let ev): |
||||
|
if case .connected = ev { |
||||
|
self.connection?.send(NostrFilter.filter_since(1648851447)) |
||||
|
} |
||||
|
print("ws_event \(ev)") |
||||
|
case .nostr_event(let ev): |
||||
|
switch ev { |
||||
|
case .event(_, let ev): |
||||
|
self.events.append(ev) |
||||
|
case .notice(let msg): |
||||
|
print(msg) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
struct ContentView_Previews: PreviewProvider { |
||||
|
static var previews: some View { |
||||
|
ContentView() |
||||
|
} |
||||
|
} |
@ -0,0 +1,183 @@ |
|||||
|
// |
||||
|
// NostrConnection.swift |
||||
|
// damus |
||||
|
// |
||||
|
// Created by William Casarin on 2022-04-02. |
||||
|
// |
||||
|
|
||||
|
import Foundation |
||||
|
import Starscream |
||||
|
|
||||
|
struct OtherEvent { |
||||
|
let event_id: String |
||||
|
let relay_url: String |
||||
|
} |
||||
|
|
||||
|
struct KeyEvent { |
||||
|
let key: String |
||||
|
let relay_url: String |
||||
|
} |
||||
|
|
||||
|
enum NostrConnectionEvent { |
||||
|
case ws_event(WebSocketEvent) |
||||
|
case nostr_event(NostrResponse) |
||||
|
} |
||||
|
|
||||
|
enum NostrTag { |
||||
|
case other_event(OtherEvent) |
||||
|
case key_event(KeyEvent) |
||||
|
} |
||||
|
|
||||
|
struct NostrFilter: Codable { |
||||
|
let ids: [String]? |
||||
|
let kinds: [String]? |
||||
|
let event_ids: [String]? |
||||
|
let pubkeys: [String]? |
||||
|
let since: Int64? |
||||
|
let until: Int64? |
||||
|
let authors: [String]? |
||||
|
|
||||
|
private enum CodingKeys : String, CodingKey { |
||||
|
case ids |
||||
|
case kinds |
||||
|
case event_ids = "#e" |
||||
|
case pubkeys = "#p" |
||||
|
case since |
||||
|
case until |
||||
|
case authors |
||||
|
} |
||||
|
|
||||
|
public static func filter_since(_ val: Int64) -> NostrFilter { |
||||
|
return NostrFilter(ids: nil, kinds: nil, event_ids: nil, pubkeys: nil, since: val, until: nil, authors: nil) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
enum NostrResponse: Decodable { |
||||
|
case event(String, NostrEvent) |
||||
|
case notice(String) |
||||
|
|
||||
|
init(from decoder: Decoder) throws { |
||||
|
var container = try decoder.unkeyedContainer() |
||||
|
|
||||
|
// Only use first item |
||||
|
let typ = try container.decode(String.self) |
||||
|
if typ == "EVENT" { |
||||
|
let sub_id = try container.decode(String.self) |
||||
|
var ev: NostrEvent |
||||
|
do { |
||||
|
ev = try container.decode(NostrEvent.self) |
||||
|
} catch { |
||||
|
print(error) |
||||
|
throw error |
||||
|
} |
||||
|
self = .event(sub_id, ev) |
||||
|
return |
||||
|
} else if typ == "NOTICE" { |
||||
|
let msg = try container.decode(String.self) |
||||
|
self = .notice(msg) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
throw DecodingError.dataCorrupted(.init(codingPath: [], debugDescription: "expected EVENT or NOTICE, got \(typ)")) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
struct NostrEvent: Decodable, Identifiable { |
||||
|
let id: String |
||||
|
let pubkey: String |
||||
|
let created_at: Int64 |
||||
|
let kind: Int |
||||
|
let tags: [[String]] |
||||
|
let content: String |
||||
|
let sig: String |
||||
|
} |
||||
|
|
||||
|
class NostrConnection: WebSocketDelegate { |
||||
|
var isConnected: Bool = false |
||||
|
var socket: WebSocket |
||||
|
var handleEvent: (NostrConnectionEvent) -> () |
||||
|
|
||||
|
init(url: URL, handleEvent: @escaping (NostrConnectionEvent) -> ()) { |
||||
|
var req = URLRequest(url: url) |
||||
|
req.timeoutInterval = 5 |
||||
|
self.socket = WebSocket(request: req) |
||||
|
self.handleEvent = handleEvent |
||||
|
|
||||
|
socket.delegate = self |
||||
|
} |
||||
|
|
||||
|
func connect(){ |
||||
|
socket.connect() |
||||
|
} |
||||
|
|
||||
|
func disconnect() { |
||||
|
socket.disconnect() |
||||
|
} |
||||
|
|
||||
|
func send(_ filter: NostrFilter) { |
||||
|
guard let req = make_nostr_req(filter) else { |
||||
|
print("failed to encode nostr req: \(filter)") |
||||
|
return |
||||
|
} |
||||
|
socket.write(string: req) |
||||
|
} |
||||
|
|
||||
|
func didReceive(event: WebSocketEvent, client: WebSocket) { |
||||
|
switch event { |
||||
|
case .connected: |
||||
|
self.isConnected = true |
||||
|
|
||||
|
case .disconnected: fallthrough |
||||
|
case .cancelled: fallthrough |
||||
|
case .error: |
||||
|
self.isConnected = false |
||||
|
|
||||
|
case .text(let txt): |
||||
|
if let ev = decode_nostr_event(txt: txt) { |
||||
|
handleEvent(.nostr_event(ev)) |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
print("decode failed for \(txt)") |
||||
|
// TODO: trigger event error |
||||
|
|
||||
|
default: |
||||
|
break |
||||
|
} |
||||
|
|
||||
|
handleEvent(.ws_event(event)) |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
func decode_nostr_event(txt: String) -> NostrResponse? { |
||||
|
return decode_data(Data(txt.utf8)) |
||||
|
} |
||||
|
|
||||
|
func decode_data<T: Decodable>(_ data: Data) -> T? { |
||||
|
let decoder = JSONDecoder() |
||||
|
do { |
||||
|
return try decoder.decode(T.self, from: data) |
||||
|
} catch { |
||||
|
print("decode_data failed for \(T.self): \(error)") |
||||
|
} |
||||
|
|
||||
|
return nil |
||||
|
} |
||||
|
|
||||
|
func make_nostr_req(_ filter: NostrFilter) -> String? { |
||||
|
let sub_id = UUID() |
||||
|
var params: [Encodable] = [] |
||||
|
|
||||
|
params.append("REQ") |
||||
|
params.append(sub_id) |
||||
|
params.append(filter) |
||||
|
|
||||
|
let encoder = JSONEncoder() |
||||
|
guard let filter_json = try? encoder.encode(filter) else { |
||||
|
return nil |
||||
|
} |
||||
|
let filter_json_str = String(decoding: filter_json, as: UTF8.self) |
||||
|
return "[\"REQ\",\"\(sub_id)\",\(filter_json_str)]" |
||||
|
} |
||||
|
|
@ -0,0 +1,50 @@ |
|||||
|
// |
||||
|
// Connection.swift |
||||
|
// damus |
||||
|
// |
||||
|
// Created by William Casarin on 2022-04-01. |
||||
|
// |
||||
|
|
||||
|
import Foundation |
||||
|
import Starscream |
||||
|
|
||||
|
class WSConnection: WebSocketDelegate { |
||||
|
var isConnected: Bool = false |
||||
|
var socket: WebSocket |
||||
|
var handleEvent: (WebSocketEvent) -> () |
||||
|
|
||||
|
init(url: URL, handleEvent: @escaping (WebSocketEvent) -> ()) { |
||||
|
var req = URLRequest(url: url) |
||||
|
req.timeoutInterval = 5 |
||||
|
self.socket = WebSocket(request: req) |
||||
|
self.handleEvent = handleEvent |
||||
|
|
||||
|
socket.delegate = self |
||||
|
} |
||||
|
|
||||
|
func connect(){ |
||||
|
socket.connect() |
||||
|
} |
||||
|
|
||||
|
func disconnect() { |
||||
|
socket.disconnect() |
||||
|
} |
||||
|
|
||||
|
func didReceive(event: WebSocketEvent, client: WebSocket) { |
||||
|
switch event { |
||||
|
case .connected: |
||||
|
self.isConnected = true |
||||
|
|
||||
|
case .disconnected: fallthrough |
||||
|
case .cancelled: fallthrough |
||||
|
case .error: |
||||
|
self.isConnected = false |
||||
|
|
||||
|
default: |
||||
|
break |
||||
|
} |
||||
|
|
||||
|
handleEvent(event) |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,17 @@ |
|||||
|
// |
||||
|
// damusApp.swift |
||||
|
// damus |
||||
|
// |
||||
|
// Created by William Casarin on 2022-04-01. |
||||
|
// |
||||
|
|
||||
|
import SwiftUI |
||||
|
|
||||
|
@main |
||||
|
struct damusApp: App { |
||||
|
var body: some Scene { |
||||
|
WindowGroup { |
||||
|
ContentView() |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
// |
||||
|
// damusTests.swift |
||||
|
// damusTests |
||||
|
// |
||||
|
// Created by William Casarin on 2022-04-01. |
||||
|
// |
||||
|
|
||||
|
import XCTest |
||||
|
@testable import damus |
||||
|
|
||||
|
class damusTests: XCTestCase { |
||||
|
|
||||
|
override func setUpWithError() throws { |
||||
|
// Put setup code here. This method is called before the invocation of each test method in the class. |
||||
|
} |
||||
|
|
||||
|
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 { |
||||
|
// This is an example of a functional test case. |
||||
|
// Use XCTAssert and related functions to verify your tests produce the correct results. |
||||
|
// Any test you write for XCTest can be annotated as throws and async. |
||||
|
// Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. |
||||
|
// Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. |
||||
|
} |
||||
|
|
||||
|
func testPerformanceExample() throws { |
||||
|
// This is an example of a performance test case. |
||||
|
self.measure { |
||||
|
// Put the code you want to measure the time of here. |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
// |
||||
|
// damusUITests.swift |
||||
|
// damusUITests |
||||
|
// |
||||
|
// Created by William Casarin on 2022-04-01. |
||||
|
// |
||||
|
|
||||
|
import XCTest |
||||
|
|
||||
|
class damusUITests: 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() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,32 @@ |
|||||
|
// |
||||
|
// damusUITestsLaunchTests.swift |
||||
|
// damusUITests |
||||
|
// |
||||
|
// Created by William Casarin on 2022-04-01. |
||||
|
// |
||||
|
|
||||
|
import XCTest |
||||
|
|
||||
|
class damusUITestsLaunchTests: 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) |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue