| 863 | } |
| 864 | |
| 865 | QString ApiWrap::exportDirectStoryLink(not_null<Data::Story*> story) { |
| 866 | const auto storyId = story->fullId(); |
| 867 | const auto peer = story->peer(); |
| 868 | const auto fallback = [&] { |
| 869 | const auto base = peer->username(); |
| 870 | const auto id = story->call() |
| 871 | ? u"live"_q |
| 872 | : QString::number(storyId.story); |
| 873 | const auto query = base + "/s/" + id; |
| 874 | return session().createInternalLinkFull(query); |
| 875 | }; |
| 876 | const auto i = _unlikelyStoryLinks.find(storyId); |
| 877 | const auto current = (i != end(_unlikelyStoryLinks)) |
| 878 | ? i->second |
| 879 | : fallback(); |
| 880 | request(MTPstories_ExportStoryLink( |
| 881 | peer->input(), |
| 882 | MTP_int(story->id()) |
| 883 | )).done([=](const MTPExportedStoryLink &result) { |
| 884 | const auto link = qs(result.data().vlink()); |
| 885 | if (current != link) { |
| 886 | _unlikelyStoryLinks.emplace_or_assign(storyId, link); |
| 887 | } |
| 888 | }).send(); |
| 889 | return current; |
| 890 | } |
| 891 | |
| 892 | void ApiWrap::requestContacts() { |
| 893 | if (_session->data().contactsLoaded().current() || _contactsRequestId) { |