Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing build error #44

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
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
14 changes: 10 additions & 4 deletions Sources/StravaSwift/StravaClient.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import AuthenticationServices
import Foundation
import Alamofire
import SwiftyJSON
#if os(iOS)
import SafariServices
#endif

/**
StravaClient responsible for making all api requests
Expand Down Expand Up @@ -82,7 +84,7 @@ extension StravaClient {
}

//MARK : - Auth

#if os(iOS)
extension StravaClient: ASWebAuthenticationPresentationContextProviding {

var currentWindow: UIWindow? { return UIApplication.shared.keyWindow }
Expand Down Expand Up @@ -118,7 +120,11 @@ extension StravaClient: ASWebAuthenticationPresentationContextProviding {
webAuthenticationSession.start()
} else {
currentAuthorizationHandler = result // Stores the handler to be executed once `handleAuthorizationRedirect(url:)` is called
UIApplication.shared.open(Router.webAuthorizationUrl, options: [:])
if #available(iOS 10.0, *) {
UIApplication.shared.open(Router.webAuthorizationUrl, options: [:])
} else {
// Fallback on earlier versions
}
}
}
}
Expand Down Expand Up @@ -205,9 +211,9 @@ extension StravaClient: ASWebAuthenticationPresentationContextProviding {
@available(iOS 12.0, *)
public func presentationAnchor(for session: ASWebAuthenticationSession) -> ASPresentationAnchor {
return currentWindow ?? ASPresentationAnchor()
}
}
}

#endif

//MARK: - Athlete

Expand Down
4 changes: 2 additions & 2 deletions StravaSwift.podspec
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
Pod::Spec.new do |s|
s.name = 'StravaSwift'
s.version = '1.0.2'
s.version = '1.0.4'
s.summary = 'A Swift library for the Strava API v3'
s.description = <<-DESC
A Swift library for the Strava API v3. For complete details visit the Strava developer site.
DESC
s.homepage = 'https://github.com/mpclarkson/StravaSwift'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Matthew Clarkson' => 'mpclarkson@gmail.com' }
s.source = { :git => 'https://github.com/mpclarkson/StravaSwift.git', :tag => s.version.to_s }
s.source = { :git => 'https://github.com/cagnulein/StravaSwift.git', :tag => s.version.to_s }
s.social_media_url = 'https://twitter.com/matt_pc'
s.swift_version = '5.0'
s.ios.deployment_target = '12.0'
Expand Down