react-native-mytatva-rn-sdk 1.2.96 → 1.2.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/mytatvarnsdk/CgmTrackyLibModule.kt +84 -0
- package/android/src/main/java/com/mytatvarnsdk/activity/ConnectSensorActivity.kt +158 -18
- package/android/src/main/java/com/mytatvarnsdk/activity/HelpActivity.kt +3 -9
- package/android/src/main/java/com/mytatvarnsdk/activity/PermissionActivity.kt +51 -16
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceSensorActivity.kt +29 -13
- package/android/src/main/java/com/mytatvarnsdk/activity/PlaceTransmitterActivity.kt +29 -13
- package/android/src/main/java/com/mytatvarnsdk/activity/QRActivity.kt +146 -5
- package/android/src/main/java/com/mytatvarnsdk/activity/SearchTransmitterActivity.kt +108 -13
- package/android/src/main/java/com/mytatvarnsdk/activity/SensorConnectSuccessActivity.kt +43 -16
- package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +26 -15
- package/android/src/main/java/com/mytatvarnsdk/activity/VideoActivity.kt +96 -50
- package/android/src/main/java/com/mytatvarnsdk/network/AuthenticateSDKService.kt +113 -0
- package/android/src/main/java/com/mytatvarnsdk/utils/CgmModuleSentryLog.kt +205 -0
- package/android/src/main/java/com/mytatvarnsdk/utils/CgmSentryLog.kt +28 -0
- package/android/src/main/java/com/mytatvarnsdk/utils/CustomerSupportConfig.kt +137 -0
- package/android/src/main/java/com/mytatvarnsdk/utils/ToolbarSupportHelper.kt +83 -0
- package/ios/Custom/CustomTopUIView.swift +25 -0
- package/ios/MyReactNativeBridge.m +4 -0
- package/ios/Support/API.swift +117 -18
- package/ios/Support/CustomTopViewSupportHelper.swift +55 -0
- package/ios/Support/CustomerSupportConfig.swift +169 -0
- package/ios/Support/Global.swift +2 -2
- package/ios/Support/GlobalYouTubePlayerView.swift +102 -11
- package/ios/ViewControllers/AttachTransmitterViewController.swift +16 -21
- package/ios/ViewControllers/ChatWithExpertViewController.swift +1 -7
- package/ios/ViewControllers/ConnectToSensorViewController.swift +16 -21
- package/ios/ViewControllers/ConnectToTransmitterViewController.swift +16 -21
- package/ios/ViewControllers/ProvidePermissionViewController.swift +16 -21
- package/ios/ViewControllers/PutOnTheSensorViewController.swift +16 -21
- package/ios/ViewControllers/StartConnectionViewController.swift +18 -25
- package/ios/ViewModel/FinalViewModel.swift +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CustomerSupportConfig.swift
|
|
3
|
+
// MyTatvaCare
|
|
4
|
+
//
|
|
5
|
+
|
|
6
|
+
import Foundation
|
|
7
|
+
import UIKit
|
|
8
|
+
|
|
9
|
+
extension Notification.Name {
|
|
10
|
+
static let customerSupportConfigDidUpdate = Notification.Name("customerSupportConfigDidUpdate")
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@objc public class CustomerSupportConfig: NSObject {
|
|
14
|
+
@objc public static let shared = CustomerSupportConfig()
|
|
15
|
+
|
|
16
|
+
static let defaultWhatsAppNumber = "918511975757"
|
|
17
|
+
static let defaultDemoVideoUrl =
|
|
18
|
+
"https://www.youtube.com/embed/65vl2aE1K_I"
|
|
19
|
+
|
|
20
|
+
private(set) var isLoaded = false
|
|
21
|
+
private(set) var isShowWhatsapp = false
|
|
22
|
+
private(set) var whatsAppNumber = CustomerSupportConfig.defaultWhatsAppNumber
|
|
23
|
+
private(set) var watchCGMDemoUrl = CustomerSupportConfig.defaultDemoVideoUrl
|
|
24
|
+
|
|
25
|
+
private override init() {}
|
|
26
|
+
|
|
27
|
+
func effectiveWhatsAppNumber() -> String {
|
|
28
|
+
whatsAppNumber.isEmpty ? Self.defaultWhatsAppNumber : whatsAppNumber
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
func shouldShowWhatsapp() -> Bool {
|
|
32
|
+
guard isLoaded else { return false }
|
|
33
|
+
return isShowWhatsapp && !effectiveWhatsAppNumber().isEmpty
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
func demoVideoURL(isForReconnect: Bool) -> String {
|
|
37
|
+
watchCGMDemoUrl.isEmpty ? Self.defaultDemoVideoUrl : watchCGMDemoUrl
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
func updateFromResponse(_ response: String) {
|
|
41
|
+
guard let data = response.data(using: .utf8),
|
|
42
|
+
let json = try? JSONSerialization.jsonObject(with: data) as? [String: Any] else {
|
|
43
|
+
print("CustomerSupportConfig: failed to parse response, using failure defaults")
|
|
44
|
+
applyFailureDefaults()
|
|
45
|
+
return
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let code: Int
|
|
49
|
+
if let intCode = json["code"] as? Int {
|
|
50
|
+
code = intCode
|
|
51
|
+
} else if let strCode = json["code"] as? String, let parsed = Int(strCode) {
|
|
52
|
+
code = parsed
|
|
53
|
+
} else {
|
|
54
|
+
code = 0
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
guard code == 1,
|
|
58
|
+
let dataObject = json["data"] as? [String: Any] else {
|
|
59
|
+
print("CustomerSupportConfig: non-success API response, using failure defaults")
|
|
60
|
+
applyFailureDefaults()
|
|
61
|
+
return
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
isShowWhatsapp = parseBool(dataObject["isShowWhatsapp"])
|
|
65
|
+
|
|
66
|
+
if let apiNumber = dataObject["whatsAppNumber"] as? String {
|
|
67
|
+
whatsAppNumber = apiNumber.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
68
|
+
}
|
|
69
|
+
if whatsAppNumber.isEmpty {
|
|
70
|
+
whatsAppNumber = Self.defaultWhatsAppNumber
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if let apiDemoUrl = dataObject["watchCGMDemoUrl"] as? String {
|
|
74
|
+
watchCGMDemoUrl = apiDemoUrl.trimmingCharacters(in: .whitespacesAndNewlines)
|
|
75
|
+
}
|
|
76
|
+
if watchCGMDemoUrl.isEmpty {
|
|
77
|
+
watchCGMDemoUrl = Self.defaultDemoVideoUrl
|
|
78
|
+
}
|
|
79
|
+
isLoaded = true
|
|
80
|
+
|
|
81
|
+
print("CustomerSupportConfig loaded | showWhatsapp=\(isShowWhatsapp) | demoUrl=\(watchCGMDemoUrl)")
|
|
82
|
+
notifyConfigDidUpdate()
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
private func notifyConfigDidUpdate() {
|
|
86
|
+
DispatchQueue.main.async {
|
|
87
|
+
NotificationCenter.default.post(
|
|
88
|
+
name: .customerSupportConfigDidUpdate,
|
|
89
|
+
object: nil
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
func applyFailureDefaults() {
|
|
95
|
+
isShowWhatsapp = true
|
|
96
|
+
whatsAppNumber = Self.defaultWhatsAppNumber
|
|
97
|
+
watchCGMDemoUrl = Self.defaultDemoVideoUrl
|
|
98
|
+
isLoaded = true
|
|
99
|
+
print("CustomerSupportConfig: failure defaults applied | showWhatsapp=\(isShowWhatsapp) | demoUrl=\(watchCGMDemoUrl)")
|
|
100
|
+
notifyConfigDidUpdate()
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@objc(fetchCustomerSupportWithToken:)
|
|
104
|
+
public func fetchCustomerSupport(withToken token: String) {
|
|
105
|
+
guard !token.isEmpty else {
|
|
106
|
+
print("CustomerSupportConfig: empty token, using failure defaults")
|
|
107
|
+
DispatchQueue.main.async { [weak self] in
|
|
108
|
+
self?.applyFailureDefaults()
|
|
109
|
+
}
|
|
110
|
+
return
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
API.shared.fetchCustomerSupportDetails(
|
|
114
|
+
token: token,
|
|
115
|
+
onSuccess: { [weak self] response in
|
|
116
|
+
DispatchQueue.main.async {
|
|
117
|
+
self?.updateFromResponse(response)
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
onFailure: { [weak self] in
|
|
121
|
+
print("CustomerSupportConfig: API fetch failed, using failure defaults")
|
|
122
|
+
DispatchQueue.main.async {
|
|
123
|
+
self?.applyFailureDefaults()
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
func fetchIfNeeded() {
|
|
130
|
+
guard !isLoaded else { return }
|
|
131
|
+
let token = currentAuthToken()
|
|
132
|
+
guard !token.isEmpty, token != defaultToken else {
|
|
133
|
+
print("CustomerSupportConfig: no valid token, using failure defaults")
|
|
134
|
+
applyFailureDefaults()
|
|
135
|
+
return
|
|
136
|
+
}
|
|
137
|
+
fetchCustomerSupport(withToken: token)
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
func openWhatsApp() {
|
|
141
|
+
let cleanedNumber = effectiveWhatsAppNumber().replacingOccurrences(
|
|
142
|
+
of: "[^0-9]",
|
|
143
|
+
with: "",
|
|
144
|
+
options: .regularExpression
|
|
145
|
+
)
|
|
146
|
+
guard !cleanedNumber.isEmpty,
|
|
147
|
+
let url = URL(string: "https://wa.me/\(cleanedNumber)") else {
|
|
148
|
+
return
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if UIApplication.shared.canOpenURL(url) {
|
|
152
|
+
UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
private func parseBool(_ value: Any?) -> Bool {
|
|
157
|
+
guard let value else { return false }
|
|
158
|
+
switch value {
|
|
159
|
+
case let bool as Bool:
|
|
160
|
+
return bool
|
|
161
|
+
case let int as Int:
|
|
162
|
+
return int == 1
|
|
163
|
+
case let string as String:
|
|
164
|
+
return string.lowercased() == "true" || string == "1"
|
|
165
|
+
default:
|
|
166
|
+
return false
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
package/ios/Support/Global.swift
CHANGED
|
@@ -14,8 +14,8 @@ enum Enum_stroyboard: String {
|
|
|
14
14
|
case Main = "MainCGM"
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
var watchCGMVideo = "https://www.youtube.com/embed/
|
|
18
|
-
var reconnectionwatchCGMVideo = "https://www.youtube.com/embed/
|
|
17
|
+
var watchCGMVideo = "https://www.youtube.com/embed/65vl2aE1K_I"
|
|
18
|
+
var reconnectionwatchCGMVideo = "https://www.youtube.com/embed/65vl2aE1K_I"
|
|
19
19
|
var applyingTheSensor = "https://www.youtube.com/embed/O01BBxzxGmE?si=SblmJ14boqu7Y4qM"
|
|
20
20
|
var applyingTheTransmitter = "https://www.youtube.com/embed/6m3pxl5BK9A?si=08OGnUJf2BdvAYfd"
|
|
21
21
|
var connectionJourneyError = "https://www.youtube.com/embed/mVMBdUeTlhc?si=ODZSiDW96UqyFiZb"
|
|
@@ -12,22 +12,113 @@ class WebViewController: UIViewController {
|
|
|
12
12
|
var webView: WKWebView!
|
|
13
13
|
var videoURL: URL?
|
|
14
14
|
|
|
15
|
+
private lazy var closeButton: UIButton = {
|
|
16
|
+
let button = UIButton(type: .custom)
|
|
17
|
+
button.translatesAutoresizingMaskIntoConstraints = false
|
|
18
|
+
button.accessibilityLabel = "Close video"
|
|
19
|
+
if let image = loadImage(named: "ic_close") {
|
|
20
|
+
button.setImage(image, for: .normal)
|
|
21
|
+
} else {
|
|
22
|
+
let config = UIImage.SymbolConfiguration(pointSize: 22, weight: .medium)
|
|
23
|
+
button.setImage(UIImage(systemName: "xmark.circle.fill", withConfiguration: config), for: .normal)
|
|
24
|
+
button.tintColor = .white
|
|
25
|
+
}
|
|
26
|
+
button.addTarget(self, action: #selector(closeTapped), for: .touchUpInside)
|
|
27
|
+
return button
|
|
28
|
+
}()
|
|
29
|
+
|
|
15
30
|
override func viewDidLoad() {
|
|
16
31
|
super.viewDidLoad()
|
|
17
|
-
view.backgroundColor = .
|
|
18
|
-
|
|
19
|
-
// Setup WebView
|
|
32
|
+
view.backgroundColor = .black
|
|
33
|
+
|
|
20
34
|
let config = WKWebViewConfiguration()
|
|
21
35
|
config.allowsInlineMediaPlayback = true
|
|
22
|
-
|
|
23
|
-
webView = WKWebView(frame:
|
|
24
|
-
webView.
|
|
36
|
+
|
|
37
|
+
webView = WKWebView(frame: .zero, configuration: config)
|
|
38
|
+
webView.translatesAutoresizingMaskIntoConstraints = false
|
|
39
|
+
webView.backgroundColor = .black
|
|
40
|
+
webView.isOpaque = false
|
|
25
41
|
view.addSubview(webView)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
|
|
43
|
+
view.addSubview(closeButton)
|
|
44
|
+
|
|
45
|
+
NSLayoutConstraint.activate([
|
|
46
|
+
closeButton.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor, constant: 8),
|
|
47
|
+
closeButton.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 8),
|
|
48
|
+
closeButton.widthAnchor.constraint(equalToConstant: 40),
|
|
49
|
+
closeButton.heightAnchor.constraint(equalToConstant: 40),
|
|
50
|
+
|
|
51
|
+
webView.topAnchor.constraint(equalTo: closeButton.bottomAnchor, constant: 8),
|
|
52
|
+
webView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
|
|
53
|
+
webView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
|
|
54
|
+
webView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
|
|
55
|
+
])
|
|
56
|
+
|
|
57
|
+
view.bringSubviewToFront(closeButton)
|
|
58
|
+
|
|
59
|
+
let videoId = resolveVideoId(from: videoURL?.absoluteString)
|
|
60
|
+
let html = buildYouTubeEmbedHtml(videoId: videoId)
|
|
61
|
+
let baseURL = URL(string: "https://www.mytatva.in/")!
|
|
62
|
+
webView.loadHTMLString(html, baseURL: baseURL)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@objc private func closeTapped() {
|
|
66
|
+
dismiss(animated: true)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private func resolveVideoId(from raw: String?) -> String {
|
|
70
|
+
let value = raw?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
|
|
71
|
+
if value.isEmpty {
|
|
72
|
+
return "65vl2aE1K_I"
|
|
31
73
|
}
|
|
74
|
+
|
|
75
|
+
let patterns = [
|
|
76
|
+
#"(?:embed/|/v/|watch\?v=|youtu\.be/)([\w-]{11})"#,
|
|
77
|
+
#"^([\w-]{11})$"#
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
for pattern in patterns {
|
|
81
|
+
if let regex = try? NSRegularExpression(pattern: pattern),
|
|
82
|
+
let match = regex.firstMatch(in: value, range: NSRange(value.startIndex..., in: value)),
|
|
83
|
+
let range = Range(match.range(at: 1), in: value) {
|
|
84
|
+
return String(value[range])
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return "65vl2aE1K_I"
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private func buildYouTubeEmbedHtml(videoId: String) -> String {
|
|
92
|
+
"""
|
|
93
|
+
<!DOCTYPE html>
|
|
94
|
+
<html>
|
|
95
|
+
<head>
|
|
96
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
97
|
+
<meta name="referrer" content="strict-origin-when-cross-origin">
|
|
98
|
+
<style>
|
|
99
|
+
html, body { margin: 0; padding: 0; background: #000; height: 100%; }
|
|
100
|
+
.video-container { position: relative; width: 100%; height: 100%; }
|
|
101
|
+
iframe {
|
|
102
|
+
position: absolute;
|
|
103
|
+
top: 0;
|
|
104
|
+
left: 0;
|
|
105
|
+
width: 100%;
|
|
106
|
+
height: 100%;
|
|
107
|
+
border: 0;
|
|
108
|
+
}
|
|
109
|
+
</style>
|
|
110
|
+
</head>
|
|
111
|
+
<body>
|
|
112
|
+
<div class="video-container">
|
|
113
|
+
<iframe
|
|
114
|
+
src="https://www.youtube-nocookie.com/embed/\(videoId)?playsinline=1&rel=0&modestbranding=1"
|
|
115
|
+
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
|
116
|
+
allowfullscreen
|
|
117
|
+
referrerpolicy="strict-origin-when-cross-origin">
|
|
118
|
+
</iframe>
|
|
119
|
+
</div>
|
|
120
|
+
</body>
|
|
121
|
+
</html>
|
|
122
|
+
"""
|
|
32
123
|
}
|
|
33
124
|
}
|
|
@@ -28,6 +28,11 @@ class AttachTransmitterViewController: UIViewController {
|
|
|
28
28
|
setupLayout()
|
|
29
29
|
viewModel.initialize()
|
|
30
30
|
}
|
|
31
|
+
|
|
32
|
+
override func viewWillAppear(_ animated: Bool) {
|
|
33
|
+
super.viewWillAppear(animated)
|
|
34
|
+
CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
|
|
35
|
+
}
|
|
31
36
|
|
|
32
37
|
func setupLayout() {
|
|
33
38
|
tableView.delegate = self
|
|
@@ -102,32 +107,22 @@ class AttachTransmitterViewController: UIViewController {
|
|
|
102
107
|
//self.navigationController?.pushViewController(vc, animated: true)
|
|
103
108
|
}
|
|
104
109
|
|
|
105
|
-
customTopView
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
let webVC = WebViewController()
|
|
118
|
-
webVC.modalPresentationStyle = .formSheet
|
|
119
|
-
webVC.videoURL = URL(string: isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
|
|
120
|
-
self.present(webVC, animated: true, completion: nil)
|
|
121
|
-
}
|
|
110
|
+
CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
|
|
111
|
+
CustomTopViewSupportHelper.bindDemoAction(
|
|
112
|
+
customTopView: customTopView,
|
|
113
|
+
isForReconnect: UserDefaults.standard.bool(forKey: "isForReconnect"),
|
|
114
|
+
presenter: self
|
|
115
|
+
)
|
|
116
|
+
CustomTopViewSupportHelper.bindWhatsappAction(
|
|
117
|
+
customTopView: customTopView,
|
|
118
|
+
navigationController: navigationController
|
|
119
|
+
)
|
|
120
|
+
|
|
122
121
|
customTopView.onCloseTapped = {
|
|
123
122
|
let vc = ExitJourneyViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
124
123
|
vc.modalPresentationStyle = .overFullScreen
|
|
125
124
|
self.present(vc, animated: true, completion: nil)
|
|
126
125
|
}
|
|
127
|
-
customTopView.onWhatsAppTapped = {
|
|
128
|
-
let vc = ChatWithExpertViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
129
|
-
self.navigationController?.pushViewController(vc, animated: false)
|
|
130
|
-
}
|
|
131
126
|
}
|
|
132
127
|
|
|
133
128
|
}
|
|
@@ -79,13 +79,7 @@ class ChatWithExpertViewController: UIViewController {
|
|
|
79
79
|
)
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
if UIApplication.shared.canOpenURL(url) {
|
|
84
|
-
UIApplication.shared.open(url, options: [:], completionHandler: nil)
|
|
85
|
-
} else {
|
|
86
|
-
print("Cannot open URL")
|
|
87
|
-
}
|
|
88
|
-
}
|
|
82
|
+
CustomerSupportConfig.shared.openWhatsApp()
|
|
89
83
|
//let vc = ConnectToTransmitterViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
90
84
|
//self.navigationController?.pushViewController(vc, animated: false)
|
|
91
85
|
}
|
|
@@ -61,6 +61,11 @@ class ConnectToSensorViewController: UIViewController {
|
|
|
61
61
|
// Do any additional setup after loading the view.
|
|
62
62
|
setupLayout()
|
|
63
63
|
}
|
|
64
|
+
|
|
65
|
+
override func viewWillAppear(_ animated: Bool) {
|
|
66
|
+
super.viewWillAppear(animated)
|
|
67
|
+
CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
|
|
68
|
+
}
|
|
64
69
|
|
|
65
70
|
func setupLayout() {
|
|
66
71
|
manager?.addObserver(self, forKeyPath: "status", options: [.new], context: nil)
|
|
@@ -144,32 +149,22 @@ class ConnectToSensorViewController: UIViewController {
|
|
|
144
149
|
|
|
145
150
|
}
|
|
146
151
|
|
|
147
|
-
customTopView
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
let webVC = WebViewController()
|
|
159
|
-
webVC.modalPresentationStyle = .formSheet
|
|
160
|
-
webVC.videoURL = URL(string: isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
|
|
161
|
-
self.present(webVC, animated: true, completion: nil)
|
|
162
|
-
}
|
|
163
|
-
|
|
152
|
+
CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
|
|
153
|
+
CustomTopViewSupportHelper.bindDemoAction(
|
|
154
|
+
customTopView: customTopView,
|
|
155
|
+
isForReconnect: UserDefaults.standard.bool(forKey: "isForReconnect"),
|
|
156
|
+
presenter: self
|
|
157
|
+
)
|
|
158
|
+
CustomTopViewSupportHelper.bindWhatsappAction(
|
|
159
|
+
customTopView: customTopView,
|
|
160
|
+
navigationController: navigationController
|
|
161
|
+
)
|
|
162
|
+
|
|
164
163
|
customTopView.onCloseTapped = {
|
|
165
164
|
let vc = ExitJourneyViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
166
165
|
vc.modalPresentationStyle = .overFullScreen
|
|
167
166
|
self.present(vc, animated: true, completion: nil)
|
|
168
167
|
}
|
|
169
|
-
customTopView.onWhatsAppTapped = {
|
|
170
|
-
let vc = ChatWithExpertViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
171
|
-
self.navigationController?.pushViewController(vc, animated: false)
|
|
172
|
-
}
|
|
173
168
|
checkCameraPermission()
|
|
174
169
|
bottomButton.disable()
|
|
175
170
|
}
|
|
@@ -63,6 +63,11 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
|
|
|
63
63
|
setupLayout()
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
+
override func viewWillAppear(_ animated: Bool) {
|
|
67
|
+
super.viewWillAppear(animated)
|
|
68
|
+
CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
|
|
69
|
+
}
|
|
70
|
+
|
|
66
71
|
deinit {
|
|
67
72
|
if let observer = bluetoothEnableObserver {
|
|
68
73
|
NotificationCenter.default.removeObserver(observer)
|
|
@@ -181,32 +186,22 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
|
|
|
181
186
|
}
|
|
182
187
|
}
|
|
183
188
|
|
|
184
|
-
customTopView
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
let webVC = WebViewController()
|
|
196
|
-
webVC.modalPresentationStyle = .formSheet
|
|
197
|
-
webVC.videoURL = URL(string: self.isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
|
|
198
|
-
self.present(webVC, animated: true, completion: nil)
|
|
199
|
-
}
|
|
200
|
-
|
|
189
|
+
CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
|
|
190
|
+
CustomTopViewSupportHelper.bindDemoAction(
|
|
191
|
+
customTopView: customTopView,
|
|
192
|
+
isForReconnect: self.isForReconnect,
|
|
193
|
+
presenter: self
|
|
194
|
+
)
|
|
195
|
+
CustomTopViewSupportHelper.bindWhatsappAction(
|
|
196
|
+
customTopView: customTopView,
|
|
197
|
+
navigationController: navigationController
|
|
198
|
+
)
|
|
199
|
+
|
|
201
200
|
customTopView.onCloseTapped = {
|
|
202
201
|
let vc = ExitJourneyViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
203
202
|
vc.modalPresentationStyle = .overFullScreen
|
|
204
203
|
self.present(vc, animated: true, completion: nil)
|
|
205
204
|
}
|
|
206
|
-
customTopView.onWhatsAppTapped = {
|
|
207
|
-
let vc = ChatWithExpertViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
208
|
-
self.navigationController?.pushViewController(vc, animated: false)
|
|
209
|
-
}
|
|
210
205
|
|
|
211
206
|
if isForReconnect {
|
|
212
207
|
//customTopView.showOnlyClose()
|
|
@@ -35,6 +35,11 @@ class ProvidePermissionViewController: UIViewController {
|
|
|
35
35
|
setupLayout()
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
override func viewWillAppear(_ animated: Bool) {
|
|
39
|
+
super.viewWillAppear(animated)
|
|
40
|
+
CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
|
|
41
|
+
}
|
|
42
|
+
|
|
38
43
|
func setupLayout() {
|
|
39
44
|
tableView.delegate = self
|
|
40
45
|
tableView.dataSource = self
|
|
@@ -74,32 +79,22 @@ class ProvidePermissionViewController: UIViewController {
|
|
|
74
79
|
userInfo: payload
|
|
75
80
|
)
|
|
76
81
|
|
|
77
|
-
customTopView
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
let webVC = WebViewController()
|
|
89
|
-
webVC.modalPresentationStyle = .formSheet
|
|
90
|
-
webVC.videoURL = URL(string: self.isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
|
|
91
|
-
self.present(webVC, animated: true, completion: nil)
|
|
92
|
-
}
|
|
93
|
-
|
|
82
|
+
CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
|
|
83
|
+
CustomTopViewSupportHelper.bindDemoAction(
|
|
84
|
+
customTopView: customTopView,
|
|
85
|
+
isForReconnect: isForReconnect,
|
|
86
|
+
presenter: self
|
|
87
|
+
)
|
|
88
|
+
CustomTopViewSupportHelper.bindWhatsappAction(
|
|
89
|
+
customTopView: customTopView,
|
|
90
|
+
navigationController: navigationController
|
|
91
|
+
)
|
|
92
|
+
|
|
94
93
|
customTopView.onCloseTapped = {
|
|
95
94
|
let vc = ExitJourneyViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
96
95
|
vc.modalPresentationStyle = .overFullScreen
|
|
97
96
|
self.present(vc, animated: true, completion: nil)
|
|
98
97
|
}
|
|
99
|
-
customTopView.onWhatsAppTapped = {
|
|
100
|
-
let vc = ChatWithExpertViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
101
|
-
self.navigationController?.pushViewController(vc, animated: false)
|
|
102
|
-
}
|
|
103
98
|
updateBottomButtonState()
|
|
104
99
|
|
|
105
100
|
// Initialize the CBCentralManager with the current view controller as the delegate
|
|
@@ -25,6 +25,11 @@ class PutOnTheSensorViewController: UIViewController {
|
|
|
25
25
|
// Do any additional setup after loading the view.
|
|
26
26
|
setupLayout()
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
override func viewWillAppear(_ animated: Bool) {
|
|
30
|
+
super.viewWillAppear(animated)
|
|
31
|
+
CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
|
|
32
|
+
}
|
|
28
33
|
|
|
29
34
|
func setupLayout() {
|
|
30
35
|
tableView.delegate = self
|
|
@@ -52,32 +57,22 @@ class PutOnTheSensorViewController: UIViewController {
|
|
|
52
57
|
self.navigationController?.pushViewController(vc, animated: false)
|
|
53
58
|
}
|
|
54
59
|
|
|
55
|
-
customTopView
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
let webVC = WebViewController()
|
|
67
|
-
webVC.modalPresentationStyle = .formSheet
|
|
68
|
-
webVC.videoURL = URL(string: isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
|
|
69
|
-
self.present(webVC, animated: true, completion: nil)
|
|
70
|
-
}
|
|
71
|
-
|
|
60
|
+
CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
|
|
61
|
+
CustomTopViewSupportHelper.bindDemoAction(
|
|
62
|
+
customTopView: customTopView,
|
|
63
|
+
isForReconnect: UserDefaults.standard.bool(forKey: "isForReconnect"),
|
|
64
|
+
presenter: self
|
|
65
|
+
)
|
|
66
|
+
CustomTopViewSupportHelper.bindWhatsappAction(
|
|
67
|
+
customTopView: customTopView,
|
|
68
|
+
navigationController: navigationController
|
|
69
|
+
)
|
|
70
|
+
|
|
72
71
|
customTopView.onCloseTapped = {
|
|
73
72
|
let vc = ExitJourneyViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
74
73
|
vc.modalPresentationStyle = .overFullScreen
|
|
75
74
|
self.present(vc, animated: true, completion: nil)
|
|
76
75
|
}
|
|
77
|
-
customTopView.onWhatsAppTapped = {
|
|
78
|
-
let vc = ChatWithExpertViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
79
|
-
self.navigationController?.pushViewController(vc, animated: false)
|
|
80
|
-
}
|
|
81
76
|
}
|
|
82
77
|
|
|
83
78
|
}
|
|
@@ -37,10 +37,15 @@ class StartConnectionViewController: UIViewController {
|
|
|
37
37
|
|
|
38
38
|
override func viewDidLoad() {
|
|
39
39
|
super.viewDidLoad()
|
|
40
|
-
|
|
40
|
+
CustomerSupportConfig.shared.fetchIfNeeded()
|
|
41
41
|
setupLayout()
|
|
42
42
|
//checkForDevice()
|
|
43
43
|
}
|
|
44
|
+
|
|
45
|
+
override func viewWillAppear(_ animated: Bool) {
|
|
46
|
+
super.viewWillAppear(animated)
|
|
47
|
+
CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
|
|
48
|
+
}
|
|
44
49
|
|
|
45
50
|
func setupLayout() {
|
|
46
51
|
navigationController?.navigationBar.isHidden = true
|
|
@@ -92,36 +97,24 @@ class StartConnectionViewController: UIViewController {
|
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
|
|
95
|
-
customTopView
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
let webVC = WebViewController()
|
|
107
|
-
webVC.modalPresentationStyle = .formSheet // or .pageSheet, .fullScreen
|
|
108
|
-
webVC.videoURL = URL(string: isForReconnect == true ? reconnectionwatchCGMVideo : watchCGMVideo)
|
|
109
|
-
self.present(webVC, animated: true, completion: nil)
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
100
|
+
CustomTopViewSupportHelper.configureWhatsapp(customTopView: customTopView)
|
|
101
|
+
CustomTopViewSupportHelper.bindDemoAction(
|
|
102
|
+
customTopView: customTopView,
|
|
103
|
+
isForReconnect: isForReconnect,
|
|
104
|
+
presenter: self
|
|
105
|
+
)
|
|
106
|
+
CustomTopViewSupportHelper.bindWhatsappAction(
|
|
107
|
+
customTopView: customTopView,
|
|
108
|
+
navigationController: navigationController
|
|
109
|
+
)
|
|
110
|
+
|
|
113
111
|
customTopView.onCloseTapped = {
|
|
114
112
|
let vc = ExitJourneyViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
115
113
|
vc.modalPresentationStyle = .overFullScreen
|
|
116
114
|
self.present(vc, animated: true, completion: nil)
|
|
117
115
|
}
|
|
118
|
-
|
|
119
|
-
customTopView.onWhatsAppTapped = {
|
|
120
|
-
let vc = ChatWithExpertViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
|
|
121
|
-
self.navigationController?.pushViewController(vc, animated: false)
|
|
122
|
-
}
|
|
123
116
|
}
|
|
124
|
-
|
|
117
|
+
|
|
125
118
|
private func updateBottomButtonState() {
|
|
126
119
|
if isBluetoothEnabled && isLocationEnabled {
|
|
127
120
|
let isForReconnect = UserDefaults.standard.bool(forKey: "isForReconnect")
|