mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-08 13:42:51 +00:00
Merge branch 'master' of https://github.com/peter-iakovlev/Signals
This commit is contained in:
commit
58cc641e2b
13
.gitignore
vendored
13
.gitignore
vendored
@ -1,6 +1,6 @@
|
|||||||
# Xcode
|
fastlane/README.md
|
||||||
#
|
fastlane/report.xml
|
||||||
build/
|
fastlane/test_output/*
|
||||||
*.pbxuser
|
*.pbxuser
|
||||||
!default.pbxuser
|
!default.pbxuser
|
||||||
*.mode1v3
|
*.mode1v3
|
||||||
@ -11,9 +11,14 @@ build/
|
|||||||
!default.perspectivev3
|
!default.perspectivev3
|
||||||
xcuserdata
|
xcuserdata
|
||||||
*.xccheckout
|
*.xccheckout
|
||||||
|
*.xcscmblueprint
|
||||||
*.moved-aside
|
*.moved-aside
|
||||||
DerivedData
|
DerivedData
|
||||||
*.hmap
|
*.hmap
|
||||||
*.ipa
|
*.ipa
|
||||||
*.xcuserstate
|
*.xcuserstate
|
||||||
|
.DS_Store
|
||||||
|
*.dSYM
|
||||||
|
*.dSYM.zip
|
||||||
|
*.ipa
|
||||||
|
*/xcuserdata/*
|
||||||
|
@ -959,6 +959,185 @@
|
|||||||
};
|
};
|
||||||
name = "Release Hockeyapp";
|
name = "Release Hockeyapp";
|
||||||
};
|
};
|
||||||
|
D021D502219CB1D90064BEBA /* Debug Fork */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||||
|
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
|
||||||
|
CLANG_CXX_LIBRARY = "libc++";
|
||||||
|
CLANG_ENABLE_MODULES = YES;
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||||
|
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||||
|
CLANG_WARN_EMPTY_BODY = YES;
|
||||||
|
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||||
|
CLANG_WARN_INT_CONVERSION = YES;
|
||||||
|
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||||
|
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||||
|
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
|
||||||
|
COPY_PHASE_STRIP = NO;
|
||||||
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
|
ENABLE_BITCODE = NO;
|
||||||
|
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||||
|
ENABLE_TESTABILITY = YES;
|
||||||
|
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||||
|
GCC_DYNAMIC_NO_PIC = NO;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_OPTIMIZATION_LEVEL = 0;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||||
|
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||||
|
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||||
|
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 8.1;
|
||||||
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
SDKROOT = iphoneos;
|
||||||
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
|
VERSIONING_SYSTEM = "apple-generic";
|
||||||
|
VERSION_INFO_PREFIX = "";
|
||||||
|
};
|
||||||
|
name = "Debug Fork";
|
||||||
|
};
|
||||||
|
D021D503219CB1D90064BEBA /* Debug Fork */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||||
|
DEFINES_MODULE = YES;
|
||||||
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
|
ENABLE_BITCODE = YES;
|
||||||
|
INFOPLIST_FILE = SSignalKit/Info.plist;
|
||||||
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
|
MACH_O_TYPE = staticlib;
|
||||||
|
ONLY_ACTIVE_ARCH = NO;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "org.telegram.$(PRODUCT_NAME:rfc1034identifier)";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = X834Q8SBVP/;
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
};
|
||||||
|
name = "Debug Fork";
|
||||||
|
};
|
||||||
|
D021D504219CB1D90064BEBA /* Debug Fork */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
INFOPLIST_FILE = SSignalKitTests/Info.plist;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
|
OTHER_LDFLAGS = (
|
||||||
|
"$(inherited)",
|
||||||
|
"-framework",
|
||||||
|
XCTest,
|
||||||
|
"-ObjC",
|
||||||
|
);
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "org.telegram.$(PRODUCT_NAME:rfc1034identifier)";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
};
|
||||||
|
name = "Debug Fork";
|
||||||
|
};
|
||||||
|
D021D505219CB1D90064BEBA /* Debug Fork */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||||
|
ARCHS = "$(ARCHS_STANDARD)";
|
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
DEFINES_MODULE = YES;
|
||||||
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
|
ENABLE_BITCODE = YES;
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
INFOPLIST_FILE = SwiftSignalKit/Info.plist;
|
||||||
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
|
OTHER_SWIFT_FLAGS = "";
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "org.telegram.$(PRODUCT_NAME:rfc1034identifier)";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
PROVISIONING_PROFILE_SPECIFIER = X834Q8SBVP/;
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos";
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_REFLECTION_METADATA_LEVEL = none;
|
||||||
|
SWIFT_VERSION = 4.0;
|
||||||
|
};
|
||||||
|
name = "Debug Fork";
|
||||||
|
};
|
||||||
|
D021D506219CB1D90064BEBA /* Debug Fork */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
"$(SDKROOT)/Developer/Library/Frameworks",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
GCC_NO_COMMON_BLOCKS = YES;
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
INFOPLIST_FILE = SwiftSignalKitTests/Info.plist;
|
||||||
|
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = "org.telegram.$(PRODUCT_NAME:rfc1034identifier)";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SWIFT_VERSION = 3.0;
|
||||||
|
};
|
||||||
|
name = "Debug Fork";
|
||||||
|
};
|
||||||
|
D021D507219CB1D90064BEBA /* Debug Fork */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
APPLICATION_EXTENSION_API_ONLY = YES;
|
||||||
|
CLANG_ANALYZER_NONNULL = YES;
|
||||||
|
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||||
|
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||||
|
CLANG_WARN_SUSPICIOUS_MOVES = YES;
|
||||||
|
CODE_SIGN_IDENTITY = "-";
|
||||||
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
|
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||||
|
DEFINES_MODULE = YES;
|
||||||
|
DEVELOPMENT_TEAM = "";
|
||||||
|
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||||
|
DYLIB_CURRENT_VERSION = 1;
|
||||||
|
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||||
|
FRAMEWORK_VERSION = A;
|
||||||
|
INFOPLIST_FILE = SwiftSignalKitMac/Info.plist;
|
||||||
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||||
|
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||||
|
PRODUCT_BUNDLE_IDENTIFIER = org.telegram.Telegram.SwiftSignalKitMac;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SDKROOT = macosx;
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||||
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_VERSION = 4.0;
|
||||||
|
};
|
||||||
|
name = "Debug Fork";
|
||||||
|
};
|
||||||
D0445DEC1A7C2CA500267924 /* Debug Hockeyapp */ = {
|
D0445DEC1A7C2CA500267924 /* Debug Hockeyapp */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
@ -2053,6 +2232,7 @@
|
|||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
D0085B361B282B9800EAF753 /* Debug Hockeyapp */,
|
D0085B361B282B9800EAF753 /* Debug Hockeyapp */,
|
||||||
|
D021D505219CB1D90064BEBA /* Debug Fork */,
|
||||||
D0DB57B91E5C4B7A0071854C /* Debug AppStore */,
|
D0DB57B91E5C4B7A0071854C /* Debug AppStore */,
|
||||||
D0ADF931212B3AD400310BBC /* Debug AppStore LLC */,
|
D0ADF931212B3AD400310BBC /* Debug AppStore LLC */,
|
||||||
D0085B371B282B9800EAF753 /* Release Hockeyapp */,
|
D0085B371B282B9800EAF753 /* Release Hockeyapp */,
|
||||||
@ -2067,6 +2247,7 @@
|
|||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
D0085B391B282B9800EAF753 /* Debug Hockeyapp */,
|
D0085B391B282B9800EAF753 /* Debug Hockeyapp */,
|
||||||
|
D021D506219CB1D90064BEBA /* Debug Fork */,
|
||||||
D0DB57BA1E5C4B7A0071854C /* Debug AppStore */,
|
D0DB57BA1E5C4B7A0071854C /* Debug AppStore */,
|
||||||
D0ADF932212B3AD400310BBC /* Debug AppStore LLC */,
|
D0ADF932212B3AD400310BBC /* Debug AppStore LLC */,
|
||||||
D0085B3A1B282B9800EAF753 /* Release Hockeyapp */,
|
D0085B3A1B282B9800EAF753 /* Release Hockeyapp */,
|
||||||
@ -2081,6 +2262,7 @@
|
|||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
D0445DEC1A7C2CA500267924 /* Debug Hockeyapp */,
|
D0445DEC1A7C2CA500267924 /* Debug Hockeyapp */,
|
||||||
|
D021D502219CB1D90064BEBA /* Debug Fork */,
|
||||||
D0DB57B61E5C4B7A0071854C /* Debug AppStore */,
|
D0DB57B61E5C4B7A0071854C /* Debug AppStore */,
|
||||||
D0ADF92E212B3AD400310BBC /* Debug AppStore LLC */,
|
D0ADF92E212B3AD400310BBC /* Debug AppStore LLC */,
|
||||||
D0445DED1A7C2CA500267924 /* Release Hockeyapp */,
|
D0445DED1A7C2CA500267924 /* Release Hockeyapp */,
|
||||||
@ -2095,6 +2277,7 @@
|
|||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
D0445DEF1A7C2CA500267924 /* Debug Hockeyapp */,
|
D0445DEF1A7C2CA500267924 /* Debug Hockeyapp */,
|
||||||
|
D021D503219CB1D90064BEBA /* Debug Fork */,
|
||||||
D0DB57B71E5C4B7A0071854C /* Debug AppStore */,
|
D0DB57B71E5C4B7A0071854C /* Debug AppStore */,
|
||||||
D0ADF92F212B3AD400310BBC /* Debug AppStore LLC */,
|
D0ADF92F212B3AD400310BBC /* Debug AppStore LLC */,
|
||||||
D0445DF01A7C2CA500267924 /* Release Hockeyapp */,
|
D0445DF01A7C2CA500267924 /* Release Hockeyapp */,
|
||||||
@ -2109,6 +2292,7 @@
|
|||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
D0445DF21A7C2CA500267924 /* Debug Hockeyapp */,
|
D0445DF21A7C2CA500267924 /* Debug Hockeyapp */,
|
||||||
|
D021D504219CB1D90064BEBA /* Debug Fork */,
|
||||||
D0DB57B81E5C4B7A0071854C /* Debug AppStore */,
|
D0DB57B81E5C4B7A0071854C /* Debug AppStore */,
|
||||||
D0ADF930212B3AD400310BBC /* Debug AppStore LLC */,
|
D0ADF930212B3AD400310BBC /* Debug AppStore LLC */,
|
||||||
D0445DF31A7C2CA500267924 /* Release Hockeyapp */,
|
D0445DF31A7C2CA500267924 /* Release Hockeyapp */,
|
||||||
@ -2123,6 +2307,7 @@
|
|||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
D0B417F31D7DFA63004562A4 /* Debug Hockeyapp */,
|
D0B417F31D7DFA63004562A4 /* Debug Hockeyapp */,
|
||||||
|
D021D507219CB1D90064BEBA /* Debug Fork */,
|
||||||
D0DB57BB1E5C4B7A0071854C /* Debug AppStore */,
|
D0DB57BB1E5C4B7A0071854C /* Debug AppStore */,
|
||||||
D0ADF933212B3AD400310BBC /* Debug AppStore LLC */,
|
D0ADF933212B3AD400310BBC /* Debug AppStore LLC */,
|
||||||
D0B417F41D7DFA63004562A4 /* Release Hockeyapp */,
|
D0B417F41D7DFA63004562A4 /* Release Hockeyapp */,
|
||||||
|
@ -28,6 +28,36 @@ public func take<T, E>(_ count: Int) -> (Signal<T, E>) -> Signal<T, E> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct SignalTakeAction {
|
||||||
|
public let passthrough: Bool
|
||||||
|
public let complete: Bool
|
||||||
|
|
||||||
|
public init(passthrough: Bool, complete: Bool) {
|
||||||
|
self.passthrough = passthrough
|
||||||
|
self.complete = complete
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func take<T, E>(until: @escaping (T) -> SignalTakeAction) -> (Signal<T, E>) -> Signal<T, E> {
|
||||||
|
return { signal in
|
||||||
|
return Signal { subscriber in
|
||||||
|
return signal.start(next: { next in
|
||||||
|
let action = until(next)
|
||||||
|
if action.passthrough {
|
||||||
|
subscriber.putNext(next)
|
||||||
|
}
|
||||||
|
if action.complete {
|
||||||
|
subscriber.putCompletion()
|
||||||
|
}
|
||||||
|
}, error: { error in
|
||||||
|
subscriber.putError(error)
|
||||||
|
}, completed: {
|
||||||
|
subscriber.putCompletion()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public func last<T, E>(signal: Signal<T, E>) -> Signal<T?, E> {
|
public func last<T, E>(signal: Signal<T, E>) -> Signal<T?, E> {
|
||||||
return Signal { subscriber in
|
return Signal { subscriber in
|
||||||
let value = Atomic<T?>(value: nil)
|
let value = Atomic<T?>(value: nil)
|
||||||
|
@ -54,26 +54,30 @@ public func suspendAwareDelay<T, E>(_ timeout: Double, granularity: Double = 4.0
|
|||||||
timer.start()
|
timer.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
var invalidateImpl: (() -> Void)?
|
if timeout <= granularity * 1.1 {
|
||||||
let timer = Timer(timeout: granularity, repeat: true, completion: {
|
startFinalTimer()
|
||||||
let currentTimestamp = CFAbsoluteTimeGetCurrent()
|
} else {
|
||||||
if beginTimestamp + timeout - granularity * 1.1 <= currentTimestamp {
|
var invalidateImpl: (() -> Void)?
|
||||||
|
let timer = Timer(timeout: granularity, repeat: true, completion: {
|
||||||
|
let currentTimestamp = CFAbsoluteTimeGetCurrent()
|
||||||
|
if beginTimestamp + timeout - granularity * 1.1 <= currentTimestamp {
|
||||||
|
invalidateImpl?()
|
||||||
|
startFinalTimer()
|
||||||
|
}
|
||||||
|
}, queue: queue)
|
||||||
|
|
||||||
|
invalidateImpl = {
|
||||||
|
queue.async {
|
||||||
|
timer.invalidate()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
disposable.set(ActionDisposable {
|
||||||
invalidateImpl?()
|
invalidateImpl?()
|
||||||
startFinalTimer()
|
})
|
||||||
}
|
|
||||||
}, queue: queue)
|
timer.start()
|
||||||
|
|
||||||
invalidateImpl = {
|
|
||||||
queue.async {
|
|
||||||
timer.invalidate()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
disposable.set(ActionDisposable {
|
|
||||||
invalidateImpl?()
|
|
||||||
})
|
|
||||||
|
|
||||||
timer.start()
|
|
||||||
}
|
}
|
||||||
return disposable
|
return disposable
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user