Camera and editor improvements

This commit is contained in:
Ilya Laktyushin
2023-05-31 15:24:07 +04:00
parent 9bd6dd35c7
commit 2b85ec7b5f
17 changed files with 372 additions and 160 deletions

View File

@@ -191,41 +191,41 @@ public final class TelegramRootController: NavigationController, TelegramRootCon
accountSettingsController.parentController = self
controllers.append(accountSettingsController)
tabBarController.cameraItemAndAction = (
UITabBarItem(title: "Camera", image: UIImage(bundleImageName: "Chat List/Tabs/IconCamera"), tag: 2),
{ [weak self] in
guard let self else {
return
}
let coordinator = self.openStoryCamera(
transitionIn: nil,
transitionedIn: { [weak self] in
guard let self, let rootTabController = self.rootTabController else {
return
}
if let index = rootTabController.controllers.firstIndex(where: { $0 is ChatListController}) {
rootTabController.selectedIndex = index
}
},
transitionOut: { [weak self] finished in
guard let self else {
return nil
}
if finished {
if let chatListController = self.chatListController as? ChatListControllerImpl, let transitionView = chatListController.transitionViewForOwnStoryItem() {
return StoryCameraTransitionOut(
destinationView: transitionView,
destinationRect: transitionView.bounds,
destinationCornerRadius: transitionView.bounds.height / 2.0
)
}
}
return nil
}
)
coordinator?.animateIn()
}
)
// tabBarController.cameraItemAndAction = (
// UITabBarItem(title: "Camera", image: UIImage(bundleImageName: "Chat List/Tabs/IconCamera"), tag: 2),
// { [weak self] in
// guard let self else {
// return
// }
// let coordinator = self.openStoryCamera(
// transitionIn: nil,
// transitionedIn: { [weak self] in
// guard let self, let rootTabController = self.rootTabController else {
// return
// }
// if let index = rootTabController.controllers.firstIndex(where: { $0 is ChatListController}) {
// rootTabController.selectedIndex = index
// }
// },
// transitionOut: { [weak self] finished in
// guard let self else {
// return nil
// }
// if finished {
// if let chatListController = self.chatListController as? ChatListControllerImpl, let transitionView = chatListController.transitionViewForOwnStoryItem() {
// return StoryCameraTransitionOut(
// destinationView: transitionView,
// destinationRect: transitionView.bounds,
// destinationCornerRadius: transitionView.bounds.height / 2.0
// )
// }
// }
// return nil
// }
// )
// coordinator?.animateIn()
// }
// )
tabBarController.setControllers(controllers, selectedIndex: restoreSettignsController != nil ? (controllers.count - 1) : (controllers.count - 2))
@@ -400,16 +400,6 @@ public final class TelegramRootController: NavigationController, TelegramRootCon
var attributes: [MessageAttribute] = []
let imageFlags: TelegramMediaImageFlags = []
// var stickerFiles: [TelegramMediaFile] = []
// if !stickers.isEmpty {
// for fileReference in stickers {
// stickerFiles.append(fileReference.media)
// }
// }
// if !stickerFiles.isEmpty {
// attributes.append(EmbeddedMediaStickersMessageAttribute(files: stickerFiles))
// imageFlags.insert(.hasStickers)
// }
let media = TelegramMediaImage(imageId: MediaId(namespace: Namespaces.Media.LocalImage, id: randomId), representations: representations, immediateThumbnailData: nil, reference: nil, partialReference: nil, flags: imageFlags)
if let timeout, timeout > 0 && timeout <= 60 {