Don't unnecessarily unsubscribe from closed group PNs

We don't need to do this anymore as we now have the ability to ignore PNs in the notification service extension
pull/479/head
Niels Andriesse 4 years ago
parent 7043e83ea3
commit 1b0a12d7c0

@ -861,17 +861,6 @@ CGFloat kIconViewLength = 24;
[self.thread updateWithMutedUntilDate:nil transaction:transaction]; [self.thread updateWithMutedUntilDate:nil transaction:transaction];
}]; }];
} }
if (self.isClosedGroup) {
NSString *groupPublicKey = [LKGroupUtilities getDecodedGroupID:((TSGroupThread *)self.thread).groupModel.groupId];
NSString *userPublicKey = [SNGeneralUtilities getUserPublicKey];
if (uiSwitch.isOn) {
[[LKPushNotificationAPI performOperation:ClosedGroupOperationUnsubscribe
forClosedGroupWithPublicKey:groupPublicKey userPublicKey:userPublicKey] retainUntilComplete];
} else {
[[LKPushNotificationAPI performOperation:ClosedGroupOperationSubscribe
forClosedGroupWithPublicKey:groupPublicKey userPublicKey:userPublicKey] retainUntilComplete];
}
}
} }
- (void)blockConversationSwitchDidChange:(id)sender - (void)blockConversationSwitchDidChange:(id)sender

@ -88,13 +88,7 @@ public final class PushNotificationAPI : NSObject {
} }
// Subscribe to all closed groups // Subscribe to all closed groups
Storage.shared.getUserClosedGroupPublicKeys().forEach { closedGroupPublicKey in Storage.shared.getUserClosedGroupPublicKeys().forEach { closedGroupPublicKey in
let groupID = LKGroupUtilities.getEncodedClosedGroupIDAsData(closedGroupPublicKey) performOperation(.subscribe, for: closedGroupPublicKey, publicKey: publicKey)
let threadOrNil = TSGroupThread.fetch(uniqueId: TSGroupThread.threadId(fromGroupId: groupID))
if threadOrNil?.isMuted == true {
// Do nothing
} else {
performOperation(.subscribe, for: closedGroupPublicKey, publicKey: publicKey)
}
} }
return promise return promise
} }

Loading…
Cancel
Save