Skip to content

Commit 490d0f8

Browse files
committed
Various improvements
1 parent 40080bb commit 490d0f8

File tree

13 files changed

+288
-169
lines changed

13 files changed

+288
-169
lines changed

Telegram/Telegram-iOS/en.lproj/Localizable.strings

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7525,9 +7525,6 @@ Sorry for the inconvenience.";
75257525
"WebApp.OpenWebViewAlertTitle" = "Open Web App";
75267526
"WebApp.OpenWebViewAlertText" = "**%@** would like to open its web app to proceed.\n\nIt will be able to access your **IP address** and basic device info.";
75277527

7528-
"WebApp.MessagePreview" = "Message Preview";
7529-
"WebApp.Send" = "Send";
7530-
75317528
"WebApp.RemoveConfirmationTitle" = "Remove Bot";
75327529
"WebApp.RemoveConfirmationText" = "Remove **%@** from the attachment menu?";
75337530

@@ -13242,3 +13239,50 @@ Sorry for the inconvenience.";
1324213239
"PrivacySettings.ValueBotsPlus" = "Mini Apps +%@";
1324313240

1324413241
"PrivacySettings.CategoryBots" = "Mini Apps";
13242+
13243+
"PeerInfo.Permissions.Title" = "ALLOW ACCESS TO";
13244+
"PeerInfo.Permissions.EmojiStatus" = "Emoji Status";
13245+
"PeerInfo.Permissions.Geolocation" = "Geolocation";
13246+
"PeerInfo.Permissions.Biometry" = "Biometry";
13247+
13248+
"Stars.Transaction.Subscription" = "Subscription";
13249+
"Stars.Transaction.Subscription.Bot" = "Bot";
13250+
"Stars.Transaction.Subscription.Business" = "Business";
13251+
13252+
"Stars.Transfer.BotSubscribeInfo" = "Do you want to subscribe to **%1$@** in **%2$@** for **%3$@** per month?";
13253+
"Stars.Transfer.BotSubscribeInfo.Stars_1" = "%@ Star";
13254+
"Stars.Transfer.BotSubscribeInfo.Stars_any" = "%@ Stars";
13255+
"Stars.Transfer.SubscribeFor" = "Subscribe for";
13256+
"Stars.Transfer.SubscribePerMonth" = "/ month";
13257+
13258+
"WebApp.AddToHomeScreen" = "Add to Home Screen";
13259+
13260+
"WebApp.Emoji.Title" = "Set Emoji Status";
13261+
"WebApp.Emoji.Text" = "Do you want to set this emoji status suggested by **%@**?";
13262+
"WebApp.Emoji.DurationText" = "Do you want to set this emoji status suggested by **%1$@** for **%2$@**?";
13263+
"WebApp.Emoji.Confirm" = "Confirm";
13264+
13265+
"WebApp.Emoji.Succeed" = "Your emoji status updated.";
13266+
"WebApp.Emoji.DurationSucceed" = "Your emoji status set for %@.";
13267+
13268+
"WebApp.EmojiPermission.Text" = "**%1$@** requests access to set your **emoji status**. You will be able to revoke this access in the profile page of **%2$@**.";
13269+
"WebApp.EmojiPermission.Allow" = "Allow";
13270+
"WebApp.EmojiPermission.Decline" = "Decline";
13271+
"WebApp.EmojiPermission.Succeed" = "**%@** can now set your emoji status anytime.";
13272+
"WebApp.EmojiPermission.Undo" = "Undo";
13273+
13274+
"WebApp.LocationPermission.Text" = "**%1$@** requests access to your **location**. You will be able to revoke this access in the profile page of **%2$@**.";
13275+
"WebApp.LocationPermission.Allow" = "Allow";
13276+
"WebApp.LocationPermission.Decline" = "Decline";
13277+
"WebApp.LocationPermission.Succeed" = "**%@** can now have access to your location.";
13278+
"WebApp.LocationPermission.Undo" = "Undo";
13279+
13280+
"WebApp.Download.Photo" = "Download Photo";
13281+
"WebApp.Download.Video" = "Download Video";
13282+
"WebApp.Download.Document" = "Download Document";
13283+
"WebApp.Download.Text" = "**%1$@** suggests you to download **%2$@**%3$@.";
13284+
"WebApp.Download.Download" = "Download";
13285+
"WebApp.Download.Cancel" = "Cancel";
13286+
13287+
"WebApp.Download.SavedToPhotos" = "Saved to Photos.";
13288+
"WebApp.Download.SavedToFiles" = "Saved to Files.";

