Skip to content
This repository was archived by the owner on Sep 8, 2022. It is now read-only.
Open
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
20 changes: 20 additions & 0 deletions Secretly.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@
E021985023FA35E20025C28E /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E021984F23FA35E20025C28E /* Assets.xcassets */; };
E021985323FA35E20025C28E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E021985123FA35E20025C28E /* LaunchScreen.storyboard */; };
E021985E23FA35E20025C28E /* SecretlyTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E021985D23FA35E20025C28E /* SecretlyTests.swift */; };
F17F4C76268650A60070BB2A /* LikeService.swift in Sources */ = {isa = PBXBuildFile; fileRef = F17F4C75268650A60070BB2A /* LikeService.swift */; };
F17F4C7A2686521C0070BB2A /* Like.swift in Sources */ = {isa = PBXBuildFile; fileRef = F17F4C792686521C0070BB2A /* Like.swift */; };
F17F4C7E268654160070BB2A /* Author.swift in Sources */ = {isa = PBXBuildFile; fileRef = F17F4C7D268654160070BB2A /* Author.swift */; };
F1A9B26E269EA0FB001BD470 /* UserProfileService.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1A9B26D269EA0FB001BD470 /* UserProfileService.swift */; };
F1A9B272269EA50D001BD470 /* UserProfileViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F1A9B271269EA50D001BD470 /* UserProfileViewController.swift */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -136,6 +141,11 @@
E021985923FA35E20025C28E /* SecretlyTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SecretlyTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
E021985D23FA35E20025C28E /* SecretlyTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecretlyTests.swift; sourceTree = "<group>"; };
E021985F23FA35E20025C28E /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
F17F4C75268650A60070BB2A /* LikeService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LikeService.swift; sourceTree = "<group>"; };
F17F4C792686521C0070BB2A /* Like.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Like.swift; sourceTree = "<group>"; };
F17F4C7D268654160070BB2A /* Author.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Author.swift; sourceTree = "<group>"; };
F1A9B26D269EA0FB001BD470 /* UserProfileService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileService.swift; sourceTree = "<group>"; };
F1A9B271269EA50D001BD470 /* UserProfileViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserProfileViewController.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -179,6 +189,7 @@
302BB621267E38E800FD74F5 /* PostInputViewController+UIImagePickerControllerDelegate.swift */,
302BB623267E3A8700FD74F5 /* PostInputViewController+UIColorPickerViewControllerDelegate.swift */,
302BB625267E447900FD74F5 /* PostInputViewController+UITextFieldDelegate.swift */,
F1A9B271269EA50D001BD470 /* UserProfileViewController.swift */,
);
path = ViewControllers;
sourceTree = "<group>";
Expand Down Expand Up @@ -222,6 +233,8 @@
30C77CAF266AD69700A888DC /* CurrentUserService.swift */,
304E06C726742BDA00A99128 /* CreatePostService.swift */,
304E06C926742CC500A99128 /* FeedService.swift */,
F17F4C75268650A60070BB2A /* LikeService.swift */,
F1A9B26D269EA0FB001BD470 /* UserProfileService.swift */,
);
path = Services;
sourceTree = "<group>";
Expand All @@ -248,6 +261,8 @@
307A30572661AD540020DF8B /* User.swift */,
30C77CB3266AF47300A888DC /* Credentials.swift */,
30C77CB5266AF48300A888DC /* CurrentUser.swift */,
F17F4C792686521C0070BB2A /* Like.swift */,
F17F4C7D268654160070BB2A /* Author.swift */,
);
path = Models;
sourceTree = "<group>";
Expand Down Expand Up @@ -437,12 +452,14 @@
307A30622661E8A90020DF8B /* UIColor+Hex.swift in Sources */,
307A30542661ABD60020DF8B /* Post.swift in Sources */,
304E06C626741A5100A99128 /* UIColor+theme.swift in Sources */,
F17F4C76268650A60070BB2A /* LikeService.swift in Sources */,
304E06C826742BDA00A99128 /* CreatePostService.swift in Sources */,
E021984723FA35E00025C28E /* AppDelegate.swift in Sources */,
30337955267536980066D94A /* PostInputViewController+CLLocationManagerDelegate.swift in Sources */,
307A30562661AD480020DF8B /* Image.swift in Sources */,
307A30582661AD540020DF8B /* User.swift in Sources */,
302B5849267E658E007133E6 /* RequestError.swift in Sources */,
F17F4C7E268654160070BB2A /* Author.swift in Sources */,
302B5846267E658E007133E6 /* AmacaConfig.swift in Sources */,
302BB61C267D7CC800FD74F5 /* PreviewPostVIew.swift in Sources */,
3033795D267537B40066D94A /* FeedCollectionViewController+UICollectionViewDelegateFlowLayout .swift in Sources */,
Expand All @@ -458,15 +475,18 @@
30BC8BA62662C02300F7E6A5 /* CacheImage.swift in Sources */,
302B5847267E658E007133E6 /* StatusCode.swift in Sources */,
302B584B267E658E007133E6 /* RequestBuilder.swift in Sources */,
F1A9B26E269EA0FB001BD470 /* UserProfileService.swift in Sources */,
307A306526629B990020DF8B /* AuthorView.swift in Sources */,
30C77CB4266AF47300A888DC /* Credentials.swift in Sources */,
30BC8BA22662BB0000F7E6A5 /* DataContainer.swift in Sources */,
E021984923FA35E00025C28E /* SceneDelegate.swift in Sources */,
30C77CB0266AD69700A888DC /* CurrentUserService.swift in Sources */,
30C77CB6266AF48300A888DC /* CurrentUser.swift in Sources */,
F1A9B272269EA50D001BD470 /* UserProfileViewController.swift in Sources */,
302BB624267E3A8700FD74F5 /* PostInputViewController+UIColorPickerViewControllerDelegate.swift in Sources */,
304E06CF267468DA00A99128 /* UIColor+Pastel.swift in Sources */,
304E06C42674133D00A99128 /* String+isBlank.swift in Sources */,
F17F4C7A2686521C0070BB2A /* Like.swift in Sources */,
30BC8BA42662BDEF00F7E6A5 /* ImageStore.swift in Sources */,
3033795B267537490066D94A /* FeedCollectionViewController+UICollectionViewDataSourcePrefetching.swift in Sources */,
30B9B93B268CA9E6007B1942 /* UIImage+PixelBuffer.swift in Sources */,
Expand Down
6 changes: 3 additions & 3 deletions Secretly/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
StorageType.cache.ensureExists()
StorageType.permanent.ensureExists()

