diff --git a/data/core.telegram.org/constructor/messageEntityPhone.html b/data/core.telegram.org/constructor/messageEntityPhone.html deleted file mode 100644 index abd229d0c1..0000000000 --- a/data/core.telegram.org/constructor/messageEntityPhone.html +++ /dev/null @@ -1,152 +0,0 @@ - - - - - messageEntityPhone - - - - - - - - - - - - - -
- -
-
-
- -

messageEntityPhone

- -

Message entity representing a phone number.

-

- -
-
messageEntityPhone#9b69e34b offset:int length:int = MessageEntity;

-

Parameters

- - - - - - - - - - - - - - - - - - - - -
NameTypeDescription
offsetintOffset of message entity within message (in UTF-8 codepoints)
lengthintLength of message entity within message (in UTF-8 codepoints)
-

Type

-

MessageEntity

- -
- -
-
- -
- - - - - - diff --git a/data/core.telegram.org/mtproto/TL-dependent.html b/data/core.telegram.org/mtproto/TL-dependent.html deleted file mode 100644 index ceb88d2f1e..0000000000 --- a/data/core.telegram.org/mtproto/TL-dependent.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - - TL-dependent - - - - - - - - - - - - - -
- -
-
-
- -

TL-dependent

- -

Main article: TL Language.

-

In certain cases, types may depend not only on other types (polymorphism), but also on the parameters of another type (dependent types). The TL language provides very limited support for this functionality: dependence is only allowed on a natural parameter whose type is designated using # (alias nat, but this is private -- TL doesn’t currently support this synonym). Values of type # are serialized as 32-bit signed numbers from 0 to 2^31-1.

-

Example: integer tuples (vectors)

-

Suppose we want to use induction to define the types “one integer”, “two integers”, and “three integers”. We could try to define them as follows:

-
empty = Empty;
-single x:int = Single;
-pair x:int y:int = Pair;
-triple x:int y:int z:int = Triple;
-quadruple x:int y:int z:int t:int = Quadruple;
-...
-

or as:

-
empty = Empty;
-single x:int empty = Single;
-pair x:int y:single = Pair;
-triple x:int yz:pair = Triple;
-quadruple x:int yzt:triple = Quadruple;
-

or as:

-
tnil = Tuple0;
-tcons0 hd:int tl:Tuple0 = Tuple1;
-tcons1 hd:int tl:Tuple1 = Tuple2;
-tcons2 hd:int tl:Tuple2 = Tuple3;
-...
-tcons_n hd:int tl:Tuple_n = Tuple_(n+1)
-

The first two variations lead to the same serialization. For example, (2 3 9):%triple and (2 (3 9)):%triple serialize as three 32-bit numbers: 2 3 9. The last variation better emphasizes the inductive version of the definition, but it uses boxed types. This is good from a theoretical perspective, but it leads to “superfluous” constructor names in serialization.

-

Therefore, we will write %Type-Ident to indicate the bare type that corresponds to the boxed type Type-Ident with a single constructor. If this constructor is named constructor, then according to the definition %Type-Ident = %constructor. Now we can write our definition like this:

-
tnil = Tuple0;
-tcons_n hd:int tl:%Tuple_n = Tuple_(n+1)
-

If we now abstract n out of the name of the type name and make it like a parameter for a polymorphic (dependent, to be more exact) type, then something like the following can be written in a suitable functional language:

