Skip to content
This repository was archived by the owner on Oct 14, 2018. It is now read-only.

Commit a0b314f

Browse files
authored
Merge pull request #13 from AnderGoig/develop
Version 1.0.6
2 parents 6b543c9 + 0947830 commit a0b314f

File tree

80 files changed

+3480
-3130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+3480
-3130
lines changed

.jazzy.yaml

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,36 @@
11
# Run jazzy from the current directory to generate documentation
22

33
module: SwiftInstagram
4-
module_version: 1.0.5
4+
module_version: 1.0.6
55
author: Ander Goig
6+
author_url: https://github.com/AnderGoig
67
github_url: https://github.com/AnderGoig/SwiftInstagram
78
exclude:
8-
- "Sources/Helpers/KeychainSwiftDistrib.swift"
9-
10-
swift_version: 4.0
9+
- "**/KeychainSwiftDistrib.swift"
1110

1211
clean: true
1312
skip_undocumented: true
1413

1514
theme: fullwidth
16-
output: docs
15+
16+
custom_categories:
17+
- name: API
18+
children:
19+
- Instagram
20+
21+
- name: Authentication
22+
children:
23+
- InstagramScope
24+
25+
- name: Models
26+
children:
27+
- InstagramUser
28+
- InstagramRelationship
29+
- InstagramMedia
30+
- InstagramComment
31+
- InstagramTag
32+
- InstagramLocation
33+
34+
- name: Errors
35+
children:
36+
- InstagramError

.swiftlint.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
disabled_rules:
2-
- line_length
32
- file_length
43
- nesting
54
opt_in_rules:
@@ -34,6 +33,8 @@ excluded:
3433
- Carthage
3534
- Sources/Helpers/KeychainSwiftDistrib.swift
3635

36+
line_length: 160
37+
3738
file_header:
3839
required_pattern: |
3940
\/\/

.travis.yml

Lines changed: 58 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,70 @@
11
language: objective-c
22
osx_image: xcode9
3-
43
git:
54
submodules: false
6-
75
env:
86
global:
9-
- LC_CTYPE=en_US.UTF-8
10-
- LANG=en_US.UTF-8
11-
- WORKSPACE=SwiftInstagram.xcworkspace
12-
- IOS_FRAMEWORK_SCHEME="SwiftInstagram-iOS"
13-
- IOS_SDK=iphonesimulator11.0
7+
- LC_CTYPE=en_US.UTF-8
8+
- LANG=en_US.UTF-8
9+
- WORKSPACE=SwiftInstagram.xcworkspace
10+
- SCHEME="SwiftInstagram-iOS"
11+
- SDK=iphonesimulator11.0
1412
matrix:
15-
- DESTINATION="OS=11.0,name=iPhone 7 Plus" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" RELEASE_READY="NO" POD_LINT="NO"
16-
- DESTINATION="OS=10.3.1,name=iPhone 7" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" RELEASE_READY="NO" POD_LINT="NO"
17-
- DESTINATION="OS=9.0,name=iPhone 6s" SCHEME="$IOS_FRAMEWORK_SCHEME" SDK="$IOS_SDK" RUN_TESTS="YES" RELEASE_READY="NO" POD_LINT="NO"
18-
13+
- TEST_TYPE=iOS
14+
- TEST_TYPE=Lint
15+
- TEST_TYPE=Carthage
16+
- TEST_TYPE=CocoaPods
1917
before_install:
20-
- gem install cocoapods --pre --no-rdoc --no-ri --no-document --quiet
21-
- brew update
22-
- brew outdated carthage || brew upgrade carthage
23-
18+
- |
19+
if [ "$TEST_TYPE" = CocoaPods ]; then
20+
gem install cocoapods --pre --no-rdoc --no-ri --no-document --quiet
21+
fi
22+
if [ "$TEST_TYPE" = Lint ] || [ "$TEST_TYPE" = Carthage ]; then
23+
brew update
24+
fi
25+
if [ "$TEST_TYPE" = Carthage ]; then
26+
brew outdated carthage || brew upgrade carthage
27+
fi
28+
install:
29+
- |
30+
gem update --system --no-document
31+
bundle install
32+
if [ "$TEST_TYPE" = Lint ]; then
33+
brew install swiftlint || brew upgrade swiftlint
34+
elif [ "$TEST_TYPE" = CocoaPods ]; then
35+
pod repo update --silent
36+
fi
2437
before_script:
25-
- sh scripts/bootstrap
26-
38+
- |
39+
if [ "$TEST_TYPE" = Carthage ]; then
40+
carthage update --no-use-binaries --use-submodules
41+
fi
2742
script:
28-
- set -o pipefail
29-
- xcodebuild -version
30-
- xcodebuild -showsdks
31-
32-
# Build Framework in Debug and Run Tests if specified
33-
- if [ $RUN_TESTS == "YES" ]; then
34-
xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -configuration Debug ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty -c;
35-
else
36-
xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -configuration Debug ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
37-
fi
38-
39-
# Build Framework in Release and Run Tests if specified
40-
- if [ $RUN_TESTS == "YES" ]; then
41-
xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -configuration Release ONLY_ACTIVE_ARCH=NO ENABLE_TESTABILITY=YES test | xcpretty -c;
42-
else
43-
xcodebuild -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -destination "$DESTINATION" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO -configuration Release ONLY_ACTIVE_ARCH=NO build | xcpretty -c;
44-
fi
45-
46-
# Run `pod lib lint` if specified
47-
- if [ $POD_LINT == "YES" ]; then
48-
pod lib lint;
49-
fi
50-
43+
- |
44+
if [ "$TEST_TYPE" = iOS ]; then
45+
set -o pipefail
46+
xcodebuild -version
47+
xcodebuild -showsdks
48+
xcodebuild build -workspace "$WORKSPACE" -scheme "$SCHEME" -sdk "$SDK" -configuration Debug -destination "platform=iOS Simulator,name=iPhone 5" -destination "platform=iOS Simulator,name=iPhone 7 Plus" | xcpretty -c
49+
elif [ "$TEST_TYPE" = Lint ]; then
50+
swiftlint lint
51+
elif [ "$TEST_TYPE" = CocoaPods ]; then
52+
pod lib lint
53+
fi
5154
before_deploy:
52-
- carthage build --no-skip-current
53-
- carthage archive SwiftInstagram
54-
55+
- carthage build --no-skip-current
56+
- carthage archive SwiftInstagram
5557
deploy:
56-
- provider: releases
57-
api_key:
58-
secure:
59-
file:
60-
- SwiftInstagram.framework.zip
61-
skip_cleanup: true
62-
overwrite: true
63-
on:
64-
repo: AnderGoig/SwiftInstagram
65-
tags: true
66-
condition: $RELEASE_READY = YES
67-
- provider: script
68-
script: pod trunk push
69-
on:
70-
tags: true
71-
condition: $RELEASE_READY = YES
58+
- provider: releases
59+
api_key:
60+
secure: jYpv6cXD6AIuTONSVvjQHGUeYDs/J/mID0pIMaFLIh3cBo3EPeM29zmYKVeBjePr9BlUUmMJqcif8oddADYyeXQkDjWr2pBLARQmryMMi1dVNMvuBq4Tb/PV7BEwkDigIb9Qcpcm4HFdYigMRFp20bntBlnGb/tjwdq3XEe5766QuM7H22g41V8S9e7Na8K5gpRmew25mMASDkwSvZHuMA5+P6Q4nam5R0kA53uBIySWYW340EZ3B23oQdtdob2vk35Eu3bR+FFAsE1idw+sddua7eFGi5DVgTlXcwb3f7hG0JKKA9IUXcCSyd5AgLYGv5h+nFBmlRIeA84sQI9xcK+f0kBnHpakm/Xp8+a9NYodxfpyr8k/ZlVal16B6/p+BC6x3TAp6SgDeymuFMNxc6/Eyz/IGrCiJ+4tMmy+385jf8/+Gv6dVGg5fos329QWUzOxcKvCk/w9d5Nz5GCQlMvgH4N/YvTmSnPaRUIBeaN7VV+Kkr4ovUb9SeOlrrG+36GU60aBriv6ZqQ6BhndEraIXKsCItfSHqxcJspliAWzTqPOpg8SqBTBIWAcrVOtcpmo9TI5ndiS8R8EwuOcAJtrl7yaNJ70iUv2IewSdNbl1ZZV9CMnu83vAEwELszssmbJ1SbTLi4GfoECEw4CHpOKyk6Fh4WXBFcSLGgvce8=
61+
file: SwiftInstagram.framework.zip
62+
skip_cleanup: true
63+
overwrite: true
64+
on:
65+
repo: AnderGoig/SwiftInstagram
66+
tags: true
67+
- provider: script
68+
script: pod trunk push
69+
on:
70+
tags: true

CHANGELOG.md

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
# Changelog
2-
All notable changes to this project will be documented in this file.
3-
4-
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5-
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
62

73
## [Unreleased]
84