Expand All @@ -20,13 +20,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

// MARK: UISceneSession Lifecycle

func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
func application(_: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options _: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}

func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
func application(_: UIApplication, didDiscardSceneSessions _: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
Expand Down
21 changes: 21 additions & 0 deletions Secretly/Assets.xcassets/background-green.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "c7804fc1d8c88e040ea41715a77f7b85.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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 Secretly/Assets.xcassets/background.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "a6728fe45010243d0736d9601d316115.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
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 Secretly/Assets.xcassets/user.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "aadb8ffd3640a9b7bf9bf84421ebc763.jpg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 23 additions & 4 deletions Secretly/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="18122" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="18093"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="System colors in document resources" minToolsVersion="11.0"/>
Expand Down Expand Up @@ -56,18 +56,36 @@
<!--Profile-->
<scene sceneID="ttH-kE-4uU">
<objects>
<viewController id="nLm-Ey-ej5" sceneMemberID="viewController">
<viewController id="nLm-Ey-ej5" customClass="UserProfileViewController" customModule="Secretly" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="V90-5c-tV2">
<rect key="frame" x="0.0" y="0.0" width="414" height="842"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="user" translatesAutoresizingMaskIntoConstraints="NO" id="4OZ-Zc-gZH">
<rect key="frame" x="132" y="258" width="150" height="150"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="center" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="UserName" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8fe-wB-857">
<rect key="frame" x="138" y="446" width="138" height="36"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="tintColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" type="system" pointSize="30"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<viewLayoutGuide key="safeArea" id="5bK-am-FFO"/>
<color key="backgroundColor" name="Cadet gray"/>
</view>
<tabBarItem key="tabBarItem" title="Profile" image="person.fill" catalog="system" id="giq-zc-Ami"/>
<connections>
<outlet property="userProfileImage" destination="4OZ-Zc-gZH" id="Cij-mb-jP3"/>
<outlet property="userProfileName" destination="8fe-wB-857" id="S5u-PA-BKj"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="5HW-0M-ikL" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1167" y="879"/>
<point key="canvasLocation" x="1166.6666666666667" y="878.57142857142856"/>
</scene>
<!--Feed-->
<scene sceneID="gKD-R1-dE4">
Expand Down Expand Up @@ -173,6 +191,7 @@
<image name="person.fill" catalog="system" width="128" height="120"/>
<image name="plus" catalog="system" width="128" height="113"/>
<image name="text.bubble.fill" catalog="system" width="128" height="110"/>
<image name="user" width="564" height="564"/>
<namedColor name="Black chocolate">
<color red="0.14499999582767487" green="0.11800000071525574" blue="0.093999996781349182" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
Expand Down
2 changes: 1 addition & 1 deletion Secretly/Credentials.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ enum Credentials {
}
}

