diff --git a/Makefile b/Makefile
index efcd86c157..207d6fc680 100644
--- a/Makefile
+++ b/Makefile
@@ -122,6 +122,24 @@ build_debug_arm64: check_env
//:IntentsExtension#dwarf-and-dsym,iphoneos-arm64 \
${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
+build_wallet_debug_arm64: check_env
+ $(BUCK) build \
+ //Wallet:AppPackage#iphoneos-arm64 \
+ //Wallet:Wallet#dwarf-and-dsym,iphoneos-arm64 \
+ //submodules/MtProtoKit:MtProtoKit#dwarf-and-dsym,shared,iphoneos-arm64 \
+ //submodules/MtProtoKit:MtProtoKit#shared,iphoneos-arm64 \
+ //submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#dwarf-and-dsym,shared,iphoneos-arm64 \
+ //submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared,iphoneos-arm64 \
+ //submodules/Postbox:Postbox#dwarf-and-dsym,shared,iphoneos-arm64 \
+ //submodules/Postbox:Postbox#shared,iphoneos-arm64 \
+ //submodules/TelegramCore:TelegramCore#dwarf-and-dsym,shared,iphoneos-arm64 \
+ //submodules/TelegramCore:TelegramCore#shared,iphoneos-arm64 \
+ //submodules/AsyncDisplayKit:AsyncDisplayKit#dwarf-and-dsym,shared,iphoneos-arm64 \
+ //submodules/AsyncDisplayKit:AsyncDisplayKit#shared,iphoneos-arm64 \
+ //submodules/Display:Display#dwarf-and-dsym,shared,iphoneos-arm64 \
+ //submodules/Display:Display#shared,iphoneos-arm64 \
+ ${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS} ${BUCK_THREADS_OPTIONS} ${BUCK_CACHE_OPTIONS}
+
build: check_env
$(BUCK) build \
//:AppPackage#iphoneos-arm64,iphoneos-armv7 \
@@ -216,6 +234,8 @@ app_arm64: build_arm64 package_arm64
app_debug_arm64: build_debug_arm64 package_debug_arm64
+wallet_debug_arm64: build_wallet_debug_arm64
+
build_buckdebug: check_env
BUCK_DEBUG_MODE=1 $(BUCK) build \
//:AppPackage#iphoneos-arm64 \
@@ -282,8 +302,6 @@ deps: check_env
$(BUCK) query "deps(//:AppPackage)" --dot \
${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS}
-
-
build_openssl: check_env
$(BUCK) build \
//submodules/openssl:openssl#iphoneos-arm64 \
@@ -304,6 +322,10 @@ project: check_env kill_xcode
$(BUCK) project //:workspace --config custom.mode=project ${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS}
open Telegram_Buck.xcworkspace
+wallet_project: check_env kill_xcode
+ $(BUCK) project //Wallet:workspace --config custom.mode=project ${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS}
+ open Wallet/WalletWorkspace.xcworkspace
+
project_buckdebug: check_env kill_xcode
BUCK_DEBUG_MODE=1 $(BUCK) project //:workspace --config custom.mode=project ${BUCK_OPTIONS} ${BUCK_DEBUG_OPTIONS}
open Telegram_Buck.xcworkspace
diff --git a/Wallet/BUCK b/Wallet/BUCK
new file mode 100644
index 0000000000..0e95e9f847
--- /dev/null
+++ b/Wallet/BUCK
@@ -0,0 +1,163 @@
+load("//Config:configs.bzl",
+ "app_binary_configs",
+ "library_configs",
+ "info_plist_substitutions",
+)
+
+load("//Config:buck_rule_macros.bzl",
+ "apple_lib",
+ "framework_binary_dependencies",
+ "framework_bundle_dependencies",
+)
+
+framework_dependencies = [
+ "//submodules/MtProtoKit:MtProtoKit",
+ "//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
+ "//submodules/Postbox:Postbox",
+ "//submodules/TelegramCore:TelegramCore",
+ "//submodules/AsyncDisplayKit:AsyncDisplayKit",
+ "//submodules/Display:Display",
+]
+
+resource_dependencies = [
+ "//submodules/TelegramUI:TelegramUIAssets",
+ "//submodules/TelegramUI:TelegramUIResources",
+ "//:AppResources",
+ "//:AppStringResources",
+ "//:InfoPlistStringResources",
+ "//:AppIntentVocabularyResources",
+ "//:Icons",
+ "//:AdditionalIcons",
+ "//:LaunchScreen",
+]
+
+apple_resource(
+ name = "AppResources",
+ files = glob([
+ "Telegram-iOS/Resources/**/*",
+ ], exclude = ["Telegram-iOS/Resources/**/.*"]),
+ visibility = ["PUBLIC"],
+)
+
+apple_resource(
+ name = "AppStringResources",
+ files = [],
+ variants = glob([
+ "Telegram-iOS/*.lproj/Localizable.strings",
+ ]),
+ visibility = ["PUBLIC"],
+)
+
+apple_resource(
+ name = "AppIntentVocabularyResources",
+ files = [],
+ variants = glob([
+ "Telegram-iOS/*.lproj/AppIntentVocabulary.plist",
+ ]),
+ visibility = ["PUBLIC"],
+)
+
+apple_resource(
+ name = "InfoPlistStringResources",
+ files = [],
+ variants = glob([
+ "Telegram-iOS/*.lproj/InfoPlist.strings",
+ ]),
+ visibility = ["PUBLIC"],
+)
+
+apple_asset_catalog(
+ name = "Icons",
+ dirs = [
+ "Telegram-iOS/Icons.xcassets",
+ "Telegram-iOS/AppIcons.xcassets",
+ ],
+ app_icon = "AppIconLLC",
+ visibility = ["PUBLIC"],
+)
+
+apple_resource(
+ name = "AdditionalIcons",
+ files = glob([
+ "Telegram-iOS/*.png",
+ ]),
+ visibility = ["PUBLIC"],
+)
+
+apple_resource(
+ name = "LaunchScreen",
+ files = [
+ "Telegram-iOS/Base.lproj/LaunchScreen.xib",
+ ],
+ visibility = ["PUBLIC"],
+)
+
+apple_library(
+ name = "AppLibrary",
+ visibility = [
+ "//:",
+ "//...",
+ ],
+ configs = library_configs(),
+ swift_version = native.read_config("swift", "version"),
+ srcs = glob([
+ "Sources/**/*.m",
+ "Sources/**/*.swift",
+ ]),
+ exported_linker_flags = [
+ "-lc++",
+ "-lz"
+ ],
+ deps = [
+ "//submodules/WalletUI:WalletUI",
+ ]
+ + framework_binary_dependencies(framework_dependencies),
+ frameworks = [
+ "$SDKROOT/System/Library/Frameworks/Foundation.framework",
+ "$SDKROOT/System/Library/Frameworks/UIKit.framework",
+ "$SDKROOT/System/Library/Frameworks/VideoToolbox.framework",
+ ],
+)
+
+apple_binary(
+ name = "AppBinary",
+ visibility = [
+ "//:",
+ "//...",
+ ],
+ configs = app_binary_configs(),
+ swift_version = native.read_config("swift", "version"),
+ srcs = [
+ "SupportFiles/Empty.swift",
+ ],
+ deps = [
+ ":AppLibrary",
+ ]
+ + resource_dependencies,
+)
+
+apple_bundle(
+ name = "Wallet",
+ visibility = [
+ "//:",
+ ],
+ extension = "app",
+ binary = ":AppBinary",
+ product_name = "Wallet",
+ info_plist = "Info.plist",
+ info_plist_substitutions = app_info_plist_substitutions(),
+ deps = [
+ ]
+ + framework_bundle_dependencies(framework_dependencies),
+)
+
+apple_package(
+ name = "AppPackage",
+ bundle = ":Wallet",
+)
+
+xcode_workspace_config(
+ name = "workspace",
+ workspace_name = "WalletWorkspace",
+ src_target = ":Wallet",
+)
diff --git a/Wallet/Info.plist b/Wallet/Info.plist
new file mode 100644
index 0000000000..d8ada8d0f8
--- /dev/null
+++ b/Wallet/Info.plist
@@ -0,0 +1,366 @@
+
+
+
+
+ CFBundleAllowMixedLocalizations
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleDisplayName
+ ${APP_NAME}
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIcons
+
+ CFBundleAlternateIcons
+
+ Black
+
+ CFBundleIconFiles
+
+ BlackIcon
+ BlackNotificationIcon
+
+ UIPrerenderedIcon
+
+
+ BlackClassic
+
+ CFBundleIconFiles
+
+ BlackClassicIcon
+ BlackClassicNotificationIcon
+
+ UIPrerenderedIcon
+
+
+ BlackFilled
+
+ CFBundleIconFiles
+
+ BlackFilledIcon
+
+ UIPrerenderedIcon
+
+
+ Blue
+
+ CFBundleIconFiles
+
+ BlueIcon
+ BlueNotificationIcon
+
+ UIPrerenderedIcon
+
+
+ BlueClassic
+
+ CFBundleIconFiles
+
+ BlueClassicIcon
+ BlueClassicNotificationIcon
+
+ UIPrerenderedIcon
+
+
+ BlueFilled
+
+ CFBundleIconFiles
+
+ BlueFilledIcon
+
+ UIPrerenderedIcon
+
+
+ WhiteFilled
+
+ CFBundleIconFiles
+
+ WhiteFilledIcon
+
+ UIPrerenderedIcon
+
+
+
+ CFBundlePrimaryIcon
+
+ CFBundleIconName
+ AppIconLLC
+ UIPrerenderedIcon
+
+
+
+ CFBundleIcons~ipad
+
+ CFBundleAlternateIcons
+
+ Black
+
+ CFBundleIconFiles
+
+ BlackIconIpad
+ BlackIconLargeIpad
+ BlackNotificationIcon
+
+ UIPrerenderedIcon
+
+
+ BlackClassic
+
+ CFBundleIconFiles
+
+ BlackClassicIconIpad
+ BlackClassicIconLargeIpad
+ BlackClassicNotificationIcon
+
+ UIPrerenderedIcon
+
+
+ BlackFilled
+
+ CFBundleIconFiles
+
+ BlackFilledIconIpad
+ BlackFilledIconLargeIpad
+
+ UIPrerenderedIcon
+
+
+ Blue
+
+ CFBundleIconFiles
+
+ BlueIconIpad
+ BlueIconLargeIpad
+ BlueNotificationIcon
+
+ UIPrerenderedIcon
+
+
+ BlueClassic
+
+ CFBundleIconFiles
+
+ BlueClassicIconIpad
+ BlueClassicIconLargeIpad
+ BlueClassicNotificationIcon
+
+ UIPrerenderedIcon
+
+
+ BlueFilled
+
+ CFBundleIconFiles
+
+ BlueFilledIconIpad
+ BlueFilledIconLargeIpad
+
+ UIPrerenderedIcon
+
+
+ WhiteFilled
+
+ CFBundleIconFiles
+
+ WhiteFilledIcon
+
+ UIPrerenderedIcon
+
+
+
+ CFBundlePrimaryIcon
+
+ CFBundleIconName
+ AppIconLLC
+ UIPrerenderedIcon
+
+
+
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ $(PRODUCT_NAME)
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ $(PRODUCT_BUNDLE_SHORT_VERSION)
+ CFBundleSignature
+ ????
+ CFBundleURLTypes
+
+
+ CFBundleTypeRole
+ Viewer
+ CFBundleURLName
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleURLSchemes
+
+ telegram
+
+
+
+ CFBundleTypeRole
+ Viewer
+ CFBundleURLName
+ $(PRODUCT_BUNDLE_IDENTIFIER).compatibility
+ CFBundleURLSchemes
+
+ tg
+ $(APP_SPECIFIC_URL_SCHEME)
+
+
+
+ CFBundleTypeRole
+ Viewer
+ CFBundleURLName
+ $(PRODUCT_BUNDLE_IDENTIFIER).ton
+ CFBundleURLSchemes
+
+ ton
+
+
+
+ CFBundleVersion
+ ${BUILD_NUMBER}
+ ITSAppUsesNonExemptEncryption
+
+ LSApplicationQueriesSchemes
+
+ instagram
+ comgooglemaps-x-callback
+ foursquare
+ here-location
+ yandexmaps
+ yandexnavi
+ comgooglemaps
+ youtube
+ twitter
+ vk
+ waze
+ googlechrome
+ googlechromes
+ firefox
+ touch-http
+ touch-https
+ yandexbrowser-open-url
+ vimeo
+ vine
+ coub
+ uber
+ citymapper
+ lyft
+ opera-http
+ opera-https
+ firefox-focus
+ ddgQuickLink
+ moovit
+ alook
+
+ LSRequiresIPhoneOS
+
+ NSAppTransportSecurity
+
+ NSAllowsArbitraryLoads
+
+
+ NSCameraUsageDescription
+ We need this so that you can take and share photos and videos.
+ NSContactsUsageDescription
+ Telegram stores your contacts heavily encrypted in the cloud to let you connect with your friends across all your devices.
+ NSFaceIDUsageDescription
+ You can use Face ID to unlock the app.
+ NSLocationAlwaysUsageDescription
+ When you send your location to your friends, Telegram needs access to show them a map. You also need this to send locations from an Apple Watch.
+ NSLocationWhenInUseUsageDescription
+ When you send your location to your friends, Telegram needs access to show them a map.
+ NSMicrophoneUsageDescription
+ We need this so that you can record and share voice messages and videos with sound.
+ NSMotionUsageDescription
+ When you send your location to your friends, Telegram needs access to show them a map.
+ NSPhotoLibraryAddUsageDescription
+ We need this so that you can share photos and videos from your photo library.
+ NSPhotoLibraryUsageDescription
+ We need this so that you can share photos and videos from your photo library.
+ NSSiriUsageDescription
+ You can use Siri to send messages.
+ NSUserActivityTypes
+
+ INSendMessageIntent
+ RemindAboutChatIntent
+
+ UIAppFonts
+
+ SFCompactRounded-Semibold.otf
+
+ UIBackgroundModes
+
+ audio
+ fetch
+ location
+ remote-notification
+ voip
+
+ UIDeviceFamily
+
+ 1
+ 2
+
+ UIFileSharingEnabled
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIRequiredDeviceCapabilities
+
+ armv7
+
+ UIRequiresPersistentWiFi
+
+ UIStatusBarStyle
+ UIStatusBarStyleDefault
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UIViewControllerBasedStatusBarAppearance
+
+ UIViewEdgeAntialiasing
+
+ UIViewGroupOpacity
+
+ UTImportedTypeDeclarations
+
+
+ UTTypeConformsTo
+
+ public.data
+
+ UTTypeDescription
+ Telegram iOS Color Theme File
+ UTTypeIconFiles
+
+ BlueIcon@3x.png
+
+ UTTypeIdentifier
+ org.telegram.Telegram-iOS.theme
+ UTTypeTagSpecification
+
+ public.filename-extension
+
+ tgios-theme
+
+
+
+
+
+
diff --git a/Wallet/Sources/AppDelegate.swift b/Wallet/Sources/AppDelegate.swift
new file mode 100644
index 0000000000..9fb7caa44a
--- /dev/null
+++ b/Wallet/Sources/AppDelegate.swift
@@ -0,0 +1,144 @@
+import UIKit
+import Display
+import TelegramPresentationData
+import WalletUI
+import SwiftSignalKit
+
+private func encodeText(_ string: String, _ key: Int) -> String {
+ var result = ""
+ for c in string.unicodeScalars {
+ result.append(Character(UnicodeScalar(UInt32(Int(c.value) + key))!))
+ }
+ return result
+}
+
+private let statusBarRootViewClass: AnyClass = NSClassFromString("UIStatusBar")!
+private let statusBarPlaceholderClass: AnyClass? = NSClassFromString("UIStatusBar_Placeholder")
+private let cutoutStatusBarForegroundClass: AnyClass? = NSClassFromString("_UIStatusBar")
+private let keyboardViewClass: AnyClass? = NSClassFromString(encodeText("VJJoqvuTfuIptuWjfx", -1))!
+private let keyboardViewContainerClass: AnyClass? = NSClassFromString(encodeText("VJJoqvuTfuDpoubjofsWjfx", -1))!
+
+private let keyboardWindowClass: AnyClass? = {
+ if #available(iOS 9.0, *) {
+ return NSClassFromString(encodeText("VJSfnpufLfzcpbseXjoepx", -1))
+ } else {
+ return NSClassFromString(encodeText("VJUfyuFggfdutXjoepx", -1))
+ }
+}()
+
+private class ApplicationStatusBarHost: StatusBarHost {
+ private let application = UIApplication.shared
+
+ var isApplicationInForeground: Bool {
+ switch self.application.applicationState {
+ case .background:
+ return false
+ default:
+ return true
+ }
+ }
+
+ var statusBarFrame: CGRect {
+ return self.application.statusBarFrame
+ }
+ var statusBarStyle: UIStatusBarStyle {
+ get {
+ return self.application.statusBarStyle
+ } set(value) {
+ self.setStatusBarStyle(value, animated: false)
+ }
+ }
+
+ func setStatusBarStyle(_ style: UIStatusBarStyle, animated: Bool) {
+ self.application.setStatusBarStyle(style, animated: animated)
+ }
+
+ func setStatusBarHidden(_ value: Bool, animated: Bool) {
+ self.application.setStatusBarHidden(value, with: animated ? .fade : .none)
+ }
+
+ var statusBarWindow: UIView? {
+ return self.application.value(forKey: "statusBarWindow") as? UIView
+ }
+
+ var statusBarView: UIView? {
+ guard let containerView = self.statusBarWindow?.subviews.first else {
+ return nil
+ }
+
+ if containerView.isKind(of: statusBarRootViewClass) {
+ return containerView
+ }
+ if let statusBarPlaceholderClass = statusBarPlaceholderClass {
+ if containerView.isKind(of: statusBarPlaceholderClass) {
+ return containerView
+ }
+ }
+
+
+ for subview in containerView.subviews {
+ if let cutoutStatusBarForegroundClass = cutoutStatusBarForegroundClass, subview.isKind(of: cutoutStatusBarForegroundClass) {
+ return subview
+ }
+ }
+ return nil
+ }
+
+ var keyboardWindow: UIWindow? {
+ guard let keyboardWindowClass = keyboardWindowClass else {
+ return nil
+ }
+
+ for window in UIApplication.shared.windows {
+ if window.isKind(of: keyboardWindowClass) {
+ return window
+ }
+ }
+ return nil
+ }
+
+ var keyboardView: UIView? {
+ guard let keyboardWindow = self.keyboardWindow, let keyboardViewContainerClass = keyboardViewContainerClass, let keyboardViewClass = keyboardViewClass else {
+ return nil
+ }
+
+ for view in keyboardWindow.subviews {
+ if view.isKind(of: keyboardViewContainerClass) {
+ for subview in view.subviews {
+ if subview.isKind(of: keyboardViewClass) {
+ return subview
+ }
+ }
+ }
+ }
+ return nil
+ }
+
+ var handleVolumeControl: Signal {
+ return .single(false)
+ }
+}
+
+@objc(AppDelegate)
+final class AppDelegate: NSObject, UIApplicationDelegate {
+ var window: UIWindow?
+ var mainWindow: Window1?
+
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
+ let statusBarHost = ApplicationStatusBarHost()
+ let (window, hostView) = nativeWindowHostView()
+ self.mainWindow = Window1(hostView: hostView, statusBarHost: statusBarHost)
+ hostView.containerView.backgroundColor = UIColor.white
+ self.window = window
+
+ let navigationController = NavigationController(mode: .single, theme: NavigationControllerTheme(presentationTheme: defaultPresentationTheme), backgroundDetailsMode: nil)
+ navigationController.setViewControllers([], animated: false)
+ self.mainWindow?.viewController = navigationController
+ navigationController.presentOverlay(controller: standardTextAlertController(theme: AlertControllerTheme(presentationTheme: defaultPresentationTheme), title: "Test", text: "Text", actions: [TextAlertAction(type: .defaultAction, title: "OK", action: {
+ })]), inGlobal: false)
+
+ self.window?.makeKeyAndVisible()
+
+ return true
+ }
+}
diff --git a/Wallet/Sources/Application.swift b/Wallet/Sources/Application.swift
new file mode 100644
index 0000000000..10c08975ea
--- /dev/null
+++ b/Wallet/Sources/Application.swift
@@ -0,0 +1,5 @@
+import UIKit
+
+@objc(Application) class Application: UIApplication {
+
+}
diff --git a/Wallet/Sources/main.m b/Wallet/Sources/main.m
new file mode 100644
index 0000000000..81d976a847
--- /dev/null
+++ b/Wallet/Sources/main.m
@@ -0,0 +1,7 @@
+#import
+
+int main(int argc, char *argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, @"Application", @"AppDelegate");
+ }
+}
diff --git a/Wallet/SupportFiles/Empty.swift b/Wallet/SupportFiles/Empty.swift
new file mode 100644
index 0000000000..8b13789179
--- /dev/null
+++ b/Wallet/SupportFiles/Empty.swift
@@ -0,0 +1 @@
+