forked from TelegramMessenger/Telegram-iOS
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
302 changed files
with
2,841 additions
and
18,219 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") | ||
|
||
swift_library( | ||
name = "NGCallRecorder", | ||
module_name = "NGCallRecorder", | ||
srcs = glob([ | ||
"Sources/**/*.swift", | ||
]), | ||
deps = [ | ||
"//submodules/ComponentFlow", | ||
"//submodules/Display" | ||
], | ||
visibility = [ | ||
"//visibility:public", | ||
], | ||
) |
85 changes: 85 additions & 0 deletions
85
Nicegram/NGCallRecorder/Sources/NGRecordIndicatorView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import UIKit | ||
import Display | ||
import ComponentFlow | ||
|
||
public class NGRecordIndicatorView: UIView { | ||
private let contentView = UIView() | ||
private let label: UILabel = { | ||
let label = UILabel() | ||
label.textColor = .white | ||
label.font = .systemFont(ofSize: 16.0, weight: .regular) | ||
|
||
return label | ||
}() | ||
private let imageView: UIImageView = { | ||
let imageView = UIImageView() | ||
imageView.image = UIImage(bundleImageName: "RecordIndicator") | ||
|
||
return imageView | ||
}() | ||
private let textHeight: CGFloat = 20.0 | ||
private let sideInset: CGFloat = 8.0 | ||
private let verticalInset: CGFloat = 4.0 | ||
private let iconSpacing: CGFloat = 4.0 | ||
private var actualSize: CGSize = .zero | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
|
||
self.clipsToBounds = true | ||
|
||
contentView.clipsToBounds = true | ||
contentView.layer.cornerRadius = (textHeight + verticalInset * 2) / 2 | ||
contentView.backgroundColor = UIColor(hexString: "FF453A") | ||
|
||
addSubview(contentView) | ||
contentView.addSubview(imageView) | ||
contentView.addSubview(label) | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
public func animateIn() { | ||
self.layer.animateScale(from: 0.001, to: 1.0, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring) | ||
self.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15) | ||
} | ||
|
||
public func animateOut(completion: @escaping () -> Void) { | ||
self.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { _ in | ||
completion() | ||
}) | ||
self.layer.animateScale(from: 1.0, to: 0.001, duration: 0.2, removeOnCompletion: false) | ||
} | ||
|
||
public func update( | ||
text: String, | ||
constrainedWidth: CGFloat = 75.0, | ||
transition: ComponentTransition | ||
) -> CGSize { | ||
label.text = text | ||
|
||
let iconSize = self.imageView.image?.size ?? CGSize(width: 20.0, height: 20.0) | ||
|
||
let maxSize = CGSize(width: constrainedWidth, height: CGFloat.greatestFiniteMagnitude) | ||
let boundingRect = text.boundingRect( | ||
with: maxSize, | ||
options: .usesLineFragmentOrigin, | ||
attributes: [.font: label.font ?? UIFont()], | ||
context: nil | ||
) | ||
let textSize = CGSize(width: ceil(max(boundingRect.width, 35.0)), height: textHeight) | ||
|
||
let size = CGSize(width: iconSize.width + iconSpacing + textSize.width + sideInset * 2.0, height: textSize.height + verticalInset * 2.0) | ||
actualSize = size.width > actualSize.width ? size : actualSize | ||
|
||
transition.setFrame(view: self.contentView, frame: CGRect(origin: CGPoint(), size: size)) | ||
|
||
transition.setFrame(view: self.imageView, frame: CGRect(origin: CGPoint(x: floorToScreenPixels((size.height - iconSize.height) * 0.5) + 4.0, y: verticalInset + floorToScreenPixels((textSize.height - iconSize.height) * 0.5)), size: iconSize)) | ||
|
||
transition.setFrame(view: self.label, frame: CGRect(origin: CGPoint(x: sideInset + iconSize.width + iconSpacing, y: verticalInset), size: textSize)) | ||
|
||
return actualSize | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
load("//Config:buck_rule_macros.bzl", "static_library") | ||
|
||
|
||
apple_asset_catalog( | ||
name = "NGUIAssets", | ||
dirs = [ | ||
"Images.xcassets", | ||
], | ||
visibility = ["PUBLIC"], | ||
) | ||
|
||
static_library( | ||
name = "NGUI", | ||
srcs = glob([ | ||
"Sources/**/*.swift", | ||
]), | ||
deps = [ | ||
"//submodules/AccountContext:AccountContext", | ||
"//submodules/Display:Display#shared", | ||
"//submodules/ItemListUI:ItemListUI", | ||
"//submodules/Postbox:Postbox#shared", | ||
"//submodules/SSignalKit/SwiftSignalKit:SwiftSignalKit#shared", | ||
"//submodules/TelegramCore:TelegramCore#shared", | ||
"//submodules/TelegramNotices:TelegramNotices", | ||
"//submodules/TelegramPresentationData:TelegramPresentationData", | ||
"//submodules/TelegramUIPreferences:TelegramUIPreferences", | ||
"//submodules/PresentationDataUtils:PresentationDataUtils", | ||
"//submodules/PeersNearbyIconNode:PeersNearbyIconNode", | ||
"//submodules/TelegramPermissionsUI:TelegramPermissionsUI", | ||
"//submodules/UndoUI:UndoUI", | ||
"//submodules/ContextUI:ContextUI", | ||
"//Nicegram/NGData:NGData", | ||
"//Nicegram/NGLogging:NGLogging", | ||
"//Nicegram/NGStrings:NGStrings", | ||
"//Nicegram/NGIAP:NGIAP" | ||
], | ||
frameworks = [ | ||
"$SDKROOT/System/Library/Frameworks/Foundation.framework", | ||
"$SDKROOT/System/Library/Frameworks/StoreKit.framework", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") | ||
|
||
|
||
filegroup( | ||
name = "NGImagesAssets", | ||
srcs = glob(["Images.xcassets/**"]), | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
swift_library( | ||
name = "NGResources", | ||
module_name = "NGResources", | ||
srcs = glob([ | ||
"Sources/**/*.swift", | ||
]), | ||
deps = [ | ||
], | ||
visibility = [ | ||
"//visibility:public", | ||
], | ||
) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
2 changes: 1 addition & 1 deletion
2
... View/OpenDocument.imageset/Contents.json → ...ts/RecordIndicator.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+1.21 KB
Nicegram/NGResources/Images.xcassets/RecordIndicator.imageset/record_indicator.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
...remium/PremiumStar.imageset/Contents.json → ...cassets/RecordSave.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "premium_30.pdf", | ||
"filename" : "record_save.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
|
Binary file added
BIN
+1.43 KB
Nicegram/NGResources/Images.xcassets/RecordSave.imageset/record_save.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
...iew/InstantViewOff.imageset/Contents.json → ...assets/RecordStart.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "boostoff_24.pdf", | ||
"filename" : "record_start.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
|
Binary file added
BIN
+1.52 KB
Nicegram/NGResources/Images.xcassets/RecordStart.imageset/record_start.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
...Chat/Message/Stars.imageset/Contents.json → ...cassets/RecordStop.imageset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "givstars.pdf", | ||
"filename" : "record_stop.pdf", | ||
"idiom" : "universal" | ||
} | ||
], | ||
|
Binary file added
BIN
+1020 Bytes
Nicegram/NGResources/Images.xcassets/RecordStop.imageset/record_stop.pdf
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.