mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various Fixes
This commit is contained in:
parent
e386a5e137
commit
afdd1462da
@ -6265,3 +6265,17 @@ Sorry for the inconvenience.";
|
||||
"VoiceChat.RemoveAndBanPeerConfirmation" = "Do you want to remove %1$@ from the voice chat and ban them in %2$@?";
|
||||
|
||||
"Notification.VoiceChatStartedChannel" = "Voice chat started";
|
||||
|
||||
"Conversation.MessageCopied" = "Message copied to clipboard";
|
||||
"Conversation.LinkCopied" = "Link copied to clipboard";
|
||||
"Conversation.TextCopied" = "Text copied to clipboard";
|
||||
"Conversation.HashtagCopied" = "Hashtag copied to clipboard";
|
||||
"Conversation.PhoneCopied" = "Phone copied to clipboard";
|
||||
"Conversation.EmailCopied" = "Email copied to clipboard";
|
||||
"Conversation.UsernameCopied" = "Username copied to clipboard";
|
||||
"Conversation.CardNumberCopied" = "Card number copied to clipboard";
|
||||
|
||||
"Conversation.StickerAddedToFavorites" = "Sticker was added to Favorites";
|
||||
"Conversation.StickerRemovedFromFavorites" = "Sticker was removed from Favorites";
|
||||
|
||||
"Conversation.DeletedFromContacts" = "**%@** deleted from your contacts";
|
||||
|
@ -16,6 +16,7 @@ swift_library(
|
||||
"//submodules/TelegramPresentationData:TelegramPresentationData",
|
||||
"//submodules/AccountContext:AccountContext",
|
||||
"//submodules/ShareController:ShareController",
|
||||
"//submodules/UndoUI:UndoUI",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -10,6 +10,7 @@ import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import UndoUI
|
||||
|
||||
private class WeakGameScriptMessageHandler: NSObject, WKScriptMessageHandler {
|
||||
private let f: (WKScriptMessage) -> ()
|
||||
@ -167,7 +168,16 @@ final class GameControllerNode: ViewControllerTracingNode {
|
||||
func shareWithoutScore() {
|
||||
if let (botPeer, gameName) = self.shareData(), let addressName = botPeer.addressName, !addressName.isEmpty, !gameName.isEmpty {
|
||||
let url = "https://t.me/\(addressName)?game=\(gameName)"
|
||||
self.present(ShareController(context: self.context, subject: .url(url), showInChat: nil, externalShare: true), nil)
|
||||
|
||||
let context = self.context
|
||||
let shareController = ShareController(context: context, subject: .url(url), showInChat: nil, externalShare: true)
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}
|
||||
self.present(shareController, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ swift_library(
|
||||
"//submodules/LocationUI:LocationUI",
|
||||
"//submodules/AppBundle:AppBundle",
|
||||
"//submodules/LocationResources:LocationResources",
|
||||
"//submodules/UndoUI:UndoUI",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -15,6 +15,7 @@ import SaveToCameraRoll
|
||||
import GalleryUI
|
||||
import OpenInExternalAppUI
|
||||
import LocationUI
|
||||
import UndoUI
|
||||
|
||||
final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
private let context: AccountContext
|
||||
@ -137,6 +138,12 @@ final class InstantPageControllerNode: ASDisplayNode, UIScrollViewDelegate {
|
||||
self.navigationBar.share = { [weak self] in
|
||||
if let strongSelf = self, let webPage = strongSelf.webPage, case let .Loaded(content) = webPage.content {
|
||||
let shareController = ShareController(context: context, subject: .url(content.url))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}
|
||||
strongSelf.present(shareController, nil)
|
||||
}
|
||||
}
|
||||
|
@ -424,6 +424,12 @@ public final class InviteLinkInviteController: ViewController {
|
||||
self?.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}, shareLink: { [weak self] invite in
|
||||
let shareController = ShareController(context: context, subject: .url(invite.link))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}
|
||||
self?.controller?.present(shareController, in: .window(.root))
|
||||
}, manageLinks: { [weak self] in
|
||||
let controller = inviteLinkListController(context: context, peerId: peerId, admin: nil)
|
||||
|
@ -198,8 +198,8 @@ public class ItemListPermanentInviteLinkItemNode: ListViewItemNode, ItemListItem
|
||||
|
||||
self.containerNode.addSubnode(self.referenceContainerNode)
|
||||
self.referenceContainerNode.addSubnode(self.addressButtonIconNode)
|
||||
self.addressButtonNode.addSubnode(self.containerNode)
|
||||
self.addSubnode(self.addressButtonNode)
|
||||
self.referenceContainerNode.addSubnode(self.addressButtonNode)
|
||||
self.addSubnode(self.containerNode)
|
||||
|
||||
self.addSubnode(self.activateArea)
|
||||
|
||||
|
@ -8,8 +8,10 @@
|
||||
#import "TGFont.h"
|
||||
#import "TGViewController.h"
|
||||
#import "TGHacks.h"
|
||||
#import "TGModernButton.h"
|
||||
|
||||
#import "TGPhotoEditorInterfaceAssets.h"
|
||||
#import "TGMediaAssetsController.h"
|
||||
|
||||
#import "HPTextViewInternal.h"
|
||||
|
||||
@ -42,6 +44,9 @@ static void setViewFrame(UIView *view, CGRect frame)
|
||||
HPGrowingTextView *_inputField;
|
||||
UILabel *_placeholderLabel;
|
||||
|
||||
UIView *_doneButtonWrapper;
|
||||
TGModernButton *_doneButton;
|
||||
|
||||
UILabel *_inputFieldOnelineLabel;
|
||||
|
||||
UILabel *_counterLabel;
|
||||
@ -148,6 +153,25 @@ static void setViewFrame(UIView *view, CGRect frame)
|
||||
_counterLabel.userInteractionEnabled = false;
|
||||
[_fieldBackground addSubview:_counterLabel];
|
||||
|
||||
_doneButtonWrapper = [[UIView alloc] init];
|
||||
_doneButtonWrapper.alpha = 0.0f;
|
||||
_doneButtonWrapper.userInteractionEnabled = false;
|
||||
[_wrapperView addSubview:_doneButtonWrapper];
|
||||
|
||||
CGSize buttonSize = CGSizeMake(49.0f, 49.0f);
|
||||
_doneButton = [[TGModernButton alloc] initWithFrame:CGRectMake(0, 0, buttonSize.width, buttonSize.height)];
|
||||
_doneButton.exclusiveTouch = true;
|
||||
_doneButton.adjustsImageWhenHighlighted = false;
|
||||
[_doneButton addTarget:self action:@selector(setButtonPressed) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_doneButtonWrapper addSubview:_doneButton];
|
||||
|
||||
TGMediaAssetsPallete *pallete = nil;
|
||||
if ([[LegacyComponentsGlobals provider] respondsToSelector:@selector(mediaAssetsPallete)])
|
||||
pallete = [[LegacyComponentsGlobals provider] mediaAssetsPallete];
|
||||
|
||||
UIImage *doneImage = pallete != nil ? pallete.doneIconImage : TGTintedImage([UIImage imageNamed:@"Editor/Commit"], [UIColor whiteColor]);
|
||||
[_doneButton setImage:doneImage forState:UIControlStateNormal];
|
||||
|
||||
[_wrapperView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleFieldBackgroundTap:)]];
|
||||
}
|
||||
return self;
|
||||
@ -175,7 +199,7 @@ static void setViewFrame(UIView *view, CGRect frame)
|
||||
_inputField.backgroundColor = nil;
|
||||
_inputField.opaque = false;
|
||||
_inputField.showPlaceholderWhenFocussed = true;
|
||||
_inputField.internalTextView.returnKeyType = UIReturnKeyDone;
|
||||
_inputField.internalTextView.returnKeyType = UIReturnKeyDefault;
|
||||
_inputField.internalTextView.backgroundColor = nil;
|
||||
_inputField.internalTextView.opaque = false;
|
||||
_inputField.internalTextView.contentMode = UIViewContentModeLeft;
|
||||
@ -544,11 +568,13 @@ static void setViewFrame(UIView *view, CGRect frame)
|
||||
[self updateCounterWithText:_caption];
|
||||
|
||||
_inputField.alpha = 0.0f;
|
||||
_doneButtonWrapper.userInteractionEnabled = true;
|
||||
[UIView animateWithDuration:0.2f animations:^
|
||||
{
|
||||
_inputField.alpha = 1.0f;
|
||||
_inputFieldOnelineLabel.alpha = 0.0f;
|
||||
_fieldBackground.alpha = 1.0f;
|
||||
_doneButtonWrapper.alpha = 1.0;
|
||||
} completion:^(BOOL finished)
|
||||
{
|
||||
if (finished)
|
||||
@ -580,10 +606,12 @@ static void setViewFrame(UIView *view, CGRect frame)
|
||||
|
||||
[self updateCounterWithText:_caption];
|
||||
|
||||
_doneButtonWrapper.userInteractionEnabled = false;
|
||||
[UIView animateWithDuration:0.2f animations:^
|
||||
{
|
||||
_inputField.alpha = 0.0f;
|
||||
_inputFieldOnelineLabel.alpha = 1.0f;
|
||||
_doneButtonWrapper.alpha = 0.0;
|
||||
|
||||
if (_caption.length == 0)
|
||||
_fieldBackground.alpha = 0.0f;
|
||||
@ -735,17 +763,6 @@ static void setViewFrame(UIView *view, CGRect frame)
|
||||
[self updateCounterWithText:text];
|
||||
}
|
||||
|
||||
- (BOOL)growingTextViewShouldReturn:(HPGrowingTextView *)__unused growingTextView
|
||||
{
|
||||
[self setButtonPressed];
|
||||
return false;
|
||||
}
|
||||
|
||||
- (void)growingTextView:(HPGrowingTextView *)__unused growingTextView receivedReturnKeyCommandWithModifierFlags:(UIKeyModifierFlags)__unused flags
|
||||
{
|
||||
[self setButtonPressed];
|
||||
}
|
||||
|
||||
- (void)addNewLine
|
||||
{
|
||||
self.caption = [NSString stringWithFormat:@"%@\n", self.caption];
|
||||
@ -1012,6 +1029,10 @@ static void setViewFrame(UIView *view, CGRect frame)
|
||||
}
|
||||
|
||||
UIEdgeInsets inputFieldInsets = [self _inputFieldInsets];
|
||||
if (self.isFirstResponder) {
|
||||
inputFieldInsets.right += 41.0;
|
||||
}
|
||||
|
||||
CGFloat inputContainerHeight = [self heightForInputFieldHeight:self.isFirstResponder ? _inputField.frame.size.height : 0];
|
||||
setViewFrame(_fieldBackground, CGRectMake(inputFieldInsets.left, inputFieldInsets.top, frame.size.width - inputFieldInsets.left - inputFieldInsets.right, inputContainerHeight - inputFieldInsets.top - inputFieldInsets.bottom));
|
||||
|
||||
@ -1037,6 +1058,8 @@ static void setViewFrame(UIView *view, CGRect frame)
|
||||
CGRect inputFieldFrame = CGRectMake(inputFieldInternalEdgeInsets.left, inputFieldInternalEdgeInsets.top + TGRetinaPixel, inputFieldWidth, _inputFieldClippingContainer.frame.size.height);
|
||||
setViewFrame(_inputField, inputFieldFrame);
|
||||
}
|
||||
|
||||
_doneButtonWrapper.frame = CGRectMake(self.frame.size.width - 47.0, CGRectGetMaxY(_fieldBackground.frame) - _doneButton.frame.size.height + 8.0, _doneButton.frame.size.width, _doneButton.frame.size.height);
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -15,6 +15,7 @@ import ShareController
|
||||
import SearchBarNode
|
||||
import SearchUI
|
||||
import ActivityIndicator
|
||||
import UndoUI
|
||||
|
||||
private enum LanguageListSection: ItemListSectionId {
|
||||
case official
|
||||
@ -530,6 +531,12 @@ final class LocalizationListControllerNode: ViewControllerTracingNode {
|
||||
return
|
||||
}
|
||||
let shareController = ShareController(context: strongSelf.context, subject: .url("https://t.me/setlanguage/\(info.languageCode)"))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
}
|
||||
strongSelf.present(shareController, nil)
|
||||
}))
|
||||
controller.setItemGroups([
|
||||
|
@ -17,6 +17,7 @@ import WallpaperResources
|
||||
import ShareController
|
||||
import AccountContext
|
||||
import ContextUI
|
||||
import UndoUI
|
||||
|
||||
private final class ContextControllerContentSourceImpl: ContextControllerContentSource {
|
||||
let controller: ViewController
|
||||
@ -722,8 +723,12 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
||||
}
|
||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Appearance_ShareTheme, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Share"), color: theme.contextMenu.primaryColor) }, action: { c, f in
|
||||
c.dismiss(completion: {
|
||||
let controller = ShareController(context: context, subject: .url("https://t.me/addtheme/\(theme.theme.slug)"), preferredAction: .default)
|
||||
presentControllerImpl?(controller, nil)
|
||||
let shareController = ShareController(context: context, subject: .url("https://t.me/addtheme/\(theme.theme.slug)"), preferredAction: .default)
|
||||
shareController.actionCompleted = {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
presentControllerImpl?(shareController, nil)
|
||||
})
|
||||
})))
|
||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Appearance_RemoveTheme, textColor: .destructive, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Delete"), color: theme.contextMenu.destructiveColor) }, action: { c, f in
|
||||
@ -944,8 +949,12 @@ public func themeSettingsController(context: AccountContext, focusOnItemTag: The
|
||||
}
|
||||
items.append(.action(ContextMenuActionItem(text: presentationData.strings.Appearance_ShareTheme, icon: { theme in generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Share"), color: theme.contextMenu.primaryColor) }, action: { c, f in
|
||||
c.dismiss(completion: {
|
||||
let controller = ShareController(context: context, subject: .url("https://t.me/addtheme/\(cloudTheme.theme.slug)"), preferredAction: .default)
|
||||
presentControllerImpl?(controller, nil)
|
||||
let shareController = ShareController(context: context, subject: .url("https://t.me/addtheme/\(cloudTheme.theme.slug)"), preferredAction: .default)
|
||||
shareController.actionCompleted = {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
presentControllerImpl?(shareController, nil)
|
||||
})
|
||||
})))
|
||||
if cloudThemeExists {
|
||||
|
@ -16,6 +16,7 @@ import ShareController
|
||||
import GalleryUI
|
||||
import HexColor
|
||||
import CounterContollerTitleView
|
||||
import UndoUI
|
||||
|
||||
public enum WallpaperListType {
|
||||
case wallpapers(WallpaperPresentationOptions?)
|
||||
@ -710,8 +711,12 @@ public class WallpaperGalleryController: ViewController {
|
||||
optionsString = "?\(options.joined(separator: "&"))"
|
||||
}
|
||||
|
||||
let controller = ShareController(context: context, subject: .url("https://t.me/bg/\(file.slug)\(optionsString)"))
|
||||
self?.present(controller, in: .window(.root), blockInteraction: true)
|
||||
let shareController = ShareController(context: context, subject: .url("https://t.me/bg/\(file.slug)\(optionsString)"))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
self?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
self?.present(shareController, in: .window(.root), blockInteraction: true)
|
||||
}
|
||||
})
|
||||
case let .file(_, _, _, _, isPattern, _, slug, _, settings):
|
||||
@ -745,6 +750,10 @@ public class WallpaperGalleryController: ViewController {
|
||||
break
|
||||
}
|
||||
if let controller = controller {
|
||||
controller.actionCompleted = { [weak self] in
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
self?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
self.present(controller, in: .window(.root), blockInteraction: true)
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import ItemListUI
|
||||
import PresentationDataUtils
|
||||
import AccountContext
|
||||
import ShareController
|
||||
import UndoUI
|
||||
|
||||
private final class UsernameSetupControllerArguments {
|
||||
let account: Account
|
||||
@ -279,7 +280,12 @@ public func usernameSetupController(context: AccountContext) -> ViewController {
|
||||
}
|
||||
if !currentAddressName.isEmpty {
|
||||
dismissInputImpl?()
|
||||
presentControllerImpl?(ShareController(context: context, subject: .url("https://t.me/\(currentAddressName)")), nil)
|
||||
let shareController = ShareController(context: context, subject: .url("https://t.me/\(currentAddressName)"))
|
||||
shareController.actionCompleted = {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
presentControllerImpl?(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
presentControllerImpl?(shareController, nil)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@ -591,7 +591,9 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
if self.fromForeignApp {
|
||||
self.transitionToContentNode(ShareLoadingContainerNode(theme: self.presentationData.theme, forceNativeAppearance: true), fastOut: true)
|
||||
} else {
|
||||
self.animateOut(shared: true, completion: {
|
||||
self.animateOut(shared: true, completion: { [weak self] in
|
||||
self?
|
||||
.completed?(peerIds)
|
||||
})
|
||||
}
|
||||
let fromForeignApp = self.fromForeignApp
|
||||
@ -629,7 +631,6 @@ final class ShareControllerNode: ViewControllerTracingNode, UIScrollViewDelegate
|
||||
}
|
||||
} else {
|
||||
strongSelf.dismiss?(true)
|
||||
strongSelf.completed?(peerIds)
|
||||
}
|
||||
}
|
||||
}, completed: {
|
||||
|
@ -27,6 +27,7 @@ swift_library(
|
||||
"//submodules/TelegramAnimatedStickerNode:TelegramAnimatedStickerNode",
|
||||
"//submodules/ArchivedStickerPacksNotice:ArchivedStickerPacksNotice",
|
||||
"//submodules/ShimmerEffect:ShimmerEffect",
|
||||
"//submodules/UndoUI:UndoUI",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
|
@ -12,6 +12,7 @@ import ShareController
|
||||
import StickerResources
|
||||
import AlertUI
|
||||
import PresentationDataUtils
|
||||
import UndoUI
|
||||
|
||||
public enum StickerPackPreviewControllerMode {
|
||||
case `default`
|
||||
@ -109,7 +110,16 @@ public final class StickerPackPreviewController: ViewController, StandalonePrese
|
||||
}
|
||||
|
||||
if let stickerPackContentsValue = strongSelf.stickerPackContentsValue, case let .result(info, _, _) = stickerPackContentsValue, !info.shortName.isEmpty {
|
||||
strongSelf.present(ShareController(context: strongSelf.context, subject: .url("https://t.me/addstickers/\(info.shortName)"), externalShare: true), in: .window(.root))
|
||||
let shareController = ShareController(context: strongSelf.context, subject: .url("https://t.me/addstickers/\(info.shortName)"), externalShare: true)
|
||||
|
||||
let parentNavigationController = strongSelf.parentNavigationController
|
||||
shareController.actionCompleted = { [weak parentNavigationController] in
|
||||
if let parentNavigationController = parentNavigationController, let controller = parentNavigationController.topViewController as? ViewController {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
controller.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}
|
||||
strongSelf.present(shareController, in: .window(.root))
|
||||
strongSelf.dismiss()
|
||||
}
|
||||
}
|
||||
|
@ -1253,7 +1253,7 @@ public final class VoiceChatController: ViewController {
|
||||
f(.default)
|
||||
})))
|
||||
|
||||
if let callState = strongSelf.callState, (callState.canManageCall && !callState.adminIds.contains(peer.id)) {
|
||||
if let callState = strongSelf.callState, (callState.canManageCall && !callState.adminIds.contains(peer.id) && peer.id.namespace != Namespaces.Peer.CloudChannel) {
|
||||
items.append(.action(ContextMenuActionItem(text: strongSelf.presentationData.strings.VoiceChat_RemovePeer, textColor: .destructive, icon: { theme in
|
||||
return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Clear"), color: theme.actionSheet.destructiveActionTextColor)
|
||||
}, action: { [weak self] c, _ in
|
||||
@ -2083,7 +2083,7 @@ public final class VoiceChatController: ViewController {
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.InviteLink_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.VoiceChat_InviteLinkCopiedText), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}
|
||||
self.controller?.present(shareController, in: .window(.root))
|
||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -5986,17 +5986,27 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
|
||||
if let stickerFile = stickerFile {
|
||||
let postbox = strongSelf.context.account.postbox
|
||||
let network = strongSelf.context.account.network
|
||||
let _ = (strongSelf.context.account.postbox.transaction { transaction -> Signal<Void, NoError> in
|
||||
let _ = (strongSelf.context.account.postbox.transaction { transaction -> Signal<Bool, NoError> in
|
||||
if getIsStickerSaved(transaction: transaction, fileId: stickerFile.fileId) {
|
||||
removeSavedSticker(transaction: transaction, mediaId: stickerFile.fileId)
|
||||
return .complete()
|
||||
return .single(false)
|
||||
} else {
|
||||
return addSavedSticker(postbox: postbox, network: network, file: stickerFile)
|
||||
|> `catch` { _ -> Signal<Void, NoError> in
|
||||
return .complete()
|
||||
}
|
||||
|> `catch` { _ -> Signal<Void, NoError> in
|
||||
return .complete()
|
||||
}
|
||||
|> map { _ -> Bool in
|
||||
return true
|
||||
}
|
||||
|> then(.single(true))
|
||||
}
|
||||
} |> switchToLatest).start()
|
||||
}
|
||||
|> switchToLatest
|
||||
|> deliverOnMainQueue).start(next: { [weak self] added in
|
||||
if let strongSelf = self {
|
||||
strongSelf.present(UndoOverlayController(presentationData: strongSelf.presentationData, content: .sticker(account: strongSelf.context.account, file: stickerFile, text: added ? strongSelf.presentationData.strings.Conversation_StickerAddedToFavorites : strongSelf.presentationData.strings.Conversation_StickerRemovedFromFavorites), elevatedLayout: false, action: { _ in return false }), in: .current)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}, presentController: { [weak self] controller, arguments in
|
||||
|
@ -18,6 +18,7 @@ import SaveToCameraRoll
|
||||
import PresentationDataUtils
|
||||
import TelegramPresentationData
|
||||
import TelegramStringFormatting
|
||||
import UndoUI
|
||||
|
||||
private struct MessageContextMenuData {
|
||||
let starStatus: Bool?
|
||||
|
@ -22,6 +22,7 @@ import UrlHandling
|
||||
import ShareController
|
||||
import ChatInterfaceState
|
||||
import TelegramCallsUI
|
||||
import UndoUI
|
||||
|
||||
private func defaultNavigationForPeerId(_ peerId: PeerId?, navigation: ChatControllerInteractionNavigateToPeer) -> ChatControllerInteractionNavigateToPeer {
|
||||
if case .default = navigation {
|
||||
@ -266,6 +267,10 @@ func openResolvedUrlImpl(_ resolvedUrl: ResolvedUrl, context: AccountContext, ur
|
||||
} else {
|
||||
if let url = url, !url.isEmpty {
|
||||
let shareController = ShareController(context: context, subject: .url(url), presetText: text, externalShare: false, immediateExternalShare: false)
|
||||
shareController.actionCompleted = {
|
||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||
present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), nil)
|
||||
}
|
||||
present(shareController, nil)
|
||||
context.sharedContext.applicationBindings.dismissNativeController()
|
||||
} else {
|
||||
|
@ -402,16 +402,16 @@ private final class VisualMediaItemNode: ASDisplayNode {
|
||||
}
|
||||
self.item = (item, media, size, mediaDimensions)
|
||||
|
||||
let progressDiameter: CGFloat = 40.0
|
||||
self.statusNode.frame = CGRect(origin: CGPoint(x: floor((size.width - progressDiameter) / 2.0), y: floor((size.height - progressDiameter) / 2.0)), size: CGSize(width: progressDiameter, height: progressDiameter))
|
||||
|
||||
self.mediaBadgeNode.frame = CGRect(origin: CGPoint(x: size.width - 3.0, y: size.height - 18.0 - 3.0), size: CGSize(width: 50.0, height: 50.0))
|
||||
|
||||
self.selectionNode?.frame = CGRect(origin: CGPoint(), size: size)
|
||||
|
||||
self.updateHiddenMedia()
|
||||
}
|
||||
|
||||
let progressDiameter: CGFloat = 40.0
|
||||
self.statusNode.frame = CGRect(origin: CGPoint(x: floor((size.width - progressDiameter) / 2.0), y: floor((size.height - progressDiameter) / 2.0)), size: CGSize(width: progressDiameter, height: progressDiameter))
|
||||
|
||||
self.mediaBadgeNode.frame = CGRect(origin: CGPoint(x: size.width - 3.0, y: size.height - 18.0 - 3.0), size: CGSize(width: 50.0, height: 50.0))
|
||||
|
||||
self.selectionNode?.frame = CGRect(origin: CGPoint(), size: size)
|
||||
|
||||
if let (item, media, _, mediaDimensions) = self.item {
|
||||
self.item = (item, media, size, mediaDimensions)
|
||||
|
||||
|
@ -3828,6 +3828,12 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
|
||||
private func openUsername(value: String) {
|
||||
let shareController = ShareController(context: self.context, subject: .url("https://t.me/\(value)"))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}
|
||||
self.view.endEditing(true)
|
||||
self.controller?.present(shareController, in: .window(.root))
|
||||
}
|
||||
@ -4080,8 +4086,13 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
}
|
||||
|
||||
strongSelf.activeActionDisposable.set((deleteSignal
|
||||
|> deliverOnMainQueue).start(completed: {
|
||||
self?.controller?.dismiss()
|
||||
|> deliverOnMainQueue).start(completed: { [weak self] in
|
||||
if let strongSelf = self, let peer = strongSelf.data?.peer {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .info(text: presentationData.strings.Conversation_DeletedFromContacts(peer.displayTitle(strings: strongSelf.presentationData.strings, displayOrder: strongSelf.presentationData.nameDisplayOrder)).0), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
|
||||
strongSelf.controller?.dismiss()
|
||||
}
|
||||
}))
|
||||
|
||||
deleteSendMessageIntents(peerId: strongSelf.peerId)
|
||||
@ -4331,6 +4342,12 @@ private final class PeerInfoScreenNode: ViewControllerTracingNode, UIScrollViewD
|
||||
}
|
||||
if let peer = peer as? TelegramUser, let username = peer.username {
|
||||
let shareController = ShareController(context: strongSelf.context, subject: .url("https://t.me/\(username)"))
|
||||
shareController.actionCompleted = { [weak self] in
|
||||
if let strongSelf = self {
|
||||
let presentationData = strongSelf.context.sharedContext.currentPresentationData.with { $0 }
|
||||
strongSelf.controller?.present(UndoOverlayController(presentationData: presentationData, content: .linkCopied(text: presentationData.strings.Conversation_LinkCopied), elevatedLayout: false, animateInAsReplacement: false, action: { _ in return false }), in: .window(.root))
|
||||
}
|
||||
}
|
||||
strongSelf.view.endEditing(true)
|
||||
strongSelf.controller?.present(shareController, in: .window(.root))
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ public enum UndoOverlayContent {
|
||||
case voiceChatRecording(text: String)
|
||||
case voiceChatFlag(text: String)
|
||||
case voiceChatCanSpeak(text: String)
|
||||
case sticker(account: Account, file: TelegramMediaFile, text: String)
|
||||
}
|
||||
|
||||
public enum UndoOverlayAction {
|
||||
|
@ -596,6 +596,84 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
|
||||
|
||||
displayUndo = false
|
||||
self.originalRemainingSeconds = 3
|
||||
case let .sticker(account, file, text):
|
||||
self.avatarNode = nil
|
||||
self.iconNode = nil
|
||||
self.iconCheckNode = nil
|
||||
self.animationNode = nil
|
||||
|
||||
let stillStickerNode = TransformImageNode()
|
||||
|
||||
self.stillStickerNode = stillStickerNode
|
||||
|
||||
enum StickerThumbnailItem {
|
||||
case still(TelegramMediaImageRepresentation)
|
||||
case animated(MediaResource)
|
||||
}
|
||||
|
||||
var thumbnailItem: StickerThumbnailItem?
|
||||
var resourceReference: MediaResourceReference?
|
||||
|
||||
if file.isAnimatedSticker {
|
||||
thumbnailItem = .animated(file.resource)
|
||||
resourceReference = MediaResourceReference.media(media: .standalone(media: file), resource: file.resource)
|
||||
} else if let dimensions = file.dimensions, let resource = chatMessageStickerResource(file: file, small: true) as? TelegramMediaResource {
|
||||
thumbnailItem = .still(TelegramMediaImageRepresentation(dimensions: dimensions, resource: resource, progressiveSizes: []))
|
||||
resourceReference = MediaResourceReference.media(media: .standalone(media: file), resource: resource)
|
||||
}
|
||||
|
||||
var updatedImageSignal: Signal<(TransformImageArguments) -> DrawingContext?, NoError>?
|
||||
var updatedFetchSignal: Signal<FetchResourceSourceType, FetchResourceError>?
|
||||
|
||||
let imageBoundingSize = CGSize(width: 34.0, height: 34.0)
|
||||
|
||||
if let thumbnailItem = thumbnailItem {
|
||||
switch thumbnailItem {
|
||||
case let .still(representation):
|
||||
let stillImageSize = representation.dimensions.cgSize.aspectFitted(imageBoundingSize)
|
||||
self.stickerImageSize = stillImageSize
|
||||
|
||||
updatedImageSignal = chatMessageStickerPackThumbnail(postbox: account.postbox, resource: representation.resource)
|
||||
case let .animated(resource):
|
||||
self.stickerImageSize = imageBoundingSize
|
||||
|
||||
updatedImageSignal = chatMessageStickerPackThumbnail(postbox: account.postbox, resource: resource, animated: true)
|
||||
}
|
||||
if let resourceReference = resourceReference {
|
||||
updatedFetchSignal = fetchedMediaResource(mediaBox: account.postbox.mediaBox, reference: resourceReference)
|
||||
}
|
||||
} else {
|
||||
updatedImageSignal = .single({ _ in return nil })
|
||||
updatedFetchSignal = .complete()
|
||||
}
|
||||
|
||||
let body = MarkdownAttributeSet(font: Font.regular(14.0), textColor: .white)
|
||||
let bold = MarkdownAttributeSet(font: Font.semibold(14.0), textColor: .white)
|
||||
let attributedText = parseMarkdownIntoAttributedString(text, attributes: MarkdownAttributes(body: body, bold: bold, link: body, linkAttribute: { _ in return nil }), textAlignment: .natural)
|
||||
self.textNode.attributedText = attributedText
|
||||
self.textNode.maximumNumberOfLines = 2
|
||||
|
||||
displayUndo = false
|
||||
self.originalRemainingSeconds = 3
|
||||
|
||||
if let updatedFetchSignal = updatedFetchSignal {
|
||||
self.fetchResourceDisposable = updatedFetchSignal.start()
|
||||
}
|
||||
|
||||
if let updatedImageSignal = updatedImageSignal {
|
||||
stillStickerNode.setSignal(updatedImageSignal)
|
||||
}
|
||||
|
||||
if let thumbnailItem = thumbnailItem {
|
||||
switch thumbnailItem {
|
||||
case .still:
|
||||
break
|
||||
case let .animated(resource):
|
||||
let animatedStickerNode = AnimatedStickerNode()
|
||||
self.animatedStickerNode = animatedStickerNode
|
||||
animatedStickerNode.setup(source: AnimatedStickerResourceSource(account: account, resource: resource), width: 80, height: 80, mode: .cached)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.remainingSeconds = self.originalRemainingSeconds
|
||||
@ -624,7 +702,7 @@ final class UndoOverlayControllerNode: ViewControllerTracingNode {
|
||||
switch content {
|
||||
case .removedChat:
|
||||
self.panelWrapperNode.addSubnode(self.timerTextNode)
|
||||
case .archivedChat, .hidArchive, .revealedArchive, .autoDelete, .succeed, .emoji, .swipeToReply, .actionSucceeded, .stickersModified, .chatAddedToFolder, .chatRemovedFromFolder, .messagesUnpinned, .setProximityAlert, .invitedToVoiceChat, .linkCopied, .banned, .importedMessage, .audioRate, .forward, .gigagroupConversion, .linkRevoked, .voiceChatRecording, .voiceChatFlag, .voiceChatCanSpeak:
|
||||
case .archivedChat, .hidArchive, .revealedArchive, .autoDelete, .succeed, .emoji, .swipeToReply, .actionSucceeded, .stickersModified, .chatAddedToFolder, .chatRemovedFromFolder, .messagesUnpinned, .setProximityAlert, .invitedToVoiceChat, .linkCopied, .banned, .importedMessage, .audioRate, .forward, .gigagroupConversion, .linkRevoked, .voiceChatRecording, .voiceChatFlag, .voiceChatCanSpeak, .sticker:
|
||||
break
|
||||
case .dice:
|
||||
self.panelWrapperNode.clipsToBounds = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user