spm macos initial commit

This commit is contained in:
overtake 2021-11-11 21:30:43 +04:00
parent c2e69de809
commit 0cf92bb440
32 changed files with 867 additions and 1520 deletions

View File

@ -0,0 +1,32 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "Crc32",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "Crc32",
targets: ["Crc32"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "Crc32",
dependencies: [],
path: ".",
exclude: ["BUILD"],
publicHeadersPath: "PublicHeaders",
cSettings: [
.headerSearchPath("PublicHeaders")
]),
]
)

View File

@ -0,0 +1,32 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "CryptoUtils",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "CryptoUtils",
targets: ["CryptoUtils"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "CryptoUtils",
dependencies: [],
path: ".",
exclude: ["BUILD"],
publicHeadersPath: "PublicHeaders",
cSettings: [
.headerSearchPath("PublicHeaders")
]),
]
)

View File

@ -0,0 +1,32 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "EncryptionProvider",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "EncryptionProvider",
targets: ["EncryptionProvider"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "EncryptionProvider",
dependencies: [],
path: ".",
exclude: ["BUILD"],
publicHeadersPath: "PublicHeaders",
cSettings: [
.headerSearchPath("PublicHeaders"),
]),
]
)

View File

@ -0,0 +1 @@
#import <EncryptionProvider/EncryptionProvider.h>

View File

@ -0,0 +1,33 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "FFMpegBinding",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "FFMpegBinding",
targets: ["FFMpegBinding"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "FFMpegBinding",
dependencies: [],
path: ".",
exclude: ["BUILD"],
publicHeadersPath: "Public",
cSettings: [
.headerSearchPath("Public"),
.unsafeFlags(["-I../../../../core-xprojects/ffmpeg/build/ffmpeg/include"])
]),
]
)

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
</dict>
</plist>

View File

@ -0,0 +1,27 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "GraphCore",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "GraphCore",
targets: ["GraphCore"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "GraphCore",
dependencies: [],
path: "Sources"),
]
)

View File

@ -1,19 +0,0 @@
//
// GraphCore.h
// GraphCore
//
// Created by Mikhail Filimonov on 03.02.2020.
// Copyright © 2020 Telegram. All rights reserved.
//
#import <Cocoa/Cocoa.h>
//! Project version number for GraphCore.
FOUNDATION_EXPORT double GraphCoreVersionNumber;
//! Project version string for GraphCore.
FOUNDATION_EXPORT const unsigned char GraphCoreVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <GraphCore/PublicHeader.h>

View File

@ -0,0 +1,33 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "MtProtoKit",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "MtProtoKit",
targets: ["MtProtoKit"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(name: "EncryptionProvider", path: "../EncryptionProvider")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "MtProtoKit",
dependencies: [.product(name: "EncryptionProvider", package: "EncryptionProvider", condition: nil)],
path: ".",
exclude: ["BUILD"],
publicHeadersPath: "PublicHeaders",
cSettings: [
.headerSearchPath("PublicHeaders"),
]),
]
)

View File

@ -0,0 +1,32 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "MurMurHash32",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "MurMurHash32",
targets: ["MurMurHash32"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "MurMurHash32",
dependencies: [],
path: ".",
exclude: ["BUILD"],
publicHeadersPath: "PublicHeaders",
cSettings: [
.headerSearchPath("PublicHeaders")
]),
]
)

View File

@ -8,6 +8,4 @@ int32_t murMurHash32(void *bytes, int length);
int32_t murMurHash32Data(NSData *data);
int32_t murMurHashString32(const char *s);
NSString *postboxTransformedString(CFStringRef string, bool replaceWithTransliteratedVersion, bool appendTransliteratedVersion);
#endif

View File

@ -101,20 +101,3 @@ int32_t murMurHashString32(const char *s)
return result;
}
NSString *postboxTransformedString(CFStringRef string, bool replaceWithTransliteratedVersion, bool appendTransliteratedVersion) {
NSMutableString *mutableString = [[NSMutableString alloc] initWithString:(__bridge NSString * _Nonnull)(string)];
CFStringTransform((CFMutableStringRef)mutableString, NULL, kCFStringTransformStripCombiningMarks, false);
if (replaceWithTransliteratedVersion || appendTransliteratedVersion) {
NSMutableString *transliteratedString = [[NSMutableString alloc] initWithString:mutableString];
CFStringTransform((CFMutableStringRef)transliteratedString, NULL, kCFStringTransformToLatin, false);
if (replaceWithTransliteratedVersion) {
return transliteratedString;
} else {
[mutableString appendString:@" "];
[mutableString appendString:transliteratedString];
}
}
return mutableString;
}

