Files
ghostgram/submodules/TelegramUI/Components/PeerInfo/PeerInfoScreen/Sources/PhotoUpdateConfirmationController.swift
ichmagmaus 812 db53826061 chore: migrate to new version + fixed several critical bugs
- Migrated project to latest Telegram iOS base (v12.3.2+)
- Fixed circular dependency between GhostModeManager and MiscSettingsManager
- Fixed multiple Bazel build configuration errors (select() default conditions)
- Fixed duplicate type definitions in PeerInfoScreen
- Fixed swiftmodule directory resolution in build scripts
- Added Ghostgram Settings tab in main Settings menu with all 5 features
- Cleared sensitive credentials from config.json (template-only now)
- Excluded bazel-cache from version control
2026-02-23 23:04:32 +01:00

119 lines
3.9 KiB
Swift

import Foundation
import UIKit
import SwiftSignalKit
import AsyncDisplayKit
import Display
import Postbox
import TelegramCore
import TelegramPresentationData
import TelegramUIPreferences
import AccountContext
import AppBundle
import ComponentFlow
import AlertComponent
import AlertTransferHeaderComponent
import AvatarComponent
func photoUpdateConfirmationController(
context: AccountContext,
peer: EnginePeer,
image: UIImage,
text: String,
doneTitle: String,
isDark: Bool = true,
commit: @escaping () -> Void
) -> ViewController {
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
let strings = presentationData.strings
var content: [AnyComponentWithIdentity<AlertComponentEnvironment>] = []
content.append(AnyComponentWithIdentity(
id: "header",
component: AnyComponent(
AlertTransferHeaderComponent(
fromComponent: AnyComponentWithIdentity(id: "user", component: AnyComponent(
AvatarComponent(
context: context,
theme: presentationData.theme,
peer: peer
)
)),
toComponent: AnyComponentWithIdentity(id: "image", component: AnyComponent(
Image(
image: image,
size: CGSize(width: 60.0, height: 60.0),
cornerRadius: 30.0
)
)),
type: .transfer
)
)
))
content.append(AnyComponentWithIdentity(
id: "text",
component: AnyComponent(
AlertTextComponent(content: .plain(text))
)
))
var updatedPresentationData: (PresentationData, Signal<PresentationData, NoError>)
if isDark {
updatedPresentationData = (presentationData.withUpdated(theme: defaultDarkColorPresentationTheme), .single(presentationData.withUpdated(theme: defaultDarkColorPresentationTheme)))
} else {
updatedPresentationData = (presentationData, context.sharedContext.presentationData)
}
let alertController = AlertScreen(
content: content,
actions: [
.init(title: strings.Common_Cancel),
.init(title: doneTitle, type: .default, action: {
commit()
})
],
updatedPresentationData: updatedPresentationData
)
return alertController
}
//private final class RoundImageComponent: Component {
// let image: UIImage
//
// public init(
// image: UIImage
// ) {
// self.image = image
// }
//
// public static func ==(lhs: RoundImageComponent, rhs: RoundImageComponent) -> Bool {
// if lhs.image !== rhs.image {
// return false
// }
// return true
// }
//
// public final class View: UIImageView {
// private var component: RoundImageComponent?
// private weak var state: EmptyComponentState?
//
// func update(component: RoundImageComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
// self.component = component
// self.state = state
//
// self.clipsToBounds = true
// self.image = component.image
// self.layer.cornerRadius = 30.0
//
// return CGSize(width: 60.0, height: 60.0)
// }
// }
//
// public func makeView() -> View {
// return View(frame: CGRect())
// }
//
// public func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
// return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
// }
//}