Browse Source

- update api login
- update api list berita
- update api detail berita
- fix bug saat buka menu lainnya menu tidak berubah berdasarkan role yang di pilih

Hendi 3 years ago
parent
commit
4cb6f09ff5

+ 1 - 1
Podfile.lock

@@ -185,4 +185,4 @@ SPEC CHECKSUMS:
 
 PODFILE CHECKSUM: 105f4c100eddf8320c57ac256906df5b70fcf20f
 
-COCOAPODS: 1.9.0.beta.2
+COCOAPODS: 1.11.3

BIN
Sirani.xcworkspace/xcuserdata/mac.xcuserdatad/UserInterfaceState.xcuserstate


+ 3 - 3
Sirani/ApiServices/SiraniApiServices.swift

@@ -28,7 +28,7 @@ class SiraniApiServices {
         let headers: HTTPHeaders = ["Accept" : "Application/json; charset=utf-8"]
         let body: Parameters = ["username" : username, "password" : password]
         
-        return AF.request(METHOD_LOGIN, method: .post, parameters: body, encoding: URLEncoding.default, headers: headers)
+        return AF.request(METHOD_LOGIN_NEW, method: .post, parameters: body, encoding: URLEncoding.default, headers: headers)
     }
     
     // Images Slider -> Home
@@ -52,7 +52,7 @@ class SiraniApiServices {
             "keyword" : keyword
         ]
         
-        return AF.request(METHOD_GET_NEWS, method: .post, parameters: body, encoding: URLEncoding.default, headers: headers)
+        return AF.request(METHOD_GET_NEWS_NEW, method: .post, parameters: body, encoding: URLEncoding.default, headers: headers)
     }
     
     // Notification Total -> Home
@@ -139,7 +139,7 @@ class SiraniApiServices {
             "id" : String(newsId)
         ]
         
-        return AF.request(METHOD_GET_NEWS_DETAIL, method: .post, parameters: body, encoding: URLEncoding.default, headers: headers)
+        return AF.request(METHOD_GET_NEWS_DETAIL_NEW, method: .post, parameters: body, encoding: URLEncoding.default, headers: headers)
     }
     
     // QR Code Result

+ 11 - 0
Sirani/ApiServices/UriConstants.swift

@@ -14,9 +14,16 @@ let HOST_API = "https://sertifikasi.postel.go.id/esertifikasi_mobile/"
 let API = "api/"
 let VERSION = "v1/"
 
+// BASE URL NEW
+let HOST_API_NEW = "https://sertifikasi.postel.go.id/sirani_sertifikasi/"
+let SIMPONI = "simponi/"
+
 // AUTH
 let METHOD_LOGIN = "\(HOST_API)\(API)\(VERSION)Auth_login"
 
+// AUTH NEW
+let METHOD_LOGIN_NEW = "\(HOST_API_NEW)\(API)\(VERSION)\(SIMPONI)Auth_login"
+
 // HOME
 let METHOD_GET_TOTAL_UNREAD_NOTIF = "\(HOST_API)\(API)\(VERSION)NotifikasiRealtime"
 let METHOD_GET_TOTAL_NOTIFIKASI = "\(HOST_API)\(API)\(VERSION)Notifikasi"
@@ -26,6 +33,10 @@ let METHOD_GET_NEWS_DETAIL = "\(HOST_API)\(API)\(VERSION)Flashnewsdetail"
 let METHOD_GET_FAQ_CATEGORY = "\(HOST_API)\(API)\(VERSION)Faq/Category"
 let METHOD_GET_FAQ_CONTENT = "\(HOST_API)\(API)\(VERSION)Faq/Content"
 
+//HOME NEW
+let METHOD_GET_NEWS_NEW = "\(HOST_API_NEW)\(API)\(VERSION)Flashnews"
+let METHOD_GET_NEWS_DETAIL_NEW = "\(HOST_API_NEW)\(API)\(VERSION)Flashnewsdetail"
+
 // NOTIFICATIONS
 let METHOD_GET_PUSH_NOTIF_LIST = "\(HOST_API)\(API)\(VERSION)NotifikasiRealtime/list"
 let METHOD_GET_PUSH_NOTIF_DETAIL = "\(HOST_API)\(API)\(VERSION)NotifikasiRealtime/detail"

+ 5 - 6
Sirani/View/Home/HomeVC.swift

@@ -192,11 +192,10 @@ class HomeVC: UIViewController {
             showMoreMenu()
         }
         
-        let roleId = UserState.instance.getRoleId()
-        
-        if (userRoleId != roleId) {
-            userRoleId = roleId
-            
+//        let roleId = UserState.instance.getRoleId()
+//        if (userRoleId != roleId) {
+//            userRoleId = roleId
+//
             if !userRoleId.isEmpty {
                 clearMoreMenu()
                 setMoreMenuAplikasiODS(userRoleId: userRoleId)
@@ -215,7 +214,7 @@ class HomeVC: UIViewController {
                 clearMoreMenuNotifData()
                 hideNotif()
             }
-        }
+//        }
     }
     
     override func viewWillDisappear(_ animated: Bool) {

+ 1 - 1
Sirani/View/News/Detail/NewsDetailPresenter.swift

@@ -34,7 +34,7 @@ class NewsDetailPresenter {
                 guard let data = response.data else { return }
                 if let json = try? JSON(data: data) {
                     let newsDetail = NewsDetail(
-                        id: json["id"].intValue,
+                        id: json["id_news"].intValue,
                         title_news: json["title_news"].stringValue,
                         pra_news: json["pra_news"].stringValue,
                         news: json["news"].stringValue,

+ 1 - 0
Sirani/View/News/Detail/NewsDetailVC.swift

@@ -63,6 +63,7 @@ class NewsDetailVC: UIViewController {
     private func loadData() {
         if !loading {
             if ConnectionHelper.isConnectedToNetwork() {
+                print("Load data \(newsId)")
                 presenter.loadData(newsId: newsId)
             } else {
                 showNoConnection()