Skip to content

Commit 0d05d78

Browse files
committed
Remove defaultStoreID from register PN methods
1 parent c836d15 commit 0d05d78

File tree

6 files changed

+5
-20
lines changed

6 files changed

+5
-20
lines changed

Modules/Sources/Networking/Remote/DevicesRemote.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ public class DevicesRemote: Remote {
1111
/// - device: APNS Device to be registered.
1212
/// - applicationId: App ID.
1313
/// - applicationVersion: App Version.
14-
/// - defaultStoreID: Active Store ID.
1514
/// - completion: Closure to be executed on completion.
1615
///
1716
public func registerDevice(device: APNSDevice,
1817
applicationId: String,
1918
applicationVersion: String,
20-
defaultStoreID: Int64,
2119
completion: @escaping (DotcomDevice?, Error?) -> Void) {
2220
var parameters = [
2321
ParameterKeys.applicationId: applicationId,
@@ -27,7 +25,6 @@ public class DevicesRemote: Remote {
2725
ParameterKeys.deviceModel: device.model,
2826
ParameterKeys.deviceName: device.name,
2927
ParameterKeys.deviceOSVersion: device.iOSVersion,
30-
ParameterKeys.defaultStoreID: ""
3128
]
3229

3330
if let deviceUUID = device.identifierForVendor {
@@ -84,6 +81,5 @@ private extension DevicesRemote {
8481
static let deviceName = "device_name"
8582
static let deviceOSVersion = "os_version"
8683
static let deviceUUID = "device_uuid"
87-
static let defaultStoreID = "selected_blog_id"
8884
}
8985
}

Modules/Sources/Yosemite/Actions/NotificationAction.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ public enum NotificationAction: Action {
1212
case registerDevice(device: APNSDevice,
1313
applicationId: String,
1414
applicationVersion: String,
15-
defaultStoreID: Int64,
1615
onCompletion: (DotcomDevice?, Error?) -> Void)
1716

1817
/// Unregisters a device for Push Notifications Delivery.

Modules/Sources/Yosemite/Stores/NotificationStore.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,10 @@ public class NotificationStore: Store {
3737
case .registerDevice(let device,
3838
let applicationId,
3939
let applicationVersion,
40-
let defaultStoreID,
4140
let onCompletion):
4241
registerDevice(device: device,
4342
applicationId: applicationId,
4443
applicationVersion: applicationVersion,
45-
defaultStoreID: defaultStoreID,
4644
onCompletion: onCompletion)
4745
case .synchronizeNotifications(let onCompletion):
4846
synchronizeNotifications(onCompletion: onCompletion)
@@ -72,12 +70,10 @@ private extension NotificationStore {
7270
func registerDevice(device: APNSDevice,
7371
applicationId: String,
7472
applicationVersion: String,
75-
defaultStoreID: Int64,
7673
onCompletion: @escaping (DotcomDevice?, Error?) -> Void) {
7774
devicesRemote.registerDevice(device: device,
7875
applicationId: applicationId,
7976
applicationVersion: applicationVersion,
80-
defaultStoreID: defaultStoreID,
8177
completion: onCompletion)
8278
}
8379

WooCommerce/Classes/AppDelegate.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
112112
}
113113

114114
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
115-
guard let defaultStoreID = ServiceLocator.stores.sessionManager.defaultStoreID else {
116-
return
117-
}
118-
119-
ServiceLocator.pushNotesManager.registerDeviceToken(with: deviceToken, defaultStoreID: defaultStoreID)
115+
ServiceLocator.pushNotesManager.registerDeviceToken(with: deviceToken)
120116
}
121117

122118
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {

WooCommerce/Classes/Notifications/PushNotificationsManager.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ extension PushNotificationsManager {
219219
/// - tokenData: APNS's Token Data
220220
/// - defaultStoreID: Default WooCommerce Store ID
221221
///
222-
func registerDeviceToken(with tokenData: Data, defaultStoreID: Int64) {
222+
func registerDeviceToken(with tokenData: Data) {
223223
let newToken = tokenData.hexString
224224

225225
if let _ = deviceToken, deviceToken != newToken {
@@ -231,7 +231,7 @@ extension PushNotificationsManager {
231231
deviceToken = newToken
232232

233233
// Register in the Dotcom's Infrastructure
234-
registerDotcomDevice(with: newToken, defaultStoreID: defaultStoreID) { (device, error) in
234+
registerDotcomDevice(with: newToken) { (device, error) in
235235
guard let deviceID = device?.deviceID else {
236236
DDLogError("⛔️ Dotcom Push Notifications Registration Failure: \(error.debugDescription)")
237237
return
@@ -556,12 +556,11 @@ private extension PushNotificationsManager {
556556

557557
/// Registers an APNS DeviceToken in the WordPress.com backend.
558558
///
559-
func registerDotcomDevice(with deviceToken: String, defaultStoreID: Int64, onCompletion: @escaping (DotcomDevice?, Error?) -> Void) {
559+
func registerDotcomDevice(with deviceToken: String, onCompletion: @escaping (DotcomDevice?, Error?) -> Void) {
560560
let device = APNSDevice(deviceToken: deviceToken)
561561
let action = NotificationAction.registerDevice(device: device,
562562
applicationId: WooConstants.pushApplicationID,
563563
applicationVersion: Bundle.main.version,
564-
defaultStoreID: defaultStoreID,
565564
onCompletion: onCompletion)
566565
stores.dispatch(action)
567566
}

WooCommerce/Classes/ServiceLocator/PushNotesManager.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,8 @@ protocol PushNotesManager {
7272
///
7373
/// - Parameters:
7474
/// - tokenData: APNS's Token Data
75-
/// - defaultStoreID: Default WooCommerce Store ID
7675
///
77-
func registerDeviceToken(with tokenData: Data, defaultStoreID: Int64)
76+
func registerDeviceToken(with tokenData: Data)
7877

7978
/// Handles a remote push notification payload when the app is in the background.
8079
/// - Parameter userInfo: Push notification payload.

0 commit comments

Comments
 (0)