kevin 3 yıl önce
ebeveyn
işleme
bb96087ddf

+ 15 - 9
appbuilder-ios/AppBuilder/AppBuilder/FirstTabViewController.swift

@@ -25,6 +25,9 @@ class FirstTabViewController: UIViewController, WKUIDelegate, UIScrollViewDelega
     let audioEngine = AVAudioEngine()
     var alertController = UIAlertController()
     
+    var dateRefresh: Date?
+    public static var forceRefresh = false
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         let cpaasMode = PrefsUtil.getCpaasMode()
@@ -89,16 +92,19 @@ class FirstTabViewController: UIViewController, WKUIDelegate, UIScrollViewDelega
                 }
             }
         }
-        print(address)
-        if let u = myURL{
-            let lang = UserDefaults.standard.string(forKey: "i18n_language")
-            var intLang = 0
-            if lang == "id" {
-                intLang = 1
+        if let u = myURL {
+            if dateRefresh == nil || Int(Date().timeIntervalSince(dateRefresh!)) >= 60 || FirstTabViewController.forceRefresh {
+                let lang = UserDefaults.standard.string(forKey: "i18n_language")
+                var intLang = 0
+                if lang == "id" {
+                    intLang = 1
+                }
+                self.webView.evaluateJavaScript("{window.localStorage.lang = \(intLang)}")
+                let myRequest = URLRequest(url: u)
+                webView.load(myRequest)
             }
-            self.webView.evaluateJavaScript("{window.localStorage.lang = \(intLang)}")
-            let myRequest = URLRequest(url: u)
-            webView.load(myRequest)
+            dateRefresh = Date()
+            FirstTabViewController.forceRefresh = false
         }
         self.navigationController?.navigationBar.topItem?.title = Bundle.main.displayName
         let cpaasMode = PrefsUtil.getCpaasMode()

+ 2 - 0
appbuilder-ios/AppBuilder/AppBuilder/FourthTabViewController.swift

@@ -374,6 +374,8 @@ public class FourthTabViewController: UIViewController, UITableViewDelegate, UIT
                 let lang = self.language[selectedIndex].values.first
                 UserDefaults.standard.set(lang, forKey: "i18n_language")
                 self.viewDidLoad()
+                FirstTabViewController.forceRefresh = true
+                ThirdTabViewController.forceRefresh = true
             }))
             self.present(alert, animated: true, completion: nil)
         } else if item.title == "Change Device".localized() {

+ 15 - 7
appbuilder-ios/AppBuilder/AppBuilder/ThirdTabViewController.swift

@@ -25,6 +25,9 @@ class ThirdTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
     let audioEngine = AVAudioEngine()
     var alertController = UIAlertController()
     
+    var dateRefresh: Date?
+    public static var forceRefresh = false
+    
     override func viewDidLoad() {
         super.viewDidLoad()
         let tapGesture = UITapGestureRecognizer(target: self, action: #selector(collapseDocked))
@@ -88,14 +91,19 @@ class ThirdTabViewController: UIViewController, UIScrollViewDelegate, UIGestureR
         }
         print(address)
         if let u = myURL{
-            let lang = UserDefaults.standard.string(forKey: "i18n_language")
-            var intLang = 0
-            if lang == "id" {
-                intLang = 1
+            if dateRefresh == nil || Int(Date().timeIntervalSince(dateRefresh!)) >= 60 || ThirdTabViewController.forceRefresh {
+                let lang = UserDefaults.standard.string(forKey: "i18n_language")
+                var intLang = 0
+                if lang == "id" {
+                    intLang = 1
+                }
+                print("idLang \(intLang)")
+                self.webView.evaluateJavaScript("{window.localStorage.lang = \(intLang)}")
+                let myRequest = URLRequest(url: u)
+                webView.load(myRequest)
             }
-            self.webView.evaluateJavaScript("{window.localStorage.lang = \(intLang)}")
-            let myRequest = URLRequest(url: u)
-            webView.load(myRequest)
+            dateRefresh = Date()
+            ThirdTabViewController.forceRefresh = false
         }
         self.navigationController?.navigationBar.topItem?.title = Bundle.main.displayName
         let cpaasMode = PrefsUtil.getCpaasMode()

+ 1 - 1
appbuilder-ios/AppBuilder/AppBuilder/ViewController.swift

@@ -163,7 +163,7 @@ class ViewController: UITabBarController, UITabBarControllerDelegate {
                 
                  
             }))
-            alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
                 ViewController.resetTabSelected()
                 let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
                 let navigationController = UINavigationController(rootViewController: controller)

+ 2 - 2
appbuilder-ios/NexilisLite/Nexilis.swift

@@ -1707,7 +1707,7 @@ extension Nexilis: MessageDelegate {
                                                 if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: "SELECT first_name, last_name FROM BUDDY where f_pin = '\(UserDefaults.standard.string(forKey: "me")!)'"), cursorData.next() {
                                                     if (cursorData.string(forColumnIndex: 0)! + " " + cursorData.string(forColumnIndex: 1)!).trimmingCharacters(in: .whitespaces) == "USR\(UserDefaults.standard.string(forKey: "me")!)" {
                                                         let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-                                                        alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+                                                        alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
                                                             let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
                                                             let navigationController = UINavigationController(rootViewController: controller)
                                                             navigationController.modalPresentationStyle = .custom
@@ -1784,7 +1784,7 @@ extension Nexilis: MessageDelegate {
                             if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: "SELECT first_name, last_name FROM BUDDY where f_pin = '\(UserDefaults.standard.string(forKey: "me")!)'"), cursorData.next() {
                                 if (cursorData.string(forColumnIndex: 0)! + " " + cursorData.string(forColumnIndex: 1)!).trimmingCharacters(in: .whitespaces) == "USR\(UserDefaults.standard.string(forKey: "me")!)" {
                                     let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-                                    alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+                                    alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
                                         let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
                                         let navigationController = UINavigationController(rootViewController: controller)
                                         navigationController.modalPresentationStyle = .custom

+ 2 - 0
appbuilder-ios/NexilisLite/NexilisLite/Resource/id.lproj/Localizable.strings

@@ -84,6 +84,7 @@
 "Powered by Qmera" = "Dipersembahkan oleh Qmera";
 "Powered by Nexilis" = "Dipersembahkan oleh Nexilis";
 "Sign-Up (Change profile)" = "Daftar (Ganti Profil)";
+"Change Profile" = "Ganti Profil";
 "Sign-In (Change Device)" = "Masuk (Ganti Perangkat)";
 "Successfully Logout" = "Berhasil Keluar";
 "Successfully changed device" = "Berhasil masuk/ganti perangkat";
@@ -102,3 +103,4 @@
 "To use Gaspol Web, go to gaspol.co.id on your computer." = "Untuk dapat menggunakan Gaspol Web, pergi ke halaman gaspol.co.id pada komputer anda.";
 "Select" = "Pilih";
 "Select Language" = "Pilih Bahasa";
+"You must change your name to use this feature" = "Anda harus mengubah nama anda agar dapat meggunakan fitur ini";

+ 7 - 7
appbuilder-ios/NexilisLite/NexilisLite/Source/FloatingButton/FloatingButton.swift

@@ -365,7 +365,7 @@ public class FloatingButton: UIView {
         let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
         if !isChangeProfile {
             let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
                 let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
                 let navigationController = UINavigationController(rootViewController: controller)
                 navigationController.modalPresentationStyle = .custom
@@ -402,7 +402,7 @@ public class FloatingButton: UIView {
         let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
         if !isChangeProfile {
             let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
                 let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
                 let navigationController = UINavigationController(rootViewController: controller)
                 navigationController.modalPresentationStyle = .custom
@@ -456,7 +456,7 @@ public class FloatingButton: UIView {
         let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
         if !isChangeProfile {
             let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
                 let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
                 let navigationController = UINavigationController(rootViewController: controller)
                 navigationController.modalPresentationStyle = .custom
@@ -500,7 +500,7 @@ public class FloatingButton: UIView {
         let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
         if !isChangeProfile {
             let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
                 let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
                 let navigationController = UINavigationController(rootViewController: controller)
                 navigationController.modalPresentationStyle = .custom
@@ -545,7 +545,7 @@ public class FloatingButton: UIView {
         let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
         if !isChangeProfile {
             let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
                 let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
                 let navigationController = UINavigationController(rootViewController: controller)
                 navigationController.modalPresentationStyle = .custom
@@ -589,7 +589,7 @@ public class FloatingButton: UIView {
         let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
         if !isChangeProfile {
             let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
                 let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
                 let navigationController = UINavigationController(rootViewController: controller)
                 navigationController.modalPresentationStyle = .custom
@@ -627,7 +627,7 @@ public class FloatingButton: UIView {
         let isChangeProfile = UserDefaults.standard.bool(forKey: "is_change_profile")
         if !isChangeProfile {
             let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-            alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+            alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
                 let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
                 let navigationController = UINavigationController(rootViewController: controller)
                 navigationController.modalPresentationStyle = .custom

+ 1 - 1
appbuilder-ios/NexilisLite/NexilisLite/Source/Nexilis.swift

@@ -2449,7 +2449,7 @@ extension Nexilis: MessageDelegate {
                             if let cursorData = Database.shared.getRecords(fmdb: fmdb, query: "SELECT first_name, last_name FROM BUDDY where f_pin = '\(UserDefaults.standard.string(forKey: "me")!)'"), cursorData.next() {
                                 if (cursorData.string(forColumnIndex: 0)! + " " + cursorData.string(forColumnIndex: 1)!).trimmingCharacters(in: .whitespaces) == "USR\(UserDefaults.standard.string(forKey: "me")!)" {
                                     let alert = UIAlertController(title: "Change Profile".localized(), message: "You must change your name to use this feature".localized(), preferredStyle: .alert)
-                                    alert.addAction(UIAlertAction(title: "Ok".localized(), style: UIAlertAction.Style.default, handler: {(_) in
+                                    alert.addAction(UIAlertAction(title: "OK".localized(), style: UIAlertAction.Style.default, handler: {(_) in
                                         let controller = AppStoryBoard.Palio.instance.instantiateViewController(withIdentifier: "changeNS") as! ChangeNamePassswordViewController
                                         let navigationController = UINavigationController(rootViewController: controller)
                                         navigationController.modalPresentationStyle = .custom