mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-09-21 17:15:09 -07:00
[DeckShare] Extract the share-creation response handling into DeckShareUtils
This commit is contained in:
parent
389dc8ac17
commit
6bf64ea712
5 changed files with 45 additions and 35 deletions
|
|
@ -778,19 +778,10 @@ void TabDeckStorage::shareFromTreeFinished(const Response &response, const Comma
|
|||
true);
|
||||
return;
|
||||
}
|
||||
const Response_DeckShareCreate &resp = response.GetExtension(Response_DeckShareCreate::ext);
|
||||
const QString token = QString::fromStdString(resp.token());
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
|
||||
const QDateTime expiry = QDateTime::fromSecsSinceEpoch(resp.expires_at(), QTimeZone::UTC);
|
||||
#else
|
||||
const QDateTime expiry = QDateTime::fromSecsSinceEpoch(resp.expires_at(), Qt::UTC);
|
||||
#endif
|
||||
const DeckShareUtils::ShareResponse share = DeckShareUtils::handleShareResponse(client, response);
|
||||
|
||||
const QString link = DeckShareUtils::buildShareLink(client, token);
|
||||
DeckShareUtils::copyShareLinkToClipboard(link);
|
||||
|
||||
showShareNotice(
|
||||
tr("Share link copied to the clipboard.\nExpires on %1.").arg(DeckShareUtils::formatShareExpiry(expiry)));
|
||||
showShareNotice(tr("Share link copied to the clipboard.\nExpires on %1.")
|
||||
.arg(DeckShareUtils::formatShareExpiry(share.expiry)));
|
||||
setShareModeEnabled(false);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue