mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-06-08 11:03:55 +02:00
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
This commit is contained in:
@@ -4,35 +4,107 @@ import AlertUI
|
||||
import AccountContext
|
||||
import SwiftSignalKit
|
||||
import TelegramPresentationData
|
||||
import AlertComponent
|
||||
|
||||
public func textAlertController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, forceTheme: PresentationTheme? = nil, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, parseMarkdown: Bool = false, dismissOnOutsideTap: Bool = true, linkAction: (([NSAttributedString.Key: Any], Int) -> Void)? = nil) -> AlertController {
|
||||
public func textAlertController(
|
||||
context: AccountContext,
|
||||
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil,
|
||||
forceTheme: PresentationTheme? = nil,
|
||||
title: String?,
|
||||
text: String,
|
||||
actions: [TextAlertAction],
|
||||
actionLayout: TextAlertContentActionLayout = .horizontal,
|
||||
allowInputInset: Bool = true,
|
||||
parseMarkdown: Bool = false,
|
||||
dismissOnOutsideTap: Bool = true,
|
||||
linkAction: (([NSAttributedString.Key: Any], Int) -> Void)? = nil
|
||||
) -> ViewController {
|
||||
return textAlertController(sharedContext: context.sharedContext, updatedPresentationData: updatedPresentationData, forceTheme: forceTheme, title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, parseMarkdown: parseMarkdown, dismissOnOutsideTap: dismissOnOutsideTap, linkAction: linkAction)
|
||||
}
|
||||
|
||||
public func textAlertController(sharedContext: SharedAccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, forceTheme: PresentationTheme? = nil, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, parseMarkdown: Bool = false, dismissOnOutsideTap: Bool = true, linkAction: (([NSAttributedString.Key: Any], Int) -> Void)? = nil) -> AlertController {
|
||||
public func textAlertController(
|
||||
sharedContext: SharedAccountContext,
|
||||
updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil,
|
||||
forceTheme: PresentationTheme? = nil,
|
||||
title: String?,
|
||||
text: String,
|
||||
actions: [TextAlertAction],
|
||||
actionLayout: TextAlertContentActionLayout = .horizontal,
|
||||
allowInputInset: Bool = true,
|
||||
parseMarkdown: Bool = false,
|
||||
dismissOnOutsideTap: Bool = true,
|
||||
linkAction: (([NSAttributedString.Key: Any], Int) -> Void)? = nil
|
||||
) -> ViewController {
|
||||
var presentationData = updatedPresentationData?.initial ?? sharedContext.currentPresentationData.with { $0 }
|
||||
if let forceTheme = forceTheme {
|
||||
if let forceTheme {
|
||||
presentationData = presentationData.withUpdated(theme: forceTheme)
|
||||
}
|
||||
return textAlertController(alertContext: AlertControllerContext(theme: AlertControllerTheme(presentationData: presentationData), themeSignal: (updatedPresentationData?.signal ?? sharedContext.presentationData) |> map {
|
||||
let updatedPresentationDataSignal = (updatedPresentationData?.signal ?? sharedContext.presentationData) |> map {
|
||||
presentationData in
|
||||
var presentationData = presentationData
|
||||
if let forceTheme = forceTheme {
|
||||
presentationData = presentationData.withUpdated(theme: forceTheme)
|
||||
}
|
||||
return AlertControllerTheme(presentationData: presentationData)
|
||||
}), title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, parseMarkdown: parseMarkdown, dismissOnOutsideTap: dismissOnOutsideTap, linkAction: linkAction)
|
||||
return presentationData
|
||||
}
|
||||
|
||||
let mappedActions: [AlertScreen.Action] = actions.map { action in
|
||||
let mappedType: AlertScreen.Action.ActionType
|
||||
switch action.type {
|
||||
case .genericAction:
|
||||
mappedType = .generic
|
||||
case .defaultAction:
|
||||
mappedType = .default
|
||||
case .destructiveAction:
|
||||
mappedType = .destructive
|
||||
case .defaultDestructiveAction:
|
||||
mappedType = .defaultDestructive
|
||||
}
|
||||
return AlertScreen.Action(
|
||||
title: action.title,
|
||||
type: mappedType,
|
||||
action: action.action
|
||||
)
|
||||
}
|
||||
|
||||
let controller = AlertScreen(
|
||||
configuration: AlertScreen.Configuration(
|
||||
actionAlignment: actionLayout == .vertical ? .vertical : .default,
|
||||
dismissOnOutsideTap: dismissOnOutsideTap,
|
||||
allowInputInset: allowInputInset
|
||||
),
|
||||
title: title,
|
||||
text: text,
|
||||
textAction: { attributes in
|
||||
linkAction?(attributes, 0)
|
||||
},
|
||||
actions: mappedActions,
|
||||
updatedPresentationData: (initial: presentationData, signal: updatedPresentationDataSignal)
|
||||
)
|
||||
return controller
|
||||
}
|
||||
|
||||
public func textAlertController(sharedContext: SharedAccountContext, title: String?, text: String, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, dismissOnOutsideTap: Bool = true) -> AlertController {
|
||||
return textAlertController(alertContext: AlertControllerContext(theme: AlertControllerTheme(presentationData: sharedContext.currentPresentationData.with { $0 }), themeSignal: sharedContext.presentationData |> map { presentationData in AlertControllerTheme(presentationData: presentationData) }), title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, dismissOnOutsideTap: dismissOnOutsideTap)
|
||||
}
|
||||
|
||||
public func richTextAlertController(context: AccountContext, title: NSAttributedString?, text: NSAttributedString, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, dismissAutomatically: Bool = true) -> AlertController {
|
||||
public func richTextAlertController(
|
||||
context: AccountContext,
|
||||
title: NSAttributedString?,
|
||||
text: NSAttributedString,
|
||||
actions: [TextAlertAction],
|
||||
actionLayout: TextAlertContentActionLayout = .horizontal,
|
||||
allowInputInset: Bool = true,
|
||||
dismissAutomatically: Bool = true
|
||||
) -> AlertController {
|
||||
return richTextAlertController(alertContext: AlertControllerContext(theme: AlertControllerTheme(presentationData: context.sharedContext.currentPresentationData.with { $0 }), themeSignal: context.sharedContext.presentationData |> map { presentationData in AlertControllerTheme(presentationData: presentationData) }), title: title, text: text, actions: actions, actionLayout: actionLayout, allowInputInset: allowInputInset, dismissAutomatically: dismissAutomatically)
|
||||
}
|
||||
|
||||
public func textWithEntitiesAlertController(context: AccountContext, title: NSAttributedString?, text: NSAttributedString, actions: [TextAlertAction], actionLayout: TextAlertContentActionLayout = .horizontal, allowInputInset: Bool = true, dismissAutomatically: Bool = true) -> AlertController {
|
||||
public func textWithEntitiesAlertController(
|
||||
context: AccountContext,
|
||||
title: NSAttributedString?,
|
||||
text: NSAttributedString,
|
||||
actions: [TextAlertAction],
|
||||
actionLayout: TextAlertContentActionLayout = .horizontal,
|
||||
allowInputInset: Bool = true,
|
||||
dismissAutomatically: Bool = true
|
||||
) -> AlertController {
|
||||
return textWithEntitiesAlertController(
|
||||
alertContext: AlertControllerContext(
|
||||
theme: AlertControllerTheme(presentationData: context.sharedContext.currentPresentationData.with { $0 }),
|
||||
|
||||
@@ -6,6 +6,7 @@ import AccountContext
|
||||
import OverlayStatusController
|
||||
import UrlWhitelist
|
||||
import TelegramPresentationData
|
||||
import AlertComponent
|
||||
|
||||
public func openUserGeneratedUrl(context: AccountContext, peerId: PeerId?, url: String, concealed: Bool, skipUrlAuth: Bool = false, skipConcealedAlert: Bool = false, forceDark: Bool = false, present: @escaping (ViewController) -> Void, openResolved: @escaping (ResolvedUrl) -> Void, progress: Promise<Bool>? = nil, alertDisplayUpdated: ((ViewController?) -> Void)? = nil) -> Disposable {
|
||||
var concealed = concealed
|
||||
@@ -95,8 +96,10 @@ public func openUserGeneratedUrl(context: AccountContext, peerId: PeerId?, url:
|
||||
let alertController = textAlertController(context: context, forceTheme: forceDark ? presentationData.theme : nil, title: nil, text: presentationData.strings.Generic_OpenHiddenLinkAlert(displayUrl).string, actions: [TextAlertAction(type: .genericAction, title: presentationData.strings.Common_No, action: {}), TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_Yes, action: {
|
||||
disposable.set(openImpl())
|
||||
})])
|
||||
alertController.dismissed = { _ in
|
||||
alertDisplayUpdated?(nil)
|
||||
if let alertController = alertController as? AlertScreen {
|
||||
alertController.dismissed = { _ in
|
||||
alertDisplayUpdated?(nil)
|
||||
}
|
||||
}
|
||||
present(alertController)
|
||||
alertDisplayUpdated?(alertController)
|
||||
|
||||
Reference in New Issue
Block a user