alqindiirsyam 3 yıl önce
ebeveyn
işleme
d19755f274

+ 6 - 5
appbuilder-ios/AppBuilder/AppBuilder/AppDelegate.swift

@@ -113,27 +113,28 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
                 if let json = try! JSONSerialization.jsonObject(with: data.data(using: String.Encoding.utf8)!, options: []) as? [[String: Any?]] {
                     for j in json {
                         if let firstTab = j["app_builder_url_first_tab"] as? String {
-                            print("first tab: \(firstTab)")
                             PrefsUtil.setURLFirstTab(value: firstTab)
                             ViewController.sURL = firstTab
                         }
                         if let thirdTab = j["app_builder_url_third_tab"] as? String {
-                            print("third tab: \(thirdTab)")
                             PrefsUtil.setURLThirdTab(value: thirdTab)
                             ViewController.tab3 = thirdTab
                         }
                         if let customTab = j["app_builder_custom_tab"] as? String {
-                            print("custom tab: \(customTab)")
                             PrefsUtil.setCustomTab(cust: customTab)
                         }
                         if let urlBase = j["app_builder_url_base"] as? String {
-                            print("url base: \(urlBase)")
                             PrefsUtil.setURLBase(value: urlBase)
                         }
                         if let urlQMS = j["app_builder_url_qms"] as? String {
-                            print("url base: \(urlQMS)")
                             PrefsUtil.setURLQMS(value: urlQMS)
                         }
+                        if let iconDock = j["app_builder_icon_dock"] as? String {
+                            PrefsUtil.setIconDock(value: iconDock)
+                        }
+                        if let iconSS = j["app_builder_icon_ss"] as? String {
+                            PrefsUtil.setIconSS(value: iconSS)
+                        }
                     }
                 }
             }

+ 7 - 4
appbuilder-ios/AppBuilder/AppBuilder/Base.lproj/LaunchScreen.storyboard

@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
@@ -9,10 +9,10 @@
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
-        <!--View Controller-->
+        <!--Launch Screen View Controller-->
         <scene sceneID="EHf-IW-A2E">
             <objects>
-                <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+                <viewController id="01J-lp-oVM" customClass="LaunchScreenViewController" customModule="DigiNetS" customModuleProvider="target" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
                         <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
@@ -33,6 +33,9 @@
                             <constraint firstItem="Dki-8X-fvw" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="ZXk-uU-Old"/>
                         </constraints>
                     </view>
+                    <connections>
+                        <outlet property="imageSS" destination="Dki-8X-fvw" id="Jzm-I3-1cF"/>
+                    </connections>
                 </viewController>
                 <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
             </objects>
@@ -40,7 +43,7 @@
         </scene>
     </scenes>
     <resources>
-        <image name="pb_icon" width="169" height="168"/>
+        <image name="pb_icon" width="1024" height="1024"/>
         <systemColor name="systemBackgroundColor">
             <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
         </systemColor>

+ 33 - 0
appbuilder-ios/AppBuilder/AppBuilder/LaunchScreenViewController.swift

