diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index f246c25197..b91bfe9217 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -15928,7 +15928,20 @@ Error: %8$@"; "BackgroundTasks.UploadingStories_any" = "Uploading %d Stories"; "BackgroundTasks.StoryOpenAppToContinue" = "Open app to continue"; "BackgroundTasks.StorySubtitle" = "Running..."; +"BackgroundTasks.StoryFinished" = "Finished"; "BackgroundTasks.UploadingMedia_1" = "Sending Message"; "BackgroundTasks.UploadingMedia_any" = "Sending %d Messages"; "BackgroundTasks.MediaSubtitle" = "Running..."; +"BackgroundTasks.MediaFinished" = "Finished"; + +"DisableSharing.Title" = "Disable Sharing"; +"DisableSharing.Screenshot.Title" = "No Screenshots"; +"DisableSharing.Screenshot.Text" = "Disable screenshots and screen recordings in this chat."; + +"DisableSharing.Forwarding.Title" = "No Forwarding"; +"DisableSharing.Forwarding.Text" = "Disable message forwarding to other chats."; + +"DisableSharing.Saving.Title" = "No Saving"; +"DisableSharing.Saving.Text" = "Disable copying text and saving photos and videos to Photos."; +"DisableSharing.Confirm" = "Disable Sharing"; diff --git a/submodules/TelegramUI/Components/PeerInfo/PeerCopyProtectionInfoScreen/Sources/PeerCopyProtectionInfoScreen.swift b/submodules/TelegramUI/Components/PeerInfo/PeerCopyProtectionInfoScreen/Sources/PeerCopyProtectionInfoScreen.swift index 96f6409cb2..ed1a58fd27 100644 --- a/submodules/TelegramUI/Components/PeerInfo/PeerCopyProtectionInfoScreen/Sources/PeerCopyProtectionInfoScreen.swift +++ b/submodules/TelegramUI/Components/PeerInfo/PeerCopyProtectionInfoScreen/Sources/PeerCopyProtectionInfoScreen.swift @@ -100,7 +100,6 @@ private final class PeerCopyProtectionInfoSheetContent: CombinedComponent { let theme = environment.theme let strings = environment.strings - let _ = strings let sideInset: CGFloat = 30.0 + environment.safeInsets.left let textSideInset: CGFloat = 30.0 + environment.safeInsets.left @@ -131,7 +130,7 @@ private final class PeerCopyProtectionInfoSheetContent: CombinedComponent { let title = title.update( component: BalancedTextComponent( - text: .plain(NSAttributedString(string: "Disable Sharing", font: titleFont, textColor: textColor)), + text: .plain(NSAttributedString(string: strings.DisableSharing_Title, font: titleFont, textColor: textColor)), horizontalAlignment: .center, maximumNumberOfLines: 0, lineSpacing: 0.1 @@ -150,9 +149,9 @@ private final class PeerCopyProtectionInfoSheetContent: CombinedComponent { AnyComponentWithIdentity( id: "screenshot", component: AnyComponent(InfoParagraphComponent( - title: "No Screenshots", + title: strings.DisableSharing_Screenshot_Title, titleColor: textColor, - text: "Disable screenshots and screen recordings in this chat.", + text: strings.DisableSharing_Screenshot_Text, textColor: secondaryTextColor, accentColor: linkColor, iconName: "Premium/CopyProtection/NoScreenshot", @@ -164,9 +163,9 @@ private final class PeerCopyProtectionInfoSheetContent: CombinedComponent { AnyComponentWithIdentity( id: "forward", component: AnyComponent(InfoParagraphComponent( - title: "No Forwarding", + title: strings.DisableSharing_Forwarding_Title, titleColor: textColor, - text: "Disable message forwarding to other chats.", + text: strings.DisableSharing_Forwarding_Text, textColor: secondaryTextColor, accentColor: linkColor, iconName: "Premium/CopyProtection/NoForward", @@ -178,9 +177,9 @@ private final class PeerCopyProtectionInfoSheetContent: CombinedComponent { AnyComponentWithIdentity( id: "save", component: AnyComponent(InfoParagraphComponent( - title: "No Saving", + title: strings.DisableSharing_Saving_Title, titleColor: textColor, - text: "Disable copying text and saving photos and videos to Photos.", + text: strings.DisableSharing_Saving_Text, textColor: secondaryTextColor, accentColor: linkColor, iconName: "Premium/CopyProtection/NoDownload", @@ -227,7 +226,7 @@ private final class PeerCopyProtectionInfoSheetContent: CombinedComponent { if component.context.isPremium { buttonContent = AnyComponentWithIdentity(id: "disable", component: AnyComponent( ButtonTextContentComponent( - text: "Disable Sharing", + text: strings.DisableSharing_Confirm, badge: 0, textColor: theme.list.itemCheckColors.foregroundColor, badgeBackground: theme.list.itemCheckColors.foregroundColor, diff --git a/submodules/TelegramUI/Sources/OpenResolvedUrl.swift b/submodules/TelegramUI/Sources/OpenResolvedUrl.swift index 7403a6a358..d6d50bdf75 100644 --- a/submodules/TelegramUI/Sources/OpenResolvedUrl.swift +++ b/submodules/TelegramUI/Sources/OpenResolvedUrl.swift @@ -1844,8 +1844,11 @@ func openResolvedUrlImpl( } else { text = presentationData.strings.AuthConfirmation_LoginSuccess_Text(domain).string } - if let topViewController = navigationController?.topViewController as? ViewController { - let controller = UndoOverlayController(presentationData: presentationData, content: .actionSucceeded(title: presentationData.strings.AuthConfirmation_LoginSuccess_Title, text: text, cancel: nil, destructive: false), elevatedLayout: topViewController is TabBarController, action: { _ in return true }) + if var topViewController = navigationController?.topViewController as? ViewController { + if let tabBarController = topViewController as? TabBarController, let controller = tabBarController.currentController { + topViewController = controller + } + let controller = UndoOverlayController(presentationData: presentationData, content: .actionSucceeded(title: presentationData.strings.AuthConfirmation_LoginSuccess_Title, text: text, cancel: nil, destructive: false), action: { _ in return true }) topViewController.present(controller, in: .current) } } @@ -1888,28 +1891,38 @@ func openResolvedUrlImpl( }, error: { _ in dismissImpl?() - if case let .request(domain, _, _, _, _, _) = result { - if let topViewController = navigationController?.topViewController as? ViewController { - let controller = UndoOverlayController(presentationData: presentationData, content: .info(title: presentationData.strings.AuthConfirmation_LoginFail_Title, text: presentationData.strings.AuthConfirmation_LoginFail_Text(domain).string, timeout: nil, customUndoText: nil), elevatedLayout: topViewController is TabBarController, action: { _ in return true }) - topViewController.present(controller, in: .current) + Queue.mainQueue().after(0.3) { + if case let .request(domain, _, _, _, _, _) = result { + if var topViewController = navigationController?.topViewController as? ViewController { + if let tabBarController = topViewController as? TabBarController, let controller = tabBarController.currentController { + topViewController = controller + } + let controller = UndoOverlayController(presentationData: presentationData, content: .info(title: presentationData.strings.AuthConfirmation_LoginFail_Title, text: presentationData.strings.AuthConfirmation_LoginFail_Text(domain).string, timeout: nil, customUndoText: nil), action: { _ in return true }) + topViewController.present(controller, in: .current) + } } + + HapticFeedback().error() } - - HapticFeedback().error() }) case .decline: let _ = context.engine.messages.declineUrlAuth(url: url).start() case .failed: dismissImpl?() - if case let .request(domain, _, _, _, _, _) = result { - if let topViewController = navigationController?.topViewController as? ViewController { - let controller = UndoOverlayController(presentationData: presentationData, content: .info(title: presentationData.strings.AuthConfirmation_LoginFail_Title, text: presentationData.strings.AuthConfirmation_LoginFail_Text(domain).string, timeout: nil, customUndoText: nil), elevatedLayout: topViewController is TabBarController, action: { _ in return true }) - topViewController.present(controller, in: .current) + Queue.mainQueue().after(0.3) { + if case let .request(domain, _, _, _, _, _) = result { + if var topViewController = navigationController?.topViewController as? ViewController { + if let tabBarController = topViewController as? TabBarController, let controller = tabBarController.currentController { + topViewController = controller + } + let controller = UndoOverlayController(presentationData: presentationData, content: .info(title: presentationData.strings.AuthConfirmation_LoginFail_Title, text: presentationData.strings.AuthConfirmation_LoginFail_Text(domain).string, timeout: nil, customUndoText: nil), action: { _ in return true }) + topViewController.present(controller, in: .current) + } } + + HapticFeedback().error() } - - HapticFeedback().error() } }) navigationController?.pushViewController(controller) @@ -1917,8 +1930,11 @@ func openResolvedUrlImpl( controller?.dismissAnimated() } } else { - if let topViewController = navigationController?.topViewController as? ViewController { - let controller = UndoOverlayController(presentationData: presentationData, content: .info(title: presentationData.strings.AuthConfirmation_LoginFail_Title, text: presentationData.strings.AuthConfirmation_LoginFail_TextUnknown, timeout: nil, customUndoText: nil), elevatedLayout: topViewController is TabBarController, action: { _ in return true }) + if var topViewController = navigationController?.topViewController as? ViewController { + if let tabBarController = topViewController as? TabBarController, let controller = tabBarController.currentController { + topViewController = controller + } + let controller = UndoOverlayController(presentationData: presentationData, content: .info(title: presentationData.strings.AuthConfirmation_LoginFail_Title, text: presentationData.strings.AuthConfirmation_LoginFail_TextUnknown, timeout: nil, customUndoText: nil), action: { _ in return true }) topViewController.present(controller, in: .current) } } diff --git a/submodules/TelegramUI/Sources/SharedWakeupManager.swift b/submodules/TelegramUI/Sources/SharedWakeupManager.swift index dfb839298f..e259fd8693 100644 --- a/submodules/TelegramUI/Sources/SharedWakeupManager.swift +++ b/submodules/TelegramUI/Sources/SharedWakeupManager.swift @@ -514,7 +514,7 @@ public final class SharedWakeupManager { return } guard let self else { - task.updateTitle(task.title, subtitle: "Finished") + task.updateTitle(task.title, subtitle: presentationData.strings.BackgroundTasks_MediaFinished) task.setTaskCompleted(success: true) return } @@ -562,7 +562,7 @@ public final class SharedWakeupManager { Task { @MainActor [weak self] in guard let self else { - task.updateTitle(task.title, subtitle: "Finished") + task.updateTitle(task.title, subtitle: presentationData.strings.BackgroundTasks_MediaFinished) task.setTaskCompleted(success: true) return } @@ -576,7 +576,7 @@ public final class SharedWakeupManager { if self.backgroundProcessingTaskId != task.identifier || self.pendingMediaUploadsByKey.isEmpty { self.backgroundProcessingTaskProgressByKey = [:] - task.updateTitle(task.title, subtitle: "Finished") + task.updateTitle(task.title, subtitle: presentationData.strings.BackgroundTasks_MediaFinished) task.setTaskCompleted(success: true) if self.backgroundProcessingTaskId == task.identifier { self.backgroundProcessingTaskId = nil @@ -690,7 +690,7 @@ public final class SharedWakeupManager { return } guard let self else { - task.updateTitle(task.title, subtitle: "Finished") + task.updateTitle(task.title, subtitle: presentationData.strings.BackgroundTasks_StoryFinished) task.setTaskCompleted(success: true) return } @@ -738,7 +738,7 @@ public final class SharedWakeupManager { Task { @MainActor [weak self] in guard let self else { - task.updateTitle(task.title, subtitle: "Finished") + task.updateTitle(task.title, subtitle: presentationData.strings.BackgroundTasks_StoryFinished) task.setTaskCompleted(success: true) return } @@ -754,7 +754,7 @@ public final class SharedWakeupManager { if self.backgroundStoryProcessingTaskId != task.identifier || self.pendingStoryUploadStatusesByKey.isEmpty { self.backgroundStoryProcessingTaskProgressByKey = [:] - task.updateTitle(task.title, subtitle: "Finished") + task.updateTitle(task.title, subtitle: presentationData.strings.BackgroundTasks_StoryFinished) task.setTaskCompleted(success: true) if self.backgroundStoryProcessingTaskId == task.identifier { self.backgroundStoryProcessingTaskId = nil