Skip to content

Commit 835ea73

Browse files
author
Isaac
committed
Stars ref
1 parent 2a42434 commit 835ea73

File tree

9 files changed

+259
-20
lines changed

9 files changed

+259
-20
lines changed

submodules/AccountContext/Sources/AccountContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1104,7 +1104,7 @@ public protocol SharedAccountContext: AnyObject {
11041104
func makeAffiliateProgramSetupScreenInitialData(context: AccountContext, peerId: EnginePeer.Id, mode: AffiliateProgramSetupScreenMode) -> Signal<AffiliateProgramSetupScreenInitialData, NoError>
11051105
func makeAffiliateProgramSetupScreen(context: AccountContext, initialData: AffiliateProgramSetupScreenInitialData) -> ViewController
11061106

1107-
func makeAffiliateProgramJoinScreen(context: AccountContext, sourcePeer: EnginePeer, commissionPermille: Int32, programDuration: Int32?, mode: JoinAffiliateProgramScreenMode) -> ViewController
1107+
func makeAffiliateProgramJoinScreen(context: AccountContext, sourcePeer: EnginePeer, commissionPermille: Int32, programDuration: Int32?, revenuePerUser: Double, mode: JoinAffiliateProgramScreenMode) -> ViewController
11081108

11091109
func makeDebugSettingsController(context: AccountContext?) -> ViewController?
11101110

submodules/AvatarNode/Sources/PeerAvatar.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public func peerAvatarImage(postbox: Postbox, network: Network, peerReference: P
299299
if let cutoutRect {
300300
context.setBlendMode(.copy)
301301
context.setFillColor(UIColor.clear.cgColor)
302-
context.fillEllipse(in: cutoutRect)
302+
context.fillEllipse(in: cutoutRect.offsetBy(dx: 0.0, dy: size.height - cutoutRect.maxY - cutoutRect.height))
303303
}
304304
})
305305
let unroundedImage: UIImage?
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import Foundation
2+
import UIKit
3+
4+
public final class TransformContents<ChildEnvironment: Equatable>: CombinedComponent {
5+
public typealias EnvironmentType = ChildEnvironment
6+
7+
private let content: AnyComponent<ChildEnvironment>
8+
private let fixedSize: CGSize?
9+
private let translation: CGPoint
10+
11+
public init(content: AnyComponent<ChildEnvironment>, fixedSize: CGSize? = nil, translation: CGPoint) {
12+
self.content = content
13+
self.fixedSize = fixedSize
14+
self.translation = translation
15+
}
16+
17+
public static func ==(lhs: TransformContents<ChildEnvironment>, rhs: TransformContents<ChildEnvironment>) -> Bool {
18+
if lhs.content != rhs.content {
19+
return false
20+
}
21+
if lhs.fixedSize != rhs.fixedSize {
22+
return false
23+
}
24+
if lhs.translation != rhs.translation {
25+
return false
26+
}
27+
return true
28+
}
29+
30+
public static var body: Body {
31+
let child = Child(environment: ChildEnvironment.self)
32+
33+
return { context in
34+
let child = child.update(
35+
component: context.component.content,
36+
environment: { context.environment[ChildEnvironment.self] },
37+
availableSize: context.availableSize,
38+
transition: context.transition
39+
)
40+
41+
let size = context.component.fixedSize ?? child.size
42+
43+
var childFrame = child.size.centered(in: CGRect(origin: CGPoint(), size: size))
44+
childFrame.origin.x += context.component.translation.x
45+
childFrame.origin.y += context.component.translation.y
46+
47+
context.add(child
48+
.position(childFrame.center)
49+
)
50+
51+
return size
52+
}
53+
}
54+
}

submodules/Display/Source/TextNode.swift

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2529,7 +2529,16 @@ open class TextNode: ASDisplayNode, TextNodeProtocol {
25292529
textColor = color
25302530
}
25312531
}
2532-
if let textColor {
2532+
if image.renderingMode == .alwaysOriginal {
2533+
let imageRect = CGRect(origin: CGPoint(x: attachment.frame.midX - image.size.width * 0.5, y: attachment.frame.midY - image.size.height * 0.5 + 1.0), size: image.size).offsetBy(dx: lineFrame.minX, dy: lineFrame.minY)
2534+
context.translateBy(x: imageRect.midX, y: imageRect.midY)
2535+
context.scaleBy(x: 1.0, y: -1.0)
2536+
context.translateBy(x: -imageRect.midX, y: -imageRect.midY)
2537+
context.draw(image.cgImage!, in: imageRect)
2538+
context.translateBy(x: imageRect.midX, y: imageRect.midY)
2539+
context.scaleBy(x: 1.0, y: -1.0)
2540+
context.translateBy(x: -imageRect.midX, y: -imageRect.midY)
2541+
} else if let textColor {
25332542
if let tintedImage = generateTintedImage(image: image, color: textColor) {
25342543
let imageRect = CGRect(origin: CGPoint(x: attachment.frame.midX - tintedImage.size.width * 0.5, y: attachment.frame.midY - tintedImage.size.height * 0.5 + 1.0), size: tintedImage.size).offsetBy(dx: lineFrame.minX, dy: lineFrame.minY)
25352544
context.translateBy(x: imageRect.midX, y: imageRect.midY)

submodules/TelegramUI/Components/Chat/ChatMessageInteractiveMediaNode/Sources/ChatMessageInteractiveMediaNode.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ public final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTr
798798

799799
var useInlineHLS = true
800800
if let data = context.currentAppConfiguration.with({ $0 }).data {
801-
if let value = data["ios_inline_hls"] as? Double {
801+
if let value = data["ios_inline_hls_v2"] as? Double {
802802
useInlineHLS = value != 0.0
803803
}
804804
}

submodules/TelegramUI/Components/PeerInfo/AffiliateProgramSetupScreen/Sources/AffiliateProgramSetupScreen.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ If you end your affiliate program:
368368
sourcePeer: bot.peer,
369369
commissionPermille: bot.commissionPermille,
370370
programDuration: bot.durationMonths,
371+
revenuePerUser: bot.participants == 0 ? 0.0 : Double(bot.revenue) / Double(bot.participants),
371372
mode: .active(JoinAffiliateProgramScreenMode.Active(
372373
targetPeer: targetPeer,
373374
bot: bot,
@@ -1422,6 +1423,7 @@ If you end your affiliate program:
14221423
sourcePeer: botPeer,
14231424
commissionPermille: item.program.commissionPermille,
14241425
programDuration: item.program.durationMonths,
1426+
revenuePerUser: item.program.dailyRevenuePerUser?.totalValue ?? 0.0,
14251427
mode: .join(JoinAffiliateProgramScreenMode.Join(
14261428
initialTargetPeer: targetPeer,
14271429
canSelectTargetPeer: false,

0 commit comments

Comments
 (0)