mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various fixes
This commit is contained in:
@@ -5317,7 +5317,7 @@ Any member of this group will be able to see messages in the channel.";
|
|||||||
"PeopleNearby.VisibleUntil" = "visible until %@";
|
"PeopleNearby.VisibleUntil" = "visible until %@";
|
||||||
|
|
||||||
"PeopleNearby.MakeVisibleTitle" = "Make Myself Visible";
|
"PeopleNearby.MakeVisibleTitle" = "Make Myself Visible";
|
||||||
"PeopleNearby.MakeVisibleDescription" = "Users nearby will be able to view your profile and send you messages. This may help you find new friends, but could also attract excessive attention. You can stop sharing your profile and location at any time.\n\nYour phone number will remain hidden.";
|
"PeopleNearby.MakeVisibleDescription" = "Users nearby will be able to view your profile and send you messages. This may help you find new friends, but could also attract excessive attention. You can stop sharing your profile at any time.\n\nYour phone number will remain hidden.";
|
||||||
|
|
||||||
"PeopleNearby.DiscoverDescription" = "Exchange contact info with people nearby\nand find new friends.";
|
"PeopleNearby.DiscoverDescription" = "Exchange contact info with people nearby\nand find new friends.";
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,12 @@ final class ChatItemGalleryFooterContentNode: GalleryFooterContentNode, UIScroll
|
|||||||
self.dateNode.isHidden = true
|
self.dateNode.isHidden = true
|
||||||
self.backwardButton.isHidden = true
|
self.backwardButton.isHidden = true
|
||||||
self.forwardButton.isHidden = true
|
self.forwardButton.isHidden = true
|
||||||
self.playbackControlButton.isHidden = true
|
if status == .Local {
|
||||||
|
self.playbackControlButton.isHidden = false
|
||||||
|
self.playbackControlButton.setImage(playImage, for: [])
|
||||||
|
} else {
|
||||||
|
self.playbackControlButton.isHidden = true
|
||||||
|
}
|
||||||
self.statusButtonNode.isHidden = false
|
self.statusButtonNode.isHidden = false
|
||||||
self.statusNode.isHidden = false
|
self.statusNode.isHidden = false
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ open class GalleryItemNode: ASDisplayNode {
|
|||||||
public var toggleControlsVisibility: () -> Void = { }
|
public var toggleControlsVisibility: () -> Void = { }
|
||||||
public var goToPreviousItem: () -> Void = { }
|
public var goToPreviousItem: () -> Void = { }
|
||||||
public var goToNextItem: () -> Void = { }
|
public var goToNextItem: () -> Void = { }
|
||||||
|
public var canGoToPreviousItem: () -> Bool = { return false }
|
||||||
|
public var canGoToNextItem: () -> Bool = { return false }
|
||||||
public var dismiss: () -> Void = { }
|
public var dismiss: () -> Void = { }
|
||||||
public var beginCustomDismiss: () -> Void = { }
|
public var beginCustomDismiss: () -> Void = { }
|
||||||
public var completeCustomDismiss: () -> Void = { }
|
public var completeCustomDismiss: () -> Void = { }
|
||||||
|
|||||||
@@ -255,6 +255,18 @@ public final class GalleryPagerNode: ASDisplayNode, UIScrollViewDelegate {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
node.canGoToPreviousItem = { [weak self] in
|
||||||
|
if let strongSelf = self, let index = strongSelf.centralItemIndex, index > 0 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
node.canGoToNextItem = { [weak self] in
|
||||||
|
if let strongSelf = self, let index = strongSelf.centralItemIndex, index < strongSelf.items.count - 1 {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
node.dismiss = self.dismiss
|
node.dismiss = self.dismiss
|
||||||
node.beginCustomDismiss = self.beginCustomDismiss
|
node.beginCustomDismiss = self.beginCustomDismiss
|
||||||
node.completeCustomDismiss = self.completeCustomDismiss
|
node.completeCustomDismiss = self.completeCustomDismiss
|
||||||
|
|||||||
@@ -255,6 +255,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||||||
private var _isVisible: Bool?
|
private var _isVisible: Bool?
|
||||||
private var initiallyActivated = false
|
private var initiallyActivated = false
|
||||||
private var hideStatusNodeUntilCentrality = false
|
private var hideStatusNodeUntilCentrality = false
|
||||||
|
private var playOnContentOwnership = false
|
||||||
private var validLayout: (ContainerViewLayout, CGFloat)?
|
private var validLayout: (ContainerViewLayout, CGFloat)?
|
||||||
private var didPause = false
|
private var didPause = false
|
||||||
private var isPaused = true
|
private var isPaused = true
|
||||||
@@ -475,6 +476,12 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||||||
videoNode.ownsContentNodeUpdated = { [weak self] value in
|
videoNode.ownsContentNodeUpdated = { [weak self] value in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
strongSelf.updateDisplayPlaceholder(!value)
|
strongSelf.updateDisplayPlaceholder(!value)
|
||||||
|
|
||||||
|
if strongSelf.playOnContentOwnership {
|
||||||
|
strongSelf.playOnContentOwnership = false
|
||||||
|
strongSelf.initiallyActivated = true
|
||||||
|
strongSelf.videoNode?.playOnceWithSound(playAndRecord: false, actionAtEnd: .stop)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.videoNode = videoNode
|
self.videoNode = videoNode
|
||||||
@@ -710,7 +717,8 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func shouldAutoplayOnCentrality() -> Bool {
|
private func shouldAutoplayOnCentrality() -> Bool {
|
||||||
if let item = self.item, let content = item.content as? NativeVideoContent, !self.initiallyActivated {
|
// !self.initiallyActivated
|
||||||
|
if let item = self.item, let content = item.content as? NativeVideoContent {
|
||||||
var isLocal = false
|
var isLocal = false
|
||||||
if let fetchStatus = self.fetchStatus, case .Local = fetchStatus {
|
if let fetchStatus = self.fetchStatus, case .Local = fetchStatus {
|
||||||
isLocal = true
|
isLocal = true
|
||||||
@@ -743,15 +751,19 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||||||
|
|
||||||
self.hideStatusNodeUntilCentrality = false
|
self.hideStatusNodeUntilCentrality = false
|
||||||
self.statusButtonNode.isHidden = self.hideStatusNodeUntilCentrality || self.statusNodeShouldBeHidden
|
self.statusButtonNode.isHidden = self.hideStatusNodeUntilCentrality || self.statusNodeShouldBeHidden
|
||||||
|
|
||||||
if videoNode.ownsContentNode {
|
if videoNode.ownsContentNode {
|
||||||
if isAnimated {
|
if isAnimated {
|
||||||
videoNode.seek(0.0)
|
videoNode.seek(0.0)
|
||||||
videoNode.play()
|
videoNode.play()
|
||||||
}
|
} else if self.shouldAutoplayOnCentrality() {
|
||||||
else if self.shouldAutoplayOnCentrality() {
|
|
||||||
self.initiallyActivated = true
|
self.initiallyActivated = true
|
||||||
videoNode.playOnceWithSound(playAndRecord: false, actionAtEnd: .stop)
|
videoNode.playOnceWithSound(playAndRecord: false, actionAtEnd: .stop)
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if self.shouldAutoplayOnCentrality() {
|
||||||
|
self.playOnContentOwnership = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
self.dismissOnOrientationChange = false
|
self.dismissOnOrientationChange = false
|
||||||
@@ -1283,6 +1295,6 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override func footerContent() -> Signal<(GalleryFooterContentNode?, GalleryOverlayContentNode?), NoError> {
|
override func footerContent() -> Signal<(GalleryFooterContentNode?, GalleryOverlayContentNode?), NoError> {
|
||||||
return .single((self.footerContentNode, self.overlayContentNode))
|
return .single((self.footerContentNode, nil))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,12 +91,12 @@ open class ZoomableContentGalleryItemNode: GalleryItemNode, UIScrollViewDelegate
|
|||||||
tapRecognizer.highlight = { [weak self] location in
|
tapRecognizer.highlight = { [weak self] location in
|
||||||
if let strongSelf = self {
|
if let strongSelf = self {
|
||||||
let transition: ContainedViewLayoutTransition = .animated(duration: 0.07, curve: .easeInOut)
|
let transition: ContainedViewLayoutTransition = .animated(duration: 0.07, curve: .easeInOut)
|
||||||
if let location = location, location.x < 44.0 {
|
if let location = location, location.x < 44.0 && strongSelf.canGoToPreviousItem() {
|
||||||
transition.updateAlpha(node: strongSelf.leftFadeNode, alpha: 1.0)
|
transition.updateAlpha(node: strongSelf.leftFadeNode, alpha: 1.0)
|
||||||
} else {
|
} else {
|
||||||
transition.updateAlpha(node: strongSelf.leftFadeNode, alpha: 0.0)
|
transition.updateAlpha(node: strongSelf.leftFadeNode, alpha: 0.0)
|
||||||
}
|
}
|
||||||
if let location = location, location.x > strongSelf.frame.width - 44.0 {
|
if let location = location, location.x > strongSelf.frame.width - 44.0 && strongSelf.canGoToNextItem() {
|
||||||
transition.updateAlpha(node: strongSelf.rightFadeNode, alpha: 1.0)
|
transition.updateAlpha(node: strongSelf.rightFadeNode, alpha: 1.0)
|
||||||
} else {
|
} else {
|
||||||
transition.updateAlpha(node: strongSelf.rightFadeNode, alpha: 0.0)
|
transition.updateAlpha(node: strongSelf.rightFadeNode, alpha: 0.0)
|
||||||
|
|||||||
@@ -18,26 +18,18 @@ public enum PeerReportSubject {
|
|||||||
case messages([MessageId])
|
case messages([MessageId])
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum PeerReportOption {
|
public enum PeerReportOption {
|
||||||
case spam
|
case spam
|
||||||
case violence
|
case violence
|
||||||
case copyright
|
case copyright
|
||||||
case pornoghraphy
|
case pornography
|
||||||
case childAbuse
|
case childAbuse
|
||||||
case other
|
case other
|
||||||
}
|
}
|
||||||
|
|
||||||
public func presentPeerReportOptions(context: AccountContext, parent: ViewController, contextController: ContextController?, subject: PeerReportSubject, completion: @escaping (Bool) -> Void) {
|
public func presentPeerReportOptions(context: AccountContext, parent: ViewController, contextController: ContextController?, subject: PeerReportSubject, options: [PeerReportOption] = [.spam, .violence, .pornography, .childAbuse, .copyright, .other], completion: @escaping (Bool) -> Void) {
|
||||||
if let contextController = contextController {
|
if let contextController = contextController {
|
||||||
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
let presentationData = context.sharedContext.currentPresentationData.with { $0 }
|
||||||
let options: [PeerReportOption] = [
|
|
||||||
.spam,
|
|
||||||
.violence,
|
|
||||||
.pornoghraphy,
|
|
||||||
.childAbuse,
|
|
||||||
.copyright,
|
|
||||||
.other
|
|
||||||
]
|
|
||||||
var items: [ContextMenuItem] = []
|
var items: [ContextMenuItem] = []
|
||||||
for option in options {
|
for option in options {
|
||||||
let title: String
|
let title: String
|
||||||
@@ -47,7 +39,7 @@ public func presentPeerReportOptions(context: AccountContext, parent: ViewContro
|
|||||||
title = presentationData.strings.ReportPeer_ReasonSpam
|
title = presentationData.strings.ReportPeer_ReasonSpam
|
||||||
case .violence:
|
case .violence:
|
||||||
title = presentationData.strings.ReportPeer_ReasonViolence
|
title = presentationData.strings.ReportPeer_ReasonViolence
|
||||||
case .pornoghraphy:
|
case .pornography:
|
||||||
title = presentationData.strings.ReportPeer_ReasonPornography
|
title = presentationData.strings.ReportPeer_ReasonPornography
|
||||||
case .childAbuse:
|
case .childAbuse:
|
||||||
title = presentationData.strings.ReportPeer_ReasonChildAbuse
|
title = presentationData.strings.ReportPeer_ReasonChildAbuse
|
||||||
@@ -67,7 +59,7 @@ public func presentPeerReportOptions(context: AccountContext, parent: ViewContro
|
|||||||
reportReason = .spam
|
reportReason = .spam
|
||||||
case .violence:
|
case .violence:
|
||||||
reportReason = .violence
|
reportReason = .violence
|
||||||
case .pornoghraphy:
|
case .pornography:
|
||||||
reportReason = .porno
|
reportReason = .porno
|
||||||
case .childAbuse:
|
case .childAbuse:
|
||||||
reportReason = .childAbuse
|
reportReason = .childAbuse
|
||||||
@@ -116,7 +108,7 @@ public func peerReportOptionsController(context: AccountContext, subject: PeerRe
|
|||||||
let options: [PeerReportOption] = [
|
let options: [PeerReportOption] = [
|
||||||
.spam,
|
.spam,
|
||||||
.violence,
|
.violence,
|
||||||
.pornoghraphy,
|
.pornography,
|
||||||
.childAbuse,
|
.childAbuse,
|
||||||
.copyright,
|
.copyright,
|
||||||
.other
|
.other
|
||||||
@@ -131,7 +123,7 @@ public func peerReportOptionsController(context: AccountContext, subject: PeerRe
|
|||||||
title = presentationData.strings.ReportPeer_ReasonSpam
|
title = presentationData.strings.ReportPeer_ReasonSpam
|
||||||
case .violence:
|
case .violence:
|
||||||
title = presentationData.strings.ReportPeer_ReasonViolence
|
title = presentationData.strings.ReportPeer_ReasonViolence
|
||||||
case .pornoghraphy:
|
case .pornography:
|
||||||
title = presentationData.strings.ReportPeer_ReasonPornography
|
title = presentationData.strings.ReportPeer_ReasonPornography
|
||||||
case .childAbuse:
|
case .childAbuse:
|
||||||
title = presentationData.strings.ReportPeer_ReasonChildAbuse
|
title = presentationData.strings.ReportPeer_ReasonChildAbuse
|
||||||
@@ -147,7 +139,7 @@ public func peerReportOptionsController(context: AccountContext, subject: PeerRe
|
|||||||
reportReason = .spam
|
reportReason = .spam
|
||||||
case .violence:
|
case .violence:
|
||||||
reportReason = .violence
|
reportReason = .violence
|
||||||
case .pornoghraphy:
|
case .pornography:
|
||||||
reportReason = .porno
|
reportReason = .porno
|
||||||
case .childAbuse:
|
case .childAbuse:
|
||||||
reportReason = .childAbuse
|
reportReason = .childAbuse
|
||||||
|
|||||||
Reference in New Issue
Block a user