func getChannelPreferences()

in apps/chat-ios/AmazonChimeSDKMessagingDemo/models/NotificationSettingsModel.swift [34:61]


    func getChannelPreferences(channelArn: String, userArn: String) {
        chimeMessagingService.getChannelMembershipPreferences(channelArn: channelArn, chimeBearer: userArn) { (response, error) in
            if let error = error {
                print("\(self.TAG) getChannelPreferences() chimeMessagingService.getChannelMembershipPreferences() error \(error)")
                return
            }
            guard let response = response else {
                print("\(self.TAG) getChannelPreferences() chimeMessagingService.getChannelMembershipPreferences() response is nil")
                return
            }
            if let allowNotification = response.preferences?.pushNotifications?.allowNotifications {
                print("\(self.TAG) getChannelPreferences() preferences.pushNotifications.allowNotification: \(allowNotification.rawValue)")
                switch allowNotification {
                case .all:
                    self.selectedLevelTitle = K.notificationLevelFull
                case .filtered:
                    self.selectedLevelTitle = K.notificationLevelNormal
                case .none:
                    self.selectedLevelTitle = K.notificationLevelMute
                default:
                    break
                }
                self.notificationLevelTableUpdatedHandler?()
            } else {
                print("\(self.TAG) getChannelPreferences() chimeMessagingService.getChannelMembershipPreferences() allowNotifications is nil")
            }
        }
    }