Skip to content

Commit

Permalink
Merge development into main
Browse files Browse the repository at this point in the history
  • Loading branch information
sbertix committed Dec 18, 2020
2 parents ca40e23 + b027c8c commit 6ba73c3
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Sources/Swiftagram/Client/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public extension Client {
scale: 3,
dpi: 458)))

#if canImport(UIKit)
#if canImport(UIKit) && !canImport(WatchKit)
/// A custom iPhone device, based on the current `UIDevice`.
///
/// - warning: If you're not running this on an iPhone (or an iPhone simulator), it will always evaluate to `nil`.
Expand Down
2 changes: 2 additions & 0 deletions Sources/Swiftagram/Extensions/Deprecations.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public enum UserAgent {
case current
}

#if canImport(WebKit)
@available(iOS 11.0, macOS 10.13, macCatalyst 13.0, *)
public extension WebViewAuthenticator {
/// Set a custom User Agent.
Expand All @@ -93,3 +94,4 @@ public extension WebViewAuthenticator {
@available(*, unavailable, message: "please create a custom `Client` and pass it to your `WebViewAuthenticator`.")
func userAgent(_ userAgent: String) -> WebViewAuthenticator<Storage> { fatalError("Unavailable") }
}
#endif
10 changes: 10 additions & 0 deletions Sources/SwiftagramCrypto/Endpoints/EndpointMedia.swift
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ public extension Endpoint.Media.Posts {
/// - users: A collection of `UserTag`s.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
@available(watchOS 6, *)
static func upload<U: Collection>(video url: URL,
preview image: Agnostic.Image,
captioned caption: String?,
Expand All @@ -349,6 +350,7 @@ public extension Endpoint.Media.Posts {
/// - caption: An optional `String`.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
@available(watchOS 6, *)
static func upload(video url: URL,
preview image: Agnostic.Image,
captioned caption: String?,
Expand All @@ -366,6 +368,7 @@ public extension Endpoint.Media.Posts {
/// - users: A collection of `UserTag`s.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
@available(watchOS 6, *)
internal static func upload<U: Collection>(video url: URL,
preview data: Data,
size: CGSize,
Expand Down Expand Up @@ -469,6 +472,7 @@ public extension Endpoint.Media.Posts {
/// - users: A collection of `UserTag`s.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
@available(watchOS 6, *)
static func upload<U: Collection>(video url: URL,
preview data: Data,
captioned caption: String?,
Expand All @@ -488,6 +492,7 @@ public extension Endpoint.Media.Posts {
/// - caption: An optional `String`.
/// - location: An optional `Location`. Defaults to `nil`.
/// - note: **SwiftagramCrypto** only.
@available(watchOS 6, *)
static func upload(video url: URL,
preview data: Data,
captioned caption: String?,
Expand Down Expand Up @@ -621,6 +626,7 @@ public extension Endpoint.Media.Stories {
/// - stickers: A sequence of `Sticker`s.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
@available(watchOS 6, *)
static func upload<S: Sequence>(video url: URL,
preview image: Agnostic.Image? = nil,
stickers: S,
Expand All @@ -639,6 +645,7 @@ public extension Endpoint.Media.Stories {
/// - image: An `Agnostic.Image` to be used as preview. Defaults to `nil`, meaning a full black preview will be used.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
@available(watchOS 6, *)
static func upload(video url: URL, preview image: Agnostic.Image? = nil, isCloseFriendsOnly: Bool = false) -> Endpoint.Disposable<Media.Unit> {
upload(video: url, preview: image, stickers: [], isCloseFriendsOnly: isCloseFriendsOnly)
}
Expand All @@ -652,6 +659,7 @@ public extension Endpoint.Media.Stories {
/// - stickers: A sequence of `Sticker`s.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
@available(watchOS 6, *)
internal static func upload<S: Sequence>(video url: URL,
preview data: Data?,
size: CGSize,
Expand Down Expand Up @@ -743,6 +751,7 @@ public extension Endpoint.Media.Stories {
/// - stickers: A sequence of `Sticker`s.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
@available(watchOS 6, *)
static func upload<S: Collection>(video url: URL,
preview data: Data,
stickers: S,
Expand All @@ -757,6 +766,7 @@ public extension Endpoint.Media.Stories {
/// - data: Some `Data` holding reference to an image to be used as preview.
/// - isCloseFriendsOnly: A valid `Bool`. Defaults to `false`.
/// - note: **SwiftagramCrypto** only.
@available(watchOS 6, *)
static func upload(video url: URL, preview data: Data, isCloseFriendsOnly: Bool = false) -> Endpoint.Disposable<Media.Unit> {
upload(video: url, preview: data, stickers: [], isCloseFriendsOnly: isCloseFriendsOnly)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

import Foundation

#if canImport(AVKit) && canImport(CoreGraphics)
import AVKit
#if canImport(AVFoundation) && canImport(CoreGraphics)
import AVFoundation
import CoreGraphics
#endif

Expand Down Expand Up @@ -71,7 +71,8 @@ extension Endpoint.Media {
date: now)
}

#if canImport(AVKit) && canImport(CoreGraphics)
#if canImport(AVFoundation) && canImport(CoreGraphics)
@available(watchOS 6, *)
/// Upload video at `url`.
/// - parameters:
/// - url: Some `url` to an `.mp4` video.
Expand Down
2 changes: 2 additions & 0 deletions Tests/SwiftagramTests/AuthenticatorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ final class AuthenticatorTests: XCTestCase {
wait(for: [expectation], timeout: 3)
}

#if canImport(WebKit)
/// Test `WebViewAuthenticator` login flow.
func testWebViewAuthenticator() {
if #available(macOS 10.13, iOS 11, *) {
Expand All @@ -87,4 +88,5 @@ final class AuthenticatorTests: XCTestCase {
wait(for: [expectation], timeout: 10)
}
}
#endif
}

0 comments on commit 6ba73c3

Please sign in to comment.