diff --git a/AgileWorks/AgileWorks/Common/Service/DeviceService.swift b/AgileWorks/AgileWorks/Common/Service/DeviceService.swift index b1ed0770af8529e4bf37ed0464cfba3daa37c83f..98efebb1db1e86f62b7f700ee07cfc3e4f83ba7c 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 d10ec00b7f364dae29dc6576b9e1742371e8ab19..4beee4af8795d8b392eddc4b5cea594891bac0c7 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 2c1226a09523f498b1fc24bd7c9cd49fc6d30c03..65f1984c7c8d9f40b24d0a50eb23724c108897be 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 cf31bc0773bac54ffbc5decabb78eef4e3b0daee..d849e561c3a7cc08f70ee6d8bbe25c08b436ffc3 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 a7572e4b51c7df6bd6436b4c397538e3e6cddc52..ced711d136126585a78163f86a017a0e31cde85f 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 3d069e3bcbd4bec2def38aa2422bd7757712c794..3dae7caae66b3b29a4150915f74be6cdf8d5c1ff 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 5cfa4fc47e6203395e27b9018a55c1543d3109be..6ba8c92d9604e9837d3cbfbaca9f5dd0053b5d37 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 d1c19f9c7d4f712156f46e900d725631eb50dbb3..f5413f75246eb52a5799cc103f5b105686f369d0 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 dec12acf64b2c9ec69b760b2e419d1cfbf72eec7..b36a22b56cf70a15eecef040db6653a1ccf2b23b 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 6fc69203eecea03ebd3cd312566036b2ce95e703..2a0584c3e143cb8b7cff5b964048b136bb395c1d 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 b32963756753ea407c1d6f9de404213976c41511..f1acafa98285e150d82834409c541178c0e1d205 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"] }