Skip to content

Commit

Permalink
add executable to RequestInterceptor
Browse files Browse the repository at this point in the history
  • Loading branch information
Stepanokdev committed Oct 26, 2023
1 parent 83e1f2b commit e49a0da
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Core/Core/Network/RequestInterceptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,11 @@ final public class RequestInterceptor: Alamofire.RequestInterceptor {

let userAgent: String = {
if let info = Bundle.main.infoDictionary {
let executable: AnyObject = info[kCFBundleExecutableKey as String] as AnyObject? ?? "Unknown" as AnyObject
let bundle: AnyObject = info[kCFBundleIdentifierKey as String] as AnyObject? ?? "Unknown" as AnyObject
let version: AnyObject = info["CFBundleShortVersionString"] as AnyObject? ?? "Unknown" as AnyObject
let os: AnyObject = ProcessInfo.processInfo.operatingSystemVersionString as AnyObject
var mutableUserAgent = NSMutableString(string: "\(bundle) (\(version); OS \(os))") as CFMutableString
var mutableUserAgent = NSMutableString(string: "\(executable)/\(bundle) (\(version); OS \(os))") as CFMutableString
let transform = NSString(string: "Any-Latin; Latin-ASCII; [:^ASCII:] Remove") as CFString
if CFStringTransform(mutableUserAgent, nil, transform, false) == true {
return mutableUserAgent as String
Expand Down

0 comments on commit e49a0da

Please sign in to comment.