-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathSwisstopoTextureLoader.swift
More file actions
29 lines (25 loc) · 1.04 KB
/
SwisstopoTextureLoader.swift
File metadata and controls
29 lines (25 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
* Copyright (c) 2021 Ubique Innovation AG <https://www.ubique.ch>
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*/
import Foundation
import MapCore
import SwisstopoMapSDKSharedModule
public class SwisstopoTextureLoader: MCTextureLoader {
private var referer: String
public override init(urlSession: URLSession? = nil) {
let bundleIdentifier = Bundle.main.bundleIdentifier ?? "N/A"
let appVersion = (Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String) ?? "N/A"
let mapsCoreVersion = STSDKOpenSwissMapsSharedModule.version()
referer = "\(bundleIdentifier);\(appVersion);openswissmaps;\(mapsCoreVersion)"
super.init(urlSession: urlSession)
}
public override func modifyUrlRequest(request: inout URLRequest) {
request.setValue(referer, forHTTPHeaderField: "referer")
}
}