diff --git a/TraccarClient.xcodeproj/project.pbxproj b/TraccarClient.xcodeproj/project.pbxproj index 157c2ef546b59b85fca786fbcb3380ea288b9893..8cbe72ed35d8a44db17fceb3d4fcbe478648fcea 100644 --- a/TraccarClient.xcodeproj/project.pbxproj +++ b/TraccarClient.xcodeproj/project.pbxproj @@ -113,6 +113,8 @@ 53B6DB792B6113E6000C1083 /* FirebaseRemoteConfig in Frameworks */ = {isa = PBXBuildFile; productRef = 53B6DB782B6113E6000C1083 /* FirebaseRemoteConfig */; }; 53B6DB7B2B6113E6000C1083 /* FirebaseRemoteConfigSwift in Frameworks */ = {isa = PBXBuildFile; productRef = 53B6DB7A2B6113E6000C1083 /* FirebaseRemoteConfigSwift */; }; 53B6DB7D2B611C12000C1083 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 53B6DB7C2B611C12000C1083 /* GoogleService-Info.plist */; }; + 53B6DB7F2B61371A000C1083 /* LeaderNavigationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53B6DB7E2B61371A000C1083 /* LeaderNavigationView.swift */; }; + 53B6DB822B61376B000C1083 /* LeaderNavigationView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 53B6DB812B61376B000C1083 /* LeaderNavigationView.xib */; }; 53D62E3F2AEFA31200C80BAC /* InitialViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53D62E3D2AEFA31200C80BAC /* InitialViewController.swift */; }; 53D62E402AEFA31200C80BAC /* InitialViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 53D62E3E2AEFA31200C80BAC /* InitialViewController.xib */; }; 53D62E432AEFA4DC00C80BAC /* Lottie in Frameworks */ = {isa = PBXBuildFile; productRef = 53D62E422AEFA4DC00C80BAC /* Lottie */; }; @@ -295,6 +297,8 @@ 53A306202B0CA92900FAEA00 /* TrackingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrackingView.swift; sourceTree = "<group>"; }; 53A306222B0CAF7800FAEA00 /* TrackingView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TrackingView.xib; sourceTree = "<group>"; }; 53B6DB7C2B611C12000C1083 /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; }; + 53B6DB7E2B61371A000C1083 /* LeaderNavigationView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeaderNavigationView.swift; sourceTree = "<group>"; }; + 53B6DB812B61376B000C1083 /* LeaderNavigationView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = LeaderNavigationView.xib; sourceTree = "<group>"; }; 53D62E3D2AEFA31200C80BAC /* InitialViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InitialViewController.swift; sourceTree = "<group>"; }; 53D62E3E2AEFA31200C80BAC /* InitialViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = InitialViewController.xib; sourceTree = "<group>"; }; 53EBC5FC2AF199FF00601AA7 /* SettingsTextTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsTextTableViewCell.swift; sourceTree = "<group>"; }; @@ -497,6 +501,7 @@ 53200CEB2B60F94300D1445D /* Leader */ = { isa = PBXGroup; children = ( + 53B6DB802B61375A000C1083 /* CustomView */, 53200CF02B60FB5800D1445D /* LeaderViewController.swift */, 53200CF12B60FB5800D1445D /* LeaderViewController.xib */, 53200CF42B60FBE400D1445D /* SecurityManager.swift */, @@ -738,6 +743,15 @@ path = TrackingView; sourceTree = "<group>"; }; + 53B6DB802B61375A000C1083 /* CustomView */ = { + isa = PBXGroup; + children = ( + 53B6DB7E2B61371A000C1083 /* LeaderNavigationView.swift */, + 53B6DB812B61376B000C1083 /* LeaderNavigationView.xib */, + ); + name = CustomView; + sourceTree = "<group>"; + }; 53D62E3C2AEFA2F800C80BAC /* InitialViewController */ = { isa = PBXGroup; children = ( @@ -1036,6 +1050,7 @@ 5326835B2AE91A6F00A364C0 /* Montserrat-BlackItalic.ttf in Resources */, 53554AE12AED1B480018BAEE /* ButtonTableViewCell.xib in Resources */, CEF6433D1B91AA9400195CEA /* Localizable.strings in Resources */, + 53B6DB822B61376B000C1083 /* LeaderNavigationView.xib in Resources */, 532683552AE91A6F00A364C0 /* Montserrat-Italic.ttf in Resources */, 53D62E402AEFA31200C80BAC /* InitialViewController.xib in Resources */, 5326833D2AE9175900A364C0 /* LoginViewController.xib in Resources */, @@ -1163,6 +1178,7 @@ 53A306212B0CA92900FAEA00 /* TrackingView.swift in Sources */, 532683752AE923A500A364C0 /* KNTextFieldView+Protocols.swift in Sources */, 532683A52AE94A3500A364C0 /* KNTextField.swift in Sources */, + 53B6DB7F2B61371A000C1083 /* LeaderNavigationView.swift in Sources */, 53157EDA2AEE57FA003C9B6A /* UITextView.swift in Sources */, 5E716A2B1F63A60800A2DBC3 /* ProtocolFormatter.swift in Sources */, 53F10AE62AF05E97004D0529 /* AuthenticationCoordinator.swift in Sources */, @@ -1333,7 +1349,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = Z7STA3KGEU; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -1347,7 +1363,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 2.0.0; OTHER_SWIFT_FLAGS = "-D FIREBASE"; PRODUCT_BUNDLE_IDENTIFIER = com.nmo.ai.teams; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -1509,7 +1525,7 @@ CODE_SIGN_ENTITLEMENTS = TraccarClient/TraccarClient.entitlements; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = Z7STA3KGEU; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -1523,7 +1539,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 2.0.0; PRODUCT_BUNDLE_IDENTIFIER = com.nmo.ai.teams; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; @@ -1547,7 +1563,7 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 9; + CURRENT_PROJECT_VERSION = 1; DEFINES_MODULE = YES; DEVELOPMENT_TEAM = Z7STA3KGEU; FRAMEWORK_SEARCH_PATHS = "$(inherited)"; @@ -1561,7 +1577,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 2.0.0; PRODUCT_BUNDLE_IDENTIFIER = com.nmo.ai.teams; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE = ""; diff --git a/TraccarClient.xcodeproj/project.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate b/TraccarClient.xcodeproj/project.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate index ca2ee36d332c6991f58bfd543fe228feb8d49282..4a0b837f0ed7a6ab3b29628648c9aca0c4e86705 100644 Binary files a/TraccarClient.xcodeproj/project.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate and b/TraccarClient.xcodeproj/project.xcworkspace/xcuserdata/g.makhoul.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/TraccarClient/LeaderNavigationView.swift b/TraccarClient/LeaderNavigationView.swift new file mode 100644 index 0000000000000000000000000000000000000000..437b810a7591c45382a0e84cb71af69580db4d26 --- /dev/null +++ b/TraccarClient/LeaderNavigationView.swift @@ -0,0 +1,35 @@ +// +// LeaderNavigationView.swift +// TraccarClient +// +// Created by George Makhoul on 24/01/2024. +// Copyright © 2024 Traccar. All rights reserved. +// + +import UIKit +protocol LeaderNavigationViewDelegate { + func back() +} + +class LeaderNavigationView: KNComponentView { + // MARK: - Outlet + @IBOutlet private var view: UIView! + @IBOutlet weak var backButton: UIButton! + + // MARK: - Properties + var delegate: LeaderNavigationViewDelegate? + + // MARK: - Lifecycle + override func setupNib() { + super.setupNib() + + view.frame = bounds + view.autoresizingMask = [.flexibleHeight, .flexibleWidth] + backButton.setTitle("", for: .normal) + + } + + @IBAction func backPressed(_ sender: UIButton) { + delegate?.back() + } +} diff --git a/TraccarClient/LeaderNavigationView.xib b/TraccarClient/LeaderNavigationView.xib new file mode 100644 index 0000000000000000000000000000000000000000..4c25cd9e0e0cd0329a33d9aa8fafd7da4aae01a0 --- /dev/null +++ b/TraccarClient/LeaderNavigationView.xib @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> + <device id="retina6_12" orientation="portrait" appearance="light"/> + <dependencies> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/> + <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="System colors in document resources" minToolsVersion="11.0"/> + <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + </dependencies> + <objects> + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="LeaderNavigationView" customModule="TraccarClient" customModuleProvider="target"> + <connections> + <outlet property="backButton" destination="kKg-l7-Bla" id="eTM-Ra-gUz"/> + <outlet property="view" destination="iN0-l3-epB" id="uRD-qv-kd7"/> + </connections> + </placeholder> + <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> + <view contentMode="scaleToFill" id="iN0-l3-epB"> + <rect key="frame" x="0.0" y="0.0" width="393" height="147"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> + <subviews> + <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kKg-l7-Bla"> + <rect key="frame" x="12" y="66" width="40" height="40"/> + <constraints> + <constraint firstAttribute="height" constant="40" id="9Fg-1L-EGB"/> + <constraint firstAttribute="width" constant="40" id="tNI-96-eMa"/> + </constraints> + <state key="normal" title="Button"/> + <buttonConfiguration key="configuration" style="plain" image="back"/> + <connections> + <action selector="backPressed:" destination="-1" eventType="touchUpInside" id="nKi-0Y-ebE"/> + </connections> + </button> + </subviews> + <viewLayoutGuide key="safeArea" id="vUN-kp-3ea"/> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstItem="kKg-l7-Bla" firstAttribute="centerY" secondItem="vUN-kp-3ea" secondAttribute="centerY" id="6nc-MQ-Tqe"/> + <constraint firstItem="kKg-l7-Bla" firstAttribute="leading" secondItem="vUN-kp-3ea" secondAttribute="leading" constant="12" id="XMj-4K-oRQ"/> + </constraints> + <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/> + <point key="canvasLocation" x="-298.47328244274809" y="-194.01408450704227"/> + </view> + </objects> + <resources> + <image name="back" width="32" height="32"/> + <systemColor name="systemBackgroundColor"> + <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + </systemColor> + </resources> +</document> diff --git a/TraccarClient/LeaderViewController.swift b/TraccarClient/LeaderViewController.swift index a03216a747392aaf55ad8cf302c1897770dc244e..e3524b33171a4df8ed6172769b2eea9599cb0a18 100644 --- a/TraccarClient/LeaderViewController.swift +++ b/TraccarClient/LeaderViewController.swift @@ -11,6 +11,9 @@ import WebKit class LeaderViewController: KNViewController, WKUIDelegate { + @IBOutlet weak var leaderNavigationBar: LeaderNavigationView! + @IBOutlet weak var NavBarHeight: NSLayoutConstraint! + static let eventLogin = Notification.Name("eventLogin") static let eventToken = Notification.Name("eventToken") static let eventEvent = Notification.Name("eventEvent") @@ -21,11 +24,14 @@ class LeaderViewController: KNViewController, WKUIDelegate { var webView: WKWebView! var initialized = false var pendingEventId: String? = nil - + + @IBOutlet weak var webViewOut: UIView! + override func viewDidLoad() { super.viewDidLoad() self.isBackButtonHidden = true hasCustomNavigation = true + leaderNavigationBar.delegate = self onStart() } @@ -67,7 +73,7 @@ class LeaderViewController: KNViewController, WKUIDelegate { let userDefaults = UserDefaults.standard let statusFrame = UIApplication.shared.statusBarFrame - var viewFrame = view.frame + var viewFrame = webViewOut.frame viewFrame.origin.y = statusFrame.size.height viewFrame.size.height -= statusFrame.size.height @@ -105,7 +111,7 @@ class LeaderViewController: KNViewController, WKUIDelegate { self.webView.uiDelegate = self self.webView.autoresizingMask = [.flexibleWidth, .flexibleHeight] - view.addSubview(self.webView) + webViewOut.addSubview(self.webView) group.notify(queue: DispatchQueue.main) { self.initialized = true @@ -177,6 +183,8 @@ extension LeaderViewController : WKScriptMessageHandler { func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) { if let body = message.body as? String { if body.starts(with: "login") { + leaderNavigationBar.isHidden = true + NavBarHeight.constant = 0 if body.count > 6 { let token = String(body[body.index(body.startIndex, offsetBy: 6)...]) print("token: \(token)") @@ -192,6 +200,7 @@ extension LeaderViewController : WKScriptMessageHandler { SecurityManager.shared.deleteToken() self.navigationController?.popViewController(animated: true) } else if body.starts(with: "server") { + let urlString = String(body[body.index(body.startIndex, offsetBy: 7)...]) UserDefaults.standard.set(urlString, forKey: "url") if let url = URL(string: urlString) { @@ -204,3 +213,9 @@ extension LeaderViewController : WKScriptMessageHandler { } +// MARK: - LeaderNavigationViewDelegate +extension LeaderViewController: LeaderNavigationViewDelegate { + func back() { + self.navigationController?.popViewController(animated: true) + } +} diff --git a/TraccarClient/LeaderViewController.xib b/TraccarClient/LeaderViewController.xib index c644d130f734a8328361c03098788f3e5290bc33..3d555bd29bc24870dec0541284e16feca1e848d8 100644 --- a/TraccarClient/LeaderViewController.xib +++ b/TraccarClient/LeaderViewController.xib @@ -1,22 +1,56 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13142" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> +<?xml version="1.0" encoding="UTF-8"?> +<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> + <device id="retina6_12" orientation="portrait" appearance="light"/> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/> + <deployment identifier="iOS"/> + <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> + <capability name="System colors in document resources" minToolsVersion="11.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> </dependencies> <objects> - <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="LeaderViewController" customModuleProvider="target"> + <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="LeaderViewController" customModule="TraccarClient" customModuleProvider="target"> <connections> + <outlet property="NavBarHeight" destination="9Uo-bd-Xh6" id="SfY-jI-rMS"/> + <outlet property="leaderNavigationBar" destination="gWz-ZM-Oaf" id="Q4t-vg-MhS"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> + <outlet property="webViewOut" destination="NiW-u8-aPl" id="NGx-In-URX"/> </connections> </placeholder> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT"> - <rect key="frame" x="0.0" y="0.0" width="375" height="667"/> + <rect key="frame" x="0.0" y="0.0" width="393" height="852"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> - <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> + <subviews> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gWz-ZM-Oaf" customClass="LeaderNavigationView" customModule="TraccarClient" customModuleProvider="target"> + <rect key="frame" x="0.0" y="0.0" width="393" height="60"/> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstAttribute="height" constant="60" id="9Uo-bd-Xh6"/> + </constraints> + </view> + <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NiW-u8-aPl"> + <rect key="frame" x="0.0" y="60" width="393" height="758"/> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + </view> + </subviews> <viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/> + <color key="backgroundColor" systemColor="systemBackgroundColor"/> + <constraints> + <constraint firstItem="gWz-ZM-Oaf" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="2zQ-Aa-rjL"/> + <constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="NiW-u8-aPl" secondAttribute="bottom" id="39T-Hf-Vuj"/> + <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="NiW-u8-aPl" secondAttribute="trailing" id="3PS-pC-UEY"/> + <constraint firstItem="gWz-ZM-Oaf" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" id="3tY-qI-WAY"/> + <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="gWz-ZM-Oaf" secondAttribute="trailing" id="eg4-Gg-4of"/> + <constraint firstItem="NiW-u8-aPl" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="mcJ-xz-ZCw"/> + <constraint firstItem="NiW-u8-aPl" firstAttribute="top" secondItem="gWz-ZM-Oaf" secondAttribute="bottom" id="oPF-6J-SBI"/> + </constraints> + <point key="canvasLocation" x="139.69465648854961" y="20.422535211267608"/> </view> </objects> + <resources> + <systemColor name="systemBackgroundColor"> + <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> + </systemColor> + </resources> </document>