mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-05-21 18:20:41 +00:00
7b2b74e79b
First build-verified unused-import sweep: speculatively dropped import Postbox from 782 consumer files (plain ^import Postbox$ lines, excluding TelegramCore/Postbox/TelegramApi paths), iterated 18 full project builds with --continueOnError, restored the import on every file that failed to compile. 183 drops survived; 189 consumer modules newly Postbox-free. Bundled: spec + plan + C1 atomic batch drop + C2 CLAUDE.md outcome and permanent methodology guidance under Wave-selection. The methodology subsection captures the reusable playbook (--continueOnError is essential, dependency graphs are deep so expect many iterations, pattern-based preemptive restores accelerate convergence, and CLAUDE.md's engine typealias cheat sheet arrows are migration targets rather than typealiases in TelegramCore). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
82 lines
2.6 KiB
Swift
82 lines
2.6 KiB
Swift
import Foundation
|
|
import UIKit
|
|
import SwiftSignalKit
|
|
import AsyncDisplayKit
|
|
import Display
|
|
import TelegramCore
|
|
import TelegramPresentationData
|
|
import AccountContext
|
|
import ComponentFlow
|
|
import MultilineTextComponent
|
|
import BalancedTextComponent
|
|
import AlertComponent
|
|
import AlertInputFieldComponent
|
|
|
|
public func businessLinkNameAlertController(
|
|
context: AccountContext,
|
|
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil,
|
|
value: String?,
|
|
apply: @escaping (String?) -> Void
|
|
) -> ViewController {
|
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
|
let strings = presentationData.strings
|
|
|
|
let inputState = AlertInputFieldComponent.ExternalState()
|
|
|
|
var content: [AnyComponentWithIdentity<AlertComponentEnvironment>] = []
|
|
content.append(AnyComponentWithIdentity(
|
|
id: "title",
|
|
component: AnyComponent(
|
|
AlertTitleComponent(title: strings.Business_Links_LinkNameTitle)
|
|
)
|
|
))
|
|
content.append(AnyComponentWithIdentity(
|
|
id: "text",
|
|
component: AnyComponent(
|
|
AlertTextComponent(content: .plain(strings.Business_Links_LinkNameText))
|
|
)
|
|
))
|
|
|
|
var applyImpl: (() -> Void)?
|
|
content.append(AnyComponentWithIdentity(
|
|
id: "input",
|
|
component: AnyComponent(
|
|
AlertInputFieldComponent(
|
|
context: context,
|
|
initialValue: value,
|
|
placeholder: strings.Business_Links_LinkNameInputPlaceholder,
|
|
characterLimit: 32,
|
|
hasClearButton: false,
|
|
isInitiallyFocused: true,
|
|
externalState: inputState,
|
|
returnKeyAction: {
|
|
applyImpl?()
|
|
}
|
|
)
|
|
)
|
|
))
|
|
|
|
var effectiveUpdatedPresentationData: (PresentationData, Signal<PresentationData, NoError>)
|
|
if let updatedPresentationData {
|
|
effectiveUpdatedPresentationData = updatedPresentationData
|
|
} else {
|
|
effectiveUpdatedPresentationData = (presentationData, context.sharedContext.presentationData)
|
|
}
|
|
|
|
let alertController = AlertScreen(
|
|
configuration: AlertScreen.Configuration(allowInputInset: true),
|
|
content: content,
|
|
actions: [
|
|
.init(title: strings.Common_Cancel),
|
|
.init(title: strings.Common_Done, type: .default, action: {
|
|
applyImpl?()
|
|
})
|
|
],
|
|
updatedPresentationData: effectiveUpdatedPresentationData
|
|
)
|
|
applyImpl = {
|
|
apply(inputState.value)
|
|
}
|
|
return alertController
|
|
}
|