mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix more leaks
This commit is contained in:
parent
c55bbe6be3
commit
b2036845f0
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
if (_impl) {
|
if (_impl) {
|
||||||
av_frame_unref(_impl);
|
av_frame_free(&_impl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,13 +98,13 @@ static void MTNetworkAvailabilityContextRelease(const void *info)
|
|||||||
MTTimer *timer = _timer;
|
MTTimer *timer = _timer;
|
||||||
_timer = nil;
|
_timer = nil;
|
||||||
|
|
||||||
[[MTNetworkAvailability networkAvailabilityQueue] dispatchOnQueue:^
|
[[MTNetworkAvailability networkAvailabilityQueue] dispatchOnQueue:^{
|
||||||
{
|
[timer invalidate];
|
||||||
[timer invalidate];
|
|
||||||
|
SCNetworkReachabilitySetCallback(reachability, NULL, NULL);
|
||||||
SCNetworkReachabilitySetCallback(reachability, NULL, NULL);
|
SCNetworkReachabilitySetDispatchQueue(reachability, NULL);
|
||||||
SCNetworkReachabilitySetDispatchQueue(reachability, NULL);
|
CFRelease(reachability);
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (MTQueue *)networkAvailabilityQueue
|
+ (MTQueue *)networkAvailabilityQueue
|
||||||
|
@ -270,7 +270,7 @@ public final class MediaStreamComponent: CombinedComponent {
|
|||||||
let moreButtonTag = local.moreButtonTag
|
let moreButtonTag = local.moreButtonTag
|
||||||
let moreAnimationTag = local.moreAnimationTag
|
let moreAnimationTag = local.moreAnimationTag
|
||||||
|
|
||||||
func makeBody() -> CGSize {
|
let makeBody: () -> CGSize = { [weak local] in
|
||||||
let canEnforceOrientation = UIDevice.current.model != "iPad"
|
let canEnforceOrientation = UIDevice.current.model != "iPad"
|
||||||
var forceFullScreenInLandscape: Bool { canEnforceOrientation && true }
|
var forceFullScreenInLandscape: Bool { canEnforceOrientation && true }
|
||||||
let environment = context.environment[ViewControllerComponentContainer.Environment.self].value
|
let environment = context.environment[ViewControllerComponentContainer.Environment.self].value
|
||||||
@ -289,13 +289,20 @@ public final class MediaStreamComponent: CombinedComponent {
|
|||||||
let state = context.state
|
let state = context.state
|
||||||
let controller = environment.controller
|
let controller = environment.controller
|
||||||
|
|
||||||
context.state.deactivatePictureInPictureIfVisible.connect {
|
context.state.deactivatePictureInPictureIfVisible.connect { [weak state] in
|
||||||
guard let controller = controller(), controller.view.window != nil else {
|
guard let controller = controller(), controller.view.window != nil else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
guard let state else {
|
||||||
|
return
|
||||||
|
}
|
||||||
state.updated(transition: .easeInOut(duration: 3))
|
state.updated(transition: .easeInOut(duration: 3))
|
||||||
deactivatePictureInPicture.invoke(Void())
|
|
||||||
|
guard let local else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
local.deactivatePictureInPicture.invoke(Void())
|
||||||
}
|
}
|
||||||
let isFullscreen: Bool
|
let isFullscreen: Bool
|
||||||
let isLandscape = context.availableSize.width > context.availableSize.height
|
let isLandscape = context.availableSize.width > context.availableSize.height
|
||||||
@ -347,8 +354,7 @@ public final class MediaStreamComponent: CombinedComponent {
|
|||||||
availableSize: CGSize(width: context.availableSize.width, height: dismissTapAreaHeight),
|
availableSize: CGSize(width: context.availableSize.width, height: dismissTapAreaHeight),
|
||||||
transition: context.transition
|
transition: context.transition
|
||||||
)
|
)
|
||||||
// (controller() as? MediaStreamComponentController)?.prefersOnScreenNavigationHidden = isFullscreen
|
|
||||||
// (controller() as? MediaStreamComponentController)?.window?.invalidatePrefersOnScreenNavigationHidden()
|
|
||||||
let video = video.update(
|
let video = video.update(
|
||||||
component: MediaStreamVideoComponent(
|
component: MediaStreamVideoComponent(
|
||||||
call: context.component.call,
|
call: context.component.call,
|
||||||
@ -832,6 +838,8 @@ public final class MediaStreamComponent: CombinedComponent {
|
|||||||
UIColor(red: 0.314, green: 0.161, blue: 0.197, alpha: 1).cgColor
|
UIColor(red: 0.314, green: 0.161, blue: 0.197, alpha: 1).cgColor
|
||||||
],
|
],
|
||||||
image: generateImage(CGSize(width: 44.0 * imageRenderScale, height: 44 * imageRenderScale), opaque: false, rotatedContext: { size, context in
|
image: generateImage(CGSize(width: 44.0 * imageRenderScale, height: 44 * imageRenderScale), opaque: false, rotatedContext: { size, context in
|
||||||
|
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||||
|
|
||||||
context.translateBy(x: size.width / 2, y: size.height / 2)
|
context.translateBy(x: size.width / 2, y: size.height / 2)
|
||||||
context.scaleBy(x: 0.4, y: 0.4)
|
context.scaleBy(x: 0.4, y: 0.4)
|
||||||
context.translateBy(x: -size.width / 2, y: -size.height / 2)
|
context.translateBy(x: -size.width / 2, y: -size.height / 2)
|
||||||
|
@ -753,12 +753,18 @@ public final class PresentationCallManagerImpl: PresentationCallManager {
|
|||||||
|
|
||||||
public func joinGroupCall(context: AccountContext, peerId: PeerId, invite: String?, requestJoinAsPeerId: ((@escaping (PeerId?) -> Void) -> Void)?, initialCall: EngineGroupCallDescription, endCurrentIfAny: Bool) -> JoinGroupCallManagerResult {
|
public func joinGroupCall(context: AccountContext, peerId: PeerId, invite: String?, requestJoinAsPeerId: ((@escaping (PeerId?) -> Void) -> Void)?, initialCall: EngineGroupCallDescription, endCurrentIfAny: Bool) -> JoinGroupCallManagerResult {
|
||||||
let begin: () -> Void = { [weak self] in
|
let begin: () -> Void = { [weak self] in
|
||||||
if let requestJoinAsPeerId = requestJoinAsPeerId {
|
if let requestJoinAsPeerId = requestJoinAsPeerId, (initialCall.isStream == nil || initialCall.isStream == false) {
|
||||||
requestJoinAsPeerId({ joinAsPeerId in
|
requestJoinAsPeerId({ joinAsPeerId in
|
||||||
let _ = self?.startGroupCall(accountContext: context, peerId: peerId, invite: invite, joinAsPeerId: joinAsPeerId, initialCall: initialCall).start()
|
guard let self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.startCallDisposable.set(self.startGroupCall(accountContext: context, peerId: peerId, invite: invite, joinAsPeerId: joinAsPeerId, initialCall: initialCall).startStrict())
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
let _ = self?.startGroupCall(accountContext: context, peerId: peerId, invite: invite, joinAsPeerId: nil, initialCall: initialCall).start()
|
guard let self else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
self.startCallDisposable.set(self.startGroupCall(accountContext: context, peerId: peerId, invite: invite, joinAsPeerId: nil, initialCall: initialCall).startStrict())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -805,6 +811,8 @@ public final class PresentationCallManagerImpl: PresentationCallManager {
|
|||||||
let accessEnabledSignal: Signal<Bool, NoError> = Signal { subscriber in
|
let accessEnabledSignal: Signal<Bool, NoError> = Signal { subscriber in
|
||||||
if let isStream = initialCall.isStream, isStream {
|
if let isStream = initialCall.isStream, isStream {
|
||||||
subscriber.putNext(true)
|
subscriber.putNext(true)
|
||||||
|
subscriber.putCompletion()
|
||||||
|
|
||||||
return EmptyDisposable
|
return EmptyDisposable
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user