mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Force System Share sheet tg://sg/debug
This commit is contained in:
parent
e332801cc9
commit
b58e326f38
@ -26,8 +26,12 @@ private enum SGDebugActions: String {
|
|||||||
case clearRegDateCache
|
case clearRegDateCache
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private enum SGDebugToggles: String {
|
||||||
|
case forceImmediateShareSheet
|
||||||
|
}
|
||||||
|
|
||||||
private typealias SGDebugControllerEntry = SGItemListUIEntry<SGDebugControllerSection, AnyHashable, AnyHashable, AnyHashable, AnyHashable, SGDebugActions>
|
|
||||||
|
private typealias SGDebugControllerEntry = SGItemListUIEntry<SGDebugControllerSection, SGDebugToggles, AnyHashable, AnyHashable, AnyHashable, SGDebugActions>
|
||||||
|
|
||||||
private func SGDebugControllerEntries(presentationData: PresentationData) -> [SGDebugControllerEntry] {
|
private func SGDebugControllerEntries(presentationData: PresentationData) -> [SGDebugControllerEntry] {
|
||||||
var entries: [SGDebugControllerEntry] = []
|
var entries: [SGDebugControllerEntry] = []
|
||||||
@ -37,6 +41,7 @@ private func SGDebugControllerEntries(presentationData: PresentationData) -> [SG
|
|||||||
entries.append(.action(id: id.count, section: .base, actionType: .flexing, text: "FLEX", kind: .generic))
|
entries.append(.action(id: id.count, section: .base, actionType: .flexing, text: "FLEX", kind: .generic))
|
||||||
#endif
|
#endif
|
||||||
entries.append(.action(id: id.count, section: .base, actionType: .clearRegDateCache, text: "Clear Regdate cache", kind: .generic))
|
entries.append(.action(id: id.count, section: .base, actionType: .clearRegDateCache, text: "Clear Regdate cache", kind: .generic))
|
||||||
|
entries.append(.toggle(id: id.count, section: .base, settingName: .forceImmediateShareSheet, value: SGSimpleSettings.shared.forceSystemSharing, text: "Force System Share Sheet", enabled: true))
|
||||||
|
|
||||||
return entries
|
return entries
|
||||||
}
|
}
|
||||||
@ -51,7 +56,12 @@ public func sgDebugController(context: AccountContext) -> ViewController {
|
|||||||
|
|
||||||
let simplePromise = ValuePromise(true, ignoreRepeated: false)
|
let simplePromise = ValuePromise(true, ignoreRepeated: false)
|
||||||
|
|
||||||
let arguments = SGItemListArguments<AnyHashable, AnyHashable, AnyHashable, AnyHashable, SGDebugActions>(context: context, action: { actionType in
|
let arguments = SGItemListArguments<SGDebugToggles, AnyHashable, AnyHashable, AnyHashable, SGDebugActions>(context: context, setBoolValue: { toggleName, value in
|
||||||
|
switch toggleName {
|
||||||
|
case .forceImmediateShareSheet:
|
||||||
|
SGSimpleSettings.shared.forceSystemSharing = value
|
||||||
|
}
|
||||||
|
}, action: { actionType in
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
switch actionType {
|
switch actionType {
|
||||||
case .clearRegDateCache:
|
case .clearRegDateCache:
|
||||||
|
@ -102,6 +102,7 @@ public class SGSimpleSettings {
|
|||||||
case forceEmojiTab
|
case forceEmojiTab
|
||||||
case forceBuiltInMic
|
case forceBuiltInMic
|
||||||
case hideChannelBottomButton
|
case hideChannelBottomButton
|
||||||
|
case forceSystemSharing
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DownloadSpeedBoostValues: String, CaseIterable {
|
public enum DownloadSpeedBoostValues: String, CaseIterable {
|
||||||
@ -187,7 +188,8 @@ public class SGSimpleSettings {
|
|||||||
Keys.messageDoubleTapActionOutgoing.rawValue: MessageDoubleTapAction.default.rawValue,
|
Keys.messageDoubleTapActionOutgoing.rawValue: MessageDoubleTapAction.default.rawValue,
|
||||||
Keys.wideChannelPosts.rawValue: false,
|
Keys.wideChannelPosts.rawValue: false,
|
||||||
Keys.forceEmojiTab.rawValue: false,
|
Keys.forceEmojiTab.rawValue: false,
|
||||||
Keys.hideChannelBottomButton.rawValue: false
|
Keys.hideChannelBottomButton.rawValue: false,
|
||||||
|
Keys.forceSystemSharing.rawValue: false,
|
||||||
]
|
]
|
||||||
|
|
||||||
@UserDefault(key: Keys.hidePhoneInSettings.rawValue)
|
@UserDefault(key: Keys.hidePhoneInSettings.rawValue)
|
||||||
@ -350,6 +352,9 @@ public class SGSimpleSettings {
|
|||||||
|
|
||||||
@UserDefault(key: Keys.hideChannelBottomButton.rawValue)
|
@UserDefault(key: Keys.hideChannelBottomButton.rawValue)
|
||||||
public var hideChannelBottomButton: Bool
|
public var hideChannelBottomButton: Bool
|
||||||
|
|
||||||
|
@UserDefault(key: Keys.forceSystemSharing.rawValue)
|
||||||
|
public var forceSystemSharing: Bool
|
||||||
}
|
}
|
||||||
|
|
||||||
extension SGSimpleSettings {
|
extension SGSimpleSettings {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
import SGSimpleSettings
|
||||||
import UIKit
|
import UIKit
|
||||||
import Display
|
import Display
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
@ -461,6 +462,10 @@ public final class ShareController: ViewController {
|
|||||||
public var parentNavigationController: NavigationController?
|
public var parentNavigationController: NavigationController?
|
||||||
|
|
||||||
public convenience init(context: AccountContext, subject: ShareControllerSubject, presetText: String? = nil, preferredAction: ShareControllerPreferredAction = .default, showInChat: ((Message) -> Void)? = nil, fromForeignApp: Bool = false, segmentedValues: [ShareControllerSegmentedValue]? = nil, externalShare: Bool = true, immediateExternalShare: Bool = false, switchableAccounts: [AccountWithInfo] = [], immediatePeerId: PeerId? = nil, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, forceTheme: PresentationTheme? = nil, forcedActionTitle: String? = nil, shareAsLink: Bool = false, collectibleItemInfo: TelegramCollectibleItemInfo? = nil) {
|
public convenience init(context: AccountContext, subject: ShareControllerSubject, presetText: String? = nil, preferredAction: ShareControllerPreferredAction = .default, showInChat: ((Message) -> Void)? = nil, fromForeignApp: Bool = false, segmentedValues: [ShareControllerSegmentedValue]? = nil, externalShare: Bool = true, immediateExternalShare: Bool = false, switchableAccounts: [AccountWithInfo] = [], immediatePeerId: PeerId? = nil, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)? = nil, forceTheme: PresentationTheme? = nil, forcedActionTitle: String? = nil, shareAsLink: Bool = false, collectibleItemInfo: TelegramCollectibleItemInfo? = nil) {
|
||||||
|
var immediateExternalShare = immediateExternalShare
|
||||||
|
if SGSimpleSettings.shared.forceSystemSharing {
|
||||||
|
immediateExternalShare = true
|
||||||
|
}
|
||||||
self.init(
|
self.init(
|
||||||
environment: ShareControllerAppEnvironment(sharedContext: context.sharedContext),
|
environment: ShareControllerAppEnvironment(sharedContext: context.sharedContext),
|
||||||
currentContext: ShareControllerAppAccountContext(context: context),
|
currentContext: ShareControllerAppAccountContext(context: context),
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
import SGSimpleSettings
|
||||||
import Display
|
import Display
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
import Postbox
|
import Postbox
|
||||||
|
Loading…
x
Reference in New Issue
Block a user