View File

@ -0,0 +1,33 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "NetworkLogging",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "NetworkLogging",
targets: ["NetworkLogging"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(name: "MtProtoKit", path: "../MtProtoKit")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "NetworkLogging",
dependencies: [.product(name: "MtProtoKit", package: "MtProtoKit", condition: nil)],
path: ".",
exclude: ["BUILD"],
publicHeadersPath: "PublicHeaders",
cSettings: [
.headerSearchPath("PublicHeaders")
]),
]
)

35
submodules/OpusBinding/Package.swift vendored Normal file
View File

@ -0,0 +1,35 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "OpusBinding",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "OpusBinding",
targets: ["OpusBinding"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "OpusBinding",
dependencies: [],
path: ".",
exclude: ["BUILD"],
publicHeadersPath: "PublicHeaders",
cSettings: [
.headerSearchPath("PublicHeaders"),
.headerSearchPath("PublicHeaders/OpusBinding"),
.headerSearchPath("Sources"),
.unsafeFlags(["-I../../../../core-xprojects/libopus/build/libopus/include"])
]),
]
)

View File

@ -0,0 +1,36 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "Postbox",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "Postbox",
targets: ["Postbox"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(name: "MurMurHash32", path: "../MurMurHash32"),
.package(name: "Crc32", path: "../Crc32"),
.package(name: "sqlcipher", path: "../sqlcipher"),
.package(name: "StringTransliteration", path: "../StringTransliteration"),
.package(name: "SSignalKit", path: "../SSignalKit"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "Postbox",
dependencies: [.product(name: "MurMurHash32", package: "MurMurHash32", condition: nil),
.product(name: "SwiftSignalKit", package: "SSignalKit", condition: nil),
.product(name: "sqlcipher", package: "sqlcipher", condition: nil),
.product(name: "StringTransliteration", package: "StringTransliteration", condition: nil),
.product(name: "Crc32", package: "Crc32", condition: nil)],
path: "Sources"),
]
)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "LegacyReachability",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "LegacyReachability",
targets: ["LegacyReachability"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "LegacyReachability",
dependencies: [],
path: ".",
exclude: ["BUILD"],
publicHeadersPath: "PublicHeaders",
cSettings: [
.headerSearchPath("PublicHeaders")
]),
]
)

View File

@ -1,10 +1,5 @@
/*
Copyright (C) 2016 Apple Inc. All Rights Reserved.
See LICENSE.txt for this samples licensing information
Abstract:
Basic demonstration of how to use the SystemConfiguration Reachablity APIs.
*/
#ifndef LegacyReachability_h
#define LegacyReachability_h
#import <Foundation/Foundation.h>
#import <SystemConfiguration/SystemConfiguration.h>
@ -17,10 +12,6 @@ typedef enum : NSInteger {
ReachableViaWWAN
} NetworkStatus;
#pragma mark IPv6 Support
//Reachability fully support IPv6. For full details, see ReadMe.md.
extern NSString *kReachabilityChangedNotification;
@ -64,3 +55,4 @@ extern NSString *kReachabilityChangedNotification;
@end
#endif

View File

@ -0,0 +1,30 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "Reachability",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "Reachability",
targets: ["Reachability"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(name: "LegacyReachability", path: "LegacyReachability"),
.package(name: "SSignalKit", path: "../SSignalKit"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "Reachability",
dependencies: [.product(name: "LegacyReachability", package: "LegacyReachability", condition: nil),
.product(name: "SwiftSignalKit", package: "SSignalKit", condition: nil)],
path: "Sources"),
]
)

View File

@ -0,0 +1,27 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "SSignalKit",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "SwiftSignalKit",
targets: ["SwiftSignalKit"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "SwiftSignalKit",
dependencies: [],
path: "SwiftSignalKit/Source"),
]
)

View File

@ -0,0 +1,32 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "StringTransliteration",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "StringTransliteration",
targets: ["StringTransliteration"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "StringTransliteration",
dependencies: [],
path: ".",
exclude: ["BUILD"],
publicHeadersPath: "PublicHeaders",
cSettings: [
.headerSearchPath("PublicHeaders")
]),
]
)

View File

@ -0,0 +1,27 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "TelegramApi",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "TelegramApi",
targets: ["TelegramApi"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "TelegramApi",
dependencies: [],
path: "Sources"),
]
)

View File

@ -0,0 +1,42 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "TelegramCore",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "TelegramCore",
targets: ["TelegramCore"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(name: "Postbox", path: "../Postbox"),
.package(name: "SSignalKit", path: "../SSignalKit"),
.package(name: "MtProtoKit", path: "../MtProtoKit"),
.package(name: "TelegramApi", path: "../TelegramApi"),
.package(name: "CryptoUtils", path: "../CryptoUtils"),
.package(name: "NetworkLogging", path: "../NetworkLogging"),
.package(name: "Reachability", path: "../Reachability"),
.package(name: "EncryptionProvider", path: "../EncryptionProvider"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "TelegramCore",
dependencies: [.product(name: "Postbox", package: "Postbox", condition: nil),
.product(name: "SwiftSignalKit", package: "SSignalKit", condition: nil),
.product(name: "MtProtoKit", package: "MtProtoKit", condition: nil),
.product(name: "TelegramApi", package: "TelegramApi", condition: nil),
.product(name: "CryptoUtils", package: "CryptoUtils", condition: nil),
.product(name: "NetworkLogging", package: "NetworkLogging", condition: nil),
.product(name: "Reachability", package: "Reachability", condition: nil),
.product(name: "EncryptionProvider", package: "EncryptionProvider", condition: nil)],
path: "Sources"),
]
)

View File

@ -3,6 +3,7 @@
import TelegramApi
import SwiftSignalKit
import Postbox
import Foundation
public enum InternalUpdaterError {
case generic

View File

@ -0,0 +1,42 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "TelegramVoip",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "TelegramVoip",
targets: ["TelegramVoip"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(name: "TgVoipWebrtc", path: "../../../tgcalls"),
.package(name: "SSignalKit", path: "../SSignalKit"),
.package(name: "TelegramCore", path: "../TelegramCore")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "TelegramVoip",
dependencies: [
.productItem(name: "TgVoipWebrtc", package: "TgVoipWebrtc", condition: nil),
.productItem(name: "SwiftSignalKit", package: "SSignalKit", condition: nil),
.productItem(name: "TelegramCore", package: "TelegramCore", condition: nil),
],
path: "Sources",
exclude: [
"IpcGroupCallContext.swift",
"OngoingCallContext.swift",
],
cxxSettings: [
.define("WEBRTC_MAC", to: "1", nil),
]),
]
)

View File

@ -0,0 +1,140 @@
//
// OngoingCallVideoCapturer.swift
// TelegramVoip
//
// Created by Mikhail Filimonov on 07.01.2021.
//
import Foundation
import Cocoa
import TgVoipWebrtc
public enum OngoingCallVideoOrientation {
case rotation0
case rotation90
case rotation180
case rotation270
}
public extension OngoingCallVideoOrientation {
init(_ orientation: OngoingCallVideoOrientationWebrtc) {
switch orientation {
case .orientation0:
self = .rotation0
case .orientation90:
self = .rotation90
case .orientation180:
self = .rotation180
case .orientation270:
self = .rotation270
@unknown default:
self = .rotation0
}
}
}
public final class OngoingCallContextPresentationCallVideoView {
public let view: NSView
public let setOnFirstFrameReceived: (((Float) -> Void)?) -> Void
public let getOrientation: () -> OngoingCallVideoOrientation
public let getAspect: () -> CGFloat
public let setOnOrientationUpdated: (((OngoingCallVideoOrientation, CGFloat) -> Void)?) -> Void
public let setVideoContentMode: (CALayerContentsGravity) -> Void
public let setOnIsMirroredUpdated: (((Bool) -> Void)?) -> Void
public let setIsPaused: (Bool) -> Void
public let renderToSize:(NSSize, Bool)->Void
public init(
view: NSView,
setOnFirstFrameReceived: @escaping (((Float) -> Void)?) -> Void,
getOrientation: @escaping () -> OngoingCallVideoOrientation,
getAspect: @escaping () -> CGFloat,
setOnOrientationUpdated: @escaping (((OngoingCallVideoOrientation, CGFloat) -> Void)?) -> Void,
setVideoContentMode: @escaping(CALayerContentsGravity) -> Void,
setOnIsMirroredUpdated: @escaping (((Bool) -> Void)?) -> Void,
setIsPaused: @escaping(Bool) -> Void,
renderToSize: @escaping(NSSize, Bool) -> Void
) {
self.view = view
self.setOnFirstFrameReceived = setOnFirstFrameReceived
self.getOrientation = getOrientation
self.getAspect = getAspect
self.setOnOrientationUpdated = setOnOrientationUpdated
self.setVideoContentMode = setVideoContentMode
self.setOnIsMirroredUpdated = setOnIsMirroredUpdated
self.setIsPaused = setIsPaused
self.renderToSize = renderToSize
}
}
public final class OngoingCallVideoCapturer {
public let impl: OngoingCallThreadLocalContextVideoCapturer
public init(_ deviceId: String = "", keepLandscape: Bool = true) {
self.impl = OngoingCallThreadLocalContextVideoCapturer(deviceId: deviceId, keepLandscape: keepLandscape)
}
public func makeOutgoingVideoView(completion: @escaping (OngoingCallContextPresentationCallVideoView?) -> Void) {
self.impl.makeOutgoingVideoView(false, completion: { view, _ in
if let view = view {
completion(OngoingCallContextPresentationCallVideoView(
view: view, setOnFirstFrameReceived: { [weak view] f in
view?.setOnFirstFrameReceived(f)
}, getOrientation: {
return .rotation90
},
getAspect: { [weak view] in
if let view = view {
return view.aspect
} else {
return 0.0
}
},
setOnOrientationUpdated: { [weak view] f in
},
setVideoContentMode: { [weak view] mode in
view?.setVideoContentMode(mode)
}, setOnIsMirroredUpdated: { [weak view] f in
view?.setOnIsMirroredUpdated { value in
f?(value)
}
}, setIsPaused: { [weak view] paused in
view?.setIsPaused(paused)
},
renderToSize: { [weak view] size, animated in
view?.render(to: size, animated: animated)
}
))
} else {
completion(nil)
}
})
}
public func setIsVideoEnabled(_ value: Bool) {
self.impl.setIsVideoEnabled(value)
}
public func setOnFatalError(_ onError: @escaping()->Void) {
self.impl.setOnFatalError({
DispatchQueue.main.async(execute: onError)
})
}
public func setOnPause(_ onPause: @escaping(Bool)->Void) {
self.impl.setOnPause({ pause in
DispatchQueue.main.async(execute: {
onPause(pause)
})
})
}
public func switchVideoInput(_ deviceId: String) {
self.impl.switchVideoInput(deviceId)
}
}

View File

@ -1,8 +1,5 @@
#ifndef WEBRTC_IOS
#import "OngoingCallThreadLocalContext.h"
#else
#import <TgVoipWebrtc/OngoingCallThreadLocalContext.h>
#endif
#import "Instance.h"
#import "InstanceImpl.h"

32
submodules/libphonenumber/Package.swift vendored Normal file
View File

@ -0,0 +1,32 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "libphonenumber",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "libphonenumber",
targets: ["libphonenumber"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "libphonenumber",
dependencies: [],
path: ".",
exclude: ["BUILD"],
publicHeadersPath: "PublicHeaders",
cSettings: [
.headerSearchPath("PublicHeaders")
]),
]
)

View File

@ -1,5 +1,8 @@
#if TARGET_OS_IOS
#import <UIKit/UIKit.h>
#else
#import <AppKit/AppKit.h>
#endif
//! Project version number for libphonenumber_iOS.
FOUNDATION_EXPORT double libphonenumber_iOSVersionNumber;

44
submodules/sqlcipher/Package.swift vendored Normal file
View File

@ -0,0 +1,44 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "sqlcipher",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "sqlcipher",
targets: ["sqlcipher"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "sqlcipher",
dependencies: [],
path: ".",
exclude: ["BUILD"],
publicHeadersPath: "PublicHeaders",
cSettings: [
.headerSearchPath("PublicHeaders"),
.define("SQLITE_HAS_CODEC", to: "1"),
.define("SQLCIPHER_CRYPTO_CC", to: "1"),
.define("SQLITE_TEMP_STORE", to: "2"),
.define("SQLITE_ENABLE_FTS5", to: "1"),
.define("HAVE_USLEEP", to: "1"),
.define("SQLITE_DEFAULT_MEMSTATUS", to: "0"),
.define("SQLITE_OMIT_LOAD_EXTENSION", to: "1"),
.define("SQLITE_OMIT_DECLTYPE", to: "1"),
.define("SSQLITE_OMIT_PROGRESS_CALLBACK", to: "1"),
.define("SQLITE_OMIT_DEPRECATED", to: "1"),
.define("NDEBUG", to: "1"),
.define("SQLITE_MAX_MMAP_SIZE", to: "0"),
]),
]
)

View File

@ -14312,11 +14312,11 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
** Macros to compute minimum and maximum of two numbers.
*/
#ifndef MIN
# define MIN(A,B) ((A)<(B)?(A):(B))
#endif
#define MIN(a, b) (((a)<(b))?(a):(b))
#endif /* MIN */
#ifndef MAX
# define MAX(A,B) ((A)>(B)?(A):(B))
#endif
#define MAX(a, b) (((a)>(b))?(a):(b))
#endif /* MAX */
/*
** Swap two objects of type TYPE.
@ -171497,11 +171497,11 @@ SQLITE_PRIVATE Fts3HashElem *sqlite3Fts3HashFindElem(const Fts3Hash *, const voi
#ifndef MIN
# define MIN(x,y) ((x)<(y)?(x):(y))
#endif
#define MIN(a, b) (((a)<(b))?(a):(b))
#endif /* MIN */
#ifndef MAX
# define MAX(x,y) ((x)>(y)?(x):(y))
#endif
#define MAX(a, b) (((a)>(b))?(a):(b))
#endif /* MAX */
/*
** Maximum length of a varint encoded integer. The varint format is different
@ -193354,12 +193354,12 @@ struct RtreeMatchArg {
RtreeDValue aParam[1]; /* Values for parameters to the SQL function */
};
#ifndef MAX
# define MAX(x,y) ((x) < (y) ? (y) : (x))
#endif
#ifndef MIN
# define MIN(x,y) ((x) > (y) ? (y) : (x))
#endif
#define MIN(a, b) (((a)<(b))?(a):(b))
#endif /* MIN */
#ifndef MAX
#define MAX(a, b) (((a)>(b))?(a):(b))
#endif /* MAX */
/* What version of GCC is being used. 0 means GCC is not being used .
** Note that the GCC_VERSION macro will also be set correctly when using
@ -213443,8 +213443,12 @@ typedef sqlite3_uint64 u64;
#define ALWAYS(x) 1
#define NEVER(x) 0
#define MIN(x,y) (((x) < (y)) ? (x) : (y))
#define MAX(x,y) (((x) > (y)) ? (x) : (y))
#ifndef MIN
#define MIN(a, b) (((a)<(b))?(a):(b))
#endif /* MIN */
#ifndef MAX
#define MAX(a, b) (((a)>(b))?(a):(b))
#endif /* MAX */
/*
** Constants for the largest and smallest possible 64-bit signed integers.

65
third-party/rnnoise/Package.swift vendored Normal file
View File

@ -0,0 +1,65 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
func replaceSymbols() -> [String] {
let symbols = [ "_celt_autocorr",
"celt_fir",
"celt_iir",
"_celt_lpc",
"celt_pitch_xcorr",
"compute_band_corr",
"compute_band_energy",
"compute_dense",
"compute_gru",
"compute_rnn",
"interp_band_gain",
"opus_fft_alloc",
"opus_fft_alloc_arch_c",
"opus_fft_alloc_twiddles",
"opus_fft_c",
"opus_fft_free",
"opus_fft_free_arch_c",
"opus_fft_impl",
"opus_ifft_c",
"pitch_downsample",
"pitch_filter",
"pitch_search",
"remove_doubling"
]
return symbols.map {
return "-D\($0)=rnnoise_\($0)"
}
}
let package = Package(
name: "rnoise",
platforms: [.macOS(.v10_11)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "rnoise",
targets: ["rnoise"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "rnoise",
dependencies: [],
path: ".",
exclude: ["BUILD",
"Sources/compile.sh"],
publicHeadersPath: "PublicHeaders",
cSettings: [
.headerSearchPath("PublicHeaders"),
.unsafeFlags(replaceSymbols())
]),
]
)