Skip to content

Commit

Permalink
[WIP] Topic APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ali committed Sep 28, 2022
1 parent d7d3b1b commit d01a785
Show file tree
Hide file tree
Showing 60 changed files with 4,249 additions and 1,846 deletions.
56 changes: 56 additions & 0 deletions Telegram/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -980,6 +980,9 @@ ios_framework(
deps = [
"//submodules/TelegramCore:TelegramCore",
],
visibility = [
"//visibility:public",
]
)

plist_fragment(
Expand Down Expand Up @@ -1466,6 +1469,9 @@ ios_extension(
":PostboxFramework",
":TelegramCoreFramework",
],
visibility = [
"//visibility:public",
]
)

plist_fragment(
Expand Down Expand Up @@ -2059,3 +2065,53 @@ ios_application(
"//third-party/libvpx:vpx",
],
)

swift_library(
name = "TelegramCoreBuildTestLib",
module_name = "TelegramCoreBuildTestLib",
srcs = glob([
"Tests/TelegramCoreBuildTest/**/*.swift",
]),
copts = [
"-warnings-as-errors",
],
data = [
":WidgetAssets",
],
deps = [
"//submodules/BuildConfig:BuildConfig",
"//submodules/WidgetItems:WidgetItems_iOS14",
"//submodules/WidgetItemsUtils:WidgetItemsUtils",
"//submodules/AppLockState:AppLockState",
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
"//submodules/Postbox:Postbox",
"//submodules/TelegramCore:TelegramCore",
"//submodules/OpenSSLEncryptionProvider:OpenSSLEncryptionProvider",
"//Telegram:GeneratedSources",
],
)

ios_application(
name = "TelegramCoreBuildTest",
bundle_id = "{telegram_bundle_id}".format(
telegram_bundle_id = telegram_bundle_id,
),
families = ["iphone", "ipad"],
minimum_os_version = minimum_os_version,
provisioning_profile = select({
":disableProvisioningProfilesSetting": None,
"//conditions:default": "@build_configuration//provisioning:Telegram.mobileprovision",
}),
entitlements = ":TelegramEntitlements.entitlements",
infoplists = [
":TelegramInfoPlist",
":BuildNumberInfoPlist",
":VersionInfoPlist",
":RequiredDeviceCapabilitiesPlist",
":UrlTypesInfoPlist",
],
frameworks = [
":TelegramCoreFramework",
],
deps = [":TelegramCoreBuildTestLib"],
)
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ private final class NotificationServiceHandler {
private let pollDisposable = MetaDisposable()

init?(queue: Queue, updateCurrentContent: @escaping (NotificationContent) -> Void, completed: @escaping () -> Void, payload: [AnyHashable: Any]) {
//debug_linker_fail_test()
self.queue = queue

let episode = String(UInt32.random(in: 0 ..< UInt32.max), radix: 16)
Expand Down
155 changes: 155 additions & 0 deletions Tests/TelegramCoreBuildTest/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
load("@build_bazel_rules_apple//apple:ios.bzl",
"ios_application",
)

load("@build_bazel_rules_swift//swift:swift.bzl",
"swift_library",
)

load("//build-system/bazel-utils:plist_fragment.bzl",
"plist_fragment",
)

load(
"@build_configuration//:variables.bzl",
"telegram_bundle_id",
"telegram_aps_environment",
"telegram_team_id",
"telegram_enable_icloud",
"telegram_enable_siri",
"telegram_enable_watch",
)

module_name = "TelegramCoreBuildTest"

swift_library(
name = "Lib",
srcs = glob([
"Sources/**/*.swift",
]),
data = [
],
deps = [
],
)

plist_fragment(
name = "BuildNumberInfoPlist",
extension = "plist",
template =
"""
<key>CFBundleVersion</key>
<string>1</string>
"""
)

plist_fragment(
name = "VersionInfoPlist",
extension = "plist",
template =
"""
<key>CFBundleShortVersionString</key>
<string>{telegramVersion}</string>
"""
)

plist_fragment(
name = "AppNameInfoPlist",
extension = "plist",
template =
"""
<key>CFBundleDisplayName</key>
<string>Test</string>
"""
)

plist_fragment(
name = "AppInfoPlist",
extension = "plist",
template =
"""
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>Test</string>
<key>CFBundleIdentifier</key>
<string>ph.telegra.Telegraph</string>
<key>CFBundleName</key>
<string>Telegram</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>UIDeviceFamily</key>
<array>
<integer>1</integer>
<integer>2</integer>
</array>
<key>UIFileSharingEnabled</key>
<false/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UIStatusBarStyle</key>
<string>UIStatusBarStyleDefault</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>UIViewEdgeAntialiasing</key>
<false/>
<key>UIViewGroupOpacity</key>
<false/>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
""".format(module_name=module_name)
)

ios_application(
name = module_name,
bundle_id = "ph.telegra.Telegraph",
families = ["iphone", "ipad"],
minimum_os_version = "11.0",
provisioning_profile = None,
infoplists = [
":AppInfoPlist",
":BuildNumberInfoPlist",
":VersionInfoPlist",
],
resources = [
"//Tests/Common:LaunchScreen",
],
extensions = [
"//Telegram:WidgetExtension",
],
deps = [
"//Tests/Common:Main",
":Lib",
],
visibility = ["//visibility:public"],
)
15 changes: 15 additions & 0 deletions Tests/TelegramCoreBuildTest/Sources/main.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Foundation
import UIKit

@objc(Application)
public final class Application: UIApplication {
}

@objc(AppDelegate)
public final class AppDelegate: NSObject, UIApplicationDelegate {
public var window: UIWindow?

public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
return true
}
}
2 changes: 2 additions & 0 deletions submodules/AccountContext/Sources/AccountContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -732,6 +732,8 @@ public protocol SharedAccountContext: AnyObject {
func makeChatRecentActionsController(context: AccountContext, peer: Peer, adminPeerId: PeerId?) -> ViewController
func makePrivacyAndSecurityController(context: AccountContext) -> ViewController
func navigateToChatController(_ params: NavigateToChatControllerParams)
func navigateToForumChannel(context: AccountContext, peerId: EnginePeer.Id, navigationController: NavigationController)
func navigateToForumThread(context: AccountContext, peerId: EnginePeer.Id, threadId: Int64, navigationController: NavigationController) -> Signal<Never, NoError>
func openStorageUsage(context: AccountContext)
func openLocationScreen(context: AccountContext, messageId: MessageId, navigationController: NavigationController)
func openExternalUrl(context: AccountContext, urlContext: OpenURLContext, url: String, forceExternal: Bool, presentationData: PresentationData, navigationController: NavigationController?, dismissInput: @escaping () -> Void)
Expand Down
5 changes: 5 additions & 0 deletions submodules/AccountContext/Sources/ChatListController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import Postbox
import Display
import TelegramCore

public enum ChatListControllerLocation {
case chatList(groupId: EngineChatList.Group)
case forum(peerId: PeerId)
}

public protocol ChatListController: ViewController {
var context: AccountContext { get }
var lockViewFrame: CGRect? { get }
Expand Down
Loading

0 comments on commit d01a785

Please sign in to comment.