5 Commits

Author SHA1 Message Date
Daniel Arantes Loverde
d2ca6e54d2 Improvements 2025-08-15 10:57:14 -03:00
Daniel Arantes Loverde
3e3e181b36 Update Package.swift 2025-07-29 13:46:38 -03:00
Daniel Arantes Loverde
daae48817a LCECripto new methods 2025-07-29 11:59:11 -03:00
Daniel Arantes Loverde
241d69ecc1 LCECryptoKit 2025-07-05 12:34:25 -03:00
Loverde Co - Git
f4fade0442 Merge branch 'feature/documentation' of git/LCEssentials into main 2025-06-23 09:49:56 -03:00
6 changed files with 121 additions and 3203 deletions

File diff suppressed because it is too large Load Diff

15
Package.resolved Normal file
View File

@@ -0,0 +1,15 @@
{
"originHash" : "ef48d023f19d8a2c259992041cec23f906eb03f03bebe9fca0d61ede6bf8de57",
"pins" : [
{
"identity" : "lcecryptokitbinary",
"kind" : "remoteSourceControl",
"location" : "http://7b47f7b439df1048cbf2fae1c46113df178e0349@git.loverde.com.br:3000/git/LCECryptoKitBinary.git",
"state" : {
"revision" : "2e7850fdb14cacf6bf2eb160f64c3df84cf5b1c4",
"version" : "1.1.0"
}
}
],
"version" : 3
}

View File

@@ -1,16 +1,33 @@
// swift-tools-version: 6.0
import PackageDescription
import Foundation
let isLocalDevelopment = FileManager.default.fileExists(atPath: "../LCECryptoKit/PrivateLib/LCECryptoKitBinary")
let package = Package(
name: "LCEssentials",
platforms: [
.iOS(.v13),
.macOS(.v10_15),
.tvOS(.v13),
.watchOS(.v6)
],
products: [
.library(
name: "LCEssentials",
targets: ["LCEssentials"]),
],
dependencies: [
.package(
url: isLocalDevelopment ?
"../LCECryptoKit/PrivateLib/LCECryptoKitBinary" :
"http://7b47f7b439df1048cbf2fae1c46113df178e0349@git.loverde.com.br:3000/git/LCECryptoKitBinary.git",
exact: "1.1.0"
)
],
targets: [
.target(
name: "LCEssentials"),
name: "LCEssentials",
dependencies: [.product(name: "LCECryptoKit", package: "lcecryptokitbinary")]),
]
)

View File

@@ -28,7 +28,36 @@ http://git.loverde.com.br:3000/git/LCEssentials.git
```
## Usage example
[Read full documentation](LCEssentials_DOCUMENTATION.md)
* Background Trhead
```swift
LCEssentials.backgroundThread(delay: 0.6, background: {
//Do something im background
}) {
//When finish, update UI
}
```
* NavigationController with Completion Handler
```swift
self.navigationController?.popViewControllerWithHandler(completion: {
//Do some stuff after pop
})
//or more simple
self.navigationController?.popViewControllerWithHandler {
//Do some stuff after pop
}
```
## Another components
> LCESnackBarView - **great way to send feedback to user**
And then import `LCEssentials ` wherever you import UIKit or SwiftUI
``` swift
import LCEssentials
```
Author:
----

View File

@@ -0,0 +1,41 @@
//
// Copyright (c) 2025 Loverde Co.
//
// 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
import LCECryptoKit
public final class LCECrypto {
private let hashKey: String
init(privateKey: String){
self.hashKey = privateKey
}
func encodeOTP(email: String, password: String) -> String? {
return LCECryptoKit.encodeSeed(email: email, password: password, hashKey: self.hashKey)
}
func decodeOTP(_ otpHash: String) -> Bool {
LCECryptoKit.decodeSeed(otpKey: otpHash, hashKey: self.hashKey)
}
}

View File

@@ -129,15 +129,26 @@ public struct API {
// Add the file
let fileName = fileURL.lastPathComponent
let mimeType = mimeTypeForPath(path: fileName)
printInfo(title: "Body size before", msg: "\(body.count) bytes")
let fileData: Data
do {
fileData = try Data(contentsOf: fileURL)
printInfo(title: "Body size after", msg: "\(body.count) bytes")
} catch {
printError(title: "Upload File", msg: error.localizedDescription)
throw error
}
do {
let fileData = try Data(contentsOf: fileURL)
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"file\"; filename=\"\(fileName)\"\r\n".data(using: .utf8)!)
body.append("Content-Type: \(mimeType)\r\n\r\n".data(using: .utf8)!)
body.append(fileData)
body.append("\r\n".data(using: .utf8)!)
} catch {
printError(title: "Upload File", msg: error.localizedDescription)
let fileDataCopy = Data(fileData)
body.append(fileDataCopy)
let dataUTF8 = "\r\n".data(using: .utf8)!
body.append(dataUTF8)
printInfo(title: "Body size after", msg: "\(body.count) bytes")
}
// Finalize the request body