Merge commit '5c25bca177cea0c968a67393a0ecf4347ddd9aee'

This commit is contained in:
Ali 2023-07-17 18:53:41 +04:00
commit d45e111151
7 changed files with 28 additions and 8 deletions

View File

@ -7390,6 +7390,7 @@ Sorry for the inconvenience.";
"Attachment.MediaAccessTitle" = "Access Your Photos and Videos";
"Attachment.MediaAccessText" = "Share an unlimited number of photos and videos of up to 2 GB each.";
"Attachment.MediaAccessStoryText" = "Share an unlimited number of photos and videos of up to 2 GB each.";
"Attachment.LimitedMediaAccessText" = "You have limited Telegram from accessing all of your photos.";
"Attachment.CameraAccessText" = "Telegram needs camera access so that you can take photos and videos.";
@ -9420,7 +9421,7 @@ Sorry for the inconvenience.";
"StoryFeed.TooltipStoryLimit" = "You can't post more than **%@** stories in **24 hours**.";
"StoryFeed.TooltipPostingDuringCall" = "You can't post stories during a call.";
"StoryFeed.TooltipPostingDuringGroupCall" = "You can't post stories during a voice chat.";
"StoryFeed.TooltipPostingDuringGroupCall" = "You can't post stories during a video chat.";
"StoryFeed.MyStory" = "My Story";
"StoryFeed.MyUploading" = "Uploading...";

View File

@ -10,7 +10,7 @@ import PresentationDataUtils
final class MediaPickerPlaceholderNode: ASDisplayNode {
enum Content {
case intro
case intro(story: Bool)
case bannedSendMedia(String)
}
@ -144,9 +144,9 @@ final class MediaPickerPlaceholderNode: ASDisplayNode {
let title: String
let text: String
switch self.content {
case .intro:
case let .intro(story):
title = strings.Attachment_MediaAccessTitle
text = strings.Attachment_MediaAccessText
text = story ? strings.Attachment_MediaAccessStoryText : strings.Attachment_MediaAccessText
case let .bannedSendMedia(banDescription):
title = ""
text = banDescription

View File

@ -1333,8 +1333,10 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
if case let .noAccess(cameraAccess) = self.state {
var hasCamera = cameraAccess == .authorized
var story = false
if let subject = self.controller?.subject, case .assets(_, .story) = subject {
hasCamera = false
story = true
self.controller?.navigationItem.rightBarButtonItem = nil
}
@ -1344,7 +1346,7 @@ public final class MediaPickerScreen: ViewController, AttachmentContainable {
if let current = self.placeholderNode {
placeholderNode = current
} else {
placeholderNode = MediaPickerPlaceholderNode(content: .intro)
placeholderNode = MediaPickerPlaceholderNode(content: .intro(story: story))
placeholderNode.settingsPressed = { [weak self] in
self?.controller?.context.sharedContext.applicationBindings.openSettings()
}

View File

@ -98,10 +98,8 @@ public final class MediaAssetsContext: NSObject, PHPhotoLibraryChangeObserver {
public func requestMediaAccess(completion: @escaping () -> Void = {}) -> Void {
PHPhotoLibrary.requestAuthorization { [weak self] status in
Queue.mainQueue().async {
if case .authorized = status {
completion()
}
}
self?.mediaAccessSink.putNext(status)
}
}

View File

@ -41,6 +41,7 @@ swift_library(
"//submodules/TelegramUI/Components/ShareWithPeersScreen",
"//submodules/TelegramUI/Components/CameraButtonComponent",
"//submodules/ChatPresentationInterfaceState",
"//submodules/DeviceAccess",
],
visibility = [
"//visibility:public",

View File

@ -30,6 +30,7 @@ import UndoUI
import ChatEntityKeyboardInputNode
import ChatPresentationInterfaceState
import TextFormat
import DeviceAccess
enum DrawingScreenType {
case drawing
@ -3953,7 +3954,20 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
fileprivate var isSavingAvailable = false
private var previousSavedValues: MediaEditorValues?
func requestSave() {
let context = self.context
DeviceAccess.authorizeAccess(to: .mediaLibrary(.save), presentationData: context.sharedContext.currentPresentationData.with { $0 }, present: { c, a in
context.sharedContext.presentGlobalController(c, a)
}, openSettings: context.sharedContext.applicationBindings.openSettings, { [weak self] authorized in
if !authorized {
return
}
self?.performSave()
})
}
private func performSave() {
guard let mediaEditor = self.node.mediaEditor, let subject = self.node.subject, self.isSavingAvailable else {
return
}

View File

@ -94,6 +94,10 @@ final class StoryItemSetContainerSendMessage {
self.navigationActionDisposable.dispose()
self.resolvePeerByNameDisposable.dispose()
self.inputMediaNodeDataDisposable?.dispose()
if let tooltipScreen = self.tooltipScreen {
tooltipScreen.dismiss()
}
}
func setup(context: AccountContext, view: StoryItemSetContainerComponent.View, inputPanelExternalState: MessageInputPanelComponent.ExternalState, keyboardInputData: Signal<ChatEntityKeyboardInputNode.InputData, NoError>) {