Various Fixes

This commit is contained in:
Ilya Laktyushin 2021-11-07 01:50:47 +04:00
parent b40173084a
commit abfc1b54e5
6 changed files with 37 additions and 22 deletions

View File

@ -17,6 +17,7 @@ public enum DeviceMetrics: CaseIterable, Equatable {
case iPhone12
case iPhone12ProMax
case iPad
case iPadMini
case iPad102Inch
case iPadPro10Inch
case iPadPro11Inch
@ -37,6 +38,7 @@ public enum DeviceMetrics: CaseIterable, Equatable {
.iPhone12,
.iPhone12ProMax,
.iPad,
.iPadMini,
.iPad102Inch,
.iPadPro10Inch,
.iPadPro11Inch,
@ -111,6 +113,8 @@ public enum DeviceMetrics: CaseIterable, Equatable {
return CGSize(width: 428.0, height: 926.0)
case .iPad:
return CGSize(width: 768.0, height: 1024.0)
case .iPadMini:
return CGSize(width: 744.0, height: 1133.0)
case .iPad102Inch:
return CGSize(width: 810.0, height: 1080.0)
case .iPadPro10Inch:
@ -162,7 +166,7 @@ public enum DeviceMetrics: CaseIterable, Equatable {
return inLandscape ? 21.0 : 34.0
case .iPadPro3rdGen, .iPadPro11Inch:
return 21.0
case .iPad, .iPadPro, .iPadPro10Inch:
case .iPad, .iPadPro, .iPadPro10Inch, .iPadMini:
if let systemOnScreenNavigationHeight = systemOnScreenNavigationHeight, !systemOnScreenNavigationHeight.isZero {
return 21.0
} else {
@ -192,7 +196,7 @@ public enum DeviceMetrics: CaseIterable, Equatable {
switch self {
case .iPhoneX, .iPhoneXSMax, .iPhoneXr, .iPhone12Mini, .iPhone12, .iPhone12ProMax:
return 44.0
case .iPadPro11Inch, .iPadPro3rdGen:
case .iPadPro11Inch, .iPadPro3rdGen, .iPadMini:
return 24.0
case let .unknown(_, statusBarHeight, _):
return statusBarHeight
@ -212,7 +216,7 @@ public enum DeviceMetrics: CaseIterable, Equatable {
return 172.0
case .iPad, .iPad102Inch, .iPadPro10Inch:
return 348.0
case .iPadPro11Inch:
case .iPadPro11Inch, .iPadMini:
return 368.0
case .iPadPro:
return 421.0
@ -235,7 +239,7 @@ public enum DeviceMetrics: CaseIterable, Equatable {
return 263.0
case .iPadPro11Inch:
return 283.0
case .iPadPro:
case .iPadPro, .iPadMini:
return 328.0
case .iPadPro3rdGen:
return 348.0
@ -250,7 +254,7 @@ public enum DeviceMetrics: CaseIterable, Equatable {
switch self {
case .iPhone4, .iPhone5, .iPhone6, .iPhone6Plus, .iPhoneX, .iPhoneXSMax, .iPhoneXr, .iPhone12Mini, .iPhone12, .iPhone12ProMax:
return 37.0
case .iPad, .iPad102Inch, .iPadPro10Inch, .iPadPro11Inch, .iPadPro, .iPadPro3rdGen:
case .iPad, .iPad102Inch, .iPadPro10Inch, .iPadPro11Inch, .iPadPro, .iPadPro3rdGen, .iPadMini:
return 50.0
case .unknown:
return 37.0
@ -263,7 +267,7 @@ public enum DeviceMetrics: CaseIterable, Equatable {
return 44.0
case .iPhone6Plus:
return 45.0
case .iPad, .iPad102Inch, .iPadPro10Inch, .iPadPro11Inch, .iPadPro, .iPadPro3rdGen:
case .iPad, .iPad102Inch, .iPadPro10Inch, .iPadPro11Inch, .iPadPro, .iPadPro3rdGen, .iPadMini:
return 50.0
case .unknown:
return 44.0

View File

@ -89,7 +89,7 @@ struct PasscodeKeyboardLayout {
self.topOffset = 329.0
self.biometricsOffset = 30.0
self.deleteOffset = 20.0
case .iPad, .iPad102Inch, .iPadPro10Inch, .iPadPro11Inch, .iPadPro, .iPadPro3rdGen:
case .iPad, .iPad102Inch, .iPadPro10Inch, .iPadPro11Inch, .iPadPro, .iPadPro3rdGen, .iPadMini:
self.buttonSize = 81.0
self.horizontalSecond = 106.0
self.horizontalThird = 212.0
@ -159,7 +159,7 @@ public struct PasscodeLayout {
self.titleOffset = 180.0
self.subtitleOffset = 0.0
self.inputFieldOffset = 226.0
case .iPad, .iPad102Inch, .iPadPro10Inch, .iPadPro11Inch, .iPadPro, .iPadPro3rdGen:
case .iPad, .iPad102Inch, .iPadPro10Inch, .iPadPro11Inch, .iPadPro, .iPadPro3rdGen, .iPadMini:
self.titleOffset = self.keyboard.topOffset - 120.0
self.subtitleOffset = -2.0
self.inputFieldOffset = self.keyboard.topOffset - 76.0

View File

@ -582,7 +582,6 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
private let screencastJoinDisposable = MetaDisposable()
private let requestDisposable = MetaDisposable()
private let startDisposable = MetaDisposable()
private let subscribeDisposable = MetaDisposable()
private var groupCallParticipantUpdatesDisposable: Disposable?
private let networkStateDisposable = MetaDisposable()
@ -937,7 +936,6 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
self.screencastJoinDisposable.dispose()
self.requestDisposable.dispose()
self.startDisposable.dispose()
self.subscribeDisposable.dispose()
self.groupCallParticipantUpdatesDisposable?.dispose()
self.leaveDisposable.dispose()
self.isMutedDisposable.dispose()
@ -1311,6 +1309,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
strongSelf.stateValue.title = state.title
strongSelf.stateValue.muteState = GroupCallParticipantsContext.Participant.MuteState(canUnmute: canManageCall || !state.defaultParticipantsAreMuted.isMuted, mutedByYou: false)
strongSelf.stateValue.subscribedToScheduled = state.subscribedToScheduled
strongSelf.stateValue.scheduleTimestamp = strongSelf.isScheduledStarted ? nil : state.scheduleTimestamp
if state.scheduleTimestamp == nil && !strongSelf.isScheduledStarted {
strongSelf.updateSessionState(internalState: .active(GroupCallInfo(id: callInfo.id, accessHash: callInfo.accessHash, participantCount: state.totalCount, streamDcId: callInfo.streamDcId, title: state.title, scheduleTimestamp: nil, subscribedToScheduled: false, recordingStartTimestamp: nil, sortAscending: true, defaultParticipantsAreMuted: callInfo.defaultParticipantsAreMuted ?? state.defaultParticipantsAreMuted, isVideoEnabled: callInfo.isVideoEnabled, unmutedVideoLimit: callInfo.unmutedVideoLimit)), audioSessionControl: strongSelf.audioSessionControl)
@ -2383,11 +2382,7 @@ public final class PresentationGroupCallImpl: PresentationGroupCall {
guard case let .active(callInfo) = self.internalState, callInfo.scheduleTimestamp != nil else {
return
}
self.stateValue.subscribedToScheduled = subscribe
self.subscribeDisposable.set((self.accountContext.engine.calls.toggleScheduledGroupCallSubscription(peerId: self.peerId, callId: callInfo.id, accessHash: callInfo.accessHash, subscribe: subscribe)
|> deliverOnMainQueue).start())
self.participantsContext?.toggleScheduledSubscription(subscribe)
}
public func schedule(timestamp: Int32) {

View File

@ -1194,6 +1194,7 @@ public final class GroupCallParticipantsContext {
}
private let account: Account
private let peerId: PeerId
public let myPeerId: PeerId
public let id: Int64
public let accessHash: Int64
@ -1286,7 +1287,8 @@ public final class GroupCallParticipantsContext {
private let updateDefaultMuteDisposable = MetaDisposable()
private let resetInviteLinksDisposable = MetaDisposable()
private let updateShouldBeRecordingDisposable = MetaDisposable()
private let subscribeDisposable = MetaDisposable()
private var localVideoIsMuted: Bool? = nil
private var localIsVideoPaused: Bool? = nil
private var localIsPresentationPaused: Bool? = nil
@ -1298,6 +1300,7 @@ public final class GroupCallParticipantsContext {
init(account: Account, peerId: PeerId, myPeerId: PeerId, id: Int64, accessHash: Int64, state: State, previousServiceState: ServiceState?) {
self.account = account
self.peerId = peerId
self.myPeerId = myPeerId
self.id = id
self.accessHash = accessHash
@ -1423,7 +1426,8 @@ public final class GroupCallParticipantsContext {
self.updateDefaultMuteDisposable.dispose()
self.updateShouldBeRecordingDisposable.dispose()
self.activityRankResetTimer?.invalidate()
resetInviteLinksDisposable.dispose()
self.resetInviteLinksDisposable.dispose()
self.subscribeDisposable.dispose()
}
public func addUpdates(updates: [Update]) {
@ -2029,6 +2033,15 @@ public final class GroupCallParticipantsContext {
}))
}
public func toggleScheduledSubscription(_ subscribe: Bool) {
if subscribe == self.stateValue.state.subscribedToScheduled {
return
}
self.stateValue.state.subscribedToScheduled = subscribe
self.subscribeDisposable.set(_internal_toggleScheduledGroupCallSubscription(account: self.account, peerId: self.peerId, callId: self.id, accessHash: self.accessHash, subscribe: subscribe).start())
}
public func loadMore(token: String) {
if token != self.stateValue.state.nextParticipantsFetchOffset {
Logger.shared.log("GroupCallParticipantsContext", "loadMore called with an invalid token \(token) (the valid one is \(String(describing: self.stateValue.state.nextParticipantsFetchOffset)))")

View File

@ -281,9 +281,7 @@ func messageMediaEditingOptions(message: Message) -> MessageMediaEditingOptions
return []
}
for attribute in message.attributes {
if attribute is AutoremoveTimeoutMessageAttribute {
return []
} else if attribute is AutoclearTimeoutMessageAttribute {
if attribute is AutoclearTimeoutMessageAttribute {
return []
}
}

View File

@ -89,8 +89,13 @@ final class NotificationItemContainerNode: ASDisplayNode {
let inset: CGFloat = 8.0
var contentInsets = UIEdgeInsets(top: inset, left: inset + layout.safeInsets.left, bottom: inset, right: inset + layout.safeInsets.right)
if let statusBarHeight = layout.statusBarHeight, CGFloat(44.0).isLessThanOrEqualTo(statusBarHeight) {
contentInsets.top += 34.0
if let statusBarHeight = layout.statusBarHeight, statusBarHeight >= 39.0 {
if statusBarHeight >= 44.0 {
contentInsets.top += 34.0
} else {
contentInsets.top += 29.0
}
}
let containerWidth = horizontalContainerFillingSizeForLayout(layout: layout, sideInset: layout.safeInsets.left)