From 7d6804f64c205c2c958faf451371078fa0ddd712 Mon Sep 17 00:00:00 2001
From: Misnikov Roman <36447757+MisnikovRoman@users.noreply.github.com>
Date: Fri, 20 Sep 2019 19:12:14 +0700
Subject: [PATCH] Added timeout property to URLSessionDispatcher init method
 (#319)

---
 CHANGELOG.md                             | 3 +++
 MatomoTracker/URLSessionDispatcher.swift | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2b93fc5c..d31a5f89 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,8 @@
 # Changelog
 
+## 7.0.2 
+* **improvement** Added `timeout` property to URLSessionDispatcher initialization method
+
 ## 7.0.1
 * **bugfix** Fixed an issue with a new `forcedVisitorId` value validation. [#315](https://github.com/matomo-org/matomo-sdk-ios/pull/315)
 
diff --git a/MatomoTracker/URLSessionDispatcher.swift b/MatomoTracker/URLSessionDispatcher.swift
index 3e515e4d..e90c67e9 100644
--- a/MatomoTracker/URLSessionDispatcher.swift
+++ b/MatomoTracker/URLSessionDispatcher.swift
@@ -20,9 +20,10 @@ public final class URLSessionDispatcher: Dispatcher {
     /// - Parameters:
     ///   - baseURL: The url of the Matomo server. This url has to end in `piwik.php`.
     ///   - userAgent: An optional parameter for custom user agent.
-    public init(baseURL: URL, userAgent: String? = nil) {                
+    ///   - timeout: The timeout interval for the request. The default is 5.0.
+    public init(baseURL: URL, userAgent: String? = nil, timeout: TimeInterval = 5.0) {
         self.baseURL = baseURL
-        self.timeout = 5
+        self.timeout = timeout
         self.session = URLSession.shared
         if let userAgent = userAgent {
             self.userAgent = userAgent