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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ let package = Package(
.library(
name: "Skyflow",
targets: ["Skyflow"]),
.library(
name: "SkyflowFlowVault",
targets: ["SkyflowFlowVault"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
Expand All @@ -19,29 +22,35 @@ let package = Package(
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "Skyflow",
name: "SkyflowCore",
dependencies: [],
resources: [
.process("Resources")
]
),
.target(
name: "Skyflow",
dependencies: ["SkyflowCore"]),
.target(
name: "SkyflowFlowVault",
dependencies: ["SkyflowCore"]),
.testTarget(
name: "skyflow-iOS-collectTests",
dependencies: ["Skyflow"]),
dependencies: ["Skyflow", "SkyflowCore"]),
.testTarget(name: "skyflow-iOS-revealTests",
dependencies: ["Skyflow"]),
dependencies: ["Skyflow", "SkyflowCore"]),
.testTarget(name: "skyflow-iOS-errorTests",
dependencies: ["Skyflow"]),
dependencies: ["Skyflow", "SkyflowCore"]),
.testTarget(name: "skyflow-iOS-getByIdTests",
dependencies: ["Skyflow"]),
dependencies: ["Skyflow", "SkyflowCore"]),
.testTarget(name: "skyflow-iOS-elementTests",
dependencies: ["Skyflow"]),
dependencies: ["Skyflow", "SkyflowCore"]),
.testTarget(name: "skyflow-iOS-utilTests",
dependencies: ["Skyflow"]),
dependencies: ["Skyflow", "SkyflowCore"]),
.testTarget(name: "skyflow-iOS-scenarioTests",
dependencies: ["Skyflow"]),
dependencies: ["Skyflow", "SkyflowCore"]),
.testTarget(name: "skyflow-iOS-getTests",
dependencies: ["Skyflow"]),
.testTarget(name: "skyflow-iOS-composableTests", dependencies: ["Skyflow"])
dependencies: ["Skyflow", "SkyflowCore"]),
.testTarget(name: "skyflow-iOS-composableTests", dependencies: ["Skyflow", "SkyflowCore"])
]
)
4 changes: 2 additions & 2 deletions Skyflow.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Pod::Spec.new do |spec|

spec.source = { :git => "https://github.com/skyflowapi/skyflow-iOS.git", :tag => "1.25.1" }

spec.source_files = "Sources/Skyflow/**/*.{swift}"
spec.source_files = "Sources/SkyflowCore/**/*.{swift}", "Sources/Skyflow/**/*.{swift}"

spec.resource_bundles = {'Skyflow' => ['Sources/Skyflow/Resources/**/*.{xcassets}'] }
spec.resource_bundles = {'Skyflow' => ['Sources/SkyflowCore/Resources/**/*.{xcassets}'] }

end

31 changes: 31 additions & 0 deletions SkyflowFlowVault.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Pod::Spec.new do |spec|

spec.name = "SkyflowFlowVault"

spec.version = "3.0.0"

spec.summary = "skyflow-iOS-flowvault"

spec.description = "Skyflow iOS SDK for FlowDB-backed vaults"

spec.homepage = "https://github.com/skyflowapi/skyflow-iOS.git"

spec.license = { :type => "MIT", :file => "LICENSE" }

spec.author = { "Skyflow" => "service-ops@skyflow.com" }

spec.swift_version = '5.0'

spec.platform = :ios, "13.0"

spec.ios.deployment_target = "13.0"

# NOTE: this tag does not exist yet - create it (or update this field) when
# the first SkyflowFlowVault release is actually cut.
spec.source = { :git => "https://github.com/skyflowapi/skyflow-iOS.git", :tag => "flowvault-3.0.0" }

spec.source_files = "Sources/SkyflowCore/**/*.{swift}", "Sources/SkyflowFlowVault/**/*.{swift}"

spec.resource_bundles = {'SkyflowFlowVault' => ['Sources/SkyflowCore/Resources/**/*.{xcassets}'] }

