Fix ItemListController crash?

This commit is contained in:
Peter
2019-10-06 04:25:10 +04:00
parent 3ddbeea591
commit 36c82642d6
77 changed files with 615 additions and 244 deletions

View File

@@ -387,7 +387,8 @@ private enum UserInfoEntry: ItemListNodeEntry {
return lhs.sortIndex < rhs.sortIndex
}
func item(_ arguments: UserInfoControllerArguments) -> ListViewItem {
func item(_ arguments: Any) -> ListViewItem {
let arguments = arguments as! UserInfoControllerArguments
switch self {
case let .info(theme, strings, dateTimeFormat, peer, presence, cachedData, state, displayCall):
return ItemListAvatarAndNameInfoItem(account: arguments.account, theme: theme, strings: strings, dateTimeFormat: dateTimeFormat, mode: .generic, peer: peer, presence: presence, cachedData: cachedData, state: state, sectionId: self.section, style: .plain, editingNameUpdated: { editingName in
@@ -1195,7 +1196,7 @@ public func userInfoController(context: AccountContext, peerId: PeerId, mode: Pe
let globalNotificationsKey: PostboxViewKey = .preferences(keys: Set<ValueBoxKey>([PreferencesKeys.globalNotifications]))
let signal = combineLatest(context.sharedContext.presentationData, statePromise.get(), peerView.get(), deviceContacts, context.account.postbox.combinedView(keys: [.peerChatState(peerId: peerId), globalNotificationsKey]))
|> map { presentationData, state, view, deviceContacts, combinedView -> (ItemListControllerState, (ItemListNodeState<UserInfoEntry>, UserInfoEntry.ItemGenerationArguments)) in
|> map { presentationData, state, view, deviceContacts, combinedView -> (ItemListControllerState, (ItemListNodeState, Any)) in
let peer = peerViewMainPeer(view.0)
var globalNotificationSettings: GlobalNotificationSettings = .defaultSettings