submodules/TelegramCore/Sources/TelegramEngine/Messages/PreparedInlineMessages.swift

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,27 @@ func _internal_getPreparedInlineMessage(account: Account, botId: EnginePeer.Id,
4444
}
4545
}
4646
}
47+
48+
func _internal_checkBotDownload(account: Account, botId: EnginePeer.Id, fileName: String, url: String) -> Signal<Bool, NoError> {
49+
return account.postbox.transaction { transaction -> Api.InputUser? in
50+
return transaction.getPeer(botId).flatMap(apiInputUser)
51+
}
52+
|> mapToSignal { inputBot -> Signal<Bool, NoError> in
53+
guard let inputBot else {
54+
return .single(false)
55+
}
56+
return account.network.request(Api.functions.bots.checkDownloadFileParams(bot: inputBot, fileName: fileName, url: url))
57+
|> `catch` { _ -> Signal<Api.Bool, NoError> in
58+
return .single(.boolFalse)
59+
}
60+
|> map { value in
61+
switch value {
62+
case .boolTrue:
63+
return true
64+
case .boolFalse:
65+
return false
66+
}
67+
}
68+
}
69+
}
70+

submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,10 @@ public extension TelegramEngine {
410410
public func getPreparedInlineMessage(botId: EnginePeer.Id, id: String) -> Signal<PreparedInlineMessage?, NoError> {
411411
return _internal_getPreparedInlineMessage(account: self.account, botId: botId, id: id)
412412
}
413+
414+
public func checkBotDownload(botId: EnginePeer.Id, fileName: String, url: String) -> Signal<Bool, NoError> {
415+
return _internal_checkBotDownload(account: self.account, botId: botId, fileName: fileName, url: url)
416+
}
413417

414418
public func requestCancelLiveLocation(ids: [MessageId]) -> Signal<Never, NoError> {
415419
return self.account.postbox.transaction { transaction -> Void in

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,14 +1544,12 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
15441544
}
15451545

15461546
if let _ = user.botInfo {
1547-
//TODO:localize
15481547
var canManageEmojiStatus = false
15491548
if let cachedData = data.cachedData as? CachedUserData, cachedData.flags.contains(.botCanManageEmojiStatus) {
15501549
canManageEmojiStatus = true
15511550
}
1552-
15531551
if canManageEmojiStatus || data.webAppPermissions?.emojiStatus?.isRequested == true {
1554-
items[.permissions]!.append(PeerInfoScreenSwitchItem(id: 31, text: "Emoji Status", value: canManageEmojiStatus, icon: UIImage(bundleImageName: "Chat/Info/Status"), isLocked: false, toggled: { value in
1552+
items[.permissions]!.append(PeerInfoScreenSwitchItem(id: 31, text: presentationData.strings.PeerInfo_Permissions_EmojiStatus, value: canManageEmojiStatus, icon: UIImage(bundleImageName: "Chat/Info/Status"), isLocked: false, toggled: { value in
15551553
let _ = (context.engine.peers.toggleBotEmojiStatusAccess(peerId: user.id, enabled: value)
15561554
|> deliverOnMainQueue).startStandalone()
15571555

@@ -1560,17 +1558,21 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
15601558
}.startStandalone()
15611559
}))
15621560
}
1563-
15641561
if data.webAppPermissions?.location?.isRequested == true || data.webAppPermissions?.location?.isAllowed == true {
1565-
items[.permissions]!.append(PeerInfoScreenSwitchItem(id: 32, text: "Geolocation", value: data.webAppPermissions?.location?.isAllowed ?? false, icon: UIImage(bundleImageName: "Chat/Info/Location"), isLocked: false, toggled: { value in
1562+
items[.permissions]!.append(PeerInfoScreenSwitchItem(id: 32, text: presentationData.strings.PeerInfo_Permissions_Geolocation, value: data.webAppPermissions?.location?.isAllowed ?? false, icon: UIImage(bundleImageName: "Chat/Info/Location"), isLocked: false, toggled: { value in
15661563
let _ = updateWebAppPermissionsStateInteractively(context: context, peerId: user.id) { current in
15671564
return WebAppPermissionsState(location: WebAppPermissionsState.Location(isRequested: true, isAllowed: value), emojiStatus: current?.emojiStatus)
15681565
}.startStandalone()
15691566
}))
15701567
}
1568+
if !"".isEmpty {
1569+
items[.permissions]!.append(PeerInfoScreenSwitchItem(id: 33, text: presentationData.strings.PeerInfo_Permissions_Biometry, value: true, icon: UIImage(bundleImageName: "Settings/Menu/TouchId"), isLocked: false, toggled: { value in
1570+
1571+
}))
1572+
}
15711573

15721574
if !items[.permissions]!.isEmpty {
1573-
items[.permissions]!.insert(PeerInfoScreenHeaderItem(id: 30, text: "ALLOW ACCESS TO"), at: 0)
1575+
items[.permissions]!.insert(PeerInfoScreenHeaderItem(id: 30, text: presentationData.strings.PeerInfo_Permissions_Title), at: 0)
15741576
}
15751577
}
15761578

submodules/TelegramUI/Components/PeerSelectionController/Sources/PeerSelectionControllerNode.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1792,8 +1792,7 @@ private final class PeersCountPanelNode: ASDisplayNode {
17921792
var count: Int = 0 {
17931793
didSet {
17941794
if self.count != oldValue && self.count > 0 {
1795-
//TODO:localize
1796-
self.button.title = "Send"
1795+
self.button.title = self.strings.ShareMenu_Send
17971796
self.button.badge = "\(self.count)"
17981797

17991798
if let (width, sideInset, bottomInset) = self.validLayout {

submodules/TelegramUI/Components/Stars/StarsTransactionScreen/Sources/StarsTransactionScreen.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -725,10 +725,9 @@ private final class StarsTransactionSheetContent: CombinedComponent {
725725
let title: String
726726
if isSubscription {
727727
if isBotSubscription {
728-
//TODO:localize
729-
title = "Bot"
728+
title = strings.Stars_Transaction_Subscription_Bot
730729
} else if isBusinessSubscription {
731-
title = "Business"
730+
title = strings.Stars_Transaction_Subscription_Business
732731
} else {
733732
title = strings.Stars_Transaction_Subscription_Subscription
734733
}
@@ -766,10 +765,9 @@ private final class StarsTransactionSheetContent: CombinedComponent {
766765
)
767766
))
768767
if case let .subscription(subscription) = component.subject, let title = subscription.title {
769-
//TODO:localize
770768
tableItems.append(.init(
771769
id: "subscription",
772-
title: "Subscription",
770+
title: strings.Stars_Transaction_Subscription,
773771
component: AnyComponent(
774772
MultilineTextComponent(text: .plain(NSAttributedString(string: title, font: tableFont, textColor: tableTextColor)))
775773
)

submodules/TelegramUI/Components/Stars/StarsTransferScreen/Sources/StarsTransferScreen.swift

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ private final class SheetContent: CombinedComponent {
362362
let titleString: String
363363
if isSubscription {
364364
if isBot {
365-
titleString = "Subscription Name"
365+
titleString = component.invoice.title
366366
} else {
367367
titleString = strings.Stars_Transfer_Subscribe_Channel_Title
368368
}
@@ -412,7 +412,7 @@ private final class SheetContent: CombinedComponent {
412412
if case .starsChatSubscription = context.component.source {
413413
infoText = strings.Stars_Transfer_SubscribeInfo(state.botPeer?.compactDisplayTitle ?? "", strings.Stars_Transfer_Info_Stars(Int32(amount))).string
414414
} else if let _ = component.invoice.subscriptionPeriod {
415-
infoText = "Do you want to subscribe to **\(component.invoice.title)** in **\(state.botPeer?.compactDisplayTitle ?? "")** for **\(strings.Stars_Transfer_Info_Stars(Int32(amount)))** per month?"
415+
infoText = strings.Stars_Transfer_BotSubscribeInfo(component.invoice.title, state.botPeer?.compactDisplayTitle ?? "", strings.Stars_Transfer_BotSubscribeInfo_Stars(Int32(amount))).string
416416
} else if !component.extendedMedia.isEmpty {
417417
var description: String = ""
418418
var photoCount: Int32 = 0
@@ -534,11 +534,10 @@ private final class SheetContent: CombinedComponent {
534534
let amountString = presentationStringsFormattedNumber(Int32(amount), presentationData.dateTimeFormat.groupingSeparator)
535535
let buttonAttributedString: NSMutableAttributedString
536536
if case .starsChatSubscription = component.source {
537-
//TODO:localize
538-
buttonAttributedString = NSMutableAttributedString(string: "Subscribe for # \(amountString) / month", font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)
539-
//buttonAttributedString = NSMutableAttributedString(string: strings.Stars_Transfer_Subscribe, font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)
537+
buttonAttributedString = NSMutableAttributedString(string: "\(strings.Stars_Transfer_SubscribeFor) # \(amountString) \(strings.Stars_Transfer_SubscribePerMonth)", font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)
538+
540539
} else if let _ = component.invoice.subscriptionPeriod {
541-
buttonAttributedString = NSMutableAttributedString(string: "Subscribe for # \(amountString) / month", font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)
540+
buttonAttributedString = NSMutableAttributedString(string: "\(strings.Stars_Transfer_SubscribeFor) # \(amountString) \(strings.Stars_Transfer_SubscribePerMonth)", font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)
542541
} else {
543542
buttonAttributedString = NSMutableAttributedString(string: "\(strings.Stars_Transfer_Pay) # \(amountString)", font: Font.semibold(17.0), textColor: theme.list.itemCheckColors.foregroundColor, paragraphAlignment: .center)
544543
}

submodules/WebUI/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ swift_library(
4949
"//submodules/TelegramUI/Components/ListSectionComponent",
5050
"//submodules/TelegramUI/Components/Chat/ChatMessageItemImpl",
5151
"//submodules/DeviceLocationManager",
52+
"//submodules/DeviceAccess",
5253
"//submodules/TelegramUI/Components/Utils/GenerateStickerPlaceholderImage",
5354
],
5455
visibility = [

0 commit comments

Comments
 (0)