diff --git a/.gitignore b/.gitignore index 070490b..0dee928 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ Package.resolved Cartfile.resolved .build/* -Carthage/* \ No newline at end of file +Carthage/* +QiscusCoreAPI.xcworkspace/xcuserdata +Examples/cocoapods/Pods +Examples/cocoapods/cocoapods/xcodeproj/xcuserdata +Examples/cocoapods/cocoapods/xcworkspace/xcuserdata \ No newline at end of file diff --git a/Cartfile b/Cartfile index d2812f0..053c8c9 100644 --- a/Cartfile +++ b/Cartfile @@ -1 +1,2 @@ git "https://github.com/SwiftyJSON/SwiftyJSON.git" +github "qiscus/QiscusRealtime-iOS" "carthage-support" \ No newline at end of file diff --git a/Examples/cocoapods/Podfile.lock b/Examples/cocoapods/Podfile.lock index 9dc1b81..0d9bf7a 100644 --- a/Examples/cocoapods/Podfile.lock +++ b/Examples/cocoapods/Podfile.lock @@ -17,4 +17,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 4002c835880c239499fd79643f5b8cc799b00eaf -COCOAPODS: 1.9.3 +COCOAPODS: 1.9.1 diff --git a/Examples/cocoapods/Pods/Manifest.lock b/Examples/cocoapods/Pods/Manifest.lock deleted file mode 100644 index 9dc1b81..0000000 --- a/Examples/cocoapods/Pods/Manifest.lock +++ /dev/null @@ -1,20 +0,0 @@ -PODS: - - QiscusCoreAPI (0.3.0): - - SwiftyJSON - - SwiftyJSON (5.0.0) - -DEPENDENCIES: - - QiscusCoreAPI (= 0.3.0) - -SPEC REPOS: - trunk: - - QiscusCoreAPI - - SwiftyJSON - -SPEC CHECKSUMS: - QiscusCoreAPI: 7c4a19d46548b02c64d698d799bf1d035ddbce8c - SwiftyJSON: 36413e04c44ee145039d332b4f4e2d3e8d6c4db7 - -PODFILE CHECKSUM: 4002c835880c239499fd79643f5b8cc799b00eaf - -COCOAPODS: 1.9.3 diff --git a/Examples/cocoapods/Pods/Pods.xcodeproj/project.pbxproj b/Examples/cocoapods/Pods/Pods.xcodeproj/project.pbxproj deleted file mode 100644 index 44c1405..0000000 --- a/Examples/cocoapods/Pods/Pods.xcodeproj/project.pbxproj +++ /dev/null @@ -1,713 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 50; - objects = { - -/* Begin PBXAggregateTarget section */ - 6794E4CB9EE3546A9EB397134AD05455 /* QiscusCoreAPI */ = { - isa = PBXAggregateTarget; - buildConfigurationList = F6B0549296B60D3675A1B6D7C43C1656 /* Build configuration list for PBXAggregateTarget "QiscusCoreAPI" */; - buildPhases = ( - ); - dependencies = ( - 8C85B14BE82B99273BFB6E9FD0BDF453 /* PBXTargetDependency */, - ); - name = QiscusCoreAPI; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 27703390084A77F0CC7CB6F77A2E78A8 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3212113385A8FBBDB272BD23C409FF61 /* Foundation.framework */; }; - 2EFAFC05E1FEBF6D7045CC060A77B973 /* SwiftyJSON-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = D6FA2CDF87D783A59C6023981C76C9FB /* SwiftyJSON-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 3EA3B4188BAC7DC299523545C0CE3F63 /* SwiftyJSON.swift in Sources */ = {isa = PBXBuildFile; fileRef = 73C2BB411F6269204DB103674B0198D1 /* SwiftyJSON.swift */; }; - 55D2A105E90179E0FAA508D5816FB623 /* SwiftyJSON-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 2816E324E614B6EBF99194ACA72B9208 /* SwiftyJSON-dummy.m */; }; - 5DB3BABE1F0B65055CDF0850BD7E25AC /* Pods-cocoapods-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 4973A122B95BE61592E66F8483DD02BC /* Pods-cocoapods-dummy.m */; }; - CDDBC6E48FC965BB799224AEA72A6DEC /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3212113385A8FBBDB272BD23C409FF61 /* Foundation.framework */; }; - D1FEDB7851C5C8D2C19B005843C76C72 /* Pods-cocoapods-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 46744AD4A06C915FB114D7D5E77EE705 /* Pods-cocoapods-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 37AF7252454116AFB73C16126ED489E7 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 6794E4CB9EE3546A9EB397134AD05455; - remoteInfo = QiscusCoreAPI; - }; - 5B639EC5D82701EDDAB5FF9C32510BD0 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = D118A6A04828FD3CDA8640CD2B6796D2; - remoteInfo = SwiftyJSON; - }; - B87D4552050EC18FABDF8B9444656DA1 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */; - proxyType = 1; - remoteGlobalIDString = D118A6A04828FD3CDA8640CD2B6796D2; - remoteInfo = SwiftyJSON; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 00134C384238222986096A09180774D3 /* QiscusCoreAPI.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = QiscusCoreAPI.release.xcconfig; sourceTree = ""; }; - 025978E71A4CC0F78A9E291B844E266A /* SwiftyJSON-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "SwiftyJSON-Info.plist"; sourceTree = ""; }; - 06804ECDF45257BD642F181929B684F6 /* Pods-cocoapods-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-cocoapods-frameworks.sh"; sourceTree = ""; }; - 208C321099C872A4D051C71BC6F747D9 /* Pods_cocoapods.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = Pods_cocoapods.framework; path = "Pods-cocoapods.framework"; sourceTree = BUILT_PRODUCTS_DIR; }; - 2816E324E614B6EBF99194ACA72B9208 /* SwiftyJSON-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SwiftyJSON-dummy.m"; sourceTree = ""; }; - 2AB884059A74CC4A208CEB4905A349CF /* Pods-cocoapods.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-cocoapods.modulemap"; sourceTree = ""; }; - 3212113385A8FBBDB272BD23C409FF61 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.2.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; - 36FF9E436F78E7258DF47CB4FEA11D4F /* SwiftyJSON.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SwiftyJSON.debug.xcconfig; sourceTree = ""; }; - 3B922DE69FE8DCA83708DFEB1EB81AF0 /* Pods-cocoapods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-cocoapods.debug.xcconfig"; sourceTree = ""; }; - 46744AD4A06C915FB114D7D5E77EE705 /* Pods-cocoapods-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-cocoapods-umbrella.h"; sourceTree = ""; }; - 481DB8D9633F5DCD66454E6947A786F2 /* Pods-cocoapods-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-cocoapods-Info.plist"; sourceTree = ""; }; - 4973A122B95BE61592E66F8483DD02BC /* Pods-cocoapods-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-cocoapods-dummy.m"; sourceTree = ""; }; - 5F8030FD10A40683C9A7F30F2FA39236 /* Pods-cocoapods-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-cocoapods-acknowledgements.markdown"; sourceTree = ""; }; - 73C2BB411F6269204DB103674B0198D1 /* SwiftyJSON.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = SwiftyJSON.swift; path = Source/SwiftyJSON/SwiftyJSON.swift; sourceTree = ""; }; - 76B863ABE307C3A2579E49BD1F7035F7 /* Pods-cocoapods-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-cocoapods-acknowledgements.plist"; sourceTree = ""; }; - 85B2A09B957846228BA5A359D63961D2 /* SwiftyJSON.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SwiftyJSON.modulemap; sourceTree = ""; }; - 8D7CCA80FA2330B63234C2584C47DDEB /* SwiftyJSON.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SwiftyJSON.release.xcconfig; sourceTree = ""; }; - 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; - BA800BB4FD9A0D8BB96A65DFB964A67E /* SwiftyJSON-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SwiftyJSON-prefix.pch"; sourceTree = ""; }; - CBA8D64DE3E10EDDF5B70478A8E84977 /* Pods-cocoapods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-cocoapods.release.xcconfig"; sourceTree = ""; }; - D6FA2CDF87D783A59C6023981C76C9FB /* SwiftyJSON-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SwiftyJSON-umbrella.h"; sourceTree = ""; }; - E23C076BA70925415F490FEDB215DA92 /* SwiftyJSON.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = SwiftyJSON.framework; path = SwiftyJSON.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - EC699B217BEEF3CEB04FC24DA9461E81 /* QiscusCoreAPI.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = QiscusCoreAPI.debug.xcconfig; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - DB3A748BC71611DC7D07854F6C11749D /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - CDDBC6E48FC965BB799224AEA72A6DEC /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F8A643BFED26889F371CFC8EFA1D2F62 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 27703390084A77F0CC7CB6F77A2E78A8 /* Foundation.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 047901991ED2EEF315E10DF603B97B75 /* QiscusCoreAPI */ = { - isa = PBXGroup; - children = ( - ACEDAE088C725E82ED2CFE409F7B493E /* Support Files */, - ); - name = QiscusCoreAPI; - path = QiscusCoreAPI; - sourceTree = ""; - }; - 72A0F534597C9C13C6F39FBC5220531E /* Products */ = { - isa = PBXGroup; - children = ( - 208C321099C872A4D051C71BC6F747D9 /* Pods_cocoapods.framework */, - E23C076BA70925415F490FEDB215DA92 /* SwiftyJSON.framework */, - ); - name = Products; - sourceTree = ""; - }; - 9583CAC26BBAB4F0C8345195F0C514D5 /* SwiftyJSON */ = { - isa = PBXGroup; - children = ( - 73C2BB411F6269204DB103674B0198D1 /* SwiftyJSON.swift */, - BA68288010D1B903171B816042469182 /* Support Files */, - ); - name = SwiftyJSON; - path = SwiftyJSON; - sourceTree = ""; - }; - ACEDAE088C725E82ED2CFE409F7B493E /* Support Files */ = { - isa = PBXGroup; - children = ( - EC699B217BEEF3CEB04FC24DA9461E81 /* QiscusCoreAPI.debug.xcconfig */, - 00134C384238222986096A09180774D3 /* QiscusCoreAPI.release.xcconfig */, - ); - name = "Support Files"; - path = "../Target Support Files/QiscusCoreAPI"; - sourceTree = ""; - }; - BA68288010D1B903171B816042469182 /* Support Files */ = { - isa = PBXGroup; - children = ( - 85B2A09B957846228BA5A359D63961D2 /* SwiftyJSON.modulemap */, - 2816E324E614B6EBF99194ACA72B9208 /* SwiftyJSON-dummy.m */, - 025978E71A4CC0F78A9E291B844E266A /* SwiftyJSON-Info.plist */, - BA800BB4FD9A0D8BB96A65DFB964A67E /* SwiftyJSON-prefix.pch */, - D6FA2CDF87D783A59C6023981C76C9FB /* SwiftyJSON-umbrella.h */, - 36FF9E436F78E7258DF47CB4FEA11D4F /* SwiftyJSON.debug.xcconfig */, - 8D7CCA80FA2330B63234C2584C47DDEB /* SwiftyJSON.release.xcconfig */, - ); - name = "Support Files"; - path = "../Target Support Files/SwiftyJSON"; - sourceTree = ""; - }; - BF3DE2E8FCBC8066EB998852F6D410C0 /* Targets Support Files */ = { - isa = PBXGroup; - children = ( - F3598CB51587F16B0E92B76478D3DBB5 /* Pods-cocoapods */, - ); - name = "Targets Support Files"; - sourceTree = ""; - }; - C0834CEBB1379A84116EF29F93051C60 /* iOS */ = { - isa = PBXGroup; - children = ( - 3212113385A8FBBDB272BD23C409FF61 /* Foundation.framework */, - ); - name = iOS; - sourceTree = ""; - }; - CF1408CF629C7361332E53B88F7BD30C = { - isa = PBXGroup; - children = ( - 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */, - D210D550F4EA176C3123ED886F8F87F5 /* Frameworks */, - DCAD7F057905434806BBACE96C729230 /* Pods */, - 72A0F534597C9C13C6F39FBC5220531E /* Products */, - BF3DE2E8FCBC8066EB998852F6D410C0 /* Targets Support Files */, - ); - sourceTree = ""; - }; - D210D550F4EA176C3123ED886F8F87F5 /* Frameworks */ = { - isa = PBXGroup; - children = ( - C0834CEBB1379A84116EF29F93051C60 /* iOS */, - ); - name = Frameworks; - sourceTree = ""; - }; - DCAD7F057905434806BBACE96C729230 /* Pods */ = { - isa = PBXGroup; - children = ( - 047901991ED2EEF315E10DF603B97B75 /* QiscusCoreAPI */, - 9583CAC26BBAB4F0C8345195F0C514D5 /* SwiftyJSON */, - ); - name = Pods; - sourceTree = ""; - }; - F3598CB51587F16B0E92B76478D3DBB5 /* Pods-cocoapods */ = { - isa = PBXGroup; - children = ( - 2AB884059A74CC4A208CEB4905A349CF /* Pods-cocoapods.modulemap */, - 5F8030FD10A40683C9A7F30F2FA39236 /* Pods-cocoapods-acknowledgements.markdown */, - 76B863ABE307C3A2579E49BD1F7035F7 /* Pods-cocoapods-acknowledgements.plist */, - 4973A122B95BE61592E66F8483DD02BC /* Pods-cocoapods-dummy.m */, - 06804ECDF45257BD642F181929B684F6 /* Pods-cocoapods-frameworks.sh */, - 481DB8D9633F5DCD66454E6947A786F2 /* Pods-cocoapods-Info.plist */, - 46744AD4A06C915FB114D7D5E77EE705 /* Pods-cocoapods-umbrella.h */, - 3B922DE69FE8DCA83708DFEB1EB81AF0 /* Pods-cocoapods.debug.xcconfig */, - CBA8D64DE3E10EDDF5B70478A8E84977 /* Pods-cocoapods.release.xcconfig */, - ); - name = "Pods-cocoapods"; - path = "Target Support Files/Pods-cocoapods"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 2563ED04EB2795D15E6F5C5AAB007F34 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - D1FEDB7851C5C8D2C19B005843C76C72 /* Pods-cocoapods-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - AA91FE937E0A2A0B6C6ED3BEDA9DFB1A /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 2EFAFC05E1FEBF6D7045CC060A77B973 /* SwiftyJSON-umbrella.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 2B446E24B26912AEE212859016DFF8C0 /* Pods-cocoapods */ = { - isa = PBXNativeTarget; - buildConfigurationList = C41F96732A386F17C43A3FB107C7E482 /* Build configuration list for PBXNativeTarget "Pods-cocoapods" */; - buildPhases = ( - 2563ED04EB2795D15E6F5C5AAB007F34 /* Headers */, - A33977F41FDB68BB6F4C87AC3A2D00DA /* Sources */, - F8A643BFED26889F371CFC8EFA1D2F62 /* Frameworks */, - 8EF2E52CFA8234250473E5F9AB374953 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - 712C7320A6F41074D51AC4CB61A0D040 /* PBXTargetDependency */, - C73D71C6702B8A668D3338C37BFBB322 /* PBXTargetDependency */, - ); - name = "Pods-cocoapods"; - productName = "Pods-cocoapods"; - productReference = 208C321099C872A4D051C71BC6F747D9 /* Pods_cocoapods.framework */; - productType = "com.apple.product-type.framework"; - }; - D118A6A04828FD3CDA8640CD2B6796D2 /* SwiftyJSON */ = { - isa = PBXNativeTarget; - buildConfigurationList = FA9028784D8DB20A419D825563A94BF3 /* Build configuration list for PBXNativeTarget "SwiftyJSON" */; - buildPhases = ( - AA91FE937E0A2A0B6C6ED3BEDA9DFB1A /* Headers */, - 85F9738B81810247424D6F6D9F60F22D /* Sources */, - DB3A748BC71611DC7D07854F6C11749D /* Frameworks */, - 88022D00FAC6E3A013F808675701DED9 /* Resources */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SwiftyJSON; - productName = SwiftyJSON; - productReference = E23C076BA70925415F490FEDB215DA92 /* SwiftyJSON.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - BFDFE7DC352907FC980B868725387E98 /* Project object */ = { - isa = PBXProject; - attributes = { - LastSwiftUpdateCheck = 1100; - LastUpgradeCheck = 1100; - }; - buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = CF1408CF629C7361332E53B88F7BD30C; - productRefGroup = 72A0F534597C9C13C6F39FBC5220531E /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 2B446E24B26912AEE212859016DFF8C0 /* Pods-cocoapods */, - 6794E4CB9EE3546A9EB397134AD05455 /* QiscusCoreAPI */, - D118A6A04828FD3CDA8640CD2B6796D2 /* SwiftyJSON */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 88022D00FAC6E3A013F808675701DED9 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 8EF2E52CFA8234250473E5F9AB374953 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 85F9738B81810247424D6F6D9F60F22D /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 55D2A105E90179E0FAA508D5816FB623 /* SwiftyJSON-dummy.m in Sources */, - 3EA3B4188BAC7DC299523545C0CE3F63 /* SwiftyJSON.swift in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - A33977F41FDB68BB6F4C87AC3A2D00DA /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 5DB3BABE1F0B65055CDF0850BD7E25AC /* Pods-cocoapods-dummy.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 712C7320A6F41074D51AC4CB61A0D040 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = QiscusCoreAPI; - target = 6794E4CB9EE3546A9EB397134AD05455 /* QiscusCoreAPI */; - targetProxy = 37AF7252454116AFB73C16126ED489E7 /* PBXContainerItemProxy */; - }; - 8C85B14BE82B99273BFB6E9FD0BDF453 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = SwiftyJSON; - target = D118A6A04828FD3CDA8640CD2B6796D2 /* SwiftyJSON */; - targetProxy = 5B639EC5D82701EDDAB5FF9C32510BD0 /* PBXContainerItemProxy */; - }; - C73D71C6702B8A668D3338C37BFBB322 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = SwiftyJSON; - target = D118A6A04828FD3CDA8640CD2B6796D2 /* SwiftyJSON */; - targetProxy = B87D4552050EC18FABDF8B9444656DA1 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 4B3A4087CF262E08D614C7484A3E5C20 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 8D7CCA80FA2330B63234C2584C47DDEB /* SwiftyJSON.release.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/SwiftyJSON/SwiftyJSON-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/SwiftyJSON/SwiftyJSON.modulemap"; - PRODUCT_MODULE_NAME = SwiftyJSON; - PRODUCT_NAME = SwiftyJSON; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 6C61D818ACD3C2C116FED6A9C67E91B4 /* 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++14"; - CLANG_CXX_LIBRARY = "libc++"; - 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_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 = ( - "POD_CONFIGURATION_DEBUG=1", - "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 = 13.4; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - PRODUCT_NAME = "$(TARGET_NAME)"; - STRIP_INSTALLED_PRODUCT = NO; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; - SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 5.0; - SYMROOT = "${SRCROOT}/../build"; - }; - name = Debug; - }; - 72CDCDE8B08D8CA86BE3E4F41B3EFF82 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = CBA8D64DE3E10EDDF5B70478A8E84977 /* Pods-cocoapods.release.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; - CLANG_ENABLE_OBJC_WEAK = NO; - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/Pods-cocoapods/Pods-cocoapods-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.4; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-cocoapods/Pods-cocoapods.modulemap"; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Release; - }; - 7DC5F11AFBEAE473E8D3C24A2D11338D /* 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++14"; - CLANG_CXX_LIBRARY = "libc++"; - 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_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_PREPROCESSOR_DEFINITIONS = ( - "POD_CONFIGURATION_RELEASE=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 = 13.4; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - PRODUCT_NAME = "$(TARGET_NAME)"; - STRIP_INSTALLED_PRODUCT = NO; - SWIFT_COMPILATION_MODE = wholemodule; - SWIFT_OPTIMIZATION_LEVEL = "-O"; - SWIFT_VERSION = 5.0; - SYMROOT = "${SRCROOT}/../build"; - }; - name = Release; - }; - A13C60FA1AE48A0DB9ABA1A0A2AED190 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 3B922DE69FE8DCA83708DFEB1EB81AF0 /* Pods-cocoapods.debug.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO; - CLANG_ENABLE_OBJC_WEAK = NO; - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - INFOPLIST_FILE = "Target Support Files/Pods-cocoapods/Pods-cocoapods-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 13.4; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MACH_O_TYPE = staticlib; - MODULEMAP_FILE = "Target Support Files/Pods-cocoapods/Pods-cocoapods.modulemap"; - OTHER_LDFLAGS = ""; - OTHER_LIBTOOLFLAGS = ""; - PODS_ROOT = "$(SRCROOT)"; - PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; - PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; - B9A0FE19D5A2D09C563CC58AF5914B1A /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = EC699B217BEEF3CEB04FC24DA9461E81 /* QiscusCoreAPI.debug.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_OBJC_WEAK = NO; - CODE_SIGN_IDENTITY = "iPhone Developer"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - F10B2765C3CC2D95384ACF6536CA0648 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 00134C384238222986096A09180774D3 /* QiscusCoreAPI.release.xcconfig */; - buildSettings = { - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - CLANG_ENABLE_OBJC_WEAK = NO; - CODE_SIGN_IDENTITY = "iPhone Developer"; - IPHONEOS_DEPLOYMENT_TARGET = 10.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - ); - SDKROOT = iphoneos; - TARGETED_DEVICE_FAMILY = "1,2"; - VALIDATE_PRODUCT = YES; - }; - name = Release; - }; - F3E3AD598D7370FFF96079EC6F13A59A /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 36FF9E436F78E7258DF47CB4FEA11D4F /* SwiftyJSON.debug.xcconfig */; - buildSettings = { - CODE_SIGN_IDENTITY = ""; - "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; - "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; - CURRENT_PROJECT_VERSION = 1; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_PREFIX_HEADER = "Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch"; - INFOPLIST_FILE = "Target Support Files/SwiftyJSON/SwiftyJSON-Info.plist"; - INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MODULEMAP_FILE = "Target Support Files/SwiftyJSON/SwiftyJSON.modulemap"; - PRODUCT_MODULE_NAME = SwiftyJSON; - PRODUCT_NAME = SwiftyJSON; - SDKROOT = iphoneos; - SKIP_INSTALL = YES; - SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) "; - SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2"; - VERSIONING_SYSTEM = "apple-generic"; - VERSION_INFO_PREFIX = ""; - }; - name = Debug; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 6C61D818ACD3C2C116FED6A9C67E91B4 /* Debug */, - 7DC5F11AFBEAE473E8D3C24A2D11338D /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C41F96732A386F17C43A3FB107C7E482 /* Build configuration list for PBXNativeTarget "Pods-cocoapods" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - A13C60FA1AE48A0DB9ABA1A0A2AED190 /* Debug */, - 72CDCDE8B08D8CA86BE3E4F41B3EFF82 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - F6B0549296B60D3675A1B6D7C43C1656 /* Build configuration list for PBXAggregateTarget "QiscusCoreAPI" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - B9A0FE19D5A2D09C563CC58AF5914B1A /* Debug */, - F10B2765C3CC2D95384ACF6536CA0648 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - FA9028784D8DB20A419D825563A94BF3 /* Build configuration list for PBXNativeTarget "SwiftyJSON" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - F3E3AD598D7370FFF96079EC6F13A59A /* Debug */, - 4B3A4087CF262E08D614C7484A3E5C20 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = BFDFE7DC352907FC980B868725387E98 /* Project object */; -} diff --git a/Examples/cocoapods/Pods/Pods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/Pods-cocoapods.xcscheme b/Examples/cocoapods/Pods/Pods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/Pods-cocoapods.xcscheme deleted file mode 100644 index 5a6667e..0000000 --- a/Examples/cocoapods/Pods/Pods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/Pods-cocoapods.xcscheme +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Examples/cocoapods/Pods/Pods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/QiscusCoreAPI.xcscheme b/Examples/cocoapods/Pods/Pods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/QiscusCoreAPI.xcscheme deleted file mode 100644 index 716ac63..0000000 --- a/Examples/cocoapods/Pods/Pods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/QiscusCoreAPI.xcscheme +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Examples/cocoapods/Pods/Pods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/SwiftyJSON.xcscheme b/Examples/cocoapods/Pods/Pods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/SwiftyJSON.xcscheme deleted file mode 100644 index 24941c0..0000000 --- a/Examples/cocoapods/Pods/Pods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/SwiftyJSON.xcscheme +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Examples/cocoapods/Pods/Pods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/xcschememanagement.plist b/Examples/cocoapods/Pods/Pods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 0f0478f..0000000 --- a/Examples/cocoapods/Pods/Pods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - SchemeUserState - - Pods-cocoapods.xcscheme - - isShown - - - QiscusCoreAPI.xcscheme - - isShown - - - SwiftyJSON.xcscheme - - isShown - - - - SuppressBuildableAutocreation - - - diff --git a/Examples/cocoapods/Pods/QiscusCoreAPI/README.md b/Examples/cocoapods/Pods/QiscusCoreAPI/README.md deleted file mode 100644 index 69fa968..0000000 --- a/Examples/cocoapods/Pods/QiscusCoreAPI/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# [QiscusCoreAPI](https://github.com/qiscus) - Messaging and Chat Core API for iOS -[Qiscus](https://qiscus.com) Enable custom in-app messaging in your Mobile App and Web using Qiscus Chat SDK and Messaging API - -[![Platform](https://img.shields.io/badge/platform-iOS-orange.svg)](https://cocoapods.org/pods/QiscusCore) -[![Languages](https://img.shields.io/badge/language-Objective--C%20%7C%20Swift-orange.svg)](https://github.com/qiscus) -[![CocoaPods](https://img.shields.io/badge/pod-v3.0.109-green.svg)](https://cocoapods.org/pods/QiscusCore) - -## Features - -- [x] Create Chat Room, 1 on 1, group -- [x] List Chat Room -- [x] Set AppID -- [x] Login or Register -- [x] User Rooms -- [x] Delete Message -- [x] Load More or Previous message - -## Installation - -### Cocoapods - -[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command: - -```bash -$ gem install cocoapods -``` - -To integrate QiscusCore into your Xcode project using CocoaPods, specify it in your `Podfile`: - -```ruby -source 'https://github.com/CocoaPods/Specs.git' -platform :ios, '10.0' -use_frameworks! - -target '' do - pod 'QiscusCoreAPI', -end -``` - -Then, run the following command: - -```bash -$ pod install -``` - -### Carthage - -[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate MultichannelWidget into your Xcode project using Carthage, specify it in your `Cartfile`: - -```ogdl -github "Qiscus-Integration/QiscusCoreApi" -``` - -### Security Disclosure - -If you believe you have identified a security vulnerability with QiscusCore, you should report it as soon as possible via email to contact.us@qiscus.com. Please do not post it to a public issue. diff --git a/Examples/cocoapods/Pods/SwiftyJSON/LICENSE b/Examples/cocoapods/Pods/SwiftyJSON/LICENSE deleted file mode 100644 index 68e3fd7..0000000 --- a/Examples/cocoapods/Pods/SwiftyJSON/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Ruoyu Fu - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/Examples/cocoapods/Pods/SwiftyJSON/README.md b/Examples/cocoapods/Pods/SwiftyJSON/README.md deleted file mode 100644 index 7a10e29..0000000 --- a/Examples/cocoapods/Pods/SwiftyJSON/README.md +++ /dev/null @@ -1,562 +0,0 @@ -# SwiftyJSON - -[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) ![CocoaPods](https://img.shields.io/cocoapods/v/SwiftyJSON.svg) ![Platform](https://img.shields.io/badge/platforms-iOS%208.0%20%7C%20macOS%2010.10%20%7C%20tvOS%209.0%20%7C%20watchOS%203.0-F28D00.svg) [![Reviewed by Hound](https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg)](https://houndci.com) - -SwiftyJSON makes it easy to deal with JSON data in Swift. - -Platform | Build Status ----------| --------------| -*OS | [![Travis CI](https://travis-ci.org/SwiftyJSON/SwiftyJSON.svg?branch=master)](https://travis-ci.org/SwiftyJSON/SwiftyJSON) | -[Linux](https://github.com/IBM-Swift/SwiftyJSON) | [![Build Status](https://travis-ci.org/IBM-Swift/SwiftyJSON.svg?branch=master)](https://travis-ci.org/IBM-Swift/SwiftyJSON) | - - -1. [Why is the typical JSON handling in Swift NOT good](#why-is-the-typical-json-handling-in-swift-not-good) -2. [Requirements](#requirements) -3. [Integration](#integration) -4. [Usage](#usage) - - [Initialization](#initialization) - - [Subscript](#subscript) - - [Loop](#loop) - - [Error](#error) - - [Optional getter](#optional-getter) - - [Non-optional getter](#non-optional-getter) - - [Setter](#setter) - - [Raw object](#raw-object) - - [Literal convertibles](#literal-convertibles) - - [Merging](#merging) -5. [Work with Alamofire](#work-with-alamofire) -6. [Work with Moya](#work-with-moya) -7. [SwiftyJSON Model Generator](#swiftyjson-model-generator) - -> [中文介绍](http://tangplin.github.io/swiftyjson/) - - -## Why is the typical JSON handling in Swift NOT good? - -Swift is very strict about types. But although explicit typing is good for saving us from mistakes, it becomes painful when dealing with JSON and other areas that are, by nature, implicit about types. - -Take the Twitter API for example. Say we want to retrieve a user's "name" value of some tweet in Swift (according to [Twitter's API](https://developer.twitter.com/en/docs/tweets/timelines/api-reference/get-statuses-home_timeline)). - -The code would look like this: - -```swift -if let statusesArray = try? JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [[String: Any]], - let user = statusesArray[0]["user"] as? [String: Any], - let username = user["name"] as? String { - // Finally we got the username -} -``` - -It's not good. - -Even if we use optional chaining, it would be messy: - -```swift -if let JSONObject = try JSONSerialization.jsonObject(with: data, options: .allowFragments) as? [[String: Any]], - let username = (JSONObject[0]["user"] as? [String: Any])?["name"] as? String { - // There's our username -} -``` - -An unreadable mess--for something that should really be simple! - -With SwiftyJSON all you have to do is: - -```swift -let json = JSON(data: dataFromNetworking) -if let userName = json[0]["user"]["name"].string { - //Now you got your value -} -``` - -And don't worry about the Optional Wrapping thing. It's done for you automatically. - -```swift -let json = JSON(data: dataFromNetworking) -let result = json[999999]["wrong_key"]["wrong_name"] -if let userName = result.string { - //Calm down, take it easy, the ".string" property still produces the correct Optional String type with safety -} else { - //Print the error - print(result.error) -} -``` - -## Requirements - -- iOS 8.0+ | macOS 10.10+ | tvOS 9.0+ | watchOS 2.0+ -- Xcode 8 - -## Integration - -#### CocoaPods (iOS 8+, OS X 10.9+) - -You can use [CocoaPods](http://cocoapods.org/) to install `SwiftyJSON` by adding it to your `Podfile`: - -```ruby -platform :ios, '8.0' -use_frameworks! - -target 'MyApp' do - pod 'SwiftyJSON', '~> 4.0' -end -``` - -#### Carthage (iOS 8+, OS X 10.9+) - -You can use [Carthage](https://github.com/Carthage/Carthage) to install `SwiftyJSON` by adding it to your `Cartfile`: - -``` -github "SwiftyJSON/SwiftyJSON" ~> 4.0 -``` - -If you use Carthage to build your dependencies, make sure you have added `SwiftyJSON.framework` to the "Linked Frameworks and Libraries" section of your target, and have included them in your Carthage framework copying build phase. - -#### Swift Package Manager - -You can use [The Swift Package Manager](https://swift.org/package-manager) to install `SwiftyJSON` by adding the proper description to your `Package.swift` file: - -```swift -// swift-tools-version:4.0 -import PackageDescription - -let package = Package( - name: "YOUR_PROJECT_NAME", - dependencies: [ - .package(url: "https://github.com/SwiftyJSON/SwiftyJSON.git", from: "4.0.0"), - ] -) -``` -Then run `swift build` whenever you get prepared. - -#### Manually (iOS 7+, OS X 10.9+) - -To use this library in your project manually you may: - -1. for Projects, just drag SwiftyJSON.swift to the project tree -2. for Workspaces, include the whole SwiftyJSON.xcodeproj - -## Usage - -#### Initialization - -```swift -import SwiftyJSON -``` - -```swift -let json = JSON(data: dataFromNetworking) -``` -Or - -```swift -let json = JSON(jsonObject) -``` -Or - -```swift -if let dataFromString = jsonString.data(using: .utf8, allowLossyConversion: false) { - let json = JSON(data: dataFromString) -} -``` - -#### Subscript - -```swift -// Getting a double from a JSON Array -let name = json[0].double -``` - -```swift -// Getting an array of string from a JSON Array -let arrayNames = json["users"].arrayValue.map {$0["name"].stringValue} -``` - -```swift -// Getting a string from a JSON Dictionary -let name = json["name"].stringValue -``` - -```swift -// Getting a string using a path to the element -let path: [JSONSubscriptType] = [1,"list",2,"name"] -let name = json[path].string -// Just the same -let name = json[1]["list"][2]["name"].string -// Alternatively -let name = json[1,"list",2,"name"].string -``` - -```swift -// With a hard way -let name = json[].string -``` - -```swift -// With a custom way -let keys:[JSONSubscriptType] = [1,"list",2,"name"] -let name = json[keys].string -``` - -#### Loop - -```swift -// If json is .Dictionary -for (key,subJson):(String, JSON) in json { - // Do something you want -} -``` - -*The first element is always a String, even if the JSON is an Array* - -```swift -// If json is .Array -// The `index` is 0.. = json["list"].arrayValue -``` - -```swift -// If not a Dictionary or nil, return [:] -let user: Dictionary = json["user"].dictionaryValue -``` - -#### Setter - -```swift -json["name"] = JSON("new-name") -json[0] = JSON(1) -``` - -```swift -json["id"].int = 1234567890 -json["coordinate"].double = 8766.766 -json["name"].string = "Jack" -json.arrayObject = [1,2,3,4] -json.dictionaryObject = ["name":"Jack", "age":25] -``` - -#### Raw object - -```swift -let rawObject: Any = json.object -``` - -```swift -let rawValue: Any = json.rawValue -``` - -```swift -//convert the JSON to raw NSData -do { - let rawData = try json.rawData() - //Do something you want -} catch { - print("Error \(error)") -} -``` - -```swift -//convert the JSON to a raw String -if let rawString = json.rawString() { - //Do something you want -} else { - print("json.rawString is nil") -} -``` - -#### Existence - -```swift -// shows you whether value specified in JSON or not -if json["name"].exists() -``` - -#### Literal convertibles - -For more info about literal convertibles: [Swift Literal Convertibles](http://nshipster.com/swift-literal-convertible/) - -```swift -// StringLiteralConvertible -let json: JSON = "I'm a json" -``` - -```swift -/ /IntegerLiteralConvertible -let json: JSON = 12345 -``` - -```swift -// BooleanLiteralConvertible -let json: JSON = true -``` - -```swift -// FloatLiteralConvertible -let json: JSON = 2.8765 -``` - -```swift -// DictionaryLiteralConvertible -let json: JSON = ["I":"am", "a":"json"] -``` - -```swift -// ArrayLiteralConvertible -let json: JSON = ["I", "am", "a", "json"] -``` - -```swift -// With subscript in array -var json: JSON = [1,2,3] -json[0] = 100 -json[1] = 200 -json[2] = 300 -json[999] = 300 // Don't worry, nothing will happen -``` - -```swift -// With subscript in dictionary -var json: JSON = ["name": "Jack", "age": 25] -json["name"] = "Mike" -json["age"] = "25" // It's OK to set String -json["address"] = "L.A." // Add the "address": "L.A." in json -``` - -```swift -// Array & Dictionary -var json: JSON = ["name": "Jack", "age": 25, "list": ["a", "b", "c", ["what": "this"]]] -json["list"][3]["what"] = "that" -json["list",3,"what"] = "that" -let path: [JSONSubscriptType] = ["list",3,"what"] -json[path] = "that" -``` - -```swift -// With other JSON objects -let user: JSON = ["username" : "Steve", "password": "supersecurepassword"] -let auth: JSON = [ - "user": user.object, // use user.object instead of just user - "apikey": "supersecretapitoken" -] -``` - -#### Merging - -It is possible to merge one JSON into another JSON. Merging a JSON into another JSON adds all non existing values to the original JSON which are only present in the `other` JSON. - -If both JSONs contain a value for the same key, _mostly_ this value gets overwritten in the original JSON, but there are two cases where it provides some special treatment: - -- In case of both values being a `JSON.Type.array` the values form the array found in the `other` JSON getting appended to the original JSON's array value. -- In case of both values being a `JSON.Type.dictionary` both JSON-values are getting merged the same way the encapsulating JSON is merged. - -In case, where two fields in a JSON have a different types, the value will get always overwritten. - -There are two different fashions for merging: `merge` modifies the original JSON, whereas `merged` works non-destructively on a copy. - -```swift -let original: JSON = [ - "first_name": "John", - "age": 20, - "skills": ["Coding", "Reading"], - "address": [ - "street": "Front St", - "zip": "12345", - ] -] - -let update: JSON = [ - "last_name": "Doe", - "age": 21, - "skills": ["Writing"], - "address": [ - "zip": "12342", - "city": "New York City" - ] -] - -let updated = original.merge(with: update) -// [ -// "first_name": "John", -// "last_name": "Doe", -// "age": 21, -// "skills": ["Coding", "Reading", "Writing"], -// "address": [ -// "street": "Front St", -// "zip": "12342", -// "city": "New York City" -// ] -// ] -``` - -## String representation -There are two options available: -- use the default Swift one -- use a custom one that will handle optionals well and represent `nil` as `"null"`: -```swift -let dict = ["1":2, "2":"two", "3": nil] as [String: Any?] -let json = JSON(dict) -let representation = json.rawString(options: [.castNilToNSNull: true]) -// representation is "{\"1\":2,\"2\":\"two\",\"3\":null}", which represents {"1":2,"2":"two","3":null} -``` - -## Work with [Alamofire](https://github.com/Alamofire/Alamofire) - -SwiftyJSON nicely wraps the result of the Alamofire JSON response handler: - -```swift -Alamofire.request(url, method: .get).validate().responseJSON { response in - switch response.result { - case .success(let value): - let json = JSON(value) - print("JSON: \(json)") - case .failure(let error): - print(error) - } -} -``` - -We also provide an extension of Alamofire for serializing NSData to SwiftyJSON's JSON. - -See: [Alamofire-SwiftyJSON](https://github.com/SwiftyJSON/Alamofire-SwiftyJSON) - - -## Work with [Moya](https://github.com/Moya/Moya) - -SwiftyJSON parse data to JSON: - -```swift -let provider = MoyaProvider() -provider.request(.showProducts) { result in - switch result { - case let .success(moyaResponse): - let data = moyaResponse.data - let json = JSON(data: data) // convert network data to json - print(json) - case let .failure(error): - print("error: \(error)") - } -} - -``` - -## SwiftyJSON Model Generator -Tools to generate SwiftyJSON Models -* [JSON Cafe](http://www.jsoncafe.com/) -* [JSON Export](https://github.com/Ahmed-Ali/JSONExport) diff --git a/Examples/cocoapods/Pods/SwiftyJSON/Source/SwiftyJSON/SwiftyJSON.swift b/Examples/cocoapods/Pods/SwiftyJSON/Source/SwiftyJSON/SwiftyJSON.swift deleted file mode 100644 index f7a3f08..0000000 --- a/Examples/cocoapods/Pods/SwiftyJSON/Source/SwiftyJSON/SwiftyJSON.swift +++ /dev/null @@ -1,1401 +0,0 @@ -// SwiftyJSON.swift -// -// Copyright (c) 2014 - 2017 Ruoyu Fu, Pinglin Tang -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -// MARK: - Error -// swiftlint:disable line_length -public enum SwiftyJSONError: Int, Swift.Error { - case unsupportedType = 999 - case indexOutOfBounds = 900 - case elementTooDeep = 902 - case wrongType = 901 - case notExist = 500 - case invalidJSON = 490 -} - -extension SwiftyJSONError: CustomNSError { - - /// return the error domain of SwiftyJSONError - public static var errorDomain: String { return "com.swiftyjson.SwiftyJSON" } - - /// return the error code of SwiftyJSONError - public var errorCode: Int { return self.rawValue } - - /// return the userInfo of SwiftyJSONError - public var errorUserInfo: [String: Any] { - switch self { - case .unsupportedType: - return [NSLocalizedDescriptionKey: "It is an unsupported type."] - case .indexOutOfBounds: - return [NSLocalizedDescriptionKey: "Array Index is out of bounds."] - case .wrongType: - return [NSLocalizedDescriptionKey: "Couldn't merge, because the JSONs differ in type on top level."] - case .notExist: - return [NSLocalizedDescriptionKey: "Dictionary key does not exist."] - case .invalidJSON: - return [NSLocalizedDescriptionKey: "JSON is invalid."] - case .elementTooDeep: - return [NSLocalizedDescriptionKey: "Element too deep. Increase maxObjectDepth and make sure there is no reference loop."] - } - } -} - -// MARK: - JSON Type - -/** -JSON's type definitions. - -See http://www.json.org -*/ -public enum Type: Int { - case number - case string - case bool - case array - case dictionary - case null - case unknown -} - -// MARK: - JSON Base - -public struct JSON { - - /** - Creates a JSON using the data. - - - parameter data: The NSData used to convert to json.Top level object in data is an NSArray or NSDictionary - - parameter opt: The JSON serialization reading options. `[]` by default. - - - returns: The created JSON - */ - public init(data: Data, options opt: JSONSerialization.ReadingOptions = []) throws { - let object: Any = try JSONSerialization.jsonObject(with: data, options: opt) - self.init(jsonObject: object) - } - - /** - Creates a JSON object - - note: this does not parse a `String` into JSON, instead use `init(parseJSON: String)` - - - parameter object: the object - - - returns: the created JSON object - */ - public init(_ object: Any) { - switch object { - case let object as Data: - do { - try self.init(data: object) - } catch { - self.init(jsonObject: NSNull()) - } - default: - self.init(jsonObject: object) - } - } - - /** - Parses the JSON string into a JSON object - - - parameter json: the JSON string - - - returns: the created JSON object - */ - public init(parseJSON jsonString: String) { - if let data = jsonString.data(using: .utf8) { - self.init(data) - } else { - self.init(NSNull()) - } - } - - /** - Creates a JSON using the object. - - - parameter jsonObject: The object must have the following properties: All objects are NSString/String, NSNumber/Int/Float/Double/Bool, NSArray/Array, NSDictionary/Dictionary, or NSNull; All dictionary keys are NSStrings/String; NSNumbers are not NaN or infinity. - - - returns: The created JSON - */ - fileprivate init(jsonObject: Any) { - object = jsonObject - } - - /** - Merges another JSON into this JSON, whereas primitive values which are not present in this JSON are getting added, - present values getting overwritten, array values getting appended and nested JSONs getting merged the same way. - - - parameter other: The JSON which gets merged into this JSON - - - throws `ErrorWrongType` if the other JSONs differs in type on the top level. - */ - public mutating func merge(with other: JSON) throws { - try self.merge(with: other, typecheck: true) - } - - /** - Merges another JSON into this JSON and returns a new JSON, whereas primitive values which are not present in this JSON are getting added, - present values getting overwritten, array values getting appended and nested JSONS getting merged the same way. - - - parameter other: The JSON which gets merged into this JSON - - - throws `ErrorWrongType` if the other JSONs differs in type on the top level. - - - returns: New merged JSON - */ - public func merged(with other: JSON) throws -> JSON { - var merged = self - try merged.merge(with: other, typecheck: true) - return merged - } - - /** - Private woker function which does the actual merging - Typecheck is set to true for the first recursion level to prevent total override of the source JSON - */ - fileprivate mutating func merge(with other: JSON, typecheck: Bool) throws { - if type == other.type { - switch type { - case .dictionary: - for (key, _) in other { - try self[key].merge(with: other[key], typecheck: false) - } - case .array: - self = JSON(arrayValue + other.arrayValue) - default: - self = other - } - } else { - if typecheck { - throw SwiftyJSONError.wrongType - } else { - self = other - } - } - } - - /// Private object - fileprivate var rawArray: [Any] = [] - fileprivate var rawDictionary: [String: Any] = [:] - fileprivate var rawString: String = "" - fileprivate var rawNumber: NSNumber = 0 - fileprivate var rawNull: NSNull = NSNull() - fileprivate var rawBool: Bool = false - - /// JSON type, fileprivate setter - public fileprivate(set) var type: Type = .null - - /// Error in JSON, fileprivate setter - public fileprivate(set) var error: SwiftyJSONError? - - /// Object in JSON - public var object: Any { - get { - switch type { - case .array: return rawArray - case .dictionary: return rawDictionary - case .string: return rawString - case .number: return rawNumber - case .bool: return rawBool - default: return rawNull - } - } - set { - error = nil - switch unwrap(newValue) { - case let number as NSNumber: - if number.isBool { - type = .bool - rawBool = number.boolValue - } else { - type = .number - rawNumber = number - } - case let string as String: - type = .string - rawString = string - case _ as NSNull: - type = .null - case nil: - type = .null - case let array as [Any]: - type = .array - rawArray = array - case let dictionary as [String: Any]: - type = .dictionary - rawDictionary = dictionary - default: - type = .unknown - error = SwiftyJSONError.unsupportedType - } - } - } - - /// The static null JSON - @available(*, unavailable, renamed:"null") - public static var nullJSON: JSON { return null } - public static var null: JSON { return JSON(NSNull()) } -} - -/// Private method to unwarp an object recursively -private func unwrap(_ object: Any) -> Any { - switch object { - case let json as JSON: - return unwrap(json.object) - case let array as [Any]: - return array.map(unwrap) - case let dictionary as [String: Any]: - var d = dictionary - dictionary.forEach { pair in - d[pair.key] = unwrap(pair.value) - } - return d - default: - return object - } -} - -public enum Index: Comparable { - case array(Int) - case dictionary(DictionaryIndex) - case null - - static public func == (lhs: Index, rhs: Index) -> Bool { - switch (lhs, rhs) { - case (.array(let left), .array(let right)): return left == right - case (.dictionary(let left), .dictionary(let right)): return left == right - case (.null, .null): return true - default: return false - } - } - - static public func < (lhs: Index, rhs: Index) -> Bool { - switch (lhs, rhs) { - case (.array(let left), .array(let right)): return left < right - case (.dictionary(let left), .dictionary(let right)): return left < right - default: return false - } - } -} - -public typealias JSONIndex = Index -public typealias JSONRawIndex = Index - -extension JSON: Swift.Collection { - - public typealias Index = JSONRawIndex - - public var startIndex: Index { - switch type { - case .array: return .array(rawArray.startIndex) - case .dictionary: return .dictionary(rawDictionary.startIndex) - default: return .null - } - } - - public var endIndex: Index { - switch type { - case .array: return .array(rawArray.endIndex) - case .dictionary: return .dictionary(rawDictionary.endIndex) - default: return .null - } - } - - public func index(after i: Index) -> Index { - switch i { - case .array(let idx): return .array(rawArray.index(after: idx)) - case .dictionary(let idx): return .dictionary(rawDictionary.index(after: idx)) - default: return .null - } - } - - public subscript (position: Index) -> (String, JSON) { - switch position { - case .array(let idx): return (String(idx), JSON(rawArray[idx])) - case .dictionary(let idx): return (rawDictionary[idx].key, JSON(rawDictionary[idx].value)) - default: return ("", JSON.null) - } - } -} - -// MARK: - Subscript - -/** - * To mark both String and Int can be used in subscript. - */ -public enum JSONKey { - case index(Int) - case key(String) -} - -public protocol JSONSubscriptType { - var jsonKey: JSONKey { get } -} - -extension Int: JSONSubscriptType { - public var jsonKey: JSONKey { - return JSONKey.index(self) - } -} - -extension String: JSONSubscriptType { - public var jsonKey: JSONKey { - return JSONKey.key(self) - } -} - -extension JSON { - - /// If `type` is `.array`, return json whose object is `array[index]`, otherwise return null json with error. - fileprivate subscript(index index: Int) -> JSON { - get { - if type != .array { - var r = JSON.null - r.error = self.error ?? SwiftyJSONError.wrongType - return r - } else if rawArray.indices.contains(index) { - return JSON(rawArray[index]) - } else { - var r = JSON.null - r.error = SwiftyJSONError.indexOutOfBounds - return r - } - } - set { - if type == .array && - rawArray.indices.contains(index) && - newValue.error == nil { - rawArray[index] = newValue.object - } - } - } - - /// If `type` is `.dictionary`, return json whose object is `dictionary[key]` , otherwise return null json with error. - fileprivate subscript(key key: String) -> JSON { - get { - var r = JSON.null - if type == .dictionary { - if let o = rawDictionary[key] { - r = JSON(o) - } else { - r.error = SwiftyJSONError.notExist - } - } else { - r.error = self.error ?? SwiftyJSONError.wrongType - } - return r - } - set { - if type == .dictionary && newValue.error == nil { - rawDictionary[key] = newValue.object - } - } - } - - /// If `sub` is `Int`, return `subscript(index:)`; If `sub` is `String`, return `subscript(key:)`. - fileprivate subscript(sub sub: JSONSubscriptType) -> JSON { - get { - switch sub.jsonKey { - case .index(let index): return self[index: index] - case .key(let key): return self[key: key] - } - } - set { - switch sub.jsonKey { - case .index(let index): self[index: index] = newValue - case .key(let key): self[key: key] = newValue - } - } - } - - /** - Find a json in the complex data structures by using array of Int and/or String as path. - - Example: - - ``` - let json = JSON[data] - let path = [9,"list","person","name"] - let name = json[path] - ``` - - The same as: let name = json[9]["list"]["person"]["name"] - - - parameter path: The target json's path. - - - returns: Return a json found by the path or a null json with error - */ - public subscript(path: [JSONSubscriptType]) -> JSON { - get { - return path.reduce(self) { $0[sub: $1] } - } - set { - switch path.count { - case 0: return - case 1: self[sub:path[0]].object = newValue.object - default: - var aPath = path - aPath.remove(at: 0) - var nextJSON = self[sub: path[0]] - nextJSON[aPath] = newValue - self[sub: path[0]] = nextJSON - } - } - } - - /** - Find a json in the complex data structures by using array of Int and/or String as path. - - - parameter path: The target json's path. Example: - - let name = json[9,"list","person","name"] - - The same as: let name = json[9]["list"]["person"]["name"] - - - returns: Return a json found by the path or a null json with error - */ - public subscript(path: JSONSubscriptType...) -> JSON { - get { - return self[path] - } - set { - self[path] = newValue - } - } -} - -// MARK: - LiteralConvertible - -extension JSON: Swift.ExpressibleByStringLiteral { - - public init(stringLiteral value: StringLiteralType) { - self.init(value) - } - - public init(extendedGraphemeClusterLiteral value: StringLiteralType) { - self.init(value) - } - - public init(unicodeScalarLiteral value: StringLiteralType) { - self.init(value) - } -} - -extension JSON: Swift.ExpressibleByIntegerLiteral { - - public init(integerLiteral value: IntegerLiteralType) { - self.init(value) - } -} - -extension JSON: Swift.ExpressibleByBooleanLiteral { - - public init(booleanLiteral value: BooleanLiteralType) { - self.init(value) - } -} - -extension JSON: Swift.ExpressibleByFloatLiteral { - - public init(floatLiteral value: FloatLiteralType) { - self.init(value) - } -} - -extension JSON: Swift.ExpressibleByDictionaryLiteral { - public init(dictionaryLiteral elements: (String, Any)...) { - let dictionary = elements.reduce(into: [String: Any](), { $0[$1.0] = $1.1}) - self.init(dictionary) - } -} - -extension JSON: Swift.ExpressibleByArrayLiteral { - - public init(arrayLiteral elements: Any...) { - self.init(elements) - } -} - -// MARK: - Raw - -extension JSON: Swift.RawRepresentable { - - public init?(rawValue: Any) { - if JSON(rawValue).type == .unknown { - return nil - } else { - self.init(rawValue) - } - } - - public var rawValue: Any { - return object - } - - public func rawData(options opt: JSONSerialization.WritingOptions = JSONSerialization.WritingOptions(rawValue: 0)) throws -> Data { - guard JSONSerialization.isValidJSONObject(object) else { - throw SwiftyJSONError.invalidJSON - } - - return try JSONSerialization.data(withJSONObject: object, options: opt) - } - - public func rawString(_ encoding: String.Encoding = .utf8, options opt: JSONSerialization.WritingOptions = .prettyPrinted) -> String? { - do { - return try _rawString(encoding, options: [.jsonSerialization: opt]) - } catch { - print("Could not serialize object to JSON because:", error.localizedDescription) - return nil - } - } - - public func rawString(_ options: [writingOptionsKeys: Any]) -> String? { - let encoding = options[.encoding] as? String.Encoding ?? String.Encoding.utf8 - let maxObjectDepth = options[.maxObjextDepth] as? Int ?? 10 - do { - return try _rawString(encoding, options: options, maxObjectDepth: maxObjectDepth) - } catch { - print("Could not serialize object to JSON because:", error.localizedDescription) - return nil - } - } - - fileprivate func _rawString(_ encoding: String.Encoding = .utf8, options: [writingOptionsKeys: Any], maxObjectDepth: Int = 10) throws -> String? { - guard maxObjectDepth > 0 else { throw SwiftyJSONError.invalidJSON } - switch type { - case .dictionary: - do { - if !(options[.castNilToNSNull] as? Bool ?? false) { - let jsonOption = options[.jsonSerialization] as? JSONSerialization.WritingOptions ?? JSONSerialization.WritingOptions.prettyPrinted - let data = try rawData(options: jsonOption) - return String(data: data, encoding: encoding) - } - - guard let dict = object as? [String: Any?] else { - return nil - } - let body = try dict.keys.map { key throws -> String in - guard let value = dict[key] else { - return "\"\(key)\": null" - } - guard let unwrappedValue = value else { - return "\"\(key)\": null" - } - - let nestedValue = JSON(unwrappedValue) - guard let nestedString = try nestedValue._rawString(encoding, options: options, maxObjectDepth: maxObjectDepth - 1) else { - throw SwiftyJSONError.elementTooDeep - } - if nestedValue.type == .string { - return "\"\(key)\": \"\(nestedString.replacingOccurrences(of: "\\", with: "\\\\").replacingOccurrences(of: "\"", with: "\\\""))\"" - } else { - return "\"\(key)\": \(nestedString)" - } - } - - return "{\(body.joined(separator: ","))}" - } catch _ { - return nil - } - case .array: - do { - if !(options[.castNilToNSNull] as? Bool ?? false) { - let jsonOption = options[.jsonSerialization] as? JSONSerialization.WritingOptions ?? JSONSerialization.WritingOptions.prettyPrinted - let data = try rawData(options: jsonOption) - return String(data: data, encoding: encoding) - } - - guard let array = object as? [Any?] else { - return nil - } - let body = try array.map { value throws -> String in - guard let unwrappedValue = value else { - return "null" - } - - let nestedValue = JSON(unwrappedValue) - guard let nestedString = try nestedValue._rawString(encoding, options: options, maxObjectDepth: maxObjectDepth - 1) else { - throw SwiftyJSONError.invalidJSON - } - if nestedValue.type == .string { - return "\"\(nestedString.replacingOccurrences(of: "\\", with: "\\\\").replacingOccurrences(of: "\"", with: "\\\""))\"" - } else { - return nestedString - } - } - - return "[\(body.joined(separator: ","))]" - } catch _ { - return nil - } - case .string: return rawString - case .number: return rawNumber.stringValue - case .bool: return rawBool.description - case .null: return "null" - default: return nil - } - } -} - -// MARK: - Printable, DebugPrintable - -extension JSON: Swift.CustomStringConvertible, Swift.CustomDebugStringConvertible { - - public var description: String { - return rawString(options: .prettyPrinted) ?? "unknown" - } - - public var debugDescription: String { - return description - } -} - -// MARK: - Array - -extension JSON { - - //Optional [JSON] - public var array: [JSON]? { - return type == .array ? rawArray.map { JSON($0) } : nil - } - - //Non-optional [JSON] - public var arrayValue: [JSON] { - return self.array ?? [] - } - - //Optional [Any] - public var arrayObject: [Any]? { - get { - switch type { - case .array: return rawArray - default: return nil - } - } - set { - self.object = newValue ?? NSNull() - } - } -} - -// MARK: - Dictionary - -extension JSON { - - //Optional [String : JSON] - public var dictionary: [String: JSON]? { - if type == .dictionary { - var d = [String: JSON](minimumCapacity: rawDictionary.count) - rawDictionary.forEach { pair in - d[pair.key] = JSON(pair.value) - } - return d - } else { - return nil - } - } - - //Non-optional [String : JSON] - public var dictionaryValue: [String: JSON] { - return dictionary ?? [:] - } - - //Optional [String : Any] - - public var dictionaryObject: [String: Any]? { - get { - switch type { - case .dictionary: return rawDictionary - default: return nil - } - } - set { - object = newValue ?? NSNull() - } - } -} - -// MARK: - Bool - -extension JSON { // : Swift.Bool - - //Optional bool - public var bool: Bool? { - get { - switch type { - case .bool: return rawBool - default: return nil - } - } - set { - object = newValue ?? NSNull() - } - } - - //Non-optional bool - public var boolValue: Bool { - get { - switch type { - case .bool: return rawBool - case .number: return rawNumber.boolValue - case .string: return ["true", "y", "t", "yes", "1"].contains { rawString.caseInsensitiveCompare($0) == .orderedSame } - default: return false - } - } - set { - object = newValue - } - } -} - -// MARK: - String - -extension JSON { - - //Optional string - public var string: String? { - get { - switch type { - case .string: return object as? String - default: return nil - } - } - set { - object = newValue ?? NSNull() - } - } - - //Non-optional string - public var stringValue: String { - get { - switch type { - case .string: return object as? String ?? "" - case .number: return rawNumber.stringValue - case .bool: return (object as? Bool).map { String($0) } ?? "" - default: return "" - } - } - set { - object = newValue - } - } -} - -// MARK: - Number - -extension JSON { - - //Optional number - public var number: NSNumber? { - get { - switch type { - case .number: return rawNumber - case .bool: return NSNumber(value: rawBool ? 1 : 0) - default: return nil - } - } - set { - object = newValue ?? NSNull() - } - } - - //Non-optional number - public var numberValue: NSNumber { - get { - switch type { - case .string: - let decimal = NSDecimalNumber(string: object as? String) - return decimal == .notANumber ? .zero : decimal - case .number: return object as? NSNumber ?? NSNumber(value: 0) - case .bool: return NSNumber(value: rawBool ? 1 : 0) - default: return NSNumber(value: 0.0) - } - } - set { - object = newValue - } - } -} - -// MARK: - Null - -extension JSON { - - public var null: NSNull? { - set { - object = NSNull() - } - get { - switch type { - case .null: return rawNull - default: return nil - } - } - } - public func exists() -> Bool { - if let errorValue = error, (400...1000).contains(errorValue.errorCode) { - return false - } - return true - } -} - -// MARK: - URL - -extension JSON { - - //Optional URL - public var url: URL? { - get { - switch type { - case .string: - // Check for existing percent escapes first to prevent double-escaping of % character - if rawString.range(of: "%[0-9A-Fa-f]{2}", options: .regularExpression, range: nil, locale: nil) != nil { - return Foundation.URL(string: rawString) - } else if let encodedString_ = rawString.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed) { - // We have to use `Foundation.URL` otherwise it conflicts with the variable name. - return Foundation.URL(string: encodedString_) - } else { - return nil - } - default: - return nil - } - } - set { - object = newValue?.absoluteString ?? NSNull() - } - } -} - -// MARK: - Int, Double, Float, Int8, Int16, Int32, Int64 - -extension JSON { - - public var double: Double? { - get { - return number?.doubleValue - } - set { - if let newValue = newValue { - object = NSNumber(value: newValue) - } else { - object = NSNull() - } - } - } - - public var doubleValue: Double { - get { - return numberValue.doubleValue - } - set { - object = NSNumber(value: newValue) - } - } - - public var float: Float? { - get { - return number?.floatValue - } - set { - if let newValue = newValue { - object = NSNumber(value: newValue) - } else { - object = NSNull() - } - } - } - - public var floatValue: Float { - get { - return numberValue.floatValue - } - set { - object = NSNumber(value: newValue) - } - } - - public var int: Int? { - get { - return number?.intValue - } - set { - if let newValue = newValue { - object = NSNumber(value: newValue) - } else { - object = NSNull() - } - } - } - - public var intValue: Int { - get { - return numberValue.intValue - } - set { - object = NSNumber(value: newValue) - } - } - - public var uInt: UInt? { - get { - return number?.uintValue - } - set { - if let newValue = newValue { - object = NSNumber(value: newValue) - } else { - object = NSNull() - } - } - } - - public var uIntValue: UInt { - get { - return numberValue.uintValue - } - set { - object = NSNumber(value: newValue) - } - } - - public var int8: Int8? { - get { - return number?.int8Value - } - set { - if let newValue = newValue { - object = NSNumber(value: Int(newValue)) - } else { - object = NSNull() - } - } - } - - public var int8Value: Int8 { - get { - return numberValue.int8Value - } - set { - object = NSNumber(value: Int(newValue)) - } - } - - public var uInt8: UInt8? { - get { - return number?.uint8Value - } - set { - if let newValue = newValue { - object = NSNumber(value: newValue) - } else { - object = NSNull() - } - } - } - - public var uInt8Value: UInt8 { - get { - return numberValue.uint8Value - } - set { - object = NSNumber(value: newValue) - } - } - - public var int16: Int16? { - get { - return number?.int16Value - } - set { - if let newValue = newValue { - object = NSNumber(value: newValue) - } else { - object = NSNull() - } - } - } - - public var int16Value: Int16 { - get { - return numberValue.int16Value - } - set { - object = NSNumber(value: newValue) - } - } - - public var uInt16: UInt16? { - get { - return number?.uint16Value - } - set { - if let newValue = newValue { - object = NSNumber(value: newValue) - } else { - object = NSNull() - } - } - } - - public var uInt16Value: UInt16 { - get { - return numberValue.uint16Value - } - set { - object = NSNumber(value: newValue) - } - } - - public var int32: Int32? { - get { - return number?.int32Value - } - set { - if let newValue = newValue { - object = NSNumber(value: newValue) - } else { - object = NSNull() - } - } - } - - public var int32Value: Int32 { - get { - return numberValue.int32Value - } - set { - object = NSNumber(value: newValue) - } - } - - public var uInt32: UInt32? { - get { - return number?.uint32Value - } - set { - if let newValue = newValue { - object = NSNumber(value: newValue) - } else { - object = NSNull() - } - } - } - - public var uInt32Value: UInt32 { - get { - return numberValue.uint32Value - } - set { - object = NSNumber(value: newValue) - } - } - - public var int64: Int64? { - get { - return number?.int64Value - } - set { - if let newValue = newValue { - object = NSNumber(value: newValue) - } else { - object = NSNull() - } - } - } - - public var int64Value: Int64 { - get { - return numberValue.int64Value - } - set { - object = NSNumber(value: newValue) - } - } - - public var uInt64: UInt64? { - get { - return number?.uint64Value - } - set { - if let newValue = newValue { - object = NSNumber(value: newValue) - } else { - object = NSNull() - } - } - } - - public var uInt64Value: UInt64 { - get { - return numberValue.uint64Value - } - set { - object = NSNumber(value: newValue) - } - } -} - -// MARK: - Comparable - -extension JSON: Swift.Comparable {} - -public func == (lhs: JSON, rhs: JSON) -> Bool { - - switch (lhs.type, rhs.type) { - case (.number, .number): return lhs.rawNumber == rhs.rawNumber - case (.string, .string): return lhs.rawString == rhs.rawString - case (.bool, .bool): return lhs.rawBool == rhs.rawBool - case (.array, .array): return lhs.rawArray as NSArray == rhs.rawArray as NSArray - case (.dictionary, .dictionary): return lhs.rawDictionary as NSDictionary == rhs.rawDictionary as NSDictionary - case (.null, .null): return true - default: return false - } -} - -public func <= (lhs: JSON, rhs: JSON) -> Bool { - - switch (lhs.type, rhs.type) { - case (.number, .number): return lhs.rawNumber <= rhs.rawNumber - case (.string, .string): return lhs.rawString <= rhs.rawString - case (.bool, .bool): return lhs.rawBool == rhs.rawBool - case (.array, .array): return lhs.rawArray as NSArray == rhs.rawArray as NSArray - case (.dictionary, .dictionary): return lhs.rawDictionary as NSDictionary == rhs.rawDictionary as NSDictionary - case (.null, .null): return true - default: return false - } -} - -public func >= (lhs: JSON, rhs: JSON) -> Bool { - - switch (lhs.type, rhs.type) { - case (.number, .number): return lhs.rawNumber >= rhs.rawNumber - case (.string, .string): return lhs.rawString >= rhs.rawString - case (.bool, .bool): return lhs.rawBool == rhs.rawBool - case (.array, .array): return lhs.rawArray as NSArray == rhs.rawArray as NSArray - case (.dictionary, .dictionary): return lhs.rawDictionary as NSDictionary == rhs.rawDictionary as NSDictionary - case (.null, .null): return true - default: return false - } -} - -public func > (lhs: JSON, rhs: JSON) -> Bool { - - switch (lhs.type, rhs.type) { - case (.number, .number): return lhs.rawNumber > rhs.rawNumber - case (.string, .string): return lhs.rawString > rhs.rawString - default: return false - } -} - -public func < (lhs: JSON, rhs: JSON) -> Bool { - - switch (lhs.type, rhs.type) { - case (.number, .number): return lhs.rawNumber < rhs.rawNumber - case (.string, .string): return lhs.rawString < rhs.rawString - default: return false - } -} - -private let trueNumber = NSNumber(value: true) -private let falseNumber = NSNumber(value: false) -private let trueObjCType = String(cString: trueNumber.objCType) -private let falseObjCType = String(cString: falseNumber.objCType) - -// MARK: - NSNumber: Comparable - -extension NSNumber { - fileprivate var isBool: Bool { - let objCType = String(cString: self.objCType) - if (self.compare(trueNumber) == .orderedSame && objCType == trueObjCType) || (self.compare(falseNumber) == .orderedSame && objCType == falseObjCType) { - return true - } else { - return false - } - } -} - -func == (lhs: NSNumber, rhs: NSNumber) -> Bool { - switch (lhs.isBool, rhs.isBool) { - case (false, true): return false - case (true, false): return false - default: return lhs.compare(rhs) == .orderedSame - } -} - -func != (lhs: NSNumber, rhs: NSNumber) -> Bool { - return !(lhs == rhs) -} - -func < (lhs: NSNumber, rhs: NSNumber) -> Bool { - - switch (lhs.isBool, rhs.isBool) { - case (false, true): return false - case (true, false): return false - default: return lhs.compare(rhs) == .orderedAscending - } -} - -func > (lhs: NSNumber, rhs: NSNumber) -> Bool { - - switch (lhs.isBool, rhs.isBool) { - case (false, true): return false - case (true, false): return false - default: return lhs.compare(rhs) == ComparisonResult.orderedDescending - } -} - -func <= (lhs: NSNumber, rhs: NSNumber) -> Bool { - - switch (lhs.isBool, rhs.isBool) { - case (false, true): return false - case (true, false): return false - default: return lhs.compare(rhs) != .orderedDescending - } -} - -func >= (lhs: NSNumber, rhs: NSNumber) -> Bool { - - switch (lhs.isBool, rhs.isBool) { - case (false, true): return false - case (true, false): return false - default: return lhs.compare(rhs) != .orderedAscending - } -} - -public enum writingOptionsKeys { - case jsonSerialization - case castNilToNSNull - case maxObjextDepth - case encoding -} - -// MARK: - JSON: Codable -extension JSON: Codable { - private static var codableTypes: [Codable.Type] { - return [ - Bool.self, - Int.self, - Int8.self, - Int16.self, - Int32.self, - Int64.self, - UInt.self, - UInt8.self, - UInt16.self, - UInt32.self, - UInt64.self, - Double.self, - String.self, - [JSON].self, - [String: JSON].self - ] - } - public init(from decoder: Decoder) throws { - var object: Any? - - if let container = try? decoder.singleValueContainer(), !container.decodeNil() { - for type in JSON.codableTypes { - if object != nil { - break - } - // try to decode value - switch type { - case let boolType as Bool.Type: - object = try? container.decode(boolType) - case let intType as Int.Type: - object = try? container.decode(intType) - case let int8Type as Int8.Type: - object = try? container.decode(int8Type) - case let int32Type as Int32.Type: - object = try? container.decode(int32Type) - case let int64Type as Int64.Type: - object = try? container.decode(int64Type) - case let uintType as UInt.Type: - object = try? container.decode(uintType) - case let uint8Type as UInt8.Type: - object = try? container.decode(uint8Type) - case let uint16Type as UInt16.Type: - object = try? container.decode(uint16Type) - case let uint32Type as UInt32.Type: - object = try? container.decode(uint32Type) - case let uint64Type as UInt64.Type: - object = try? container.decode(uint64Type) - case let doubleType as Double.Type: - object = try? container.decode(doubleType) - case let stringType as String.Type: - object = try? container.decode(stringType) - case let jsonValueArrayType as [JSON].Type: - object = try? container.decode(jsonValueArrayType) - case let jsonValueDictType as [String: JSON].Type: - object = try? container.decode(jsonValueDictType) - default: - break - } - } - } - self.init(object ?? NSNull()) - } - public func encode(to encoder: Encoder) throws { - var container = encoder.singleValueContainer() - if object is NSNull { - try container.encodeNil() - return - } - switch object { - case let intValue as Int: - try container.encode(intValue) - case let int8Value as Int8: - try container.encode(int8Value) - case let int32Value as Int32: - try container.encode(int32Value) - case let int64Value as Int64: - try container.encode(int64Value) - case let uintValue as UInt: - try container.encode(uintValue) - case let uint8Value as UInt8: - try container.encode(uint8Value) - case let uint16Value as UInt16: - try container.encode(uint16Value) - case let uint32Value as UInt32: - try container.encode(uint32Value) - case let uint64Value as UInt64: - try container.encode(uint64Value) - case let doubleValue as Double: - try container.encode(doubleValue) - case let boolValue as Bool: - try container.encode(boolValue) - case let stringValue as String: - try container.encode(stringValue) - case is [Any]: - let jsonValueArray = array ?? [] - try container.encode(jsonValueArray) - case is [String: Any]: - let jsonValueDictValue = dictionary ?? [:] - try container.encode(jsonValueDictValue) - default: - break - } - } -} diff --git a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-Info.plist b/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-Info.plist deleted file mode 100644 index 2243fe6..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - ${PRODUCT_BUNDLE_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0.0 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-acknowledgements.markdown b/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-acknowledgements.markdown deleted file mode 100644 index 7e6929c..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-acknowledgements.markdown +++ /dev/null @@ -1,28 +0,0 @@ -# Acknowledgements -This application makes use of the following third party libraries: - -## SwiftyJSON - -The MIT License (MIT) - -Copyright (c) 2017 Ruoyu Fu - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -Generated by CocoaPods - https://cocoapods.org diff --git a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-acknowledgements.plist b/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-acknowledgements.plist deleted file mode 100644 index c030611..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-acknowledgements.plist +++ /dev/null @@ -1,60 +0,0 @@ - - - - - PreferenceSpecifiers - - - FooterText - This application makes use of the following third party libraries: - Title - Acknowledgements - Type - PSGroupSpecifier - - - FooterText - The MIT License (MIT) - -Copyright (c) 2017 Ruoyu Fu - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - - License - MIT - Title - SwiftyJSON - Type - PSGroupSpecifier - - - FooterText - Generated by CocoaPods - https://cocoapods.org - Title - - Type - PSGroupSpecifier - - - StringsTable - Acknowledgements - Title - Acknowledgements - - diff --git a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-dummy.m b/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-dummy.m deleted file mode 100644 index 9c96c00..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_Pods_cocoapods : NSObject -@end -@implementation PodsDummy_Pods_cocoapods -@end diff --git a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks-Debug-input-files.xcfilelist b/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks-Debug-input-files.xcfilelist deleted file mode 100644 index f31b553..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks-Debug-input-files.xcfilelist +++ /dev/null @@ -1,2 +0,0 @@ -${PODS_ROOT}/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks.sh -${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework \ No newline at end of file diff --git a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks-Debug-output-files.xcfilelist b/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks-Debug-output-files.xcfilelist deleted file mode 100644 index 6dcc652..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks-Debug-output-files.xcfilelist +++ /dev/null @@ -1 +0,0 @@ -${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyJSON.framework \ No newline at end of file diff --git a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks-Release-input-files.xcfilelist b/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks-Release-input-files.xcfilelist deleted file mode 100644 index f31b553..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks-Release-input-files.xcfilelist +++ /dev/null @@ -1,2 +0,0 @@ -${PODS_ROOT}/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks.sh -${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework \ No newline at end of file diff --git a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks-Release-output-files.xcfilelist b/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks-Release-output-files.xcfilelist deleted file mode 100644 index 6dcc652..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks-Release-output-files.xcfilelist +++ /dev/null @@ -1 +0,0 @@ -${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyJSON.framework \ No newline at end of file diff --git a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks.sh b/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks.sh deleted file mode 100755 index 27d632b..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-frameworks.sh +++ /dev/null @@ -1,207 +0,0 @@ -#!/bin/sh -set -e -set -u -set -o pipefail - -function on_error { - echo "$(realpath -mq "${0}"):$1: error: Unexpected failure" -} -trap 'on_error $LINENO' ERR - -if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then - # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy - # frameworks to, so exit 0 (signalling the script phase was successful). - exit 0 -fi - -echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" -mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - -COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}" -SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" - -# Used as a return value for each invocation of `strip_invalid_archs` function. -STRIP_BINARY_RETVAL=0 - -# This protects against multiple targets copying the same framework dependency at the same time. The solution -# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html -RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????") - -# Copies and strips a vendored framework -install_framework() -{ - if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then - local source="${BUILT_PRODUCTS_DIR}/$1" - elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then - local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" - elif [ -r "$1" ]; then - local source="$1" - fi - - local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" - - if [ -L "${source}" ]; then - echo "Symlinked..." - source="$(readlink "${source}")" - fi - - # Use filter instead of exclude so missing patterns don't throw errors. - echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" - rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" - - local basename - basename="$(basename -s .framework "$1")" - binary="${destination}/${basename}.framework/${basename}" - - if ! [ -r "$binary" ]; then - binary="${destination}/${basename}" - elif [ -L "${binary}" ]; then - echo "Destination binary is symlinked..." - dirname="$(dirname "${binary}")" - binary="${dirname}/$(readlink "${binary}")" - fi - - # Strip invalid architectures so "fat" simulator / device frameworks work on device - if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then - strip_invalid_archs "$binary" - fi - - # Resign the code if required by the build settings to avoid unstable apps - code_sign_if_enabled "${destination}/$(basename "$1")" - - # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. - if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then - local swift_runtime_libs - swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u) - for lib in $swift_runtime_libs; do - echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" - rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" - code_sign_if_enabled "${destination}/${lib}" - done - fi -} - -# Copies and strips a vendored dSYM -install_dsym() { - local source="$1" - warn_missing_arch=${2:-true} - if [ -r "$source" ]; then - # Copy the dSYM into the targets temp dir. - echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\"" - rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}" - - local basename - basename="$(basename -s .dSYM "$source")" - binary_name="$(ls "$source/Contents/Resources/DWARF")" - binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}" - - # Strip invalid architectures so "fat" simulator / device frameworks work on device - if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then - strip_invalid_archs "$binary" "$warn_missing_arch" - fi - - if [[ $STRIP_BINARY_RETVAL == 1 ]]; then - # Move the stripped file into its final destination. - echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\"" - rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}" - else - # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing. - touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM" - fi - fi -} - -# Copies the bcsymbolmap files of a vendored framework -install_bcsymbolmap() { - local bcsymbolmap_path="$1" - local destination="${BUILT_PRODUCTS_DIR}" - echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"" - rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}" -} - -# Signs a framework with the provided identity -code_sign_if_enabled() { - if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then - # Use the current code_sign_identity - echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" - local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'" - - if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then - code_sign_cmd="$code_sign_cmd &" - fi - echo "$code_sign_cmd" - eval "$code_sign_cmd" - fi -} - -# Strip invalid architectures -strip_invalid_archs() { - binary="$1" - warn_missing_arch=${2:-true} - # Get architectures for current target binary - binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)" - # Intersect them with the architectures we are building for - intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)" - # If there are no archs supported by this binary then warn the user - if [[ -z "$intersected_archs" ]]; then - if [[ "$warn_missing_arch" == "true" ]]; then - echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)." - fi - STRIP_BINARY_RETVAL=0 - return - fi - stripped="" - for arch in $binary_archs; do - if ! [[ "${ARCHS}" == *"$arch"* ]]; then - # Strip non-valid architectures in-place - lipo -remove "$arch" -output "$binary" "$binary" - stripped="$stripped $arch" - fi - done - if [[ "$stripped" ]]; then - echo "Stripped $binary of architectures:$stripped" - fi - STRIP_BINARY_RETVAL=1 -} - -install_artifact() { - artifact="$1" - base="$(basename "$artifact")" - case $base in - *.framework) - install_framework "$artifact" - ;; - *.dSYM) - # Suppress arch warnings since XCFrameworks will include many dSYM files - install_dsym "$artifact" "false" - ;; - *.bcsymbolmap) - install_bcsymbolmap "$artifact" - ;; - *) - echo "error: Unrecognized artifact "$artifact"" - ;; - esac -} - -copy_artifacts() { - file_list="$1" - while read artifact; do - install_artifact "$artifact" - done <$file_list -} - -ARTIFACT_LIST_FILE="${BUILT_PRODUCTS_DIR}/cocoapods-artifacts-${CONFIGURATION}.txt" -if [ -r "${ARTIFACT_LIST_FILE}" ]; then - copy_artifacts "${ARTIFACT_LIST_FILE}" -fi - -if [[ "$CONFIGURATION" == "Debug" ]]; then - install_framework "${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework" -fi -if [[ "$CONFIGURATION" == "Release" ]]; then - install_framework "${BUILT_PRODUCTS_DIR}/SwiftyJSON/SwiftyJSON.framework" -fi -if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then - wait -fi diff --git a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-umbrella.h b/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-umbrella.h deleted file mode 100644 index 000da1f..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods-umbrella.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - - -FOUNDATION_EXPORT double Pods_cocoapodsVersionNumber; -FOUNDATION_EXPORT const unsigned char Pods_cocoapodsVersionString[]; - diff --git a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods.debug.xcconfig b/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods.debug.xcconfig deleted file mode 100644 index 00b13a7..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods.debug.xcconfig +++ /dev/null @@ -1,12 +0,0 @@ -ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON/SwiftyJSON.framework/Headers" -LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_LDFLAGS = $(inherited) -framework "CFNetwork" -framework "CoreData" -framework "Foundation" -framework "MobileCoreServices" -framework "QuartzCore" -framework "Security" -framework "SwiftyJSON" -framework "UIKit" -OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_PODFILE_DIR_PATH = ${SRCROOT}/. -PODS_ROOT = ${SRCROOT}/Pods -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods.modulemap b/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods.modulemap deleted file mode 100644 index 7043e44..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module Pods_cocoapods { - umbrella header "Pods-cocoapods-umbrella.h" - - export * - module * { export * } -} diff --git a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods.release.xcconfig b/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods.release.xcconfig deleted file mode 100644 index 00b13a7..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/Pods-cocoapods/Pods-cocoapods.release.xcconfig +++ /dev/null @@ -1,12 +0,0 @@ -ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON/SwiftyJSON.framework/Headers" -LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' -OTHER_LDFLAGS = $(inherited) -framework "CFNetwork" -framework "CoreData" -framework "Foundation" -framework "MobileCoreServices" -framework "QuartzCore" -framework "Security" -framework "SwiftyJSON" -framework "UIKit" -OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_PODFILE_DIR_PATH = ${SRCROOT}/. -PODS_ROOT = ${SRCROOT}/Pods -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Examples/cocoapods/Pods/Target Support Files/QiscusCoreAPI/QiscusCoreAPI.debug.xcconfig b/Examples/cocoapods/Pods/Target Support Files/QiscusCoreAPI/QiscusCoreAPI.debug.xcconfig deleted file mode 100644 index 7caecaa..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/QiscusCoreAPI/QiscusCoreAPI.debug.xcconfig +++ /dev/null @@ -1,11 +0,0 @@ -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/QiscusCoreAPI -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_LDFLAGS = $(inherited) -framework "CFNetwork" -framework "CoreData" -framework "Foundation" -framework "MobileCoreServices" -framework "QuartzCore" -framework "Security" -framework "UIKit" -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/QiscusCoreAPI -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Examples/cocoapods/Pods/Target Support Files/QiscusCoreAPI/QiscusCoreAPI.release.xcconfig b/Examples/cocoapods/Pods/Target Support Files/QiscusCoreAPI/QiscusCoreAPI.release.xcconfig deleted file mode 100644 index 7caecaa..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/QiscusCoreAPI/QiscusCoreAPI.release.xcconfig +++ /dev/null @@ -1,11 +0,0 @@ -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/QiscusCoreAPI -FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON" -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_LDFLAGS = $(inherited) -framework "CFNetwork" -framework "CoreData" -framework "Foundation" -framework "MobileCoreServices" -framework "QuartzCore" -framework "Security" -framework "UIKit" -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/QiscusCoreAPI -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-Info.plist b/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-Info.plist deleted file mode 100644 index e2771ff..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-Info.plist +++ /dev/null @@ -1,26 +0,0 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - ${PRODUCT_BUNDLE_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - FMWK - CFBundleShortVersionString - 5.0.0 - CFBundleSignature - ???? - CFBundleVersion - ${CURRENT_PROJECT_VERSION} - NSPrincipalClass - - - diff --git a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-dummy.m b/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-dummy.m deleted file mode 100644 index 3159bec..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-dummy.m +++ /dev/null @@ -1,5 +0,0 @@ -#import -@interface PodsDummy_SwiftyJSON : NSObject -@end -@implementation PodsDummy_SwiftyJSON -@end diff --git a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch b/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch deleted file mode 100644 index beb2a24..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-prefix.pch +++ /dev/null @@ -1,12 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - diff --git a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-umbrella.h b/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-umbrella.h deleted file mode 100644 index b627dec..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON-umbrella.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef __OBJC__ -#import -#else -#ifndef FOUNDATION_EXPORT -#if defined(__cplusplus) -#define FOUNDATION_EXPORT extern "C" -#else -#define FOUNDATION_EXPORT extern -#endif -#endif -#endif - - -FOUNDATION_EXPORT double SwiftyJSONVersionNumber; -FOUNDATION_EXPORT const unsigned char SwiftyJSONVersionString[]; - diff --git a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.debug.xcconfig b/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.debug.xcconfig deleted file mode 100644 index 145ab25..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.debug.xcconfig +++ /dev/null @@ -1,10 +0,0 @@ -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftyJSON -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.modulemap b/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.modulemap deleted file mode 100644 index 6f41751..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.modulemap +++ /dev/null @@ -1,6 +0,0 @@ -framework module SwiftyJSON { - umbrella header "SwiftyJSON-umbrella.h" - - export * - module * { export * } -} diff --git a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.release.xcconfig b/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.release.xcconfig deleted file mode 100644 index 145ab25..0000000 --- a/Examples/cocoapods/Pods/Target Support Files/SwiftyJSON/SwiftyJSON.release.xcconfig +++ /dev/null @@ -1,10 +0,0 @@ -CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SwiftyJSON -GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 -OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS -PODS_BUILD_DIR = ${BUILD_DIR} -PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) -PODS_ROOT = ${SRCROOT} -PODS_TARGET_SRCROOT = ${PODS_ROOT}/SwiftyJSON -PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} -SKIP_INSTALL = YES -USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES diff --git a/Examples/cocoapods/cocoapods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/xcschememanagement.plist b/Examples/cocoapods/cocoapods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 4a89dca..0000000 --- a/Examples/cocoapods/cocoapods.xcodeproj/xcuserdata/asharijuang.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,14 +0,0 @@ - - - - - SchemeUserState - - cocoapods.xcscheme_^#shared#^_ - - orderHint - 0 - - - - diff --git a/QiscusCoreAPI.podspec b/QiscusCoreAPI.podspec index af902cd..190d255 100644 --- a/QiscusCoreAPI.podspec +++ b/QiscusCoreAPI.podspec @@ -11,5 +11,6 @@ s.platform = :ios, "10.0" s.source_files = "QiscusCoreAPI", "Source/QiscusCoreAPI/**/*.{h,m,swift}" s.ios.frameworks = ["UIKit", "QuartzCore", "CFNetwork", "Security", "Foundation", "CoreServices", "CoreData"] s.dependency 'SwiftyJSON' +s.dependency 'QiscusRealtime' end diff --git a/QiscusCoreAPI.xcodeproj/project.pbxproj b/QiscusCoreAPI.xcodeproj/project.pbxproj index 1ff48c7..ee71b0a 100644 --- a/QiscusCoreAPI.xcodeproj/project.pbxproj +++ b/QiscusCoreAPI.xcodeproj/project.pbxproj @@ -7,6 +7,11 @@ objects = { /* Begin PBXBuildFile section */ + 112CCBEF24BCB91000DB1D09 /* RealtimeManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 112CCBEE24BCB91000DB1D09 /* RealtimeManager.swift */; }; + 112CCBF424BCBAC900DB1D09 /* QiscusRealtime.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 112CCBF024BCBAC900DB1D09 /* QiscusRealtime.framework */; }; + 112CCBF524BCBAC900DB1D09 /* CocoaAsyncSocket.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 112CCBF124BCBAC900DB1D09 /* CocoaAsyncSocket.framework */; }; + 112CCBF624BCBAC900DB1D09 /* CocoaMQTT.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 112CCBF224BCBAC900DB1D09 /* CocoaMQTT.framework */; }; + 112CCBF724BCBAC900DB1D09 /* Starscream.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 112CCBF324BCBAC900DB1D09 /* Starscream.framework */; }; 11449A6F249DD16C00E32D9F /* QiscusCoreAPI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 11449A65249DD16B00E32D9F /* QiscusCoreAPI.framework */; }; 11449A74249DD16C00E32D9F /* QiscusCoreAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11449A73249DD16C00E32D9F /* QiscusCoreAPITests.swift */; }; 11449A76249DD16C00E32D9F /* QiscusCoreAPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 11449A68249DD16B00E32D9F /* QiscusCoreAPI.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -54,6 +59,11 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 112CCBEE24BCB91000DB1D09 /* RealtimeManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RealtimeManager.swift; sourceTree = ""; }; + 112CCBF024BCBAC900DB1D09 /* QiscusRealtime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QiscusRealtime.framework; path = Carthage/Build/iOS/QiscusRealtime.framework; sourceTree = ""; }; + 112CCBF124BCBAC900DB1D09 /* CocoaAsyncSocket.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CocoaAsyncSocket.framework; path = Carthage/Build/iOS/CocoaAsyncSocket.framework; sourceTree = ""; }; + 112CCBF224BCBAC900DB1D09 /* CocoaMQTT.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CocoaMQTT.framework; path = Carthage/Build/iOS/CocoaMQTT.framework; sourceTree = ""; }; + 112CCBF324BCBAC900DB1D09 /* Starscream.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Starscream.framework; path = Carthage/Build/iOS/Starscream.framework; sourceTree = ""; }; 11449A65249DD16B00E32D9F /* QiscusCoreAPI.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = QiscusCoreAPI.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 11449A68249DD16B00E32D9F /* QiscusCoreAPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = QiscusCoreAPI.h; sourceTree = ""; }; 11449A69249DD16B00E32D9F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -100,6 +110,10 @@ buildActionMask = 2147483647; files = ( 11449AD0249DD1D500E32D9F /* SwiftyJSON.framework in Frameworks */, + 112CCBF424BCBAC900DB1D09 /* QiscusRealtime.framework in Frameworks */, + 112CCBF524BCBAC900DB1D09 /* CocoaAsyncSocket.framework in Frameworks */, + 112CCBF624BCBAC900DB1D09 /* CocoaMQTT.framework in Frameworks */, + 112CCBF724BCBAC900DB1D09 /* Starscream.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -114,6 +128,14 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 112CCBED24BCB91000DB1D09 /* Realtime */ = { + isa = PBXGroup; + children = ( + 112CCBEE24BCB91000DB1D09 /* RealtimeManager.swift */, + ); + path = Realtime; + sourceTree = ""; + }; 11449A5B249DD16B00E32D9F = { isa = PBXGroup; children = ( @@ -165,6 +187,7 @@ children = ( 11449A81249DD1B900E32D9F /* ConfigManager.swift */, 11449A82249DD1B900E32D9F /* QiscusCore.swift */, + 112CCBED24BCB91000DB1D09 /* Realtime */, 11449A83249DD1B900E32D9F /* Network */, 11449A92249DD1B900E32D9F /* Protocol */, 11449A96249DD1B900E32D9F /* Extentions */, @@ -289,6 +312,10 @@ 11449ACE249DD1D500E32D9F /* Frameworks */ = { isa = PBXGroup; children = ( + 112CCBF124BCBAC900DB1D09 /* CocoaAsyncSocket.framework */, + 112CCBF224BCBAC900DB1D09 /* CocoaMQTT.framework */, + 112CCBF024BCBAC900DB1D09 /* QiscusRealtime.framework */, + 112CCBF324BCBAC900DB1D09 /* Starscream.framework */, 11449ACF249DD1D500E32D9F /* SwiftyJSON.framework */, ); name = Frameworks; @@ -431,6 +458,7 @@ 11449AC2249DD1B900E32D9F /* QiscusConfig.swift in Sources */, 11449AB1249DD1B900E32D9F /* NetworkRoom.swift in Sources */, 11449AB5249DD1B900E32D9F /* HTTPUtil.swift in Sources */, + 112CCBEF24BCB91000DB1D09 /* RealtimeManager.swift in Sources */, 11449ABE249DD1B900E32D9F /* Data.swift in Sources */, 11449ABF249DD1B900E32D9F /* UIDeviceInfo.swift in Sources */, ); diff --git a/QiscusCoreAPI.xcworkspace/xcuserdata/asharijuang.xcuserdatad/UserInterfaceState.xcuserstate b/QiscusCoreAPI.xcworkspace/xcuserdata/asharijuang.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index ba22612..0000000 Binary files a/QiscusCoreAPI.xcworkspace/xcuserdata/asharijuang.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/QiscusCoreAPI.xcworkspace/xcuserdata/rahardyan.xcuserdatad/UserInterfaceState.xcuserstate b/QiscusCoreAPI.xcworkspace/xcuserdata/rahardyan.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 1b5f171..0000000 Binary files a/QiscusCoreAPI.xcworkspace/xcuserdata/rahardyan.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/Source/QiscusCoreApi/QiscusCore.swift b/Source/QiscusCoreApi/QiscusCore.swift index 019064b..0236f89 100644 --- a/Source/QiscusCoreApi/QiscusCore.swift +++ b/Source/QiscusCoreApi/QiscusCore.swift @@ -7,6 +7,7 @@ // import Foundation +import QiscusRealtime let VERSION_NUMBER = "0.2.1" @@ -33,6 +34,8 @@ public class QiscusCoreAPI { return self.userProfile != nil } + internal let realtimeManager: RealtimeManager = RealtimeManager.shared + /// Can't set to nil public private(set) var userProfile : UserModel? { set { @@ -50,12 +53,16 @@ public class QiscusCoreAPI { public init(withAppId id: String, server: QiscusServer? = nil) { let defaultURL = URL(string: "https://api.qiscus.com")! self.network = NetworkManager(core: self) - + realtimeManager.setup(appName: id) let defaultServer = QiscusServer(url: defaultURL, realtimeURL: "", realtimePort: 80) self.config = QiscusConfig(appId: id, server: defaultServer) if let _server = server { self.config.server = _server } + + if let user = self.userProfile { + self.realtimeManager.connect(username: user.username, password: user.token) + } } } @@ -76,9 +83,13 @@ extension QiscusCoreAPI : CoreCommand { /// - onSuccess: success login /// - onError: error login public func setUserWithIdentityToken(token: String, onSuccess: @escaping (UserModel) -> Void, onError: @escaping (QError) -> Void) { - network.login(identityToken: token, onSuccess: { (user) in + network.login(identityToken: token, onSuccess: { [weak self] (user) in + guard let self = self else { + return + } // save user profile self.userProfile = user + self.realtimeManager.connect(username: user.username, password: user.token) // return success onSuccess(user) }, onError: onError) diff --git a/Source/QiscusCoreApi/Realtime/RealtimeManager.swift b/Source/QiscusCoreApi/Realtime/RealtimeManager.swift new file mode 100644 index 0000000..4ff9e02 --- /dev/null +++ b/Source/QiscusCoreApi/Realtime/RealtimeManager.swift @@ -0,0 +1,390 @@ + // +// RealtimeManager.swift +// QiscusCore +// +// Created by Qiscus on 09/08/18. +// + +import Foundation +import QiscusRealtime + +typealias _roomEvent = (RoomEvent) -> Void +typealias _roomTyping = (RoomTyping) -> Void + +public class RealtimeManager { + static var shared : RealtimeManager = RealtimeManager() + private var client : QiscusRealtime? = nil + private var pendingSubscribeTopic : [RealtimeSubscribeEndpoint] = [RealtimeSubscribeEndpoint]() + var state : QiscusRealtimeConnectionState = QiscusRealtimeConnectionState.disconnected + private var roomEvents : [String : _roomEvent] = [String : _roomEvent]() + + private var roomTypings : [String : _roomTyping] = [String : _roomTyping]() + func setup(appName: String) { + // make sure realtime client still single object + // if client != nil { return } + let bundle = Bundle.main.infoDictionary![kCFBundleNameKey as String] as! String + var deviceID = "00000000" + if let vendorIdentifier = UIDevice.current.identifierForVendor { + deviceID = vendorIdentifier.uuidString + } + let clientID = "iosMQTT-\(bundle)-\(deviceID)" + let config = QiscusRealtimeConfig(appName: appName, clientID: clientID, host: "realtime-jogja.qiscus.com", port: 1885) + client = QiscusRealtime.init(withConfig: config) + } + + func disconnect() { + guard let c = client else { + return + } + c.disconnect() + self.pendingSubscribeTopic.removeAll() + } + + func connect(username: String, password: String) { + guard let c = client else { + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + self.connect(username: username, password: password) + return + } + return + } + self.pendingSubscribeTopic.append(.comment(token: password)) + self.pendingSubscribeTopic.append(.notification(token: password)) + + c.connect(username: username, password: password, delegate: self) + + } + + /// Subscribe comment(deliverd and read), typing by member in the room, and online status + /// + /// - Parameter rooms: array of rooms + // MARK: TODO optimize, check already subscribe? + func subscribeRooms(rooms: [RoomModel]) { + guard let c = client else { + return + } + for room in rooms { + + // subscribe comment deliverd receipt + if !c.subscribe(endpoint: .delivery(roomID: room.id)){ + self.pendingSubscribeTopic.append(.delivery(roomID: room.id)) + QiscusLogger.errorPrint("failed to subscribe event deliver event from room \(room.name), then queue in pending") + } + // subscribe comment read + if !c.subscribe(endpoint: .read(roomID: room.id)) { + self.pendingSubscribeTopic.append(.read(roomID: room.id)) + QiscusLogger.errorPrint("failed to subscribe event read from room \(room.name), then queue in pending") + } + if !c.subscribe(endpoint: .typing(roomID: room.id)) { + self.pendingSubscribeTopic.append(.typing(roomID: room.id)) + QiscusLogger.errorPrint("failed to subscribe event typing from room \(room.name), then queue in pending") + } + guard let participants = room.participants else { return } + for u in participants { + if !c.subscribe(endpoint: .onlineStatus(user: u.email)) { + self.pendingSubscribeTopic.append(.onlineStatus(user: u.email)) + QiscusLogger.errorPrint("failed to subscribe online status user \(u.email), then queue in pending") + } + } + + + + } + + self.resumePendingSubscribeTopic() + } + + /// subscribe user online presence / online status + /// + /// - Parameter userId: userId + func subscribeUserOnlinePresence(userId : String){ + guard let c = client else { + return + } + + if !c.subscribe(endpoint: .onlineStatus(user: userId)) { + self.pendingSubscribeTopic.append(.onlineStatus(user: userId)) + QiscusLogger.errorPrint("failed to subscribe online status user \(userId), then queue in pending") + } + } + + /// subscribe user online presence / online status + /// + /// - Parameter userIds: array of userIds + func subscribeUserOnlinePresence(userIds : [String]){ + guard let c = client else { + return + } + + for userId in userIds { + if !c.subscribe(endpoint: .onlineStatus(user: userId)) { + self.pendingSubscribeTopic.append(.onlineStatus(user: userId)) + QiscusLogger.errorPrint("failed to subscribe online status user \(userId), then queue in pending") + } + } + } + + func unsubscribeUserOnlinePresence(userId : String){ + guard let c = client else { + return + } + + c.unsubscribe(endpoint: .onlineStatus(user: userId)) + } + + func unsubscribeUserOnlinePresence(userIds : [String]){ + guard let c = client else { + return + } + + for userId in userIds { + c.unsubscribe(endpoint: .onlineStatus(user: userId)) + } + } + + /// Subscribe comment(deliverd and read), typing by member in the room, and online status + /// + /// - Parameter rooms: array of rooms + // MARK: TODO optimize, check already subscribe? + func subscribeRoomsWithoutOnlineStatus(rooms: [RoomModel]) { + guard let c = client else { + return + } + for room in rooms { + + // subscribe comment deliverd receipt + if !c.subscribe(endpoint: .delivery(roomID: room.id)){ + self.pendingSubscribeTopic.append(.delivery(roomID: room.id)) + QiscusLogger.errorPrint("failed to subscribe event deliver event from room \(room.name), then queue in pending") + } + // subscribe comment read + if !c.subscribe(endpoint: .read(roomID: room.id)) { + self.pendingSubscribeTopic.append(.read(roomID: room.id)) + QiscusLogger.errorPrint("failed to subscribe event read from room \(room.name), then queue in pending") + } + if !c.subscribe(endpoint: .typing(roomID: room.id)) { + self.pendingSubscribeTopic.append(.typing(roomID: room.id)) + QiscusLogger.errorPrint("failed to subscribe event typing from room \(room.name), then queue in pending") + } + + } + + self.resumePendingSubscribeTopic() + } + + func unsubscribeRooms(rooms: [RoomModel]) { + guard let c = client else { + return + } + + for room in rooms { + + // unsubcribe room event + c.unsubscribe(endpoint: .delivery(roomID: room.id)) + c.unsubscribe(endpoint: .read(roomID: room.id)) + c.unsubscribe(endpoint: .typing(roomID: room.id)) + guard let participants = room.participants else { return } + for u in participants { + c.unsubscribe(endpoint: .onlineStatus(user: u.email)) + } + + } + + } + + func unsubscribeRoomsWithoutOnlineStatus(rooms: [RoomModel]) { + guard let c = client else { + return + } + + for room in rooms { + + // unsubcribe room event + c.unsubscribe(endpoint: .delivery(roomID: room.id)) + c.unsubscribe(endpoint: .read(roomID: room.id)) + c.unsubscribe(endpoint: .typing(roomID: room.id)) + + + } + + } + + + func isTyping(_ value: Bool, roomID: String){ + guard let c = client else { + return + } + if !c.publish(endpoint: .isTyping(value: value, roomID: roomID)) { + QiscusLogger.errorPrint("failed to send typing to roomID \(roomID)") + } + } + + func isOnline(_ value: Bool) { + guard let c = client else { + return + } + if !c.publish(endpoint: .onlineStatus(value: value)) { + QiscusLogger.errorPrint("failed to send Online status") + } + } + + func resumePendingSubscribeTopic() { + guard let client = client else { + return + } + QiscusLogger.debugPrint("Resume pending subscribe") + // resume pending subscribe + if !pendingSubscribeTopic.isEmpty { + for (i,t) in pendingSubscribeTopic.enumerated().reversed() { + // check if success subscribe + if client.subscribe(endpoint: t) { + // remove from pending list + self.pendingSubscribeTopic.remove(at: i) + } + } + } + + QiscusLogger.debugPrint("pendingSubscribeTopic count = \(pendingSubscribeTopic.count)") + } + + // MARK : Typing event + func subscribeTyping(roomID: String, onTyping: @escaping (RoomTyping) -> Void) { + guard let c = client else { return } + + if c.isConnect{ + if !c.subscribe(endpoint: .typing(roomID: roomID)) { + self.pendingSubscribeTopic.append(.typing(roomID: roomID)) + QiscusLogger.errorPrint("failed to subscribe event typing from room \(roomID), then queue in pending") + }else{ + self.roomTypings[roomID] = onTyping + } + }else{ + DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) { + self.subscribeTyping(roomID: roomID) { (roomTyping) in + self.roomTypings[roomID] = onTyping + } + } + + } + } + + func unsubscribeTyping(roomID: String) { + roomTypings.removeValue(forKey: roomID) + guard let c = client else { + return + } + // unsubcribe room event + c.unsubscribe(endpoint: .typing(roomID: roomID)) + } + + // MARK : Custom Event + func subscribeEvent(roomID: String, onEvent: @escaping (RoomEvent) -> Void) { + guard let c = client else { + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { + self.subscribeEvent(roomID: roomID, onEvent: onEvent) + return + } + return + } + + if c.isConnect{ + // subcribe user token to get new comment + if !c.subscribe(endpoint: .roomEvent(roomID: roomID)) { + self.pendingSubscribeTopic.append(.roomEvent(roomID: roomID)) + QiscusLogger.errorPrint("failed to subscribe room Event, then queue in pending") + }else { + self.roomEvents[roomID] = onEvent + } + }else{ + DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) { + self.subscribeEvent(roomID: roomID, onEvent: { (roomEvent) in + self.roomEvents[roomID] = onEvent + }) + } + } + } + + func unsubscribeEvent(roomID: String) { + DispatchQueue.main.asyncAfter(deadline: .now() + 3) { + if self.roomEvents.count == 0 { + return + } + + guard let c = self.client else { + return + } + + if self.roomEvents.removeValue(forKey: roomID) != nil{ + // unsubcribe room event + c.unsubscribe(endpoint: .roomEvent(roomID: roomID)) + } + } + } + + // util + func toDictionary(text : String) -> [String: Any]? { + if let data = text.data(using: .utf8) { + do { + return try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] + } catch { + print("error parsing \(error.localizedDescription)") + } + } + return nil + } +} + + extension RealtimeManager: QiscusRealtimeDelegate { + public func didReceiveRoomEvent(roomID: String, data: String) { + guard let payload = toDictionary(text: data) else { return } + guard let postEvent = roomEvents[roomID] else { return } + let event = RoomEvent(sender: payload["sender"] as? String ?? "", data: payload["data"] as? [String : Any] ?? ["":""]) + postEvent(event) + } + + public func didReceiveUser(userEmail: String, isOnline: Bool, timestamp: String) { + // TODO: Pass this online status event to client app + } + + public func didReceiveMessageStatus(roomId: String, commentId: String, commentUniqueId: String, Status: MessageStatus, userEmail: String) { + self.updateMessageStatus(roomId: roomId, commentId: commentId, commentUniqueId: commentUniqueId, Status: Status, userEmail: userEmail, sourceMqtt: true) + } + + func updateMessageStatus(roomId: String, commentId: String, commentUniqueId: String, Status: MessageStatus, userEmail: String, sourceMqtt: Bool = true) { + switch Status { + case .deleted: + // TODO: pass this delete event to client + break + case .delivered: + // TODO: pass this deliver event to client + break + case .read: + // TODO: pass this read event to client + break + } + } + + public func didReceiveMessage(data: String) { + let json = ApiResponse.decode(string: data) + let comment = CommentModel(json: json) + + + } + + public func didReceiveUser(typing: Bool, roomId: String, userEmail: String) { + // TODO: pass this typing status event to client app + + } + + public func connectionState(change state: QiscusRealtimeConnectionState) { + print("::connection state \(state)") + // TODO: handle connection state later + } + + + public func disconnect(withError err: Error?){ + print("::disconnected \(err)") + // TODO: handle disconnect event later + } + +}