mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various Fixes
This commit is contained in:
parent
c6b89a31cc
commit
a9289f03e4
@ -386,7 +386,7 @@ private func inviteLinkEditControllerEntries(invite: ExportedInvitation?, state:
|
|||||||
}
|
}
|
||||||
entries.append(.timeInfo(presentationData.theme, presentationData.strings.InviteLink_Create_TimeLimitInfo))
|
entries.append(.timeInfo(presentationData.theme, presentationData.strings.InviteLink_Create_TimeLimitInfo))
|
||||||
|
|
||||||
if !state.requestApproval {
|
if !state.requestApproval || isPublic {
|
||||||
entries.append(.usageHeader(presentationData.theme, presentationData.strings.InviteLink_Create_UsersLimit.uppercased()))
|
entries.append(.usageHeader(presentationData.theme, presentationData.strings.InviteLink_Create_UsersLimit.uppercased()))
|
||||||
entries.append(.usagePicker(presentationData.theme, presentationData.dateTimeFormat, state.usage))
|
entries.append(.usagePicker(presentationData.theme, presentationData.dateTimeFormat, state.usage))
|
||||||
|
|
||||||
@ -524,6 +524,8 @@ public func inviteLinkEditController(context: AccountContext, updatedPresentatio
|
|||||||
))
|
))
|
||||||
|> deliverOnMainQueue
|
|> deliverOnMainQueue
|
||||||
|> map { presentationData, state, peer -> (ItemListControllerState, (ItemListNodeState, Any)) in
|
|> map { presentationData, state, peer -> (ItemListControllerState, (ItemListNodeState, Any)) in
|
||||||
|
let isPublic = !(peer?.addressName?.isEmpty ?? true)
|
||||||
|
|
||||||
let leftNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Cancel), style: .regular, enabled: true, action: {
|
let leftNavigationButton = ItemListNavigationButton(content: .text(presentationData.strings.Common_Cancel), style: .regular, enabled: true, action: {
|
||||||
dismissImpl?()
|
dismissImpl?()
|
||||||
})
|
})
|
||||||
@ -548,7 +550,7 @@ public func inviteLinkEditController(context: AccountContext, updatedPresentatio
|
|||||||
let titleString = state.title.trimmingCharacters(in: .whitespacesAndNewlines)
|
let titleString = state.title.trimmingCharacters(in: .whitespacesAndNewlines)
|
||||||
let title = titleString.isEmpty ? nil : titleString
|
let title = titleString.isEmpty ? nil : titleString
|
||||||
let usageLimit = state.usage.value
|
let usageLimit = state.usage.value
|
||||||
let requestNeeded = state.requestApproval
|
let requestNeeded = state.requestApproval && !isPublic
|
||||||
|
|
||||||
if invite == nil {
|
if invite == nil {
|
||||||
let _ = (context.engine.peers.createPeerExportedInvitation(peerId: peerId, title: title, expireDate: expireDate, usageLimit: requestNeeded ? 0 : usageLimit, requestNeeded: requestNeeded)
|
let _ = (context.engine.peers.createPeerExportedInvitation(peerId: peerId, title: title, expireDate: expireDate, usageLimit: requestNeeded ? 0 : usageLimit, requestNeeded: requestNeeded)
|
||||||
@ -600,7 +602,7 @@ public func inviteLinkEditController(context: AccountContext, updatedPresentatio
|
|||||||
}
|
}
|
||||||
|
|
||||||
let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text(invite == nil ? presentationData.strings.InviteLink_Create_Title : presentationData.strings.InviteLink_Create_EditTitle), leftNavigationButton: leftNavigationButton, rightNavigationButton: rightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: true)
|
let controllerState = ItemListControllerState(presentationData: ItemListPresentationData(presentationData), title: .text(invite == nil ? presentationData.strings.InviteLink_Create_Title : presentationData.strings.InviteLink_Create_EditTitle), leftNavigationButton: leftNavigationButton, rightNavigationButton: rightNavigationButton, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: true)
|
||||||
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: inviteLinkEditControllerEntries(invite: invite, state: state, isGroup: isGroup, isPublic: !(peer?.addressName?.isEmpty ?? true), presentationData: presentationData), style: .blocks, emptyStateItem: nil, crossfadeState: false, animateChanges: animateChanges)
|
let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: inviteLinkEditControllerEntries(invite: invite, state: state, isGroup: isGroup, isPublic: isPublic, presentationData: presentationData), style: .blocks, emptyStateItem: nil, crossfadeState: false, animateChanges: animateChanges)
|
||||||
|
|
||||||
return (controllerState, (listState, arguments))
|
return (controllerState, (listState, arguments))
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,9 @@ public func inviteRequestsController(context: AccountContext, updatedPresentatio
|
|||||||
}, action: { _, f in
|
}, action: { _, f in
|
||||||
f(.dismissWithoutContent)
|
f(.dismissWithoutContent)
|
||||||
|
|
||||||
|
Queue.mainQueue().after(0.3, {
|
||||||
denyRequestImpl(peer)
|
denyRequestImpl(peer)
|
||||||
|
})
|
||||||
})))
|
})))
|
||||||
|
|
||||||
let dismissPromise = ValuePromise<Bool>(false)
|
let dismissPromise = ValuePromise<Bool>(false)
|
||||||
|
@ -2,6 +2,7 @@ import Foundation
|
|||||||
import UIKit
|
import UIKit
|
||||||
import SwiftSignalKit
|
import SwiftSignalKit
|
||||||
import Display
|
import Display
|
||||||
|
import CoreImage
|
||||||
import Postbox
|
import Postbox
|
||||||
import TelegramCore
|
import TelegramCore
|
||||||
import MediaResources
|
import MediaResources
|
||||||
@ -1476,23 +1477,6 @@ public func themeIconImage(account: Account, accountManager: AccountManager<Tele
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var masking = false
|
|
||||||
if let image = colors.3, colors.5 {
|
|
||||||
c.setFillColor(UIColor.black.cgColor)
|
|
||||||
c.fill(drawingRect)
|
|
||||||
|
|
||||||
if let cgImage = image.cgImage {
|
|
||||||
let fittedSize = image.size.aspectFilled(CGSize(width: drawingRect.size.width + 1.0, height: drawingRect.size.height + 1.0))
|
|
||||||
|
|
||||||
c.saveGState()
|
|
||||||
c.translateBy(x: drawingRect.width / 2.0, y: drawingRect.height / 2.0)
|
|
||||||
c.scaleBy(x: 1.0, y: -1.0)
|
|
||||||
c.translateBy(x: -drawingRect.width / 2.0, y: -drawingRect.height / 2.0)
|
|
||||||
c.clip(to: CGRect(origin: CGPoint(x: (drawingRect.size.width - fittedSize.width) / 2.0, y: (drawingRect.size.height - fittedSize.height) / 2.0), size: fittedSize), mask: cgImage)
|
|
||||||
masking = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if colors.0.2.count >= 3 {
|
if colors.0.2.count >= 3 {
|
||||||
let image = GradientBackgroundNode.generatePreview(size: CGSize(width: 60.0, height: 60.0), colors: colors.0.2.map(UIColor.init(rgb:)))
|
let image = GradientBackgroundNode.generatePreview(size: CGSize(width: 60.0, height: 60.0), colors: colors.0.2.map(UIColor.init(rgb:)))
|
||||||
c.draw(image.cgImage!, in: drawingRect)
|
c.draw(image.cgImage!, in: drawingRect)
|
||||||
@ -1514,11 +1498,7 @@ public func themeIconImage(account: Account, accountManager: AccountManager<Tele
|
|||||||
c.fill(drawingRect)
|
c.fill(drawingRect)
|
||||||
}
|
}
|
||||||
|
|
||||||
if masking {
|
if let image = colors.3 {
|
||||||
c.restoreGState()
|
|
||||||
}
|
|
||||||
|
|
||||||
if let image = colors.3, !colors.5 {
|
|
||||||
if colors.4 {
|
if colors.4 {
|
||||||
let initialThumbnailContextFittingSize = arguments.imageSize.fitted(CGSize(width: 90.0, height: 90.0))
|
let initialThumbnailContextFittingSize = arguments.imageSize.fitted(CGSize(width: 90.0, height: 90.0))
|
||||||
let thumbnailContextSize = image.size.aspectFilled(initialThumbnailContextFittingSize)
|
let thumbnailContextSize = image.size.aspectFilled(initialThumbnailContextFittingSize)
|
||||||
@ -1538,6 +1518,20 @@ public func themeIconImage(account: Account, accountManager: AccountManager<Tele
|
|||||||
c.restoreGState()
|
c.restoreGState()
|
||||||
}
|
}
|
||||||
} else if let cgImage = image.cgImage {
|
} else if let cgImage = image.cgImage {
|
||||||
|
if colors.5 {
|
||||||
|
let fittedSize = image.size.aspectFilled(CGSize(width: drawingRect.size.width + 1.0, height: drawingRect.size.height + 1.0))
|
||||||
|
|
||||||
|
c.saveGState()
|
||||||
|
c.translateBy(x: drawingRect.width / 2.0, y: drawingRect.height / 2.0)
|
||||||
|
c.scaleBy(x: 1.0, y: -1.0)
|
||||||
|
c.translateBy(x: -drawingRect.width / 2.0, y: -drawingRect.height / 2.0)
|
||||||
|
c.clip(to: CGRect(origin: CGPoint(x: (drawingRect.size.width - fittedSize.width) / 2.0, y: (drawingRect.size.height - fittedSize.height) / 2.0), size: fittedSize), mask: cgImage)
|
||||||
|
|
||||||
|
c.setFillColor(UIColor.black.cgColor)
|
||||||
|
c.fill(drawingRect)
|
||||||
|
|
||||||
|
c.restoreGState()
|
||||||
|
} else {
|
||||||
let fittedSize = image.size.aspectFilled(CGSize(width: drawingRect.size.width + 1.0, height: drawingRect.size.height + 1.0))
|
let fittedSize = image.size.aspectFilled(CGSize(width: drawingRect.size.width + 1.0, height: drawingRect.size.height + 1.0))
|
||||||
|
|
||||||
c.saveGState()
|
c.saveGState()
|
||||||
@ -1552,6 +1546,7 @@ public func themeIconImage(account: Account, accountManager: AccountManager<Tele
|
|||||||
c.restoreGState()
|
c.restoreGState()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
c.translateBy(x: drawingRect.width / 2.0, y: drawingRect.height / 2.0)
|
c.translateBy(x: drawingRect.width / 2.0, y: drawingRect.height / 2.0)
|
||||||
c.scaleBy(x: 1.0, y: -1.0)
|
c.scaleBy(x: 1.0, y: -1.0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user