Skip to content

Commit 7e4a7df

Browse files
author
Ali
committed
Don't link unused code
1 parent 615e2c7 commit 7e4a7df

23 files changed

Lines changed: 111 additions & 23 deletions

‎BUCK‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ resource_dependencies = [
4848
"//submodules/LegacyComponents:LegacyComponentsResources",
4949
"//submodules/TelegramUI:TelegramUIAssets",
5050
"//submodules/TelegramUI:TelegramUIResources",
51-
"//submodules/WalletUI:WalletUIAssets",
52-
"//submodules/WalletUI:WalletUIResources",
51+
#"//submodules/WalletUI:WalletUIAssets",
52+
#"//submodules/WalletUI:WalletUIResources",
5353
"//submodules/PasswordSetupUI:PasswordSetupUIResources",
5454
"//submodules/PasswordSetupUI:PasswordSetupUIAssets",
5555
"//submodules/OverlayStatusController:OverlayStatusControllerResources",

‎submodules/AccountContext/BUCK‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ static_library(
1616
"//submodules/Postbox:Postbox#shared",
1717
"//submodules/TelegramCore:TelegramCore#shared",
1818
"//submodules/SyncCore:SyncCore#shared",
19-
"//submodules/WalletCore:WalletCore",
19+
#"//submodules/WalletCore:WalletCore",
2020
],
2121
frameworks = [
2222
"$SDKROOT/System/Library/Frameworks/Foundation.framework",

‎submodules/AccountContext/Sources/AccountContext.swift‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import SwiftSignalKit
88
import Display
99
import DeviceLocationManager
1010
import TemporaryCachedPeerDataManager
11+
12+
#if ENABLE_WALLET
1113
import WalletCore
14+
#endif
1215

1316
public final class TelegramApplicationOpenUrlCompletion {
1417
public let completion: (Bool) -> Void
@@ -175,7 +178,9 @@ public enum ResolvedUrl {
175178
case share(url: String?, text: String?, to: String?)
176179
case wallpaper(WallpaperUrlParameter)
177180
case theme(String)
181+
#if ENABLE_WALLET
178182
case wallet(address: String, amount: Int64?, comment: String?)
183+
#endif
179184
case settings(ResolvedUrlSettingsSection)
180185
}
181186

@@ -378,10 +383,12 @@ public final class ContactSelectionControllerParams {
378383
}
379384
}
380385

386+
#if ENABLE_WALLET
381387
public enum OpenWalletContext {
382388
case generic
383389
case send(address: String, amount: Int64?, comment: String?)
384390
}
391+
#endif
385392

386393
public let defaultContactLabel: String = "_$!<Mobile>!$_"
387394

@@ -464,7 +471,9 @@ public protocol SharedAccountContext: class {
464471
func openAddContact(context: AccountContext, firstName: String, lastName: String, phoneNumber: String, label: String, present: @escaping (ViewController, Any?) -> Void, pushController: @escaping (ViewController) -> Void, completed: @escaping () -> Void)
465472
func openAddPersonContact(context: AccountContext, peerId: PeerId, pushController: @escaping (ViewController) -> Void, present: @escaping (ViewController, Any?) -> Void)
466473
func presentContactsWarningSuppression(context: AccountContext, present: (ViewController, Any?) -> Void)
474+
#if ENABLE_WALLET
467475
func openWallet(context: AccountContext, walletContext: OpenWalletContext, present: @escaping (ViewController) -> Void)
476+
#endif
468477
func openImagePicker(context: AccountContext, completion: @escaping (UIImage) -> Void, present: @escaping (ViewController) -> Void)
469478

470479
func makeRecentSessionsController(context: AccountContext, activeSessionsContext: ActiveSessionsContext) -> ViewController & RecentSessionsController
@@ -477,6 +486,7 @@ public protocol SharedAccountContext: class {
477486
func beginNewAuth(testingEnvironment: Bool)
478487
}
479488

489+
#if ENABLE_WALLET
480490
private final class TonInstanceData {
481491
var config: String?
482492
var blockchainName: String?
@@ -541,19 +551,27 @@ public final class TonContext {
541551
}
542552
}
543553

554+
#endif
555+
544556
public protocol AccountContext: class {
545557
var sharedContext: SharedAccountContext { get }
546558
var account: Account { get }
559+
560+
#if ENABLE_WALLET
547561
var tonContext: StoredTonContext? { get }
562+
#endif
548563

549564
var liveLocationManager: LiveLocationManager? { get }
550565
var fetchManager: FetchManager { get }
551566
var downloadedMediaStoreManager: DownloadedMediaStoreManager { get }
552567
var peerChannelMemberCategoriesContextsManager: PeerChannelMemberCategoriesContextsManager { get }
553568
var wallpaperUploadManager: WallpaperUploadManager? { get }
554569
var watchManager: WatchManager? { get }
570+
571+
#if ENABLE_WALLET
555572
var hasWallets: Signal<Bool, NoError> { get }
556573
var hasWalletAccess: Signal<Bool, NoError> { get }
574+
#endif
557575

558576
var currentLimitsConfiguration: Atomic<LimitsConfiguration> { get }
559577
var currentContentSettings: Atomic<ContentSettings> { get }

‎submodules/ChatListUI/Sources/ChatListController.swift‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ private final class ContextControllerContentSourceImpl: ContextControllerContent
9999
}
100100
}
101101

102-
public class ChatListControllerImpl: TelegramBaseController, ChatListController, UIViewControllerPreviewingDelegate, TabBarContainedController {
102+
public class ChatListControllerImpl: TelegramBaseController, ChatListController, UIViewControllerPreviewingDelegate/*, TabBarContainedController*/ {
103103
private var validLayout: ContainerViewLayout?
104104

105105
public let context: AccountContext
@@ -1808,7 +1808,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
18081808
}
18091809
}
18101810

1811-
public func presentTabBarPreviewingController(sourceNodes: [ASDisplayNode]) {
1811+
/*public func presentTabBarPreviewingController(sourceNodes: [ASDisplayNode]) {
18121812
if self.isNodeLoaded {
18131813
let _ = (self.context.account.postbox.transaction { transaction -> [ChatListFilterPreset] in
18141814
let settings = transaction.getPreferencesEntry(key: ApplicationSpecificPreferencesKeys.chatListFilterSettings) as? ChatListFilterSettings ?? ChatListFilterSettings.default
@@ -1852,5 +1852,5 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController,
18521852

18531853
public func updateTabBarPreviewingControllerPresentation(_ update: TabBarContainedControllerPresentationUpdate) {
18541854

1855-
}
1855+
}*/
18561856
}

‎submodules/SettingsUI/BUCK‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static_library(
7878
"//submodules/InstantPageCache:InstantPageCache",
7979
"//submodules/AppBundle:AppBundle",
8080
"//submodules/ContextUI:ContextUI",
81-
"//submodules/WalletUI:WalletUI",
81+
#"//submodules/WalletUI:WalletUI",
8282
"//submodules/Markdown:Markdown",
8383
"//submodules/UndoUI:UndoUI",
8484
"//submodules/DeleteChatPeerActionSheetItem:DeleteChatPeerActionSheetItem",

‎submodules/SettingsUI/Sources/DebugController.swift‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import ItemListUI
1717
import PresentationDataUtils
1818
import OverlayStatusController
1919
import AccountContext
20-
import WalletUI
2120

2221
@objc private final class DebugControllerMailComposeDelegate: NSObject, MFMailComposeViewControllerDelegate {
2322
public func mailComposeController(_ controller: MFMailComposeViewController, didFinishWith result: MFMailComposeResult, error: Error?) {

‎submodules/SettingsUI/Sources/LogoutOptionsController.swift‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,11 @@ func logoutOptionsController(context: AccountContext, navigationController: Navi
219219
presentControllerImpl?(alertController, nil)
220220
})
221221

222+
#if ENABLE_WALLET
222223
let hasWallets = context.hasWallets
224+
#else
225+
let hasWallets: Signal<Bool, NoError> = .single(false)
226+
#endif
223227

224228
let signal = combineLatest(queue: .mainQueue(),
225229
context.sharedContext.presentationData,

‎submodules/SettingsUI/Sources/Search/SettingsSearchableItems.swift‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,7 @@ func settingsSearchableItems(context: AccountContext, notificationExceptionsList
882882
})
883883
allItems.append(passport)
884884

885+
#if ENABLE_WALLET
885886
if hasWallet {
886887
let wallet = SettingsSearchableItem(id: .wallet(0), title: strings.Settings_Wallet, alternate: synonyms(strings.SettingsSearch_Synonyms_Wallet), icon: .wallet, breadcrumbs: [], present: { context, _, present in
887888
context.sharedContext.openWallet(context: context, walletContext: .generic, present: { c in
@@ -890,6 +891,7 @@ func settingsSearchableItems(context: AccountContext, notificationExceptionsList
890891
})
891892
allItems.append(wallet)
892893
}
894+
#endif
893895

894896
let support = SettingsSearchableItem(id: .support(0), title: strings.Settings_Support, alternate: synonyms(strings.SettingsSearch_Synonyms_Support), icon: .support, breadcrumbs: [], present: { context, _, present in
895897
let _ = (supportPeerId(account: context.account)

‎submodules/SettingsUI/Sources/SettingsController.swift‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ import PeerAvatarGalleryUI
3333
import MapResourceToAvatarSizes
3434
import AppBundle
3535
import ContextUI
36+
#if ENABLE_WALLET
3637
import WalletUI
38+
#endif
3739
import PhoneNumberFormat
3840
import AccountUtils
3941
import AuthTransferUI
@@ -221,7 +223,9 @@ private indirect enum SettingsEntry: ItemListNodeEntry {
221223
case themes(PresentationTheme, UIImage?, String)
222224
case language(PresentationTheme, UIImage?, String, String)
223225
case passport(PresentationTheme, UIImage?, String, String)
226+
#if ENABLE_WALLET
224227
case wallet(PresentationTheme, UIImage?, String, String)
228+
#endif
225229
case watch(PresentationTheme, UIImage?, String, String)
226230

227231
case askAQuestion(PresentationTheme, UIImage?, String)
@@ -243,8 +247,12 @@ private indirect enum SettingsEntry: ItemListNodeEntry {
243247
return SettingsSection.media.rawValue
244248
case .notificationsAndSounds, .privacyAndSecurity, .dataAndStorage, .themes, .language, .contentStickers:
245249
return SettingsSection.generalSettings.rawValue
246-
case .passport, .wallet, .watch :
250+
case .passport, .watch:
247251
return SettingsSection.advanced.rawValue
252+
#if ENABLE_WALLET
253+
case .wallet:
254+
return SettingsSection.advanced.rawValue
255+
#endif
248256
case .askAQuestion, .faq:
249257
return SettingsSection.help.rawValue
250258
}
@@ -290,8 +298,10 @@ private indirect enum SettingsEntry: ItemListNodeEntry {
290298
return 1012
291299
case .contentStickers:
292300
return 1013
301+
#if ENABLE_WALLET
293302
case .wallet:
294303
return 1014
304+
#endif
295305
case .passport:
296306
return 1015
297307
case .watch:
@@ -457,12 +467,14 @@ private indirect enum SettingsEntry: ItemListNodeEntry {
457467
} else {
458468
return false
459469
}
470+
#if ENABLE_WALLET
460471
case let .wallet(lhsTheme, lhsImage, lhsText, lhsValue):
461472
if case let .wallet(rhsTheme, rhsImage, rhsText, rhsValue) = rhs, lhsTheme === rhsTheme, lhsImage === rhsImage, lhsText == rhsText, lhsValue == rhsValue {
462473
return true
463474
} else {
464475
return false
465476
}
477+
#endif
466478
case let .watch(lhsTheme, lhsImage, lhsText, lhsValue):
467479
if case let .watch(rhsTheme, rhsImage, rhsText, rhsValue) = rhs, lhsTheme === rhsTheme, lhsImage === rhsImage, lhsText == rhsText, lhsValue == rhsValue {
468480
return true
@@ -596,10 +608,12 @@ private indirect enum SettingsEntry: ItemListNodeEntry {
596608
return ItemListDisclosureItem(presentationData: presentationData, icon: image, title: text, label: value, sectionId: ItemListSectionId(self.section), style: .blocks, action: {
597609
arguments.openPassport()
598610
})
611+
#if ENABLE_WALLET
599612
case let .wallet(theme, image, text, value):
600613
return ItemListDisclosureItem(presentationData: presentationData, icon: image, title: text, label: value, sectionId: ItemListSectionId(self.section), style: .blocks, action: {
601614
arguments.openWallet()
602615
})
616+
#endif
603617
case let .watch(theme, image, text, value):
604618
return ItemListDisclosureItem(presentationData: presentationData, icon: image, title: text, label: value, sectionId: ItemListSectionId(self.section), style: .blocks, action: {
605619
arguments.openWatch()
@@ -685,9 +699,11 @@ private func settingsEntries(account: Account, presentationData: PresentationDat
685699
entries.append(.language(presentationData.theme, PresentationResourcesSettings.language, presentationData.strings.Settings_AppLanguage, languageName.isEmpty ? presentationData.strings.Localization_LanguageName : languageName))
686700
entries.append(.contentStickers(presentationData.theme, PresentationResourcesSettings.stickers, presentationData.strings.ChatSettings_Stickers, unreadTrendingStickerPacks == 0 ? "" : "\(unreadTrendingStickerPacks)", archivedPacks))
687701

702+
#if ENABLE_WALLET
688703
if hasWallet {
689704
entries.append(.wallet(presentationData.theme, PresentationResourcesSettings.wallet, "Gram Wallet", ""))
690705
}
706+
#endif
691707
if hasPassport {
692708
entries.append(.passport(presentationData.theme, PresentationResourcesSettings.passport, presentationData.strings.Settings_Passport, ""))
693709
}
@@ -989,13 +1005,15 @@ public func settingsController(context: AccountContext, accountManager: AccountM
9891005
pushControllerImpl?(SecureIdAuthController(context: context, mode: .list))
9901006
})
9911007
}, openWallet: {
1008+
#if ENABLE_WALLET
9921009
let _ = (contextValue.get()
9931010
|> deliverOnMainQueue
9941011
|> take(1)).start(next: { context in
9951012
context.sharedContext.openWallet(context: context, walletContext: .generic, present: { c in
9961013
pushControllerImpl?(c)
9971014
})
9981015
})
1016+
#endif
9991017
}, openWatch: {
10001018
let _ = (contextValue.get()
10011019
|> deliverOnMainQueue
@@ -1252,11 +1270,14 @@ public func settingsController(context: AccountContext, accountManager: AccountM
12521270
}
12531271
)
12541272
)
1255-
1273+
#if ENABLE_WALLET
12561274
let hasWallet = contextValue.get()
12571275
|> mapToSignal { context in
12581276
return context.hasWalletAccess
12591277
}
1278+
#else
1279+
let hasWallet: Signal<Bool, NoError> = .single(false)
1280+
#endif
12601281

12611282
let hasPassport = ValuePromise<Bool>(false)
12621283
let updatePassport: () -> Void = {

‎submodules/TelegramUI/BUCK‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,8 +186,8 @@ framework(
186186
"//submodules/MessageReactionListUI:MessageReactionListUI",
187187
"//submodules/SegmentedControlNode:SegmentedControlNode",
188188
"//submodules/AppBundle:AppBundle",
189-
"//submodules/WalletUI:WalletUI",
190-
"//submodules/WalletCore:WalletCore",
189+
#"//submodules/WalletUI:WalletUI",
190+
#"//submodules/WalletCore:WalletCore",
191191
"//submodules/Markdown:Markdown",
192192
"//submodules/SearchPeerMembers:SearchPeerMembers",
193193
"//submodules/WidgetItems:WidgetItems",

0 commit comments

Comments
 (0)