Skip to content
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
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DEPENDENCIES:
- SAMKeychain

SPEC REPOS:
trunk:
https://github.com/cocoapods/specs.git:
- DVR
- SAMKeychain

Expand All @@ -17,4 +17,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 02c21c317ba9be4fdecdfff242f3fa20e9b269bd

COCOAPODS: 1.8.3
COCOAPODS: 1.6.1
122 changes: 70 additions & 52 deletions fakestagram.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion fakestagram/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func loadOrCreateAccount() {
if Credentials.apiToken.get() != nil { return }
let account = Account(id: nil, name: "Juan Camaney", deviceNumber: UIDevice.identifier, deviceModel: UIDevice.modelName)
let account = Account(id: nil, name: "Jules LeGrand", deviceNumber: UIDevice.identifier, deviceModel: UIDevice.modelName)
let client = RestClient<Account>(client: Client.fakestagram, basePath: "/api/v1/accounts")
client.create(account) { account in
guard let account = account, let idx = account.id else { return }
Expand Down
2 changes: 1 addition & 1 deletion fakestagram/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<key>NSCameraUsageDescription</key>
<string>To capture your favorite moments and share with the world</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Geololcalize your moments</string>
<string>Geolocalize your moments</string>
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
Expand Down
30 changes: 30 additions & 0 deletions fakestagram/Services/LikeService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// LikeService.swift
// fakestagram
//
// Created by Ago Moviles on 1/17/20.
// Copyright © 2020 3zcurdia. All rights reserved.
//

import Foundation

struct CreatingLike: Codable {
let id: Int?
}

class LikeService {

func call(id: Int?, success: @escaping (Int?) -> Void) {

let newLike = CreatingLike(id:id)
let client = RestClient<CreatingLike>(client: Client.fakestagram, basePath: "/api/v1/posts/ \(newLike.id!)/like")

debugPrint("In Like Service, id: \(newLike.id!)")

client.create(newLike) { post in
NotificationCenter.default.post(name: NotificationKeys.didFinishPostCreation.value, object: nil)
success(post?.id)
}
}

}
11 changes: 11 additions & 0 deletions fakestagram/Views/PostCollectionViewCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,16 @@ class PostCollectionViewCell: UICollectionViewCell {
self.imageView.image = img
}
}

@IBAction func tapLikeBtn(sender: UIButton) {
debugPrint("Picaste!!!")
let service = LikeService()
guard let post = self.post else {
return
}
service.call(id: post.id!) { postId in
debugPrint(postId ?? -2)
}
}

}
8 changes: 5 additions & 3 deletions fakestagram/Views/PostCollectionViewCell.xib
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.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
Expand Down Expand Up @@ -36,6 +36,9 @@
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ata-8B-MoQ">
<rect key="frame" x="0.0" y="0.0" width="20.5" height="22"/>
<state key="normal" image="heart" catalog="system"/>
<connections>
<action selector="tapLikeBtnWithSender:" destination="gTV-IL-0wX" eventType="touchUpInside" id="QQF-w7-owR"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="8XJ-Ma-oEM">
<rect key="frame" x="23.5" y="0.0" width="22.5" height="22"/>
Expand Down Expand Up @@ -77,7 +80,6 @@
<outlet property="authorView" destination="fc1-xe-uQk" id="iwP-4C-eqh"/>
<outlet property="commentBttn" destination="8XJ-Ma-oEM" id="lba-fp-hiW"/>
<outlet property="imageView" destination="bfs-US-mwI" id="OXS-jJ-xCG"/>
<outlet property="likeBttn" destination="ata-8B-MoQ" id="165-uC-Gpr"/>
<outlet property="likeCounter" destination="WUZ-ZG-6VV" id="VMH-v3-2ul"/>
<outlet property="titleLabel" destination="OPw-zA-9Ik" id="IiN-Q2-eL4"/>
</connections>
Expand Down