no message

This commit is contained in:
Peter
2016-08-09 00:23:25 +03:00
parent c1f7dadd0b
commit cd0eb7f756
6 changed files with 18 additions and 12 deletions

View File

@@ -750,6 +750,7 @@
PROVISIONING_PROFILE_SPECIFIER = X834Q8SBVP/;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
@@ -775,6 +776,7 @@
PROVISIONING_PROFILE_SPECIFIER = X834Q8SBVP/;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
};
name = Release;
};
@@ -796,6 +798,7 @@
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;
};
@@ -815,6 +818,7 @@
PRODUCT_BUNDLE_IDENTIFIER = "org.telegram.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
};
name = Release;
};
@@ -1097,6 +1101,7 @@
PROVISIONING_PROFILE_SPECIFIER = X834Q8SBVP/;
SKIP_INSTALL = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_VERSION = 3.0;
};
name = Hockeyapp;
};
@@ -1115,6 +1120,7 @@
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 = Hockeyapp;
};

View File

@@ -8,7 +8,7 @@ public final class Atomic<T> {
self.value = value
}
public func with<R>(_ f: (T) -> R) -> R {
public func with<R>(_ f: @noescape(T) -> R) -> R {
OSSpinLockLock(&self.lock)
let result = f(self.value)
OSSpinLockUnlock(&self.lock)
@@ -16,7 +16,7 @@ public final class Atomic<T> {
return result
}
public func modify(_ f: (T) -> T) -> T {
public func modify(_ f: @noescape(T) -> T) -> T {
OSSpinLockLock(&self.lock)
let result = f(self.value)
self.value = result

View File

@@ -20,11 +20,11 @@ public final class Queue {
}
public class func concurrentDefaultQueue() -> Queue {
return Queue(queue: DispatchQueue.global(attributes: [.qosDefault]), specialIsMainQueue: false)
return Queue(queue: DispatchQueue.global(qos: .default), specialIsMainQueue: false)
}
public class func concurrentBackgroundQueue() -> Queue {
return Queue(queue: DispatchQueue.global(attributes: [.qosBackground]), specialIsMainQueue: false)
return Queue(queue: DispatchQueue.global(qos: .background), specialIsMainQueue: false)
}
public init(queue: DispatchQueue) {
@@ -38,17 +38,17 @@ public final class Queue {
}
public init(name: String? = nil) {
self.nativeQueue = DispatchQueue(label: name ?? "", attributes: [.serial], target: nil)
self.nativeQueue = DispatchQueue(label: name ?? "", qos: .default)
self.specialIsMainQueue = false
self.nativeQueue.setSpecific(key: QueueSpecificKey, value: self.specific)
}
func isCurrent() -> Bool {
public func isCurrent() -> Bool {
if DispatchQueue.getSpecific(key: QueueSpecificKey) === self.specific {
return true
} else if self.specialIsMainQueue && Thread.isMainThread() {
} else if self.specialIsMainQueue && Thread.isMainThread {
return true
} else {
return false
@@ -63,7 +63,7 @@ public final class Queue {
}
}
public func sync(_ f: (Void) -> Void) {
public func sync(_ f: @noescape(Void) -> Void) {
if self.isCurrent() {
f()
} else {
@@ -77,6 +77,6 @@ public final class Queue {
public func after(_ delay: Double, _ f: (Void) -> Void) {
let time: DispatchTime = DispatchTime.now() + Double(Int64(delay * Double(NSEC_PER_SEC)))
self.nativeQueue.after(when: time, execute: f)
self.nativeQueue.asyncAfter(deadline: time, execute: f)
}
}

View File

@@ -114,7 +114,7 @@ public func retry<T, E>(_ delayIncrement: Double, maxDelay: Double, onQueue queu
}
let time: DispatchTime = DispatchTime.now() + Double(Int64(delay * Double(NSEC_PER_SEC)))
queue.queue.after(when: time, execute: {
queue.queue.asyncAfter(deadline: time, execute: {
recurse()
})
}, completed: {

View File

@@ -157,7 +157,7 @@ public func ==(lhs: ThreadPoolQueue, rhs: ThreadPoolQueue) -> Bool {
}
public func isCurrentThreadInPool() -> Bool {
let currentThread = Thread.current()
let currentThread = Thread.current
for thread in self.threads {
if currentThread.isEqual(thread) {
return true

View File

@@ -19,7 +19,7 @@ public final class Timer {
}
public func start() {
let timer = DispatchSource.timer(queue: self.queue.queue)
let timer = DispatchSource.makeTimerSource(queue: self.queue.queue)
timer.setEventHandler(handler: { [weak self] in
if let strongSelf = self {
strongSelf.completion()