mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix story link handling
This commit is contained in:
parent
42ff2acdbc
commit
98263431a4
BIN
submodules/TelegramUI/Resources/Animations/story_expired.tgs
Normal file
BIN
submodules/TelegramUI/Resources/Animations/story_expired.tgs
Normal file
Binary file not shown.
@ -805,6 +805,15 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
|||||||
dismissInput()
|
dismissInput()
|
||||||
}
|
}
|
||||||
case let .story(peerId, id):
|
case let .story(peerId, id):
|
||||||
|
let _ = (context.account.postbox.transaction { transaction -> Bool in
|
||||||
|
if let value = transaction.getStory(id: StoryId(peerId: peerId, id: id)), !value.data.isEmpty {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|> deliverOnMainQueue).start(next: { exists in
|
||||||
|
if exists {
|
||||||
let storyContent = SingleStoryContentContextImpl(context: context, storyId: StoryId(peerId: peerId, id: id))
|
let storyContent = SingleStoryContentContextImpl(context: context, storyId: StoryId(peerId: peerId, id: id))
|
||||||
let _ = (storyContent.state
|
let _ = (storyContent.state
|
||||||
|> take(1)
|
|> take(1)
|
||||||
@ -823,5 +832,12 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
|||||||
)
|
)
|
||||||
navigationController?.pushViewController(storyContainerScreen)
|
navigationController?.pushViewController(storyContainerScreen)
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
//TODO:localize
|
||||||
|
present(UndoOverlayController(presentationData: presentationData, content: .universal(animation: "story_expired", scale: 0.066, colors: [:], title: nil, text: "This story does not exist", customUndoText: nil, timeout: nil), elevatedLayout: true, animateInAsReplacement: false, action: { _ in
|
||||||
|
return true
|
||||||
|
}), nil)
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -709,7 +709,10 @@ private func resolveInternalUrl(context: AccountContext, url: ParsedInternalUrl)
|
|||||||
case let .voiceChat(invite):
|
case let .voiceChat(invite):
|
||||||
return .single(.joinVoiceChat(peer.id, invite))
|
return .single(.joinVoiceChat(peer.id, invite))
|
||||||
case let .story(id):
|
case let .story(id):
|
||||||
return .single(.story(peerId: peer.id, id: id))
|
return context.engine.messages.refreshStories(peerId: peer.id, ids: [id])
|
||||||
|
|> map { _ -> ResolvedUrl? in
|
||||||
|
}
|
||||||
|
|> then(.single(.story(peerId: peer.id, id: id)))
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return .single(.peer(peer, .chat(textInputState: nil, subject: nil, peekData: nil)))
|
return .single(.peer(peer, .chat(textInputState: nil, subject: nil, peekData: nil)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user