9-
## [1.0.5] - 2017-10-18
5+
## [1.0.6] (2017-11-03)
6+
[Full Changelog](https://github.com/AnderGoig/SwiftInstagram/compare/v1.0.5...v1.0.6)
7+
### Added
8+
- JSON parser improvements.
9+
- General source code improvements.
10+
### Changed
11+
- `searchLocation()` method attributes `lat` and `lng` have been replaced by `coordinates`.
12+
- `isSessionValid()` method has been renamed to `isAuthenticated` (property).
13+
- Change key for keychain (#11).
14+
- Better handling of #7 bug.
15+
16+
## [1.0.5] (2017-10-18)
17+
[Full Changelog](https://github.com/AnderGoig/SwiftInstagram/compare/v1.0.4...v1.0.5)
1018
### Changed
1119
- The `Success` and `Failure` handlers, for all the API endpoints, are no longer nullable.
1220
### Fixed
1321
- Fixed the bug parsing `InstagramMedia` objects with a `location` property (#7).
1422

15-
## [1.0.4] - 2017-10-10
23+
## [1.0.4] (2017-10-10)
24+
[Full Changelog](https://github.com/AnderGoig/SwiftInstagram/compare/v1.0.3...v1.0.4)
1625
### Added
1726
- 100% documented code.
1827
### Changed
@@ -22,12 +31,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
2231
### Fixed
2332
- Fixed the type of the returned errors.
2433

25-
## [1.0.3] - 2017-10-08
34+
## [1.0.3] (2017-10-08)
35+
[Full Changelog](https://github.com/AnderGoig/SwiftInstagram/compare/v1.0.2...v1.0.3)
2636
### Changed
2737
- Improved documentation.
2838
- `InstagramAuthScope` renamed to `InstagramScope`.
2939

30-
## [1.0.2] - 2017-10-07
40+
## [1.0.2] (2017-10-07)
41+
[Full Changelog](https://github.com/AnderGoig/SwiftInstagram/compare/v1.0.1...v1.0.2)
3142
### Added
3243
- `InstagramLoginViewController` hides automatically when concludes.
3344
- `@discardableResult` to `logout()` method.
@@ -37,7 +48,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
3748
- Authorization process errors are now correctly captured.
3849
- Travis CI build error.
3950

40-
## [1.0.1] - 2017-10-03
51+
## [1.0.1] (2017-10-03)
52+
[Full Changelog](https://github.com/AnderGoig/SwiftInstagram/compare/v1.0.0...v1.0.1)
4153
### Added
4254
- Use of `DispatchQueue` for parsing JSON and calling callback functions.
4355
### Changed
@@ -46,13 +58,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
4658
### Fixed
4759
- Login page `WKWebView` now fits correctly when rotating device.
4860

49-
## 1.0.0 - 2017-09-30
61+
## [1.0.0] (2017-09-30)
5062
### Added
5163
- Initial release.
5264

53-
[Unreleased]: https://github.com/AnderGoig/SwiftInstagram/compare/v1.0.5...develop
54-
[1.0.5]: https://github.com/AnderGoig/SwiftInstagram/compare/v1.0.4...v1.0.5
55-
[1.0.4]: https://github.com/AnderGoig/SwiftInstagram/compare/v1.0.3...v1.0.4
56-
[1.0.3]: https://github.com/AnderGoig/SwiftInstagram/compare/v1.0.2...v1.0.3
57-
[1.0.2]: https://github.com/AnderGoig/SwiftInstagram/compare/v1.0.1...v1.0.2
58-
[1.0.1]: https://github.com/AnderGoig/SwiftInstagram/compare/v1.0.0...v1.0.1
65+
[Unreleased]: https://github.com/AnderGoig/SwiftInstagram/compare/v1.0.6...develop
66+
[1.0.6]: https://github.com/AnderGoig/SwiftInstagram/tree/v1.0.6
67+
[1.0.5]: https://github.com/AnderGoig/SwiftInstagram/tree/v1.0.5
68+
[1.0.4]: https://github.com/AnderGoig/SwiftInstagram/tree/v1.0.4
69+
[1.0.3]: https://github.com/AnderGoig/SwiftInstagram/tree/v1.0.3
70+
[1.0.2]: https://github.com/AnderGoig/SwiftInstagram/tree/v1.0.2
71+
[1.0.1]: https://github.com/AnderGoig/SwiftInstagram/tree/v1.0.1
72+
[1.0.0]: https://github.com/AnderGoig/SwiftInstagram/tree/v1.0.0

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<p align="center">
22
<a href="https://andergoig.github.io/SwiftInstagram">
3-
<img src="https://rawgit.com/AnderGoig/SwiftInstagram/develop/.assets/SwiftInstagram-Logo.png" alt="SwiftInstagram Logo" width="700" height="200">
3+
<img src="https://rawgit.com/AnderGoig/SwiftInstagram/master/.assets/SwiftInstagram-Logo.png" alt="SwiftInstagram Logo" width="700" height="200">
44
</a>
55
</p>
66

@@ -21,8 +21,8 @@
2121
<img src="https://codebeat.co/badges/e5274943-8feb-4e51-a937-43552205f62e"
2222
alt="Codebeat">
2323
</a>
24-
<a href="https://andergoig.github.io/SwiftInstagram/Classes/Instagram.html">
25-
<img src="docs/badge.svg"
24+
<a href="https://andergoig.github.io/SwiftInstagram">
25+
<img src="https://rawgit.com/AnderGoig/SwiftInstagram/master/docs/badge.svg"
2626
alt="Documentation">
2727
</a>
2828
<a href="https://raw.githubusercontent.com/AnderGoig/SwiftInstagram/master/LICENSE">
@@ -52,10 +52,11 @@
5252

5353
## Features
5454

55-
- [x] Effortless and straightforward use of Instagram API.
56-
- [x] Up-to-date with the latest of [Instagram API](https://www.instagram.com/developer/).
57-
- [x] Client-Side authentication.
55+
- [x] Effortless and straightforward use.
56+
- [x] Up-to-date with the latest [Instagram API](https://www.instagram.com/developer/) features.
5857
- [x] Secure access token storing, thanks to [keychain-swift](https://github.com/evgenyneu/keychain-swift).
58+
- [x] Client-Side authentication.
59+
- [x] 100% documented code.
5960
- [x] Up-to-date with the latest Apple technologies (Swift 4, Xcode 9, etc).
6061

6162
### [Upcoming features](https://github.com/AnderGoig/SwiftInstagram/projects/1)

Sources/Endpoints/Comments.swift

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
//
2+
// Comments.swift
3+
// SwiftInstagram
4+
//
5+
// Created by Ander Goig on 29/10/17.
6+
// Copyright © 2017 Ander Goig. All rights reserved.
7+
//
8+
9+
extension Instagram {
10+
11+
/// Get a list of recent comments on a media object.
12+
///
13+
/// - parameter Parameter mediaId: The ID of the media object to reference.
14+
/// - parameter success: The callback called after a correct retrieval.
15+
/// - parameter failure: The callback called after an incorrect retrieval.
16+
///
17+
/// - important: It requires *public_content* scope for media that does not belong to your own user.
18+
19+
public func comments(fromMedia mediaId: String, success: SuccessHandler<[InstagramComment]>?, failure: FailureHandler?) {
20+
request("/media/\(mediaId)/comments", success: success, failure: failure)
21+
}
22+
23+
/// Create a comment on a media object.
24+
///
25+
/// - parameter mediaId: The ID of the media object to reference.
26+
/// - parameter text: Text to post as a comment on the media object as specified in `mediaId`.
27+
/// - parameter failure: The callback called after an incorrect creation.
28+
///
29+
/// - important: It requires *comments* scope. Also, *public_content* scope is required for media that does not
30+
/// belong to your own user.
31+
///
32+
/// - note:
33+
/// - The total length of the comment cannot exceed 300 characters.
34+
/// - The comment cannot contain more than 4 hashtags.
35+
/// - The comment cannot contain more than 1 URL.
36+
/// - The comment cannot consist of all capital letters.
37+
38+
public func createComment(onMedia mediaId: String, text: String, failure: FailureHandler?) {
39+
var parameters = Parameters()
40+
41+
parameters["text"] = text
42+
43+
request("/media/\(mediaId)/comments", method: .post, parameters: parameters, success: { (_: InstagramResponse<Any?>) in return }, failure: failure)
44+
}
45+
46+
/// Remove a comment either on the authenticated user's media object or authored by the authenticated user.
47+
///
48+
/// - parameter commentId: The ID of the comment to delete.
49+
/// - parameter mediaId: The ID of the media object to reference.
50+
/// - parameter failure: The callback called after an incorrect deletion.
51+
///
52+
/// - important: It requires *comments* scope. Also, *public_content* scope is required for media that does not
53+
/// belong to your own user.
54+
55+
public func deleteComment(_ commentId: String, onMedia mediaId: String, failure: FailureHandler?) {
56+
request("/media/\(mediaId)/comments/\(commentId)", method: .delete, success: { (_: InstagramResponse<Any?>) in return }, failure: failure)
57+
}
58+
59+
}

0 commit comments

Comments
 (0)