From 6ebc0daf0fa5152347a1f43ec331e6182bbe1642 Mon Sep 17 00:00:00 2001 From: Gk40002148 Date: Mon, 14 Mar 2022 15:33:09 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=87=E3=83=90=E3=82=A4=E3=82=B9=E9=96=A2?= =?UTF-8?q?=E9=80=A3API=E5=88=87=E3=82=8A=E6=9B=BF=E3=81=88=EF=BC=88XP=20-?= =?UTF-8?q?>=20AW=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/Service/DeviceService.swift | 4 +++- .../GoogleService-Info-Production.plist | 18 ++++++++-------- .../Login/Presenter/LoginPresenter.swift | 2 -- AgileWorks/Common/Entity/DeviceRequest.swift | 3 ++- AgileWorks/Common/Entity/DeviceResponse.swift | 6 +++--- .../WebClient/DeleteDeviceEndpoint.swift | 17 ++++++++++++--- .../WebClient/GetApprovalsEndpoint.swift | 2 +- .../Common/WebClient/GetDeviceEndpoint.swift | 21 ++----------------- .../Common/WebClient/GetSessionEndpoint.swift | 2 +- .../Common/WebClient/PostDeviceEndpoint.swift | 4 ++-- .../Common/WebClient/PutDeviceEndpoint.swift | 6 +++--- 11 files changed, 40 insertions(+), 45 deletions(-) diff --git a/AgileWorks/AgileWorks/Common/Service/DeviceService.swift b/AgileWorks/AgileWorks/Common/Service/DeviceService.swift index b1ed077..98efebb 100644 --- a/AgileWorks/AgileWorks/Common/Service/DeviceService.swift +++ b/AgileWorks/AgileWorks/Common/Service/DeviceService.swift @@ -66,7 +66,9 @@ public class DeviceService { } func deleteDevice(completion: @escaping (APIResult) -> Void) { - let deleteDevice = DeleteDeviceEndpoint() + let request = DeviceRequest(deleteFlag: true) + + let deleteDevice = DeleteDeviceEndpoint(request: request) Session.send(deleteDevice) { result in let completionArg: APIResult switch result { diff --git a/AgileWorks/AgileWorks/Configurations/GoogleService-Info-Production.plist b/AgileWorks/AgileWorks/Configurations/GoogleService-Info-Production.plist index d10ec00..4beee4a 100644 --- a/AgileWorks/AgileWorks/Configurations/GoogleService-Info-Production.plist +++ b/AgileWorks/AgileWorks/Configurations/GoogleService-Info-Production.plist @@ -3,21 +3,23 @@ CLIENT_ID - 204764192992-f7u4n14kj9pugtf8ts3t2fe9ujng8ton.apps.googleusercontent.com + 329754530773-6lmjr4t47s6vna4fmhgev8va15tl1b0s.apps.googleusercontent.com REVERSED_CLIENT_ID - com.googleusercontent.apps.204764192992-f7u4n14kj9pugtf8ts3t2fe9ujng8ton + com.googleusercontent.apps.329754530773-6lmjr4t47s6vna4fmhgev8va15tl1b0s + ANDROID_CLIENT_ID + 329754530773-ojpo3eg1640i3rcqdss62393lis4qouc.apps.googleusercontent.com API_KEY - AIzaSyDgTu_zXAQefzM6pWWli-UYmeicYxI0cnM + AIzaSyBkha3FRg2307lq0j8H_K8NOcGs9sIE87w GCM_SENDER_ID - 204764192992 + 329754530773 PLIST_VERSION 1 BUNDLE_ID jp.atled.agileworks PROJECT_ID - x-point-app + agileworks-app STORAGE_BUCKET - x-point-app.appspot.com + agileworks-app.appspot.com IS_ADS_ENABLED IS_ANALYTICS_ENABLED @@ -29,8 +31,6 @@ IS_SIGNIN_ENABLED GOOGLE_APP_ID - 1:204764192992:ios:c2511d6c0f7e978ecd7085 - DATABASE_URL - https://x-point-app.firebaseio.com + 1:329754530773:ios:b470b83a5a18c6ff37a35c \ No newline at end of file diff --git a/AgileWorks/AgileWorks/Login/Presenter/LoginPresenter.swift b/AgileWorks/AgileWorks/Login/Presenter/LoginPresenter.swift index 2c1226a..65f1984 100644 --- a/AgileWorks/AgileWorks/Login/Presenter/LoginPresenter.swift +++ b/AgileWorks/AgileWorks/Login/Presenter/LoginPresenter.swift @@ -45,7 +45,6 @@ extension LoginPresenterImpl: LoginPresenter { // 使いまわしてしまうと前回ログイン時のアカウントへの通知も届いてしまう。 // 一応、アプリ起動時にもインスタンスの作り直しは行っているものの、 // そのタイミングでオンラインである保証はないのでここでも行うことで確実を期している。 - /* TODO Device API が出来るまで、いったんコメントアウト FirebaseSupport.removeInstanceIDOnDemand { error in if let error = error { log.e(error) @@ -61,7 +60,6 @@ extension LoginPresenterImpl: LoginPresenter { } } } - */ completion(.success(true)) case .failure(let error): log.e(error) diff --git a/AgileWorks/Common/Entity/DeviceRequest.swift b/AgileWorks/Common/Entity/DeviceRequest.swift index cf31bc0..d849e56 100644 --- a/AgileWorks/Common/Entity/DeviceRequest.swift +++ b/AgileWorks/Common/Entity/DeviceRequest.swift @@ -12,5 +12,6 @@ struct DeviceRequest: Codable { var name: String? var os: String? var osVersion: String? - var fcmToken: String + var fcmToken: String? + var deleteFlag: Bool? } diff --git a/AgileWorks/Common/Entity/DeviceResponse.swift b/AgileWorks/Common/Entity/DeviceResponse.swift index a7572e4..ced711d 100644 --- a/AgileWorks/Common/Entity/DeviceResponse.swift +++ b/AgileWorks/Common/Entity/DeviceResponse.swift @@ -18,7 +18,7 @@ struct DeviceResponse: Codable { var name: String var os: String var osVersion: String - var createDatetime: String - var updateDatetime: String - var lastUseDatetime: String + var registrationDate: String + var modifyDate: String + var lastUseDate: String } diff --git a/AgileWorks/Common/WebClient/DeleteDeviceEndpoint.swift b/AgileWorks/Common/WebClient/DeleteDeviceEndpoint.swift index 3d069e3..3dae7ca 100644 --- a/AgileWorks/Common/WebClient/DeleteDeviceEndpoint.swift +++ b/AgileWorks/Common/WebClient/DeleteDeviceEndpoint.swift @@ -11,20 +11,31 @@ import Foundation struct DeleteDeviceEndpoint: APIEndpoint { typealias Response = DeviceResponse - let method: HttpMethod = .DELETE - let path = "/xpoint/x/v1/device" + let method: HttpMethod = .POST + let path = "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/MobileAppApi/Device" var requestBody: Data? var headerFields: [String: String]? { return ["Authorization": "Bearer \(KeychainDataStore().readAccessToken() ?? "")", - "X-ATLED-XP-Device-Id": KeychainDataStore().readDeviceID()?.description ?? "", + "X-ATLED-AW-Device-Id": KeychainDataStore().readDeviceID()?.description ?? "", "Content-Type": "application/json"] } var pathParameters: [String]? { return [KeychainDataStore().readDeviceID()?.description ?? ""] } + + init(request: DeviceRequest) { + let encoder = JSONEncoder() + encoder.keyEncodingStrategy = .convertToSnakeCase + + do { + self.requestBody = try encoder.encode(request) + } catch { + log.e(error.localizedDescription) + } + } } extension DeleteDeviceEndpoint { diff --git a/AgileWorks/Common/WebClient/GetApprovalsEndpoint.swift b/AgileWorks/Common/WebClient/GetApprovalsEndpoint.swift index 5cfa4fc..6ba8c92 100644 --- a/AgileWorks/Common/WebClient/GetApprovalsEndpoint.swift +++ b/AgileWorks/Common/WebClient/GetApprovalsEndpoint.swift @@ -23,7 +23,7 @@ struct GetApprovalsEndpoint: APIEndpoint { var headerFields: [String: String]? { return ["Authorization": "Bearer \(KeychainDataStore().readAccessToken() ?? "")", - "X-ATLED-XP-Device-Id": KeychainDataStore().readDeviceID()?.description ?? "", + "X-ATLED-AW-Device-Id": KeychainDataStore().readDeviceID()?.description ?? "", "Content-Type": "application/json"] } } diff --git a/AgileWorks/Common/WebClient/GetDeviceEndpoint.swift b/AgileWorks/Common/WebClient/GetDeviceEndpoint.swift index d1c19f9..f5413f7 100644 --- a/AgileWorks/Common/WebClient/GetDeviceEndpoint.swift +++ b/AgileWorks/Common/WebClient/GetDeviceEndpoint.swift @@ -14,30 +14,13 @@ struct GetDeviceEndpoint: APIEndpoint { var requestBody: Data? let method: HttpMethod = .GET - let path = "/xpoint/x/v1/device" + let path = "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/MobileAppApi/Device" var headerFields: [String: String]? { return ["Authorization": "Bearer \(KeychainDataStore().readAccessToken() ?? "")", - "X-ATLED-XP-Device-Id": KeychainDataStore().readDeviceID()?.description ?? "", + "X-ATLED-AW-Device-Id": KeychainDataStore().readDeviceID()?.description ?? "", "Content-Type": "application/json"] } - - let deviceID: Int? - - var pathParameters: [String]? { - guard let deviceID = self.deviceID else { - return [] - } - return [deviceID.description] - } - - init(deviceID: Int) { - self.deviceID = deviceID - } - - init() { - self.deviceID = nil - } } extension GetDeviceEndpoint { diff --git a/AgileWorks/Common/WebClient/GetSessionEndpoint.swift b/AgileWorks/Common/WebClient/GetSessionEndpoint.swift index dec12ac..b36a22b 100644 --- a/AgileWorks/Common/WebClient/GetSessionEndpoint.swift +++ b/AgileWorks/Common/WebClient/GetSessionEndpoint.swift @@ -23,7 +23,7 @@ struct GetSessionEndpoint: APIEndpoint { var headerFields: [String: String]? { return ["Authorization": "Bearer \(KeychainDataStore().readAccessToken() ?? "")", - "X-ATLED-XP-Device-Id": KeychainDataStore().readDeviceID()?.description ?? ""] + "X-ATLED-AW-Device-Id": KeychainDataStore().readDeviceID()?.description ?? ""] } } diff --git a/AgileWorks/Common/WebClient/PostDeviceEndpoint.swift b/AgileWorks/Common/WebClient/PostDeviceEndpoint.swift index 6fc6920..2a0584c 100644 --- a/AgileWorks/Common/WebClient/PostDeviceEndpoint.swift +++ b/AgileWorks/Common/WebClient/PostDeviceEndpoint.swift @@ -14,11 +14,11 @@ struct PostDeviceEndpoint: APIEndpoint { var requestBody: Data? let method: HttpMethod = .POST - let path = "/xpoint/x/v1/device" + let path = "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/MobileAppApi/Device" var headerFields: [String: String]? { return ["Authorization": "Bearer \(KeychainDataStore().readAccessToken() ?? "")", - "X-ATLED-XP-Device-Id": KeychainDataStore().readDeviceID()?.description ?? "", + "X-ATLED-AW-Device-Id": KeychainDataStore().readDeviceID()?.description ?? "", "Content-Type": "application/json"] } diff --git a/AgileWorks/Common/WebClient/PutDeviceEndpoint.swift b/AgileWorks/Common/WebClient/PutDeviceEndpoint.swift index b329637..f1acafa 100644 --- a/AgileWorks/Common/WebClient/PutDeviceEndpoint.swift +++ b/AgileWorks/Common/WebClient/PutDeviceEndpoint.swift @@ -13,12 +13,12 @@ struct PutDeviceEndpoint: APIEndpoint { var requestBody: Data? - let method: HttpMethod = .PUT - let path = "/xpoint/x/v1/device" + let method: HttpMethod = .POST + let path = "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/MobileAppApi/Device" var headerFields: [String: String]? { return ["Authorization": "Bearer \(KeychainDataStore().readAccessToken() ?? "")", - "X-ATLED-XP-Device-Id": KeychainDataStore().readDeviceID()?.description ?? "", + "X-ATLED-AW-Device-Id": KeychainDataStore().readDeviceID()?.description ?? "", "Content-Type": "application/json"] } -- GitLab