-
NewType Tuple (n : #) :=
-| tnil = Tuple 0
-| tcons n:# hd:int tl:%(Tuple n) = Tuple (S n)
-EndType;
-

In the TL language, it looks like this:

-
tnil = Tuple 0;
-tcons {n:#} hd:int tl:%(Tuple n) = Tuple (S n);
-

The function S : # -> # and the constant O : # (it is 0) are the function for the next natural number (S n = n + 1) and the constant null. Therefore, the type # (alias nat) behaves as if it were defined in TL using the constructors

-
O = nat;
-S nat = nat;
-

or, using syntax more typical of other functional languages,

-
NewType nat :=
-| O
-| S nat
-EndType;
-

Types of all defined combinators:

-
O : #
-S : # -> #
-Tuple : # -> Type
-tnil : Tuple 0
-tcons : forall n : #, int -> Tuple n -> Tuple (S n)
-

or

-
Tuple : forall n : #, Type;
-tcons : forall n : #, forall hd : int, forall tl : Tuple n, Tuple (S n)
-

Note that in this case the constructor tnil does not depend on the parameter n, while tcons does.

-

In an analogous manner, it is possible to define a complete binary tree of height h with strings in the leaf nodes:

-
tleaf value:string = BinTree 0;
-tnode {h:#} left:(BinTree h) right:(BinTree h) = BinTree (S h);
-

Or a random tree whose leaf nodes are all a distance of h from the root and whose nodes are all labeled with integers:

-
hleaf value:int = Tree 0;
-hnode {n:#} left:(Tree n) next:(Tree (S n)) = Tree (S n)
-hnil {n:#} = Tree (S n)
-

Another version:

-
hleaf' value:int = Tree' 0;
-hnode' {n:#} children:(list (Tree' n)) = Tree' (S n)
-

Polymorphic dependent types

-

Let us try to define a type Tuple X n whose values are n-tuples of type X values. In this way, Tuple will be simultaneously polymorphic and dependent:

-
Tuple : Type -> # -> Type;
-

In the familiar syntax of functional languages:

-
NewType Tuple {X : Type} {n : #} :=
-| vnil : Tuple X 0
-| vcons {n:#} hd:X tl:%(Tuple X n) : Tuple X (S n)
-EndType
-

or, in TL syntax,

-
vnil {X:Type} = Tuple X 0;
-vcons {X:Type} {n:#} tl:(%Tuple X n) = Tuple X S n
-

In the end we obtain terms for the following types:

-
vnil : forall X : Type, Tuple X 0
-vcons : forall X : Type, forall n : #, X -> Tuple X n -> Tuple X (S n)
-

or

-
vnil : forall X : Type, Tuple X 0
-vcons : forall X : Type, forall n : #, forall hd : X, forall tl : Tuple X n, Tuple X (S n)
-

Dependent sums

-

The Tuple we just defined differs from the built-in Vector type. Specifically, the Vector type formally depends on a single argument (a type), but our Tuple depends on two (a type and a number):

-
Tuple : Type -> # -> Type;
-Vector : Type -> Type;
-

The built-in Vector could be defined in terms of our Tuple using “summing across all n : #":

-
vector {X:Type} n:# v:(%Tuple X n) = Vector X;
-

Nevertheless, our Tuple has its advantages. For example, we can define data types such as:

-
matrix_10x10 a:(%Tuple (%Tuple double 10) 10) = Matrix_10x10;
-

In any event, remember that during calculation of the matrix_10x10 combinator’s number, all parentheses must be removed and the CRC32 of the string matrix_10x10 a:%Tuple %Tuple double 10 10 = Matrix_10x10 must be computed.

-

Moreover, we can define arbitrarily-sized matrices:

-
matrix {X:Type} m:# n:# a:(%Tuple (%Tuple X m) n) = Matrix X;
-

In this case using vector would result in storing the length of a row (m) in each row, e.g. n times.

-

Note that the serializations of values of type %Tuple X n and vector X (also known as %vector X and %Vector X) nearly match when n > 0: in both cases we obtain a single 32-bit number (equal to n-1 or n depending on the version) followed by the serializations of n objects of type X. (This is slightly untrue: values of type %Tuple X n can only be serialized if n is a constant or value known from one of the preceding fields of the enclosing entry; but then this n won’t be serialized explicitly anywhere).

-

Special syntax for repetitions

-

In view of the importance of the construction presented above, it is built into the TL language in the following manner. A substructure in the form of [ array-field-name ":" ] [ nat-ident "" ] "[" field-descr ... "]” may be used in the declaration of any combinator, where nat-ident* is the name of any previously encountered field of type # (if it is not explicitly indicated, the most recent is used). In abstract, this substructure is equivalent to:

-
aux_type *field-descr* ... = AuxType;
-*current_constructor* ... [ *array-field-name* ":" ] (%Tuple aux_type *nat-ident*)
-

For example, 10x10 matrices, vectors, and arbitrary matrices may be defined in the following way:

-
matrix {X:Type} m:# n:# a:n*[ m*[ X ] ] = Matrix X;
-matrix_10x10 a:10*[ 10*[ double ]] = Matrix_10x10;
-vector {X:Type} # [ X ] = Vector X;
-

We have already encountered the last version as a “definition” of the “built-in type” Vector.

-

Of course, several fields, as complex as desired, may be within the repeating part. Furthermore, besides using n as a repeat counter, one may use expressions of the form (n+const) and (const+n), where const is a small nonnegative constant, which are shorthand for S (S ( ... (S n) ... )):

-
repeat_np1 n:# a:(S n)*[ key:string value:string ] = Dictionary;
-

To calculate the CRC32 these expressions are converted to expressions of the form (const+X) without internal spaces. Additionally, the * in this case is not set off by spaces on the left and right.

-

Serialization of dependent types

-

Serialization of dependent types and polymorphic types is not a fundamental challenge: we have combinators with non-zero arity with Type values. For example, the type Tuple double 10 : Type serializes to 'Tuple' '%double' 10. Note that at present in practice there is virtually no need to serialize types, whether dependent or not.

-

Optional combinator parameters in TL

-

Optional combinator parameters in TL must possess the following properties:

-
    -
  • -

    Optional parameters must be precisely ythe combinator’s first several arguments;

    -
  • -
  • -

    The value of any optional parameter must be entirely determined by the combinator’s result type.

    -
  • -
-

For example, in cons {X:Type} hd:X tl:(list X) = list X the parameter X may be made optional, because it is located at the very beginning of the argument list and is unambiguously determined by the list X result type. Similarly, in tcons {X:Type} {n:#} hd:X tl:(%Tuple X n) = Tuple X (S n) the values of X and n are completely determined based on the Tuple X (S n) result type, therefore they made be made optional parameters.

-

It usually makes sense to move all of a constructor’s arguments satisfying the second condition to the beginning of the list, arrange them in the order they appear in the result type’s parameters, and make them optional. Given such an approach, the full version of a constructor is rarely needed -- only when we want to transmit the value of the polymorphic or dependent type as a value of type Object. In all other cases, the type of the expected value from the context is already known, which means that all optional parameters can be recovered during decomposition.

-

See also Optional combinator parameters and their values.

- -
- -
-
- -
- - - - - - diff --git a/data/telegram.org/blog/shared-media-join-requests-and-more.html b/data/telegram.org/blog/shared-media-join-requests-and-more.html new file mode 100644 index 0000000000..51dbdd9844 --- /dev/null +++ b/data/telegram.org/blog/shared-media-join-requests-and-more.html @@ -0,0 +1,304 @@ + + + + + Hyper-Speed Scrolling and Calendar View for Shared Media, Join Requests, Global Chat Themes and More + + + + + + + + + + + + + + + + + + + +
+
+ +
+
+
+ +
+
+

Hyper-Speed Scrolling and Calendar View for Shared Media, Join Requests, Global Chat Themes and More

+ +
+ +
+ TITLE +
+ +

Today's update brings new ways to find memories in shared media with accelerated scrolling and a calendar view, an admin approval setting for invite links, global chat themes for your entire app, and more.

+

Hyper-Speed Scrolling and Calendar View for Shared Media

+

Every Telegram user has unlimited cloud storage – and each chat has a Shared Media page that shows all the photos, videos, files and music that have been sent there. We've added a new date bar on the side of the page, which you can drag up and down to scroll through shared media faster. It's like your own personal DeLorean with 1.21 gigawatts of time-travel torque.

+
+ +
+ +

To get a better look, pinch to zoom in and out, so you can see anywhere from 2 big thumbnails to a dozen small squares per row.

+

Calendar View for Shared Media

+

To quickly find media from a specific time, tap on the date bar to open a calendar interface with media previews for each day – then tap to see all the media from that date.

+
+ +
+ +

In addition to the new tools for jumping between past and present, you can filter shared media to show only photos, only videos, or both.

+
+

To view shared media, simply tap the header at the top of your screen in any chat and scroll down.

+
+

Join Requests for Groups and Channels

+

Invite links let you give users the opportunity to join your group or channel on their own time – whether you share the link privately or turn it into a QR code on a billboard is up to you. When you create additional invite links for your chat, there is a now a Request Admin Approval setting, which gives admins more control over who is able to join and see the chat.

+

When a user opens a link with Admin Approval turned on, they will see a button to send a join request that admins can manage from a new bar at the top of the chat. From there, admins can view an applicant's public profile pictures and bio, then approve or dismiss their request.

+
+

For example, you could post an invite link to your poetry channel on social media – then approve only your close friends to see your writing.

+
+
+ TITLE +
+ +
+

Applicants can also be managed from the Chat's Profile > Edit > Member Requests.

+
+

Unique Names for Invite Links

+

Admin Approval can be applied to any link in the 'Additional Invite Links' section – we've also added the ability to give all of those links unique names, so you can label them for better organization.

+
+ TITLE +
+ +

Global Chat Themes

+

Our last update introduced 8 new themes that you could set for individual chats – and now they're available for your entire app. The Chat Settings (Android) and Appearance (iOS) pages have been fully redesigned, giving these themes center stage. Built by the Telegram Team, every theme has a Day and Night mode, colorful animated background and gradient message bubbles.

+
+ +
+ +

Like all themes, you can personalize these designs and tweak the colors or change the pattern. For more options and custom settings, tap ‘Chat Themes’ to edit and share your creations.

+

• Apply one of 8 new preset themes to your entire app – each theme has a Day and Night mode, colorful animated backgrounds and gradient message bubbles.
• Personalize these themes and find custom theme options in Appearance Settings > Chat Themes.

+

Transit Time for Shared Locations on iOS

+

You can show where you are or where you're headed by sending a location from the attachment menu 📎 in the message bar. Tapping a shared location pulls up a map of the area – which now shows you the travel time to get there by foot, car, or public transport. To see detailed directions or get a taxi to their location, tap on the travel time to open the location in your preferred app.

+
+ TITLE +
+ +
+

Transit times are shown for both static and live locations – so you can see how long it will take to meet your friends while they're on the move.

+
+

• Tap a user's shared Location or Live Location to see how long it will take you to reach them by foot, car or public transport.
• Tap on the travel time to open the location in another app.

+

Instant Media Captions for iOS

+

The text you type in the message bar now automatically converts to a caption when you attach media, so you'll never have to retype or cut and paste what you just wrote. This also works with Cloud Drafts – so you can type out the message on your computer, then simply attach the photo from your phone and send it all together.

+
+ +
+ +

More Interactive Emoji

+

• Send one 👻 👎 🤮 😂 💸 or 🎃 to any private chat, then tap on the animated emoji to launch a fullscreen effect.
• If your chat partner also has the chat open, you will both see the effects and feel the vibrations simultaneously.

+
+ +
+ +
+

If your chat partner also has the chat open, you will both see the effects and feel the vibrations simultaneously.

+
+

As you know from our previous update, this also works with 🎆 🎉 🎈 👍 💩 and ❤️.

+ +
+ +
+ + +
+ + +
+
+
+ + + + + + + +