Commit f37d4324 authored by Christophe Deschamps's avatar Christophe Deschamps
Browse files

User-agent

parent 40fa3eec
Pipeline #29060 failed with stage
in 3 minutes and 49 seconds
......@@ -137,6 +137,8 @@
C6571BAA241936C0008987AB /* linphonerc-factory-appex in Resources */ = {isa = PBXBuildFile; fileRef = C6571BA724193340008987AB /* linphonerc-factory-appex */; };
C664BD0124D9556000EDE72D /* CallLog+extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62709C024B484D1000E43D2 /* CallLog+extension.swift */; };
C664BD0224D9556100EDE72D /* CallLog+extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C62709C024B484D1000E43D2 /* CallLog+extension.swift */; };
C6667561264AD3A200A0273C /* Bundle+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C648F9F824A1BA0A00D9B92D /* Bundle+Extension.swift */; };
C6667562264AD3A300A0273C /* Bundle+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = C648F9F824A1BA0A00D9B92D /* Bundle+Extension.swift */; };
C676AD7824040F6C0048C504 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C676AD7724040F6C0048C504 /* AppDelegate.swift */; };
C676AD8224040F6E0048C504 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C676AD8024040F6E0048C504 /* LaunchScreen.storyboard */; };
C67F30E024D80EAB0066A0A0 /* MutableLiveData.swift in Sources */ = {isa = PBXBuildFile; fileRef = C648FA3E24A23C6E00D9B92D /* MutableLiveData.swift */; };
......@@ -1366,6 +1368,7 @@
C68978D824D163EF00FB8235 /* StorageManager.swift in Sources */,
C68992C425124E0300B62F70 /* UIDevice+Extension.swift in Sources */,
C68978D424D163D700FB8235 /* ActionTypes.swift in Sources */,
C6667562264AD3A300A0273C /* Bundle+Extension.swift in Sources */,
C68978D024D163AB00FB8235 /* StringUtil.swift in Sources */,
C67F30E124D80EAC0066A0A0 /* MutableLiveData.swift in Sources */,
C68978E424D1643400FB8235 /* Theme.swift in Sources */,
......@@ -1540,6 +1543,7 @@
C68978D724D163EE00FB8235 /* StorageManager.swift in Sources */,
C68978D324D163D700FB8235 /* ActionTypes.swift in Sources */,
C68978CF24D163AA00FB8235 /* StringUtil.swift in Sources */,
C6667561264AD3A200A0273C /* Bundle+Extension.swift in Sources */,
C67F30E024D80EAB0066A0A0 /* MutableLiveData.swift in Sources */,
C68978E324D1643300FB8235 /* Theme.swift in Sources */,
C68978DD24D1641000FB8235 /* HistoryEventStore.swift in Sources */,
......
......@@ -22,7 +22,7 @@
<key>LinhomeServiceExtension.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>25</integer>
<integer>27</integer>
</dict>
<key>VideoNotifDemoServiceExtension.xcscheme_^#shared#^_</key>
<dict>
......
......@@ -25,6 +25,7 @@
import UIKit
import linphonesw
import DeviceGuru
struct CoreError: Error {
let message: String
......@@ -41,7 +42,7 @@ extension Core {
private static var _instance : Core?
public static var iterateTimers:[String:Timer] = [:]
public static var pushToken : String?
public static func get(autoIterate:Bool = true) -> Core { // Singleton initiatlisation
if (_instance == nil) {
......@@ -67,7 +68,7 @@ extension Core {
Log.warn("Manually iterating inside contenet app extension")
iterateTimers["\(result)"] = Timer.scheduledTimer(timeInterval: 0.20, target: result, selector: #selector(myIterate), userInfo: nil, repeats: true)
}
result.computeUserAgent()
return result
} catch {
Log.error("Unable to create core \(error)")
......@@ -98,16 +99,16 @@ extension Core {
let services = "remote"
let token = pushToken+":"+services
#if DEBUG
let pushEnvironment = ".dev"
let pushEnvironment = ".dev"
#else
let pushEnvironment = ""
let pushEnvironment = ""
#endif
proxyConfig.contactUriParameters = "pn-provider=apns"+pushEnvironment+";pn-prid="+token+";pn-param="+Config.teamID+"."+Bundle.main.bundleIdentifier!+"."+services+";pn-silent=1;pn-msg-str=IM_MSG;pn-call-str=IC_MSG;"
proxyConfig.contactParameters = ""
try?proxyConfig.done()
}
public static func runsInsideExtension() -> Bool { // Tells wether it is run inside app extension or the main app.
let bundleUrl: URL = Bundle.main.bundleURL
let bundlePathExtension: String = bundleUrl.pathExtension
......@@ -119,7 +120,7 @@ extension Core {
callLog.callId != nil && callLog.callId.count > 0 // CallID can be null in early stage of call.
}.reversed()
}
func missedCount() -> Int {
......@@ -170,5 +171,20 @@ extension Core {
userDefaults.setValue(true, forKey: "default_codec_set")
}
//User-Agent: Linhome/14.5.1 (iphone_x) LinphoneSDK/4.5.0
func computeUserAgent() {
let deviceName: String = "\(DeviceGuru().hardware())"
let appName: String = Bundle.main.appName()
let iosVersion = UIDevice.current.systemVersion
let userAgent = "\(appName) \(Bundle.main.desc())/\(deviceName) (\(iosVersion)) LinphoneSDK"
let sdkVersion = Core.getVersion
setUserAgent(name: userAgent, version: sdkVersion)
}
//User-Agent: Linhome (1.1 (2) / 14.5.1 (iphone_x) LinphoneSDK/4.5.0
}
......@@ -37,4 +37,9 @@ extension Bundle {
return "\(releaseVersionNumber ?? "") (\(buildVersionNumber ?? ""))"
}
func appName() -> String {
return infoDictionary?["CFBundleName"] as! String
}
}
......@@ -25,6 +25,7 @@ def app_pods
pod 'Firebase/Analytics'
pod 'Firebase/Crashlytics'
pod 'MarqueeLabel'
pod 'DeviceGuru'
end
target 'Linhome' do
......@@ -39,6 +40,7 @@ def ext_pods
pod 'PocketSVG'
pod 'Firebase/Analytics'
pod 'Firebase/Crashlytics'
pod 'DeviceGuru'
end
target 'LinhomeContentExtension' do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment