mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-15 21:45:19 +00:00
Build Postbox, SyncCore, TelegramCore
This commit is contained in:
parent
a7ff727533
commit
a75bd17b6c
@ -120,6 +120,9 @@ swift_library(
|
||||
"//submodules/WalletUI:WalletUI",
|
||||
"//submodules/WebsiteType:WebsiteType",
|
||||
"//submodules/MtProtoKit:MtProtoKit",
|
||||
"//submodules/Postbox:Postbox",
|
||||
"//submodules/SyncCore:SyncCore",
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
],
|
||||
)
|
||||
|
||||
|
@ -9,6 +9,7 @@ static_library(
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared",
|
||||
"//submodules/Postbox:Postbox#shared",
|
||||
"//submodules/MtProtoKit:MtProtoKit#shared",
|
||||
"//submodules/EncryptionProvider:EncryptionProvider",
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
|
18
submodules/CloudData/BUILD
Normal file
18
submodules/CloudData/BUILD
Normal file
@ -0,0 +1,18 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "CloudData",
|
||||
module_name = "CloudData",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Postbox:Postbox",
|
||||
"//submodules/MtProtoKit:MtProtoKit",
|
||||
"//submodules/EncryptionProvider:EncryptionProvider",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -9,7 +9,7 @@ static_library(
|
||||
"Sources/*.h",
|
||||
]),
|
||||
exported_headers = glob([
|
||||
"Sources/*.h",
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
deps = [
|
||||
],
|
||||
|
21
submodules/Crc32/BUILD
Normal file
21
submodules/Crc32/BUILD
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
objc_library(
|
||||
name = "Crc32",
|
||||
enable_modules = True,
|
||||
module_name = "Crc32",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
hdrs = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"PublicHeaders",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"Foundation",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
#import "Crc32.h"
|
||||
#import <Crc32/Crc32.h>
|
||||
|
||||
#import <zlib.h>
|
||||
|
||||
|
19
submodules/CryptoUtils/BUCK
Normal file
19
submodules/CryptoUtils/BUCK
Normal file
@ -0,0 +1,19 @@
|
||||
load("//Config:buck_rule_macros.bzl", "static_library")
|
||||
|
||||
static_library(
|
||||
name = "CryptoUtils",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
headers = glob([
|
||||
"Sources/*.h",
|
||||
]),
|
||||
exported_headers = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
deps = [
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
],
|
||||
)
|
21
submodules/CryptoUtils/BUILD
Normal file
21
submodules/CryptoUtils/BUILD
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
objc_library(
|
||||
name = "CryptoUtils",
|
||||
enable_modules = True,
|
||||
module_name = "CryptoUtils",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
hdrs = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"PublicHeaders",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"Foundation",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
#include "Crypto.h"
|
||||
#include <CryptoUtils/Crypto.h>
|
||||
|
||||
#import <CommonCrypto/CommonCrypto.h>
|
||||
|
@ -6,10 +6,10 @@ static_library(
|
||||
"Sources/**/*.m",
|
||||
]),
|
||||
headers = glob([
|
||||
"Sources/**/*.h",
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
exported_headers = glob([
|
||||
"Sources/**/*.h",
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
deps = [
|
||||
],
|
||||
|
@ -1,13 +1,16 @@
|
||||
|
||||
objc_library(
|
||||
name = "EncryptionProvider",
|
||||
enable_modules = True,
|
||||
module_name = "EncryptionProvider",
|
||||
srcs = glob([
|
||||
"Sources/**/*.m",
|
||||
]),
|
||||
hdrs = glob([
|
||||
"Sources/**/*.h",
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"Sources/Public",
|
||||
"PublicHeaders",
|
||||
],
|
||||
deps = [
|
||||
],
|
||||
|
19
submodules/MurMurHash32/BUCK
Normal file
19
submodules/MurMurHash32/BUCK
Normal file
@ -0,0 +1,19 @@
|
||||
load("//Config:buck_rule_macros.bzl", "static_library")
|
||||
|
||||
static_library(
|
||||
name = "MurMurHash32",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
headers = glob([
|
||||
"Sources/*.h",
|
||||
]),
|
||||
exported_headers = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
deps = [
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
],
|
||||
)
|
21
submodules/MurMurHash32/BUILD
Normal file
21
submodules/MurMurHash32/BUILD
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
objc_library(
|
||||
name = "MurMurHash32",
|
||||
enable_modules = True,
|
||||
module_name = "MurMurHash32",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
hdrs = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"PublicHeaders",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"Foundation",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -7,6 +7,7 @@
|
||||
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
|
@ -1,4 +1,4 @@
|
||||
#import "MurMurHash32.h"
|
||||
#import <MurMurHash32/MurMurHash32.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
20
submodules/NetworkLogging/BUCK
Normal file
20
submodules/NetworkLogging/BUCK
Normal file
@ -0,0 +1,20 @@
|
||||
load("//Config:buck_rule_macros.bzl", "static_library")
|
||||
|
||||
static_library(
|
||||
name = "NetworkLogging",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
headers = glob([
|
||||
"Sources/*.h",
|
||||
]),
|
||||
exported_headers = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/MtProtoKit:MtProtoKit#shared",
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
],
|
||||
)
|
24
submodules/NetworkLogging/BUILD
Normal file
24
submodules/NetworkLogging/BUILD
Normal file
@ -0,0 +1,24 @@
|
||||
|
||||
objc_library(
|
||||
name = "NetworkLogging",
|
||||
enable_modules = True,
|
||||
module_name = "NetworkLogging",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
hdrs = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"PublicHeaders",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/MtProtoKit:MtProtoKit",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"Foundation",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -1,8 +1,7 @@
|
||||
#import "NetworkLogging.h"
|
||||
#import <NetworkLogging/NetworkLogging.h>
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import <MtProtoKit/MtProtoKit.h>
|
||||
#import <MtProtoKit/MtLogging.h>
|
||||
|
||||
static void (*bridgingTrace)(NSString *, NSString *);
|
||||
void setBridgingTraceFunction(void (*f)(NSString *, NSString *)) {
|
@ -4,18 +4,13 @@ framework(
|
||||
name = "Postbox",
|
||||
srcs = glob([
|
||||
"Sources/*.swift",
|
||||
"Sources/*.m",
|
||||
]),
|
||||
headers = [
|
||||
"Sources/MurMurHash32.h",
|
||||
],
|
||||
exported_headers = [
|
||||
"Sources/MurMurHash32.h",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/Crc32:Crc32",
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared",
|
||||
"//submodules/sqlcipher:sqlcipher",
|
||||
"//submodules/MurMurHash32:MurMurHash32",
|
||||
"//submodules/StringTransliteration:StringTransliteration",
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
|
19
submodules/Postbox/BUILD
Normal file
19
submodules/Postbox/BUILD
Normal file
@ -0,0 +1,19 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "Postbox",
|
||||
module_name = "Postbox",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/Crc32:Crc32",
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/sqlcipher:sqlcipher",
|
||||
"//submodules/MurMurHash32:MurMurHash32",
|
||||
"//submodules/StringTransliteration:StringTransliteration",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -1,5 +1,5 @@
|
||||
import Foundation
|
||||
import sqlcipher
|
||||
import MurMurHash32
|
||||
|
||||
public protocol PostboxCoding {
|
||||
init(decoder: PostboxDecoder)
|
||||
|
@ -1,2 +0,0 @@
|
||||
SWIFT_INCLUDE_PATHS = $(SRCROOT)/Postbox
|
||||
MODULEMAP_PRIVATE_FILE = $(SRCROOT)/Postbox/module.private.modulemap
|
@ -22,6 +22,7 @@
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import sqlcipher
|
||||
|
||||
public final class Database {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Foundation
|
||||
import sqlcipher
|
||||
import MurMurHash32
|
||||
|
||||
public enum HashFunctions {
|
||||
public static func murMurHash32(_ s: String) -> Int32 {
|
||||
|
@ -1,26 +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>en</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>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string></string>
|
||||
</dict>
|
||||
</plist>
|
@ -1,14 +0,0 @@
|
||||
#ifndef IpcNotifier_h
|
||||
#define IpcNotifier_h
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface RLMNotifier : NSObject
|
||||
|
||||
- (instancetype _Nonnull)initWithBasePath:(NSString * _Nonnull)basePath notify:(void (^ _Nonnull)())notify;
|
||||
- (void)listen;
|
||||
- (void)notifyOtherRealms;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
@ -1,195 +0,0 @@
|
||||
#import <sys/event.h>
|
||||
#import <sys/stat.h>
|
||||
#import <sys/time.h>
|
||||
#import <sys/errno.h>
|
||||
#import <unistd.h>
|
||||
|
||||
#import "IpcNotifier.h"
|
||||
|
||||
// Write a byte to a pipe to notify anyone waiting for data on the pipe
|
||||
static void notifyFd(int fd) {
|
||||
while (true) {
|
||||
char c = 0;
|
||||
ssize_t ret = write(fd, &c, 1);
|
||||
if (ret == 1) {
|
||||
break;
|
||||
}
|
||||
|
||||
// If the pipe's buffer is full, we need to read some of the old data in
|
||||
// it to make space. We don't just read in the code waiting for
|
||||
// notifications so that we can notify multiple waiters with a single
|
||||
// write.
|
||||
assert(ret == -1 && errno == EAGAIN);
|
||||
char buff[1024];
|
||||
read(fd, buff, sizeof buff);
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
// A RAII holder for a file descriptor which automatically closes the wrapped fd
|
||||
// when it's deallocated
|
||||
class FdHolder {
|
||||
int fd = -1;
|
||||
void close() {
|
||||
if (fd != -1) {
|
||||
::close(fd);
|
||||
}
|
||||
fd = -1;
|
||||
}
|
||||
|
||||
FdHolder& operator=(FdHolder const&) = delete;
|
||||
FdHolder(FdHolder const&) = delete;
|
||||
|
||||
public:
|
||||
FdHolder() { }
|
||||
~FdHolder() { close(); }
|
||||
operator int() const { return fd; }
|
||||
|
||||
FdHolder& operator=(int newFd) {
|
||||
close();
|
||||
fd = newFd;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Inter-thread and inter-process notifications of changes are done using a
|
||||
// named pipe in the filesystem next to the Realm file. Everyone who wants to be
|
||||
// notified of commits waits for data to become available on the pipe, and anyone
|
||||
// who commits a write transaction writes data to the pipe after releasing the
|
||||
// write lock. Note that no one ever actually *reads* from the pipe: the data
|
||||
// actually written is meaningless, and trying to read from a pipe from multiple
|
||||
// processes at once is fraught with race conditions.
|
||||
|
||||
// When a RLMRealm instance is created, we add a CFRunLoopSource to the current
|
||||
// thread's runloop. On each cycle of the run loop, the run loop checks each of
|
||||
// its sources for work to do, which in the case of CFRunLoopSource is just
|
||||
// checking if CFRunLoopSourceSignal has been called since the last time it ran,
|
||||
// and if so invokes the function pointer supplied when the source is created,
|
||||
// which in our case just invokes `[realm handleExternalChange]`.
|
||||
|
||||
// Listening for external changes is done using kqueue() on a background thread.
|
||||
// kqueue() lets us efficiently wait until the amount of data which can be read
|
||||
// from one or more file descriptors has changed, and tells us which of the file
|
||||
// descriptors it was that changed. We use this to wait on both the shared named
|
||||
// pipe, and a local anonymous pipe. When data is written to the named pipe, we
|
||||
// signal the runloop source and wake up the target runloop, and when data is
|
||||
// written to the anonymous pipe the background thread removes the runloop
|
||||
// source from the runloop and and shuts down.
|
||||
|
||||
@implementation RLMNotifier {
|
||||
// Realm to notify of changes
|
||||
void (^_notify)();
|
||||
// Runloop which notifications are delivered on
|
||||
CFRunLoopRef _runLoop;
|
||||
|
||||
// Read-write file descriptor for the named pipe which is waited on for
|
||||
// changes and written to when a commit is made
|
||||
FdHolder _notifyFd;
|
||||
// File descriptor for the kqueue
|
||||
FdHolder _kq;
|
||||
// The two ends of an anonymous pipe used to notify the kqueue() thread that
|
||||
// it should be shut down.
|
||||
FdHolder _shutdownReadFd;
|
||||
FdHolder _shutdownWriteFd;
|
||||
}
|
||||
|
||||
- (instancetype)initWithBasePath:(NSString *)basePath notify:( void (^ _Nonnull)())notify {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_notify = [notify copy];
|
||||
|
||||
_kq = kqueue();
|
||||
if (_kq == -1) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
const char *path = [basePath stringByAppendingString:@"postbox.note"].UTF8String;
|
||||
|
||||
// Create and open the named pipe
|
||||
int ret = mkfifo(path, 0600);
|
||||
if (ret == -1) {
|
||||
int err = errno;
|
||||
if (err == ENOTSUP) {
|
||||
// Filesystem doesn't support named pipes, so try putting it in tmp instead
|
||||
// Hash collisions are okay here because they just result in doing
|
||||
// extra work, as opposed to correctness problems
|
||||
static NSString *tmpDir = NSTemporaryDirectory();
|
||||
path = [tmpDir stringByAppendingFormat:@"poxtbox_%llu.note", (unsigned long long)[basePath hash]].UTF8String;
|
||||
ret = mkfifo(path, 0600);
|
||||
err = errno;
|
||||
}
|
||||
// the fifo already existing isn't an error
|
||||
if (ret == -1 && err != EEXIST) {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
_notifyFd = open(path, O_RDWR);
|
||||
if (_notifyFd == -1) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Make writing to the pipe return -1 when the pipe's buffer is full
|
||||
// rather than blocking until there's space available
|
||||
ret = fcntl(_notifyFd, F_SETFL, O_NONBLOCK);
|
||||
if (ret == -1) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
// Create the anonymous pipe
|
||||
int pipeFd[2];
|
||||
ret = pipe(pipeFd);
|
||||
if (ret == -1) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
_shutdownReadFd = pipeFd[0];
|
||||
_shutdownWriteFd = pipeFd[1];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)listen {
|
||||
// Set up the kqueue
|
||||
// EVFILT_READ indicates that we care about data being available to read
|
||||
// on the given file descriptor.
|
||||
// EV_CLEAR makes it wait for the amount of data available to be read to
|
||||
// change rather than just returning when there is any data to read.
|
||||
struct kevent ke[2];
|
||||
EV_SET(&ke[0], _notifyFd, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0);
|
||||
EV_SET(&ke[1], _shutdownReadFd, EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, 0);
|
||||
int ret = kevent(_kq, ke, 2, nullptr, 0, nullptr);
|
||||
assert(ret == 0);
|
||||
|
||||
while (true) {
|
||||
struct kevent event;
|
||||
// Wait for data to become on either fd
|
||||
// Return code is number of bytes available or -1 on error
|
||||
ret = kevent(_kq, nullptr, 0, &event, 1, nullptr);
|
||||
assert(ret >= 0);
|
||||
if (ret == 0) {
|
||||
// Spurious wakeup; just wait again
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check which file descriptor had activity: if it's the shutdown
|
||||
// pipe, then someone called -stop; otherwise it's the named pipe
|
||||
// and someone committed a write transaction
|
||||
if (event.ident == (uint32_t)_shutdownReadFd) {
|
||||
return;
|
||||
}
|
||||
assert(event.ident == (uint32_t)_notifyFd);
|
||||
|
||||
_notify();
|
||||
}
|
||||
}
|
||||
|
||||
- (void)stop {
|
||||
notifyFd(_shutdownWriteFd);
|
||||
}
|
||||
|
||||
- (void)notifyOtherRealms {
|
||||
notifyFd(_notifyFd);
|
||||
}
|
||||
@end
|
@ -1,20 +0,0 @@
|
||||
//
|
||||
// Postbox.h
|
||||
// Postbox
|
||||
//
|
||||
// Created by Peter on 10/06/15.
|
||||
// Copyright (c) 2015 Telegram. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for Postbox.
|
||||
FOUNDATION_EXPORT double PostboxVersionNumber;
|
||||
|
||||
//! Project version string for Postbox.
|
||||
FOUNDATION_EXPORT const unsigned char PostboxVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <Postbox/PublicHeader.h>
|
||||
|
||||
#import <Postbox/MurMurHash32.h>
|
||||
//#import <Postbox/IpcNotifier.h>
|
@ -1,5 +1,5 @@
|
||||
import Foundation
|
||||
import sqlcipher
|
||||
import StringTransliteration
|
||||
|
||||
public enum StringIndexTokenTransliteration {
|
||||
case none
|
||||
|
@ -1,3 +0,0 @@
|
||||
module Postbox.PostboxPrivate {
|
||||
export *
|
||||
}
|
18
submodules/Reachability/BUCK
Normal file
18
submodules/Reachability/BUCK
Normal file
@ -0,0 +1,18 @@
|
||||
load("//Config:buck_rule_macros.bzl", "static_library")
|
||||
|
||||
static_library(
|
||||
name = "Reachability",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
headers = glob([
|
||||
"Sources/*.h",
|
||||
]),
|
||||
exported_headers = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/SystemConfiguration.framework",
|
||||
],
|
||||
)
|
22
submodules/Reachability/BUILD
Normal file
22
submodules/Reachability/BUILD
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
objc_library(
|
||||
name = "Reachability",
|
||||
enable_modules = True,
|
||||
module_name = "Reachability",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
hdrs = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"PublicHeaders",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"Foundation",
|
||||
"SystemConfiguration",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -14,7 +14,7 @@
|
||||
|
||||
#import <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
#import "Reachability.h"
|
||||
#import <Reachability/Reachability.h>
|
||||
|
||||
#import <pthread.h>
|
||||
#import <libkern/OSAtomic.h>
|
19
submodules/StringTransliteration/BUCK
Normal file
19
submodules/StringTransliteration/BUCK
Normal file
@ -0,0 +1,19 @@
|
||||
load("//Config:buck_rule_macros.bzl", "static_library")
|
||||
|
||||
static_library(
|
||||
name = "StringTransliteration",
|
||||
srcs = glob([
|
||||
"Sources/*.m",
|
||||
]),
|
||||
headers = glob([
|
||||
"Sources/*.h",
|
||||
]),
|
||||
exported_headers = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
deps = [
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
],
|
||||
)
|
21
submodules/StringTransliteration/BUILD
Normal file
21
submodules/StringTransliteration/BUILD
Normal file
@ -0,0 +1,21 @@
|
||||
|
||||
objc_library(
|
||||
name = "StringTransliteration",
|
||||
enable_modules = True,
|
||||
module_name = "StringTransliteration",
|
||||
srcs = glob([
|
||||
"Source/*.m",
|
||||
]),
|
||||
hdrs = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
includes = [
|
||||
"PublicHeaders",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"Foundation",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -0,0 +1,8 @@
|
||||
#ifndef StringTransliteration_h
|
||||
#define StringTransliteration_h
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NSString *postboxTransformedString(CFStringRef string, bool replaceWithTransliteratedVersion, bool appendTransliteratedVersion);
|
||||
|
||||
#endif
|
@ -0,0 +1,19 @@
|
||||
#import <StringTransliteration/StringTransliteration.h>
|
||||
|
||||
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;
|
||||
}
|
16
submodules/SyncCore/BUILD
Normal file
16
submodules/SyncCore/BUILD
Normal file
@ -0,0 +1,16 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "SyncCore",
|
||||
module_name = "SyncCore",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Postbox:Postbox",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public struct AccountBackupData: Codable, Equatable {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public final class CachedResolvedByNamePeer: PostboxCoding {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public struct SecureIdConfiguration: PostboxCoding {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public struct CloudFileMediaResourceId: MediaResourceId {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public enum ProxyServerConnection: Equatable, Hashable, PostboxCoding {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
private enum SecretChatOutgoingFileValue: Int32 {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public final class SecretFileEncryptionKey: PostboxCoding, Equatable {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public struct SecureFileMediaResourceId: MediaResourceId {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public struct SecureIdFileReference: Equatable {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
private let typeFileName: Int32 = 0
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public enum TelegramMediaImageReference: PostboxCoding, Equatable {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public struct TelegramMediaPollOption: Equatable, PostboxCoding {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public struct TemporaryTwoStepPasswordToken: PostboxCoding, Equatable {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
|
||||
public struct WalletCollectionItem: Equatable, PostboxCoding {
|
||||
|
12
submodules/TelegramApi/BUILD
Normal file
12
submodules/TelegramApi/BUILD
Normal file
@ -0,0 +1,12 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "TelegramApi",
|
||||
module_name = "TelegramApi",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -4,18 +4,7 @@ framework(
|
||||
name = "TelegramCore",
|
||||
srcs = glob([
|
||||
"Sources/*.swift",
|
||||
"Sources/*.m",
|
||||
]),
|
||||
headers = [
|
||||
"Sources/Crypto.h",
|
||||
"Sources/NetworkLogging.h",
|
||||
"Sources/Reachability.h",
|
||||
],
|
||||
exported_headers = [
|
||||
"Sources/Crypto.h",
|
||||
"Sources/NetworkLogging.h",
|
||||
"Sources/Reachability.h",
|
||||
],
|
||||
deps = [
|
||||
"//submodules/TelegramApi:TelegramApi#shared",
|
||||
"//submodules/MtProtoKit:MtProtoKit#shared",
|
||||
@ -24,9 +13,11 @@ framework(
|
||||
"//submodules/SyncCore:SyncCore#shared",
|
||||
"//submodules/CloudData:CloudData",
|
||||
"//submodules/EncryptionProvider:EncryptionProvider",
|
||||
"//submodules/CryptoUtils:CryptoUtils",
|
||||
"//submodules/NetworkLogging:NetworkLogging",
|
||||
"//submodules/Reachability:Reachability",
|
||||
],
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
],
|
||||
)
|
||||
|
||||
|
24
submodules/TelegramCore/BUILD
Normal file
24
submodules/TelegramCore/BUILD
Normal file
@ -0,0 +1,24 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "TelegramCore",
|
||||
module_name = "TelegramCore",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/TelegramApi:TelegramApi",
|
||||
"//submodules/MtProtoKit:MtProtoKit",
|
||||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit",
|
||||
"//submodules/Postbox:Postbox",
|
||||
"//submodules/SyncCore:SyncCore",
|
||||
"//submodules/CloudData:CloudData",
|
||||
"//submodules/EncryptionProvider:EncryptionProvider",
|
||||
"//submodules/CryptoUtils:CryptoUtils",
|
||||
"//submodules/NetworkLogging:NetworkLogging",
|
||||
"//submodules/Reachability:Reachability",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -2,6 +2,7 @@ import Foundation
|
||||
import Postbox
|
||||
import MtProtoKit
|
||||
import SwiftSignalKit
|
||||
import CryptoUtils
|
||||
|
||||
private enum GenerateSecureSecretError {
|
||||
case generic
|
||||
|
@ -3,7 +3,7 @@ import Postbox
|
||||
import SwiftSignalKit
|
||||
import MtProtoKit
|
||||
import TelegramApi
|
||||
|
||||
import CryptoUtils
|
||||
import SyncCore
|
||||
import EncryptionProvider
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import SyncCore
|
||||
import TelegramCore
|
||||
|
||||
public final class ChatUpdatingMessageMedia: Equatable {
|
||||
public let text: String
|
||||
|
@ -2,7 +2,7 @@ import Foundation
|
||||
import TelegramApi
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
|
||||
import CryptoUtils
|
||||
import SyncCore
|
||||
|
||||
private func md5(_ data: Data) -> Data {
|
||||
|
@ -2,6 +2,7 @@ import Foundation
|
||||
import SwiftSignalKit
|
||||
import Postbox
|
||||
import TelegramApi
|
||||
import NetworkLogging
|
||||
|
||||
private let queue = DispatchQueue(label: "org.telegram.Telegram.trace", qos: .utility)
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import CryptoUtils
|
||||
|
||||
public extension MemoryBuffer {
|
||||
func md5Digest() -> Data {
|
||||
|
@ -3,7 +3,7 @@ import Postbox
|
||||
import TelegramApi
|
||||
import SwiftSignalKit
|
||||
import MtProtoKit
|
||||
|
||||
import CryptoUtils
|
||||
import SyncCore
|
||||
|
||||
private typealias SignalKitTimer = SwiftSignalKit.Timer
|
||||
|
@ -1,9 +1,9 @@
|
||||
import Foundation
|
||||
|
||||
import Postbox
|
||||
import TelegramApi
|
||||
import SwiftSignalKit
|
||||
import MtProtoKit
|
||||
import NetworkLogging
|
||||
|
||||
#if os(iOS)
|
||||
import CloudData
|
||||
|
@ -1,6 +1,7 @@
|
||||
import Foundation
|
||||
import SwiftSignalKit
|
||||
import MtProtoKit
|
||||
import Reachability
|
||||
#if os(iOS)
|
||||
import CoreTelephony
|
||||
#endif
|
||||
|
@ -2,7 +2,7 @@ import Foundation
|
||||
import Postbox
|
||||
import TelegramApi
|
||||
import SwiftSignalKit
|
||||
|
||||
import CryptoUtils
|
||||
import SyncCore
|
||||
|
||||
enum PendingMessageUploadedContent {
|
||||
|
@ -1,3 +1,4 @@
|
||||
import Foundation
|
||||
import Postbox
|
||||
import MtProtoKit
|
||||
import SwiftSignalKit
|
||||
|
19
submodules/TextFormat/BUILD
Normal file
19
submodules/TextFormat/BUILD
Normal file
@ -0,0 +1,19 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "TextFormat",
|
||||
module_name = "TextFormat",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
deps = [
|
||||
"//submodules/TelegramCore:TelegramCore",
|
||||
"//submodules/SyncCore:SyncCore",
|
||||
"//submodules/Display:Display",
|
||||
"//submodules/TelegramPresentationData:TelegramPresentationData",
|
||||
"//submodules/Markdown:Markdown",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -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>
|
12
submodules/TinyThumbnail/BUILD
Normal file
12
submodules/TinyThumbnail/BUILD
Normal file
@ -0,0 +1,12 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "TinyThumbnail",
|
||||
module_name = "TinyThumbnail",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
@ -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>
|
@ -1,19 +0,0 @@
|
||||
//
|
||||
// TinyThumbnail.h
|
||||
// TinyThumbnail
|
||||
//
|
||||
// Created by Peter on 8/10/19.
|
||||
// Copyright © 2019 Telegram Messenger LLP. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
//! Project version number for TinyThumbnail.
|
||||
FOUNDATION_EXPORT double TinyThumbnailVersionNumber;
|
||||
|
||||
//! Project version string for TinyThumbnail.
|
||||
FOUNDATION_EXPORT const unsigned char TinyThumbnailVersionString[];
|
||||
|
||||
// In this header, you should import all the public headers of your framework using statements like #import <TinyThumbnail/PublicHeader.h>
|
||||
|
||||
|
12
submodules/Tuples/BUILD
Normal file
12
submodules/Tuples/BUILD
Normal file
@ -0,0 +1,12 @@
|
||||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
|
||||
|
||||
swift_library(
|
||||
name = "Tuples",
|
||||
module_name = "Tuples",
|
||||
srcs = glob([
|
||||
"Sources/**/*.swift",
|
||||
]),
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
18
submodules/sqlcipher/BUCK
vendored
18
submodules/sqlcipher/BUCK
vendored
@ -12,18 +12,12 @@ static_library(
|
||||
srcs = glob([
|
||||
"Sources/*.c",
|
||||
]),
|
||||
headers = [
|
||||
"Sources/sqlcipher_config.h",
|
||||
"Sources/sqlite3.h",
|
||||
"Sources/sqlite3ext.h",
|
||||
],
|
||||
exported_headers = [
|
||||
"Sources/sqlcipher_config.h",
|
||||
"Sources/sqlite3.h",
|
||||
"Sources/sqlite3ext.h",
|
||||
],
|
||||
deps = [
|
||||
],
|
||||
headers = glob([
|
||||
"Sources/*.h",
|
||||
]),
|
||||
exported_headers = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
]),
|
||||
frameworks = [
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
],
|
||||
|
32
submodules/sqlcipher/BUILD
vendored
Normal file
32
submodules/sqlcipher/BUILD
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
public_headers = glob([
|
||||
"PublicHeaders/**/*.h",
|
||||
])
|
||||
|
||||
objc_library(
|
||||
name = "sqlcipher",
|
||||
enable_modules = True,
|
||||
module_name = "sqlcipher",
|
||||
srcs = glob([
|
||||
"Sources/*.c",
|
||||
"Sources/*.h",
|
||||
], exclude = public_headers),
|
||||
hdrs = public_headers,
|
||||
includes = [
|
||||
"PublicHeaders",
|
||||
],
|
||||
copts = [
|
||||
"-DDSQLITE_HAS_CODEC=1",
|
||||
"-DSQLCIPHER_CRYPTO_CC=1",
|
||||
"-DSQLITE_ENABLE_FTS5",
|
||||
"-DSQLITE_DEFAULT_MEMSTATUS=0",
|
||||
"-DNDEBUG",
|
||||
],
|
||||
sdk_frameworks = [
|
||||
"Foundation",
|
||||
"Security",
|
||||
],
|
||||
visibility = [
|
||||
"//visibility:public",
|
||||
],
|
||||
)
|
22
submodules/sqlcipher/Info.plist
vendored
22
submodules/sqlcipher/Info.plist
vendored
@ -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>
|
Loading…
x
Reference in New Issue
Block a user