end
1 change: 1 addition & 0 deletions Sources/Skyflow/collect/CollectAPICallback.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Callback used while API callback for Collect the elements

import Foundation
import SkyflowCore
import UIKit

internal class CollectAPICallback: Callback {
Expand Down
42 changes: 5 additions & 37 deletions Sources/Skyflow/collect/CollectContainer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
// Implementation of Container Interface for Collect the records

import Foundation
import SkyflowCore
import UIKit

public class CollectContainer: ContainerProtocol {}

public extension Container {
func create(input: CollectElementInput, options: CollectElementOptions? = CollectElementOptions()) -> TextField where T: CollectContainer {
var tempContextOptions = self.skyflow.contextOptions
Expand All @@ -33,30 +32,13 @@ public extension Container {
let errorCode = ErrorCodes.EMPTY_VAULT_URL()
return callback.onFailure(errorCode.getErrorObject(contextOptions: tempContextOptions))
}
var errors = ""
var errorCode: ErrorCodes?
Log.info(message: .VALIDATE_COLLECT_RECORDS, contextOptions: tempContextOptions)

for element in self.elements {
errorCode = checkElement(element: element)
if errorCode != nil {
callback.onFailure(errorCode!.getErrorObject(contextOptions: tempContextOptions))
return
}


let state = element.getState()
let error = state["validationError"]
if (state["isRequired"] as! Bool) && (state["isEmpty"] as! Bool) {
errors += element.columnName + " is empty" + "\n"
element.updateErrorMessage()
}
if !(state["isValid"] as! Bool) {
errors += "for " + element.columnName + " " + (error as! String) + "\n"
}
if element.isFirstResponder {
element.resignFirstResponder()
}
let (elementError, errors) = CollectValidation.validateElements(self.elements)
if let elementError = elementError {
callback.onFailure(elementError.getErrorObject(contextOptions: tempContextOptions))
return
}
if errors != "" {
callback.onFailure(NSError(domain: "", code: 400, userInfo: [NSLocalizedDescriptionKey: errors]))
Expand Down Expand Up @@ -103,20 +85,6 @@ public extension Container {
}
}

private func checkElement(element: TextField) -> ErrorCodes? {
if element.collectInput.table.isEmpty {
return .EMPTY_TABLE_NAME_IN_COLLECT()
}
if element.collectInput.column.isEmpty {
return .EMPTY_COLUMN_NAME_IN_COLLECT()
}
if !element.isMounted() {
return .UNMOUNTED_COLLECT_ELEMENT(value: element.collectInput.column)
}

return nil
}

private func checkRecord(record: [String: Any], index: Int) -> ErrorCodes? {
if record["table"] == nil {
return .TABLE_KEY_ERROR(value: "\(index)")
Expand Down
1 change: 1 addition & 0 deletions Sources/Skyflow/collect/CollectRequestBody.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Class for formatting the request body for collecting the data

import Foundation
import SkyflowCore

internal class CollectRequestBody {
static var tableSet: Set<String> = Set<String>()
Expand Down
1 change: 1 addition & 0 deletions Sources/Skyflow/collect/ICOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//

import Foundation
import SkyflowCore

internal struct ICOptions {
var tokens: Bool
Expand Down
1 change: 1 addition & 0 deletions Sources/Skyflow/collect/InsertAPICallback.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Callback used while API callback for Collect the elements

import Foundation
import SkyflowCore
import UIKit

internal class InsertAPICallback: Callback {
Expand Down
1 change: 1 addition & 0 deletions Sources/Skyflow/collect/InsertOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// Object that describes the Options for Insert

import Foundation
import SkyflowCore

public struct InsertOptions {
var tokens: Bool
Expand Down
1 change: 1 addition & 0 deletions Sources/Skyflow/collect/TokenAPICallback.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
//

import Foundation
import SkyflowCore

internal class TokenAPICallback: Callback {
var callback: Callback
Expand Down
Loading
Loading