mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Bazel build updates
This commit is contained in:
parent
eafbe0dc23
commit
a0fa8132ea
28
Makefile
28
Makefile
@ -416,6 +416,34 @@ bazel_app_arm64:
|
|||||||
--output_groups=+dsyms \
|
--output_groups=+dsyms \
|
||||||
--verbose_failures
|
--verbose_failures
|
||||||
|
|
||||||
|
bazel_app_armv7:
|
||||||
|
APP_VERSION="${APP_VERSION}" \
|
||||||
|
BAZEL_CACHE_DIR="${BAZEL_CACHE_DIR}" \
|
||||||
|
build-system/prepare-build.sh Telegram distribution
|
||||||
|
"${BAZEL}" build Telegram/Telegram ${BAZEL_CACHE_FLAGS} ${BAZEL_COMMON_FLAGS} ${BAZEL_OPT_FLAGS} \
|
||||||
|
-c opt \
|
||||||
|
--ios_multi_cpus=armv7 \
|
||||||
|
--watchos_cpus=armv7k,arm64_32 \
|
||||||
|
--objc_enable_binary_stripping=true \
|
||||||
|
--features=dead_strip \
|
||||||
|
--apple_generate_dsym \
|
||||||
|
--output_groups=+dsyms \
|
||||||
|
--verbose_failures
|
||||||
|
|
||||||
|
bazel_app:
|
||||||
|
APP_VERSION="${APP_VERSION}" \
|
||||||
|
BAZEL_CACHE_DIR="${BAZEL_CACHE_DIR}" \
|
||||||
|
build-system/prepare-build.sh Telegram distribution
|
||||||
|
"${BAZEL}" build Telegram/Telegram ${BAZEL_CACHE_FLAGS} ${BAZEL_COMMON_FLAGS} ${BAZEL_OPT_FLAGS} \
|
||||||
|
-c opt \
|
||||||
|
--ios_multi_cpus=armv7,arm64 \
|
||||||
|
--watchos_cpus=armv7k,arm64_32 \
|
||||||
|
--objc_enable_binary_stripping=true \
|
||||||
|
--features=dead_strip \
|
||||||
|
--apple_generate_dsym \
|
||||||
|
--output_groups=+dsyms \
|
||||||
|
--verbose_failures
|
||||||
|
|
||||||
bazel_prepare_development_build:
|
bazel_prepare_development_build:
|
||||||
APP_VERSION="${APP_VERSION}" \
|
APP_VERSION="${APP_VERSION}" \
|
||||||
BAZEL_CACHE_DIR="${BAZEL_CACHE_DIR}" \
|
BAZEL_CACHE_DIR="${BAZEL_CACHE_DIR}" \
|
||||||
|
@ -1628,13 +1628,8 @@ ios_application(
|
|||||||
":AdditionalInfoPlist",
|
":AdditionalInfoPlist",
|
||||||
":TelegramInfoIconsPlist",
|
":TelegramInfoIconsPlist",
|
||||||
],
|
],
|
||||||
#app_icons = [
|
|
||||||
# ":DefaultAppIcon",
|
|
||||||
#],
|
|
||||||
resources = [
|
resources = [
|
||||||
":AdditionalIcons",
|
":AdditionalIcons",
|
||||||
#":DefaultAppIcon",
|
|
||||||
#":AppIcons",
|
|
||||||
],
|
],
|
||||||
frameworks = [
|
frameworks = [
|
||||||
":MtProtoKitFramework",
|
":MtProtoKitFramework",
|
||||||
@ -1652,10 +1647,10 @@ ios_application(
|
|||||||
],
|
],
|
||||||
extensions = [
|
extensions = [
|
||||||
":ShareExtension",
|
":ShareExtension",
|
||||||
":WidgetExtension",
|
|
||||||
":NotificationContentExtension",
|
":NotificationContentExtension",
|
||||||
":NotificationServiceExtension",
|
":NotificationServiceExtension",
|
||||||
":IntentsExtension",
|
":IntentsExtension",
|
||||||
|
":WidgetExtension",
|
||||||
],
|
],
|
||||||
watch_application = ":TelegramWatchApp",
|
watch_application = ":TelegramWatchApp",
|
||||||
deps = [
|
deps = [
|
||||||
|
@ -52,43 +52,98 @@ extension PeersWidgetData {
|
|||||||
static let previewData = PeersWidgetData.placeholder
|
static let previewData = PeersWidgetData.placeholder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct AvatarItemView: View {
|
||||||
|
var accountPeerId: Int64
|
||||||
|
var peer: WidgetDataPeer
|
||||||
|
var itemSize: CGFloat
|
||||||
|
|
||||||
|
var body: some View {
|
||||||
|
return ZStack {
|
||||||
|
Image(uiImage: avatarImage(accountPeerId: accountPeerId, peer: peer, size: CGSize(width: itemSize, height: itemSize)))
|
||||||
|
if let badge = peer.badge, badge.count > 0 {
|
||||||
|
Text("\(badge.count)")
|
||||||
|
.font(Font.system(size: 16.0))
|
||||||
|
.multilineTextAlignment(.center)
|
||||||
|
.foregroundColor(.white)
|
||||||
|
.padding(.horizontal, 4.0)
|
||||||
|
.background(
|
||||||
|
RoundedRectangle(cornerRadius: 10)
|
||||||
|
.fill(badge.isMuted ? Color.gray : Color.red)
|
||||||
|
.frame(minWidth: 20, idealWidth: 20, maxWidth: .infinity, minHeight: 20, idealHeight: 20, maxHeight: 20.0, alignment: .center)
|
||||||
|
)
|
||||||
|
.position(x: floor(0.84 * itemSize), y: floor(0.16 * itemSize))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct WidgetView: View {
|
struct WidgetView: View {
|
||||||
|
@Environment(\.widgetFamily) private var widgetFamily
|
||||||
let data: PeersWidgetData
|
let data: PeersWidgetData
|
||||||
|
|
||||||
func placeholder(geometry: GeometryProxy) -> some View {
|
func placeholder(geometry: GeometryProxy) -> some View {
|
||||||
let defaultItemSize: CGFloat = 60.0
|
let defaultItemSize: CGFloat = 60.0
|
||||||
let defaultPaddingFraction: CGFloat = 0.36
|
let defaultPaddingFraction: CGFloat = 0.36
|
||||||
|
|
||||||
let rowCount = Int(round(geometry.size.width / (defaultItemSize * (1.0 + defaultPaddingFraction))))
|
let columnCount = Int(round(geometry.size.width / (defaultItemSize * (1.0 + defaultPaddingFraction))))
|
||||||
let itemSize = floor(geometry.size.width / (CGFloat(rowCount) + defaultPaddingFraction * CGFloat(rowCount - 1)))
|
let itemSize = floor(geometry.size.width / (CGFloat(columnCount) + defaultPaddingFraction * CGFloat(columnCount - 1)))
|
||||||
|
|
||||||
let firstRowY = itemSize / 2.0
|
let firstRowY = itemSize / 2.0
|
||||||
let secondRowY = itemSize / 2.0 + geometry.size.height - itemSize
|
let secondRowY = itemSize / 2.0 + geometry.size.height - itemSize
|
||||||
|
|
||||||
return ZStack {
|
return ZStack {
|
||||||
ForEach(0 ..< rowCount * 2, content: { i in
|
ForEach(0 ..< columnCount * 2, content: { i in
|
||||||
return Circle().frame(width: itemSize, height: itemSize).position(x: itemSize / 2.0 + floor(CGFloat(i % rowCount) * itemSize * (1.0 + defaultPaddingFraction)), y: i / rowCount == 0 ? firstRowY : secondRowY).foregroundColor(.gray)
|
return Circle().frame(width: itemSize, height: itemSize).position(x: itemSize / 2.0 + floor(CGFloat(i % columnCount) * itemSize * (1.0 + defaultPaddingFraction)), y: i / columnCount == 0 ? firstRowY : secondRowY).foregroundColor(.gray)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func linkForPeer(id: Int64) -> String {
|
||||||
|
switch self.widgetFamily {
|
||||||
|
case .systemSmall:
|
||||||
|
return "\(buildConfig.appSpecificUrlScheme)://"
|
||||||
|
default:
|
||||||
|
return "\(buildConfig.appSpecificUrlScheme)://localpeer?id=\(id)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func peersView(geometry: GeometryProxy, peers: WidgetDataPeers) -> some View {
|
func peersView(geometry: GeometryProxy, peers: WidgetDataPeers) -> some View {
|
||||||
let defaultItemSize: CGFloat = 60.0
|
let defaultItemSize: CGFloat = 60.0
|
||||||
let defaultPaddingFraction: CGFloat = 0.36
|
let defaultPaddingFraction: CGFloat = 0.36
|
||||||
|
|
||||||
let rowCount = Int(round(geometry.size.width / (defaultItemSize * (1.0 + defaultPaddingFraction))))
|
let rowCount: Int
|
||||||
let itemSize = floor(geometry.size.width / (CGFloat(rowCount) + defaultPaddingFraction * CGFloat(rowCount - 1)))
|
let rowHeight: CGFloat
|
||||||
|
let topOffset: CGFloat
|
||||||
|
switch self.widgetFamily {
|
||||||
|
case .systemLarge:
|
||||||
|
rowCount = 4
|
||||||
|
rowHeight = 88.0
|
||||||
|
topOffset = 12.0
|
||||||
|
default:
|
||||||
|
rowCount = 2
|
||||||
|
rowHeight = 76.0
|
||||||
|
topOffset = 0.0
|
||||||
|
}
|
||||||
|
let columnCount = Int(round(geometry.size.width / (defaultItemSize * (1.0 + defaultPaddingFraction))))
|
||||||
|
let itemSize = floor(geometry.size.width / (CGFloat(columnCount) + defaultPaddingFraction * CGFloat(columnCount - 1)))
|
||||||
|
|
||||||
let firstRowY = itemSize / 2.0
|
let rowOffset: [CGFloat] = [
|
||||||
let secondRowY = itemSize / 2.0 + geometry.size.height - itemSize
|
topOffset + itemSize / 2.0,
|
||||||
|
topOffset + itemSize / 2.0 + rowHeight,
|
||||||
|
topOffset + itemSize / 2.0 + rowHeight * 2,
|
||||||
|
topOffset + itemSize / 2.0 + rowHeight * 3,
|
||||||
|
]
|
||||||
|
|
||||||
return ZStack {
|
return ZStack {
|
||||||
ForEach(0 ..< min(peers.peers.count, rowCount * 2), content: { i in
|
ForEach(0 ..< min(peers.peers.count, columnCount * rowCount), content: { i in
|
||||||
Link(destination: URL(string: "\(buildConfig.appSpecificUrlScheme)://localpeer?id=\(peers.peers[i].id)")!, label: {
|
Link(destination: URL(string: linkForPeer(id: peers.peers[i].id))!, label: {
|
||||||
Image(uiImage: avatarImage(accountPeerId: peers.accountPeerId, peer: peers.peers[i], size: CGSize(width: itemSize, height: itemSize)))
|
AvatarItemView(
|
||||||
.frame(width: itemSize, height: itemSize)
|
accountPeerId: peers.accountPeerId,
|
||||||
|
peer: peers.peers[i],
|
||||||
|
itemSize: itemSize
|
||||||
|
).frame(width: itemSize, height: itemSize)
|
||||||
}).frame(width: itemSize, height: itemSize)
|
}).frame(width: itemSize, height: itemSize)
|
||||||
.position(x: itemSize / 2.0 + floor(CGFloat(i % rowCount) * itemSize * (1.0 + defaultPaddingFraction)), y: i / rowCount == 0 ? firstRowY : secondRowY)
|
.position(x: itemSize / 2.0 + floor(CGFloat(i % columnCount) * itemSize * (1.0 + defaultPaddingFraction)), y: rowOffset[i / columnCount])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,7 +269,7 @@ struct Static_Widget: Widget {
|
|||||||
WidgetView(data: getWidgetData())
|
WidgetView(data: getWidgetData())
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.supportedFamilies([.systemMedium])
|
.supportedFamilies([.systemSmall, .systemMedium, .systemLarge])
|
||||||
.configurationDisplayName(presentationData.widgetGalleryTitle)
|
.configurationDisplayName(presentationData.widgetGalleryTitle)
|
||||||
.description(presentationData.widgetGalleryDescription)
|
.description(presentationData.widgetGalleryDescription)
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
3.4.1
|
3.7.0
|
||||||
|
@ -23,12 +23,62 @@ final class WidgetDataContext {
|
|||||||
guard let account = account else {
|
guard let account = account else {
|
||||||
return .single(.notAuthorized)
|
return .single(.notAuthorized)
|
||||||
}
|
}
|
||||||
return recentPeers(account: account)
|
|
||||||
|
enum RecentPeers {
|
||||||
|
struct Unread {
|
||||||
|
var count: Int32
|
||||||
|
var isMuted: Bool
|
||||||
|
}
|
||||||
|
|
||||||
|
case disabled
|
||||||
|
case peers(peers: [Peer], unread: [PeerId: Unread])
|
||||||
|
}
|
||||||
|
|
||||||
|
let recent: Signal<RecentPeers, NoError> = recentPeers(account: account)
|
||||||
|
|> mapToSignal { recent -> Signal<RecentPeers, NoError> in
|
||||||
|
switch recent {
|
||||||
|
case .disabled:
|
||||||
|
return .single(.disabled)
|
||||||
|
case let .peers(peers):
|
||||||
|
return combineLatest(queue: .mainQueue(), peers.filter { !$0.isDeleted }.map { account.postbox.peerView(id: $0.id)}) |> mapToSignal { peerViews -> Signal<RecentPeers, NoError> in
|
||||||
|
return account.postbox.unreadMessageCountsView(items: peerViews.map {
|
||||||
|
.peer($0.peerId)
|
||||||
|
})
|
||||||
|
|> map { values -> RecentPeers in
|
||||||
|
var peers: [Peer] = []
|
||||||
|
var unread: [PeerId: RecentPeers.Unread] = [:]
|
||||||
|
for peerView in peerViews {
|
||||||
|
if let peer = peerViewMainPeer(peerView) {
|
||||||
|
var isMuted: Bool = false
|
||||||
|
if let notificationSettings = peerView.notificationSettings as? TelegramPeerNotificationSettings {
|
||||||
|
switch notificationSettings.muteState {
|
||||||
|
case .muted:
|
||||||
|
isMuted = true
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let unreadCount = values.count(for: .peer(peerView.peerId))
|
||||||
|
if let unreadCount = unreadCount, unreadCount > 0 {
|
||||||
|
unread[peerView.peerId] = RecentPeers.Unread(count: Int32(unreadCount), isMuted: isMuted)
|
||||||
|
}
|
||||||
|
|
||||||
|
peers.append(peer)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return .peers(peers: peers, unread: unread)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return recent
|
||||||
|> map { result -> WidgetData in
|
|> map { result -> WidgetData in
|
||||||
switch result {
|
switch result {
|
||||||
case .disabled:
|
case .disabled:
|
||||||
return .disabled
|
return .disabled
|
||||||
case let .peers(peers):
|
case let .peers(peers, unread):
|
||||||
return .peers(WidgetDataPeers(accountPeerId: account.peerId.toInt64(), peers: peers.compactMap { peer -> WidgetDataPeer? in
|
return .peers(WidgetDataPeers(accountPeerId: account.peerId.toInt64(), peers: peers.compactMap { peer -> WidgetDataPeer? in
|
||||||
guard let user = peer as? TelegramUser else {
|
guard let user = peer as? TelegramUser else {
|
||||||
return nil
|
return nil
|
||||||
@ -46,12 +96,21 @@ final class WidgetDataContext {
|
|||||||
name = phone
|
name = phone
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var badge: WidgetDataPeer.Badge?
|
||||||
|
if let unreadValue = unread[peer.id], unreadValue.count > 0 {
|
||||||
|
badge = WidgetDataPeer.Badge(
|
||||||
|
count: Int(unreadValue.count),
|
||||||
|
isMuted: unreadValue.isMuted
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
return WidgetDataPeer(id: user.id.toInt64(), name: name, lastName: lastName, letters: user.displayLetters, avatarPath: smallestImageRepresentation(user.photo).flatMap { representation in
|
return WidgetDataPeer(id: user.id.toInt64(), name: name, lastName: lastName, letters: user.displayLetters, avatarPath: smallestImageRepresentation(user.photo).flatMap { representation in
|
||||||
return account.postbox.mediaBox.resourcePath(representation.resource)
|
return account.postbox.mediaBox.resourcePath(representation.resource)
|
||||||
})
|
}, badge: badge)
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|> distinctUntilChanged
|
||||||
}).start(next: { widgetData in
|
}).start(next: { widgetData in
|
||||||
let path = basePath + "/widget-data"
|
let path = basePath + "/widget-data"
|
||||||
if let data = try? JSONEncoder().encode(widgetData) {
|
if let data = try? JSONEncoder().encode(widgetData) {
|
||||||
|
@ -5,18 +5,30 @@ public enum WidgetCodingError: Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public struct WidgetDataPeer: Codable, Equatable {
|
public struct WidgetDataPeer: Codable, Equatable {
|
||||||
|
public struct Badge: Codable, Equatable {
|
||||||
|
public var count: Int
|
||||||
|
public var isMuted: Bool
|
||||||
|
|
||||||
|
public init(count: Int, isMuted: Bool) {
|
||||||
|
self.count = count
|
||||||
|
self.isMuted = isMuted
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public var id: Int64
|
public var id: Int64
|
||||||
public var name: String
|
public var name: String
|
||||||
public var lastName: String?
|
public var lastName: String?
|
||||||
public var letters: [String]
|
public var letters: [String]
|
||||||
public var avatarPath: String?
|
public var avatarPath: String?
|
||||||
|
public var badge: Badge?
|
||||||
|
|
||||||
public init(id: Int64, name: String, lastName: String?, letters: [String], avatarPath: String?) {
|
public init(id: Int64, name: String, lastName: String?, letters: [String], avatarPath: String?, badge: Badge?) {
|
||||||
self.id = id
|
self.id = id
|
||||||
self.name = name
|
self.name = name
|
||||||
self.lastName = lastName
|
self.lastName = lastName
|
||||||
self.letters = letters
|
self.letters = letters
|
||||||
self.avatarPath = avatarPath
|
self.avatarPath = avatarPath
|
||||||
|
self.badge = badge
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
17
submodules/ffmpeg/BUILD
vendored
17
submodules/ffmpeg/BUILD
vendored
@ -127,9 +127,19 @@ genrule(
|
|||||||
],
|
],
|
||||||
cmd_bash =
|
cmd_bash =
|
||||||
"""
|
"""
|
||||||
SOURCE_PATH="submodules/ffmpeg/Sources/FFMpeg"
|
#random:2
|
||||||
|
|
||||||
BUILD_DIR="$(RULEDIR)/build"
|
set -x
|
||||||
|
|
||||||
|
ABS_RULEDIR="$$(pwd)/$(RULEDIR)"
|
||||||
|
echo "ABS_RULEDIR=$$ABS_RULEDIR"
|
||||||
|
|
||||||
|
SOURCE_PATH="$$ABS_RULEDIR/FFMpegSource"
|
||||||
|
rm -rf "$$SOURCE_PATH"
|
||||||
|
|
||||||
|
cp -R "submodules/ffmpeg/Sources/FFMpeg" "$$SOURCE_PATH"
|
||||||
|
|
||||||
|
BUILD_DIR="$$ABS_RULEDIR/build"
|
||||||
rm -rf "$$BUILD_DIR"
|
rm -rf "$$BUILD_DIR"
|
||||||
mkdir -p "$$BUILD_DIR"
|
mkdir -p "$$BUILD_DIR"
|
||||||
YASM_DIR="$$BUILD_DIR/yasm"
|
YASM_DIR="$$BUILD_DIR/yasm"
|
||||||
@ -167,6 +177,9 @@ genrule(
|
|||||||
cc_library(
|
cc_library(
|
||||||
name = "ffmpeg_lib",
|
name = "ffmpeg_lib",
|
||||||
srcs = ffmpeg_libs,
|
srcs = ffmpeg_libs,
|
||||||
|
visibility = [
|
||||||
|
"//visibility:public",
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
objc_library(
|
objc_library(
|
||||||
|
@ -120,6 +120,7 @@ then
|
|||||||
do
|
do
|
||||||
echo "building $ARCH..."
|
echo "building $ARCH..."
|
||||||
mkdir -p "$SCRATCH/$ARCH"
|
mkdir -p "$SCRATCH/$ARCH"
|
||||||
|
pushd "$SCRATCH/$ARCH"
|
||||||
|
|
||||||
LIBOPUS_PATH="$SOURCE_DIR/libopus"
|
LIBOPUS_PATH="$SOURCE_DIR/libopus"
|
||||||
|
|
||||||
@ -178,6 +179,8 @@ then
|
|||||||
|
|
||||||
CORE_COUNT=`sysctl -n hw.logicalcpu`
|
CORE_COUNT=`sysctl -n hw.logicalcpu`
|
||||||
make -j$CORE_COUNT install $EXPORT || exit 1
|
make -j$CORE_COUNT install $EXPORT || exit 1
|
||||||
|
|
||||||
|
popd
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
4
third-party/webrtc/BUILD
vendored
4
third-party/webrtc/BUILD
vendored
@ -27,7 +27,7 @@ genrule(
|
|||||||
"""
|
"""
|
||||||
OUT_DIR="ios"
|
OUT_DIR="ios"
|
||||||
if [ "$(TARGET_CPU)" == "ios_armv7" ]; then
|
if [ "$(TARGET_CPU)" == "ios_armv7" ]; then
|
||||||
BUILD_ARCH="armv7"
|
BUILD_ARCH="arm"
|
||||||
elif [ "$(TARGET_CPU)" == "ios_arm64" ]; then
|
elif [ "$(TARGET_CPU)" == "ios_arm64" ]; then
|
||||||
BUILD_ARCH="arm64"
|
BUILD_ARCH="arm64"
|
||||||
elif [ "$(TARGET_CPU)" == "ios_x86_64" ]; then
|
elif [ "$(TARGET_CPU)" == "ios_x86_64" ]; then
|
||||||
@ -37,7 +37,7 @@ genrule(
|
|||||||
echo "Unsupported architecture $(TARGET_CPU)"
|
echo "Unsupported architecture $(TARGET_CPU)"
|
||||||
fi
|
fi
|
||||||
BUILD_DIR="$(RULEDIR)/$$BUILD_ARCH"
|
BUILD_DIR="$(RULEDIR)/$$BUILD_ARCH"
|
||||||
#rm -rf "$$BUILD_DIR"
|
rm -rf "$$BUILD_DIR"
|
||||||
mkdir -p "$$BUILD_DIR"
|
mkdir -p "$$BUILD_DIR"
|
||||||
|
|
||||||
SOURCE_PATH="third-party/webrtc/webrtc-ios/src"
|
SOURCE_PATH="third-party/webrtc/webrtc-ios/src"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user