func set(value: String) -> Bool {
func set(value _: String) -> Bool {
switch self {
case .userToken:
return true
Expand Down
2 changes: 1 addition & 1 deletion Secretly/Extensions/String+isBlank.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import Foundation

extension String {
var isBlank: Bool {
return self.isEmpty || self.trimmingCharacters(in: .whitespaces) == ""
return isEmpty || trimmingCharacters(in: .whitespaces) == ""
}
}
10 changes: 5 additions & 5 deletions Secretly/Extensions/UIColor+Hex.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ extension UIColor {
var hexNumber: UInt64 = 0

if scanner.scanHexInt64(&hexNumber) {
r = CGFloat((hexNumber & 0xff000000) >> 24) / 255
g = CGFloat((hexNumber & 0x00ff0000) >> 16) / 255
b = CGFloat((hexNumber & 0x0000ff00) >> 8) / 255
a = CGFloat(hexNumber & 0x000000ff) / 255
r = CGFloat((hexNumber & 0xFF00_0000) >> 24) / 255
g = CGFloat((hexNumber & 0x00FF_0000) >> 16) / 255
b = CGFloat((hexNumber & 0x0000_FF00) >> 8) / 255
a = CGFloat(hexNumber & 0x0000_00FF) / 255

self.init(red: r, green: g, blue: b, alpha: a)
return
Expand All @@ -44,7 +44,7 @@ extension UIColor {
var b: CGFloat = 0
var a: CGFloat = 0
getRed(&r, green: &g, blue: &b, alpha: &a)
let rgb: Int = (Int)(r*255)<<16 | (Int)(g*255)<<8 | (Int)(b*255)<<0
let rgb: Int = (Int)(r * 255) << 16 | (Int)(g * 255) << 8 | (Int)(b * 255) << 0
return String(format: "#%06x", rgb)
}
}
2 changes: 1 addition & 1 deletion Secretly/Extensions/UIColor+Pastel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extension UIColor {
var brightness: CGFloat = 0
var alpha: CGFloat = 0

self.getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha)
getHue(&hue, saturation: &saturation, brightness: &brightness, alpha: &alpha)

return UIColor(hue: hue, saturation: CGFloat(0.70), brightness: brightness, alpha: alpha)
}
Expand Down
10 changes: 5 additions & 5 deletions Secretly/Extensions/UIImage+PixelBuffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ import UIKit

extension UIImage {
func resize(to newSize: CGSize) -> UIImage? {
guard self.size != newSize else { return self }
guard size != newSize else { return self }

UIGraphicsBeginImageContextWithOptions(newSize, false, 0.0)
self.draw(in: CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height))
draw(in: CGRect(x: 0, y: 0, width: newSize.width, height: newSize.height))

defer { UIGraphicsEndImageContext() }
return UIGraphicsGetImageFromCurrentImageContext()
}

func pixelBuffer() -> CVPixelBuffer? {
let width = Int(self.size.width)
let height = Int(self.size.height)
let width = Int(size.width)
let height = Int(size.height)

let attrs = [kCVPixelBufferCGImageCompatibilityKey: kCFBooleanTrue, kCVPixelBufferCGBitmapContextCompatibilityKey: kCFBooleanTrue] as CFDictionary
var pixelBuffer: CVPixelBuffer?
Expand All @@ -42,7 +42,7 @@ extension UIImage {
context.scaleBy(x: 1.0, y: -1.0)

UIGraphicsPushContext(context)
self.draw(in: CGRect(x: 0, y: 0, width: width, height: height))
draw(in: CGRect(x: 0, y: 0, width: width, height: height))
UIGraphicsPopContext()
CVPixelBufferUnlockBaseAddress(pixelBuffer!, CVPixelBufferLockFlags(rawValue: 0))

Expand Down
2 changes: 1 addition & 1 deletion Secretly/Extensions/UIImage+encodeBase64.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import UIKit

extension UIImage {
func encodeBase64() -> String? {
guard let data = self.jpegData(compressionQuality: 0.85) else { return nil }
guard let data = jpegData(compressionQuality: 0.85) else { return nil }
return "data:image/jpeg;base64,\(data.base64EncodedString())"
}
}
20 changes: 20 additions & 0 deletions Secretly/Models/Author.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// Author.swift
// Secretly
//
// Created by Yocelin Garcia Romero on 25/06/21.
// Copyright © 2021 3zcurdia. All rights reserved.
//

import Foundation
import UIKit

struct Author: Restable {
let name: String?
let id: String?

init(id: String, name: String) {
self.name = name
self.id = id
}
}
6 changes: 2 additions & 4 deletions Secretly/Models/Credentials.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ struct Credentials: Restable {
let password: String?
let token: String?

var id: String {
get { "" }
}
var id: String { "" }

init(username: String, password: String) {
self.username = username
self.password = password
self.token = nil
token = nil
}

enum CodingKeys: String, CodingKey {
Expand Down
18 changes: 18 additions & 0 deletions Secretly/Models/Like.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Like.swift
// Secretly
//
// Created by Yocelin Garcia Romero on 25/06/21.
// Copyright © 2021 3zcurdia. All rights reserved.
//

import Foundation
import UIKit

struct Like: Restable {
let id: Int
let likeableType: String
let likeableId: Int
let createdAt, updatedAt: String
let user: User
}
Loading