-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #105 from tukcomCD2024/SNOW-70-feat#86/generate-logic
Feat#86/generate logic
- Loading branch information
Showing
26 changed files
with
1,425 additions
and
122 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// Environment.swift | ||
// Memetory | ||
// | ||
// Created by 이승진 on 2024/06/17. | ||
// | ||
|
||
import Foundation | ||
|
||
struct Environment { | ||
static func load() { | ||
guard let envPath = Bundle.main.path(forResource: ".env", ofType: nil) else { | ||
print(".env file not found") | ||
return | ||
} | ||
|
||
// 경로 출력 | ||
print("Env file path: \(envPath)") | ||
|
||
do { | ||
let envContents = try String(contentsOfFile: envPath) | ||
print("Env file contents:\n\(envContents)") | ||
let envLines = envContents.split(separator: "\n") | ||
|
||
for line in envLines { | ||
let keyValue = line.split(separator: "=") | ||
if keyValue.count == 2 { | ||
let key = String(keyValue[0]).trimmingCharacters(in: .whitespaces) | ||
let value = String(keyValue[1]).trimmingCharacters(in: .whitespaces) | ||
setenv(key, value, 1) | ||
} | ||
} | ||
} catch { | ||
print("Failed to read .env file: \(error)") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// S3Configuration.swift | ||
// Memetory | ||
// | ||
// Created by 이승진 on 2024/05/12. | ||
// | ||
|
||
import Foundation | ||
|
||
enum S3Configuration : String | ||
{ | ||
// case IDENTITY_POOL_ID = "Your Identity Pool Id" | ||
case BUCKET_NAME = "memetory" | ||
// case CALLBACK_KEY = "Personality Message" | ||
case CONTENT_TYPE_IMAGE = "image/jpg" | ||
case CONTENT_TYPE_VIDEO = "video/mp4" | ||
case CONTENT_TYPE_TXT = "text/plain" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// | ||
// S3Manager.swift | ||
// Memetory | ||
// | ||
// Created by 이승진 on 2024/06/17. | ||
// | ||
|
||
import UIKit | ||
import AWSS3 | ||
|
||
class S3Manager { | ||
static let shared = S3Manager() | ||
|
||
let S3BucketName = "memetory" | ||
|
||
private init() { | ||
|
||
} | ||
|
||
func uploadImage(image: UIImage, completion: @escaping (String?) -> Void) { | ||
guard let imageData = image.jpegData(compressionQuality: 0.9) else { | ||
print("imgae X") | ||
completion(nil) | ||
return | ||
} | ||
let transferUtility = AWSS3TransferUtility.default() | ||
|
||
let expression = AWSS3TransferUtilityUploadExpression() | ||
expression.setValue("AES256", forRequestHeader: "x-amz-server-side-encryption") | ||
expression.progressBlock = { (task, progress) in | ||
DispatchQueue.main.async { | ||
print("[ Upload progress ]: \(progress.fractionCompleted)") | ||
} | ||
} | ||
|
||
let currentDate = Date() | ||
let dateFormatter = DateFormatter() | ||
dateFormatter.dateFormat = "yyyyMMddhhmmssSSS" | ||
let fileName = dateFormatter.string(from: currentDate) + ".jpg" | ||
|
||
transferUtility.uploadData( | ||
imageData, | ||
bucket: S3BucketName, | ||
key: fileName, | ||
contentType: "image/jpg", | ||
expression: expression | ||
) { (task, error) in | ||
if let error = error { | ||
print("Error uploading image: \(error.localizedDescription)") | ||
completion(nil) | ||
} else { | ||
print("Image uploaded successfully!") | ||
completion(fileName) | ||
} | ||
} | ||
} | ||
|
||
|
||
func uploadFile(data: Data, bucketName: String, key: String, completion: @escaping (Bool, Error?) -> Void) { | ||
let expression = AWSS3TransferUtilityUploadExpression() | ||
let transferUtility = AWSS3TransferUtility.default() | ||
|
||
transferUtility.uploadData(data, bucket: bucketName, key: key, contentType: "text/plain", expression: expression) { task, error in | ||
if let error = error { | ||
print("Upload failed with error: \(error)") | ||
completion(false, error) | ||
} else { | ||
print("Upload successful") | ||
completion(true, nil) | ||
} | ||
} | ||
} | ||
|
||
func downloadFile(bucketName: String, key: String, completion: @escaping (Data?, Error?) -> Void) { | ||
let expression = AWSS3TransferUtilityDownloadExpression() | ||
let transferUtility = AWSS3TransferUtility.default() | ||
|
||
transferUtility.downloadData(fromBucket: bucketName, key: key, expression: expression) { task, url, data, error in | ||
if let error = error { | ||
print("Download failed with error: \(error)") | ||
completion(nil, error) | ||
} else { | ||
print("Download successful") | ||
completion(data, nil) | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
iOS/Memetory/Memetory/Resources/Assets.xcassets/LoadingImage.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "LoadingImage.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+44.1 KB
...etory/Memetory/Resources/Assets.xcassets/LoadingImage.imageset/LoadingImage.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions
21
iOS/Memetory/Memetory/Resources/Assets.xcassets/radio-button-line.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "radio-button-line.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+705 Bytes
...tory/Resources/Assets.xcassets/radio-button-line.imageset/radio-button-line.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
iOS/Memetory/Memetory/View/Meme-generate/Models/PackingItem/Member.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// Member.swift | ||
// Memetory | ||
// | ||
// Created by 이승진 on 2024/05/15. | ||
// | ||
|
||
import Foundation | ||
|
||
struct Member : Codable { | ||
var name : String | ||
var imageUrl : String | ||
} |
Oops, something went wrong.