@@ -1459,7 +1459,7 @@ public void onItemClick(int id) {
14591459 TLRPC .TL_messages_requestWebView req = new TLRPC .TL_messages_requestWebView ();
14601460 req .bot = MessagesController .getInstance (currentAccount ).getInputUser (botId );
14611461 req .peer = MessagesController .getInstance (currentAccount ).getInputPeer (botId );
1462- req .platform = "android" ;
1462+ req .platform = org . telegram . ui . ForkSettingsActivity . GetBotPlatform ( currentAccount , botId ) ;
14631463 req .compact = props .compact ;
14641464 req .fullscreen = props .fullscreen ;
14651465
@@ -1488,7 +1488,7 @@ public void onItemClick(int id) {
14881488 TLRPC .TL_messages_requestSimpleWebView req = new TLRPC .TL_messages_requestSimpleWebView ();
14891489 req .from_switch_webview = (props .flags & FLAG_FROM_INLINE_SWITCH ) != 0 ;
14901490 req .bot = MessagesController .getInstance (currentAccount ).getInputUser (botId );
1491- req .platform = "android" ;
1491+ req .platform = org . telegram . ui . ForkSettingsActivity . GetBotPlatform ( currentAccount , botId ) ;
14921492 req .from_side_menu = (props .flags & FLAG_FROM_SIDE_MENU ) != 0 ;
14931493 req .compact = props .compact ;
14941494 req .fullscreen = props .fullscreen ;
@@ -1520,7 +1520,7 @@ public void onItemClick(int id) {
15201520 TLRPC .TL_messages_requestWebView req = new TLRPC .TL_messages_requestWebView ();
15211521 req .peer = MessagesController .getInstance (currentAccount ).getInputPeer (peerId );
15221522 req .bot = MessagesController .getInstance (currentAccount ).getInputUser (botId );
1523- req .platform = "android" ;
1523+ req .platform = org . telegram . ui . ForkSettingsActivity . GetBotPlatform ( currentAccount , botId ) ;
15241524 req .compact = props .compact ;
15251525 req .fullscreen = props .fullscreen ;
15261526 if (props .buttonUrl != null ) {
@@ -1566,7 +1566,7 @@ public void onItemClick(int id) {
15661566
15671567 req .app = botApp ;
15681568 req .write_allowed = props .allowWrite ;
1569- req .platform = "android" ;
1569+ req .platform = org . telegram . ui . ForkSettingsActivity . GetBotPlatform ( currentAccount , botId ) ;
15701570 req .peer = fragment instanceof ChatActivity ? ((ChatActivity ) fragment ).getCurrentUser () != null ? MessagesController .getInputPeer (((ChatActivity ) fragment ).getCurrentUser ()) : MessagesController .getInputPeer (((ChatActivity ) fragment ).getCurrentChat ())
15711571 : MessagesController .getInputPeer (props .botUser );
15721572 req .compact = props .compact ;
@@ -1597,7 +1597,7 @@ public void onItemClick(int id) {
15971597 TLRPC .TL_messages_requestMainWebView req = new TLRPC .TL_messages_requestMainWebView ();
15981598
15991599 req .bot = MessagesController .getInstance (currentAccount ).getInputUser (props .botId );
1600- req .platform = "android" ;
1600+ req .platform = org . telegram . ui . ForkSettingsActivity . GetBotPlatform ( currentAccount , botId ) ;
16011601 req .peer = fragment instanceof ChatActivity ? ((ChatActivity ) fragment ).getCurrentUser () != null ? MessagesController .getInputPeer (((ChatActivity ) fragment ).getCurrentUser ()) : MessagesController .getInputPeer (((ChatActivity ) fragment ).getCurrentChat ())
16021602 : MessagesController .getInputPeer (props .botUser );
16031603 req .compact = props .compact ;
@@ -1693,6 +1693,41 @@ private void openOptions() {
16931693 })
16941694 .addIf (currentBot != null && (currentBot .show_in_side_menu || currentBot .show_in_attach_menu ), R .drawable .msg_delete , LocaleController .getString (R .string .BotWebViewDeleteBot ), () -> {
16951695 deleteBot (currentAccount , botId , () -> dismiss ());
1696+ })
1697+ .addSpaceGap ()
1698+ .add (R .drawable .msg_bot , LocaleController .getString (R .string .BotSetPlatform ), () -> {
1699+ String [] platforms = { "android" , "tdesktop" , "ios" , "macos" };
1700+ int [] icons = new int [platforms .length ];
1701+ String wasPlatform = org .telegram .ui .ForkSettingsActivity .GetBotPlatform (currentAccount , botId );
1702+ for (int i = 0 ; i < platforms .length ; i ++) {
1703+ icons [i ] = (wasPlatform .equals (platforms [i ])) ? R .drawable .msg_text_check : 0 ;
1704+ }
1705+
1706+ AlertDialog dialog = new AlertDialog .Builder (getContext ())
1707+ .setTitle (LocaleController .getString (R .string .BotSetPlatformTitle ))
1708+ .forceVerticalButtons ()
1709+ .setMessage (LocaleController .getString (R .string .BotSetPlatformAbout ))
1710+ .setNegativeButton (LocaleController .getString (R .string .Cancel ), null )
1711+ .setItems (platforms , icons , (d , which ) -> {
1712+ android .content .SharedPreferences .Editor editor = MessagesController .getMainSettings (currentAccount ).edit ();
1713+ editor .putString ("bot_platform_" + botId , platforms [which ]);
1714+ editor .commit ();
1715+ })
1716+ .create ();
1717+ dialog .show ();
1718+ })
1719+ .add (org .telegram .ui .ForkSettingsActivity .GetBotCopyLink (currentAccount , botId )
1720+ ? R .drawable .msg_text_check
1721+ : 0 ,
1722+ LocaleController .getString (R .string .BotCopyUrl ),
1723+ () -> {
1724+ android .content .SharedPreferences .Editor editor = MessagesController .getMainSettings (currentAccount ).edit ();
1725+ editor .putBoolean ("bot_copy_link_" + botId , !org .telegram .ui .ForkSettingsActivity .GetBotCopyLink (currentAccount , botId ));
1726+ editor .commit ();
1727+ android .widget .Toast .makeText (
1728+ getContext (),
1729+ LocaleController .getString (R .string .OK ),
1730+ android .widget .Toast .LENGTH_SHORT ).show ();
16961731 });
16971732
16981733 if (actionBarColor != Theme .getColor (Theme .key_windowBackgroundWhite )) {
@@ -2174,7 +2209,10 @@ private void updateWebViewBackgroundColor() {
21742209
21752210 private boolean resetOffsetY = true ;
21762211 private ValueAnimator fullscreenAnimator ;
2177- public void setFullscreen (boolean fullscreen , boolean animated ) {
2212+ public void setFullscreen (boolean fullscreenF , boolean animated ) {
2213+ final boolean fullscreen = org .telegram .messenger .MessagesController .getGlobalMainSettings ().getBoolean ("botSkipFullscreen" , false )
2214+ ? false
2215+ : fullscreenF ;
21782216 if (this .fullscreen == fullscreen ) return ;
21792217 this .fullscreen = fullscreen ;
21802218 if (fullscreenAnimator != null ) {
0 commit comments