@@ -0,0 +1,33 @@
+//
+//  LaunchScreenViewController.swift
+//  DigiNetS
+//
+//  Created by Qindi on 31/08/22.
+//
+
+import UIKit
+import NotificationBannerSwift
+import NexilisLite
+
+class LaunchScreenViewController: UIViewController {
+    @IBOutlet weak var imageSS: UIImageView!
+    
+    override func viewDidLoad() {
+        super.viewDidLoad()
+
+        if !CheckConnection.isConnectedToNetwork() {
+            let imageView = UIImageView(image: UIImage(systemName: "xmark.circle.fill"))
+            imageView.tintColor = .white
+            let banner = FloatingNotificationBanner(title: "Check your connection".localized(), subtitle: nil, titleFont: UIFont.systemFont(ofSize: 16), titleColor: nil, titleTextAlign: .left, subtitleFont: nil, subtitleColor: nil, subtitleTextAlign: nil, leftView: imageView, rightView: nil, style: .danger, colors: nil, iconPosition: .center)
+            banner.show()
+            return
+        }
+        if PrefsUtil.getIconDock() != nil {
+            let data = try? Data(contentsOf: URL(string: PrefsUtil.getUrlDock()!)!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
+            if data != nil {
+                imageSS.image = UIImage(data: data!)
+            }
+        }
+    }
+
+}

+ 18 - 0
appbuilder-ios/AppBuilder/AppBuilder/PrefsUtil.swift

@@ -55,6 +55,18 @@ class PrefsUtil {
     static func getURLQMS() -> String? {
         return UserDefaults.standard.string(forKey: "app_builder_url_qms")
     }
+    static func getIconDock() -> String? {
+        return UserDefaults.standard.string(forKey: "app_builder_icon_dock")
+    }
+    static func getIconSS() -> String? {
+        return UserDefaults.standard.string(forKey: "app_builder_icon_ss")
+    }
+    static func getUrlSS() -> String? {
+        return PrefsUtil.getURLBase()! + "dashboardv2/uploads/splashscreen/" + PrefsUtil.getIconSS()!
+    }
+    static func getUrlDock() -> String? {
+        return PrefsUtil.getURLBase()! + "dashboardv2/uploads/fb_icon/" + PrefsUtil.getIconDock()!
+    }
     
     static func setURLFirstTab(value: String) {
         UserDefaults.standard.set(value, forKey: "app_builder_url_first_tab")
@@ -69,6 +81,12 @@ class PrefsUtil {
     static func setURLQMS(value: String) {
         UserDefaults.standard.set(value, forKey: "app_builder_url_qms")
     }
+    static func setIconDock(value: String) {
+        UserDefaults.standard.set(value, forKey: "app_builder_icon_dock")
+    }
+    static func setIconSS(value: String) {
+        UserDefaults.standard.set(value, forKey: "app_builder_icon_ss")
+    }
     
     static func getTerms() -> Bool {
         return UserDefaults.standard.bool(forKey: "terms_app")

+ 47 - 1
appbuilder-ios/AppBuilder/AppBuilder/SceneDelegate.swift

@@ -10,7 +10,7 @@ import UIKit
 class SceneDelegate: UIResponder, UIWindowSceneDelegate {
 
     var window: UIWindow?
-
+    var splashWindow: UIWindow?
 
     func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
         // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
@@ -29,6 +29,39 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
     func sceneDidBecomeActive(_ scene: UIScene) {
         // Called when the scene has moved from an inactive state to an active state.
         // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
+        if let launchStoryboardName = InfoPList.launchStoryboardName,
+                   let windowScene          = self.window?.windowScene
+        {
+            splashWindow = splashWindow ??
+            {
+                let window = UIWindow(windowScene: windowScene)
+                    window.windowLevel = .statusBar
+
+                let storyboard = UIStoryboard(name: launchStoryboardName, bundle: nil)
+
+                window.rootViewController = storyboard.instantiateInitialViewController()
+                window.isHidden           = false
+
+                // ⏳Wait for 5 seconds, then remove.
+                //
+                DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(2))
+                {
+                    UIView.animate(withDuration: -1, // system default
+                        animations:
+                        {
+                            self.splashWindow?.alpha = 0
+                        },
+                        completion:
+                        { _ in
+                            self.splashWindow?.isHidden = true
+                            self.splashWindow = nil
+                        }
+                    )
+                }
+
+                return window
+            }()
+        }
     }
 
     func sceneWillResignActive(_ scene: UIScene) {
@@ -50,3 +83,16 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
 
 }
 
+struct InfoPList
+{
+    private static func value(for name: String) -> String? { Bundle.main.object(forInfoDictionaryKey: name) as? String }
+
+    static var bundleIdentifier:         String? { self.value(for: "CFBundleIdentifier") }
+    static var bundleDisplayName:        String? { self.value(for: "CFBundleDisplayName") }
+    static var bundleShortVersionString: String? { self.value(for: "CFBundleShortVersionString") }
+    static var bundleVersion:            String? { self.value(for: "CFBundleVersion") }
+
+    static var launchStoryboardName: String? { self.value(for: "UILaunchStoryboardName") }
+    static var mainStoryboardName:   String? { self.value(for: "UIMainStoryboardFile") }
+}
+

+ 36 - 3
appbuilder-ios/AppBuilder/AppBuilder/ViewController.swift

@@ -116,7 +116,18 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
 //                }),
             ]
             let menu = UIMenu(title: "", children: childrenMenu)
-            navigationItem.rightBarButtonItem = UIBarButtonItem(image: resizeImage(image: UIImage(named: "pb_button", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), primaryAction: .none, menu: menu)
+            if PrefsUtil.getIconDock() != nil {
+                DispatchQueue.global().async {
+                    let data = try? Data(contentsOf: URL(string: PrefsUtil.getUrlDock()!)!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
+                    DispatchQueue.main.async {
+                        if data != nil {
+                            self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: self.resizeImage(image: UIImage(data: data!)!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), primaryAction: .none, menu: menu)
+                        }
+                    }
+                }
+            } else {
+                navigationItem.rightBarButtonItem = UIBarButtonItem(image: resizeImage(image: UIImage(named: "pb_button", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), primaryAction: .none, menu: menu)
+            }
         }
         if((cpaasMode == PrefsUtil.CPAAS_MODE_DOCKED || cpaasMode == PrefsUtil.CPAAS_MODE_MIX)){
             createMidFloatingButton()
@@ -287,7 +298,18 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
         print("buttonCenterX \(buttonCenterX)")
         print("buttonCenterY \(buttonCenterY)")
         ViewController.middleButton = UIButton(frame: CGRect(x: buttonCenterX - 50 , y: buttonCenterY - 55, width: 100, height: 100))
-        ViewController.middleButton.setBackgroundImage(UIImage(named: "pb_button", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
+        if PrefsUtil.getIconDock() != nil {
+            DispatchQueue.global().async {
+                let data = try? Data(contentsOf: URL(string: PrefsUtil.getUrlDock()!)!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
+                DispatchQueue.main.async {
+                    if data != nil {
+                        ViewController.middleButton.setBackgroundImage(UIImage(data: data!), for: .normal)
+                    }
+                }
+            }
+        } else {
+            ViewController.middleButton.setBackgroundImage(UIImage(named: "pb_button", in: Bundle.resourceBundle(for: Nexilis.self), with: nil), for: .normal)
+        }
         ViewController.middleButton.layer.shadowColor = UIColor.black.cgColor
         ViewController.middleButton.layer.shadowOffset = CGSize(width: 0.0, height: 2.0)
         ViewController.middleButton.layer.shadowOpacity = 1.0
@@ -344,7 +366,18 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
                 childrenMenu.append(contentsOf: vc.childrenMenu)
             }
             let menu = UIMenu(title: "", children: childrenMenu)
-            navigationItem.rightBarButtonItem = UIBarButtonItem(image: resizeImage(image: UIImage(named: "pb_button", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), primaryAction: .none, menu: menu)
+            if PrefsUtil.getIconDock() != nil {
+                DispatchQueue.global().async {
+                    let data = try? Data(contentsOf: URL(string: PrefsUtil.getUrlDock()!)!) //make sure your image in this url does exist, otherwise unwrap in a if let check / try-catch
+                    DispatchQueue.main.async {
+                        if data != nil {
+                            self.navigationItem.rightBarButtonItem = UIBarButtonItem(image: self.resizeImage(image: UIImage(data: data!)!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), primaryAction: .none, menu: menu)
+                        }
+                    }
+                }
+            } else {
+                navigationItem.rightBarButtonItem = UIBarButtonItem(image: resizeImage(image: UIImage(named: "pb_button", in: Bundle.resourceBundle(for: Nexilis.self), with: nil)!, targetSize: CGSize(width: 25, height: 25)).withRenderingMode(.alwaysOriginal), primaryAction: .none, menu: menu)
+            }
         }
     }