CN117278513A - Message display realization method and device and electronic equipment - Google Patents

Message display realization method and device and electronic equipment Download PDF

Info

Publication number
CN117278513A
CN117278513A CN202311272382.9A CN202311272382A CN117278513A CN 117278513 A CN117278513 A CN 117278513A CN 202311272382 A CN202311272382 A CN 202311272382A CN 117278513 A CN117278513 A CN 117278513A
Authority
CN
China
Prior art keywords
message
character string
content
target
configuration
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311272382.9A
Other languages
Chinese (zh)
Inventor
叶松林
修怀忠
周忠华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Thalys Automobile Co ltd
Original Assignee
Thalys Automobile Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Thalys Automobile Co ltd filed Critical Thalys Automobile Co ltd
Priority to CN202311272382.9A priority Critical patent/CN117278513A/en
Publication of CN117278513A publication Critical patent/CN117278513A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/06Message adaptation to terminal or network requirements
    • H04L51/063Content adaptation, e.g. replacement of unsuitable content
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/06Message adaptation to terminal or network requirements
    • H04L51/066Format adaptation, e.g. format conversion or compression

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • User Interface Of Digital Computer (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The method and the device for realizing message display are characterized in that a first electronic device receives a character string message, the character string message comprises message configuration content and type labels, the message configuration content comprises message content to be displayed, the type labels are extracted from the character string message, a first target character string corresponding to the message configuration content is matched according to the type labels, a second target character string corresponding to the message content to be displayed is determined from the first target character string, configuration and display of the message content to be displayed are realized based on the first target character string, the second target character string and configuration display rules corresponding to the type labels, when the message configuration content is changed, the first electronic device can also acquire the first target character string corresponding to the changed message configuration content, and further, corresponding configuration and display can be realized automatically for the message content to be displayed without configuration modification of the first electronic device, and user operation is simplified.

Description

Message display realization method and device and electronic equipment
Technical Field
The present invention relates to the field of message display technologies, and in particular, to a method and an apparatus for implementing message display, and an electronic device.
Background
With the continuous development of internet technology, various application programs are layered endlessly. Currently, in order to enable a client to receive a message of a server and display the received message of the server according to a pre-configured format requirement, corresponding rules are generally required to be configured on two sides of the client and the server in advance so as to display the message according to requirements. Specifically, a message sending rule needs to be configured at a server, and a message processing rule needs to be configured at a client, so that each time the client receives a message sent by the server, the message can be processed according to the pre-configured message processing rule, and the message is displayed according to requirements. The current technology has such a problem that: when the format requirement of the message display is changed, for example, when the display color of the text message needs to be changed, configuration modification needs to be performed on two sides of the client and the server respectively, which is not beneficial to user operation.
Disclosure of Invention
An embodiment of the present application is directed to providing a method and an apparatus for implementing message display, and an electronic device, so as to solve the above technical problems.
In one aspect, a method for implementing message presentation is provided, and the method is applied to a first electronic device, and includes:
Receiving a character string message sent by a second electronic device through an application program on the first electronic device; the character string message comprises message configuration content and a type tag for indicating the type of the message configuration content, wherein the message configuration content comprises message content to be displayed;
extracting the type tag from the string message;
matching a first target character string corresponding to the message configuration content from the character string message according to a first matching rule corresponding to the type tag;
determining a second target character string corresponding to the message content to be displayed from the first target character string;
and configuring and displaying the message content to be displayed based on the first target character string, the second target character string and the configuration display rule corresponding to the type tag.
In one embodiment, the message configuration content further includes an attribute tag and an attribute value corresponding to the attribute tag;
the configuring and displaying the message content to be displayed based on the first target character string, the second target character string and the configuration rule corresponding to the type tag includes:
Matching a third target character string corresponding to the attribute value from the first target character string according to a second matching rule corresponding to the attribute tag;
and configuring and displaying the message content to be displayed based on the second target character string, the third target character string and the configuration display rule corresponding to the type tag.
In one embodiment, the configuring and displaying the message content to be displayed based on the second target string, the third target string and the configuration display rule corresponding to the type tag includes:
replacing the character string message with the second target character string, and configuring a target variable into the third target character string to realize configuration and display of the message content to be displayed; the target variable is a variable corresponding to the attribute tag under the type tag.
In one embodiment, when the attribute tag includes a link address tag, the configuring and displaying the message content to be displayed based on the second target string, the third target string, and a configuration display rule corresponding to the type tag includes:
And replacing the character string message with the second target character string, converting the third target character string into a target link, and associating the second target character string with the target link to realize the configuration and the display of the message content to be displayed.
In one embodiment, the type tag includes a skip link tag, and the third target string includes module identification information of a target service module to be skipped, page identification information of a corresponding target page under the target service module, and transfer parameter information.
In one embodiment, the receiving, by the application on the first electronic device, the string message sent by the second electronic device includes:
when the application program is in an activated state, the first electronic device periodically pulls the character string message from the second electronic device through the application program;
and/or the number of the groups of groups,
when the starting of the application program is detected, the first electronic equipment acquires the character string message from the second electronic equipment through the application program;
and/or the number of the groups of groups,
and when the current display page of the application program is detected to be updated, the first electronic equipment acquires the character string message from the second electronic equipment through the application program.
In another aspect, a method for implementing message presentation is provided, which is applied to a second electronic device, and the method includes:
generating a character string message; the character string message comprises message configuration content and a type tag for indicating the type of the message configuration content, wherein the message configuration content comprises message content to be displayed;
and sending the character string message to the first electronic device so that the first electronic device extracts the type tag from the character string message, matching a first target character string corresponding to the message configuration content from the character string message according to a first matching rule corresponding to the type tag, determining a second target character string corresponding to the message content to be displayed from the first target character string, and configuring and displaying the message content to be displayed based on the first target character string, the second target character string and the configuration display rule corresponding to the type tag.
In another aspect, an implementation apparatus for message presentation is provided, which is applied to a first electronic device, and the apparatus includes:
the receiving module is used for receiving the character string message sent by the second electronic equipment through the application program on the first electronic equipment; the character string message comprises message configuration content and a type tag for indicating the type of the message configuration content, wherein the message configuration content comprises message content to be displayed;
The extraction module is used for extracting the type tag from the character string message;
the matching module is used for matching a first target character string corresponding to the message configuration content from the character string message according to a first matching rule corresponding to the type tag;
the determining module is used for determining a second target character string corresponding to the message content to be displayed from the first target character string;
and the configuration display module is used for realizing the configuration and display of the message content to be displayed based on the first target character string, the second target character string and the configuration display rule corresponding to the type label.
In another aspect, an implementation apparatus for message display is provided, which is applied to a second electronic device, and the apparatus includes:
the generation module is used for generating a character string message; the character string message comprises message configuration content and a type tag for indicating the type of the message configuration content, wherein the message configuration content comprises message content to be displayed;
the sending module is used for sending the character string message to the first electronic device so that the first electronic device can extract the type tag from the character string message, a first target character string corresponding to the message configuration content is matched from the character string message according to a first matching rule corresponding to the type tag, a second target character string corresponding to the message content to be displayed is determined from the first target character string, and configuration and display of the message content to be displayed are achieved based on the first target character string, the second target character string and the configuration display rule corresponding to the type tag.
In another aspect, an electronic device is provided that includes a processor and a memory having a computer program stored therein, the processor executing the computer program to implement any of the methods described above.
According to the method, the device and the electronic equipment for realizing message display, the character string message sent by the second electronic equipment is received through the application program on the first electronic equipment, the character string message comprises message configuration content and a type tag used for indicating the type of the message configuration content, the message configuration content comprises message content to be displayed, the type tag is extracted from the character string message, a first target character string corresponding to the message configuration content is matched from the character string message according to the first matching rule corresponding to the type tag, a second target character string corresponding to the message content to be displayed is determined from the first target character string, the configuration and display of the message content to be displayed are realized based on the first target character string, the second target character string and the configuration display rule corresponding to the type tag, and because the first electronic equipment can determine the first target character string corresponding to the message configuration content and the second target character string corresponding to the message content to be displayed from the character string message, even if the message configuration content is changed, the first electronic equipment can acquire the first target character string corresponding to the message configuration content to be displayed after the message configuration content is changed, the first electronic equipment can display the message configuration content to be displayed automatically, and the display of the message is not required to be improved, and the display operation of the message is simplified.
Drawings
Fig. 1 is a flow chart of a method for implementing message presentation according to an embodiment of the present application;
fig. 2 is a schematic flow chart of configuring and displaying the content of a message to be displayed according to the first embodiment of the present application;
FIG. 3 is a schematic diagram of an interface display according to a first embodiment of the present disclosure;
FIG. 4 is a schematic view of another interface according to the first embodiment of the present disclosure;
fig. 5 is a first structural schematic diagram of a message display implementation device according to a second embodiment of the present application;
fig. 6 is a second schematic structural diagram of a message display implementation device according to the second embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to a third embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
Embodiment one:
an embodiment of the present application provides a method for implementing message presentation, specifically, referring to fig. 1, fig. 1 is a flow chart of the method for implementing message presentation provided in the embodiment of the present application, which is applied to a first electronic device and includes:
S11: receiving a character string message sent by a second electronic device through an application program on the first electronic device; the character string message comprises message configuration content and a type tag for indicating the type of the message configuration content, and the message configuration content comprises message content to be displayed.
S12: the type tag is extracted from the string message.
S13: and matching a first target character string corresponding to the message configuration content from the character string message according to a first matching rule corresponding to the type tag.
S14: and determining a second target character string corresponding to the message content to be displayed from the first target character string.
S15: and configuring and displaying the content of the message to be displayed based on the first target character string, the second target character string and the configuration display rule corresponding to the type tag.
The specific procedures of the above steps will be described in detail.
It should be noted that, in the embodiment of the present application, the first electronic device and the second electronic device may be terminals; or servers; or one may be a server and one may be a terminal.
The first electronic device in the embodiment of the application is a terminal, and the second electronic device is a server.
The terminal may be a smart phone, a tablet computer, a notebook computer, a personal computer (Personal Computer, PC), a smart home, a wearable electronic device, a VR/AR device, a vehicle-mounted computer, or the like. The server may be an interworking server or a background server among a plurality of heterogeneous systems, may be an independent physical server, may be a server cluster or a distributed system formed by a plurality of physical servers, and may be a cloud server for providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, basic cloud computing services such as big data and an artificial intelligence platform, and the like.
In step S11, the character string message sent by the second electronic device may be received by an application program installed on the first electronic device, where the application program may be any application program on the first electronic device, and specifically may be set by a developer according to an actual application scenario.
The character string message in the embodiment of the application comprises message configuration content and a type tag for indicating the type of the message configuration content, wherein the message configuration content comprises message content to be displayed. The message configuration content shows what configuration is needed for what message content to be displayed for the message. The type tag is a message that represents what type of message is.
The type tag in the embodiment of the application comprises at least one of a text tag, a picture tag and a link tag, wherein the link tag comprises at least one of a hyperlink tag and a jump link tag. The text label in the embodiment of the application is used for indicating that the type of the message configuration content is text, namely, the text is configured and the text message is displayed based on the configured result. The picture tag is used for indicating that the type of the message configuration content is a picture, namely, the picture is configured and the picture message is displayed based on the configured result. The link tag is used for indicating that the type of the message configuration content is a link, that is, the link is configured and the message is displayed based on the configured result.
It should be noted that, in the embodiment of the present application, specific content of each type of tag may be flexibly set by a developer, so long as the type of the content is configured through the corresponding content indication message.
For example, in the embodiment of the present application, the Text label may be in a format of < Text/Text >, the picture label may be in a format of < Image/Image >, the hyperlink label may be in a format of < Link/Link >, and the skip Link label may be in a format of < Scheme.
It can be understood that in the embodiment of the present application, various types of tags and the correspondence between the various types of tags and the first matching rule may be stored in advance on the first electronic device side.
In step S12 and step S13, a type tag may be extracted from the string message, and then a first target string corresponding to the message configuration content may be matched from the string message according to a preset correspondence between the type tag and a first matching rule and according to a first matching rule corresponding to the extracted type tag. It will be appreciated that the first target string here is essentially the message configuration content.
It should be noted that, when the first electronic device side stores a plurality of type tags and the correspondence between the plurality of type tags and the first matching rule, each type tag stored in advance may be respectively matched with the content in the received string message, and when the content of the string is matched to be consistent, the content of the string is extracted, where the content of the string is the extracted type tag.
The second target character string in the embodiment of the present application refers to a character string corresponding to the content of the message to be displayed in the character string message received by the first electronic device.
For step S14, when the message configuration content only includes the message content to be displayed, the first target character string may be directly used as the second target character string.
For step S14, when the message configuration content further includes an attribute tag and an attribute value corresponding to the attribute tag, a string corresponding to the attribute tag in the first target string and other strings except for a string corresponding to the attribute value may be used as the second target string, which will be described below with reference to a specific example.
When the message configuration content further includes an attribute tag and an attribute value corresponding to the attribute tag, as shown in fig. 2, step S15 may include the following sub-steps:
s151: and matching a third target character string corresponding to the attribute value from the first target character string according to a second matching rule corresponding to the attribute tag.
S152: and configuring and displaying the message content to be displayed based on the second target character string, the third target character string and the configuration display rule corresponding to the type tag.
In this embodiment of the present application, for each type of tag, the corresponding attribute tag may be stored in advance on the first electronic device side, and for each attribute tag, a second matching rule corresponding to the attribute tag may be preset.
Therefore, after the first target character string is obtained from the received character string message, the third target character string corresponding to the attribute value can be matched from the first target character string according to the attribute tag in the first target character string and the corresponding second matching rule. It will be appreciated that the third target string here is essentially the attribute value.
It should be noted that, in the embodiment of the present application, the specific content of each attribute tag may be flexibly set by a developer, and by way of example, the attribute tag in the embodiment of the present application includes, but is not limited to, at least one of a link address tag, a font color tag, a font size tag, and a font name tag.
Illustratively, the link address label may be in the form of Url (x), the font Color label may be in the form of Color (x), the font size label may be in the form of FontSize (x), and the font name label may be in the form of fontsname (x).
It should be noted that, when the first electronic device side stores a plurality of attribute tags for the type tag and the correspondence between the plurality of attribute tags and the second matching rule, each attribute tag stored in advance may be respectively matched with the first target character string, when the matching is to the consistent character string content, the character string content is extracted, that is, the matched attribute tag, and then a third target character string is matched from the first target character string according to the second matching rule corresponding to the attribute tag as an attribute value.
For step S152, in some embodiments, the string message may be replaced with the second target string, and the target variable may be configured into the third target string, so as to implement configuration and display of the message content to be displayed; the target variable is a variable corresponding to the attribute tag under the type tag. For example, when the type tag in the string message is a text tag, the string message may be replaced with a second target string, and the configuration of the corresponding attribute is completed based on the third target string, so as to realize the display of the message content to be displayed.
For step S152, in some other embodiments, when the attribute tag includes a link address tag, the character string message may be replaced with the second target character string, the third target character string may be converted into a target link, and the second target character string may be associated with the target link, so as to implement configuration and display of the message content to be displayed.
For ease of understanding, the following description is given by way of specific examples.
In a first example, the string message received by the first electronic device may be "1 km away from your destination < Text Color (# 082 A3A) Kang Zhuang subway station/Text >," where the Text indicating that a Color is to be configured is "Kang Zhuang subway station" and the Color is shown in hexadecimal HEX strings.
Here, first, the start position and the end position of the text label appearance need to be calculated. In the embodiment of the present application, regular expressions may be used for matching, and an exemplary first matching rule corresponding to a text label may be: all Text data in the matching Text label "< text..x/Text >" contains Text data of the Text label "< text..x/Text >" itself.
In specific implementation, a method regexSubString (pattern: string) - > [ String: string ], the parameter being a String message, the return value being a dictionary array object, and a temporary object stringArr being of the type [ String: string ] being created in the method. Then, a function nsguilarexpression (pattern: < Text./Text >) is called in the method, the parameter is a type tag, the calling function returns a regular matching object, hereinafter collectively referred to as regex, the regex object is used to call the matches method, the matches method returns an array containing all the ranges (range) of the content matched with the type tag in the character string, when the range array is taken, the array is traversed, the character string corresponding to each range is taken out, the required Text content can be obtained, and the Text content should be a "Color (# 082 A3A) Kang Zhuang subway station", and it can be understood that the "Color (# 082 A3A) Kang Zhuang subway station" is the first target character string mentioned in the above.
The first target string includes an attribute tag Color (x), and similarly, the corresponding text Color #082A3A, that is, the attribute value corresponding to the attribute tag Color (x) may be extracted by using the second matching rule corresponding to the attribute tag Color (x) by using the matching method of the regular expression.
It should be noted that, in this embodiment of the present application, after obtaining the attribute value, the character string corresponding to the attribute tag in the first target character string may be deleted, the third target character string may be deleted, and the remaining character string may be used as the second target character string corresponding to the content of the message to be displayed, where the second target character string is configured and displayed. Continuing with the description of the present example, it will be understood that Color (# 082 A3A) is a Color of the set text, so that it is not required to be displayed in the text, and therefore, after the first target character string "Color (# 082 A3A) Kang Zhuang subway station" is acquired, the character string corresponding to the attribute tag can be deleted, and at the same time, the attribute value is deleted, that is, "Color (# 082 A3A)" in the first target character string is deleted, so that the message content to be displayed, that is, "Kang Zhuang subway station" can be obtained.
It should be further noted that, after obtaining the attribute value, an attribute may be set to a corresponding target variable, where the target variable may be a temporary variable corresponding to the attribute tag under the type tag. For example, in the present example, a value of stringArr [ "color" ] = "#082A3A", stringArr [ "text" ] = "Kang Zhuang subway station", and finally returned by the regexSubString method may be set.
It can be understood that when there are multiple message contents to be displayed in the string message, matching can be performed on the information to be configured of each message content to be displayed, that is, similar processes are repeatedly performed, which is not described herein.
The regexSubString method may return the data format required to draw the interface. Illustratively, in this example, the return data format for the text set color is: the Text "=" #082A3A "," Text "=" Kang Zhuang subway station "], but the real character string is now" 1km away from your destination < Text Color (# 082 A3A) Kang Zhuang subway station/Text > "and clicks on navigation >" for the style of interface as shown in fig. 3, when the message is drawn, the matched Text can be replaced with the Text field of the return data by using the configuration display rule corresponding to the type tag < Text >/Text >, specifically, the replayOccurrence function provided by the matched Text calling system can be replaced with the content, and the Color can be set as the Color field of the return data by using the HEX method, so that the effect display shown in fig. 3 is realized.
In a second example, the character string message received by the first electronic device is "Link Url (http:// www.baidu.com) Kang Zhuang subway station/Link > only 1km away from your destination, click navigation >", which indicates that a hyperlink needs to be configured for the text of "Kang Zhuang subway station", and the matching rule is similar to the manner of the first example, which is not repeated here, and the return data format of the hyperlink may be: [ "color" = "#082A3A", "text" = "Kang Zhuang subway station", "url": "http:// www.baidu.com" ].
When the message is drawn, the corresponding content can be configured by using a matching rule, wherein < Link > is used for matching the corresponding text, a replaying Occurrence function provided by a matched text calling system is used for replacing the content with a text field of returned data, then a character string is converted into an NSMutableAttributeString object, and an addAdttribute (NSAttributeString. Key. Link, value: URL (string: URL) & range: rule: text) mode provided by the matching text calling system is used for converting the content into a hyperlink, namely, the target Link. Finally, the text view is used for displaying on an interface, so that the aim of responding to clicking is achieved, when a user clicks a text, a UIApplication. Shared. Open (url) function can be called, and the user jumps to the outside of the application and opens a corresponding webpage
In a third example, the character string message received by the first electronic device is "from your destination < schemeUrl (servx:// path=homeview controlleruserid=" 000111"& type=" RE FRESH ") Kang Zhuang subway station/Scheme > only 1km, and click navigation >" indicating that a jump link needs to be configured for the text of "Kang Zhuang subway station", and the matching rule is similar to the manner described in the first example, and is not repeated here. The return data format of the jump link may be:
[ "color" = "#082A3A", "text" = "Kang Zhuang subway station", "sechem": "servex:// path = HomeViewControlleruserId" = "000111" & type "=" REFRESH "")
When the message is drawn, the corresponding content can be configured by using a matching rule, wherein < sechem >/sechem > is used for matching the corresponding text, a replaying Occurrence function provided by a matched text calling system is used for replacing the content with a text field of returned data, a character string is converted into an NSMutableAttribute string object, and an addAuthoribute (NSAttributeKey. Link, value: URL (string: sechem) and range: rule: range) mode provided by the NSMutabletrion string object is converted into a jump link, namely, the target link. Finally, the text view is used for displaying on the interface, so that the aim of responding to clicking is fulfilled.
In this embodiment of the present application, when the type tag includes a skip link tag, the third target string may include module identification information of a target service module to be skipped, page identification information of a corresponding target page under the target service module, and transfer parameter information.
In this embodiment of the present application, the URL format corresponding to the jump link may be:
seresx://path=HomeViewControlleruserId="000111"&type="REFRESH
scheme e: corresponding module identifiers, such as two modules with the same class name, need to jump to the class of the corresponding module by using scheme, and jump by using scheme, and can configure different schemes according to the modules, and the corresponding parts are seresx://.
path: corresponding page identity, get path =? The star part between the two parts is jumped to the page to be displayed according to the name of the star part, and the corresponding part is path=homeview controller? .
params: the parameters required to be input into the corresponding page, such as userId and type, are connected by using a symbol, a part behind the url question mark is intercepted, and the parameters are split according to the symbol, so that the parameters can be flexibly configured, and the corresponding part is userid= "000111" and type= "REFRESH".
Continuing with the description of the above example, when the user clicks on text associated with a jump link, the user can jump to the corresponding module according to "seresx://" and decide which interface to jump to according to "path", according to "? "acquire the corresponding parameter content".
In the embodiment of the present application, the manner in which the first electronic device obtains the character string message includes, but is not limited to, at least one of the following manners:
mode one: and when the application program is in an activated state, the first electronic device periodically pulls the character string message from the second electronic device through the application program.
Mode two: and when the application program is detected to be started, the first electronic equipment acquires the character string message from the second electronic equipment through the application program.
Mode three: and when the current display page of the application program is detected to be updated, the first electronic equipment acquires the character string message from the second electronic equipment through the application program.
For the first mode, when the application program is in an active state, a timer may be started to pull the string message from the second electronic device side every N seconds, and the flow is consistent with the call flow when entering App, which is different in that the timing task may be triggered repeatedly, the latest message may be obtained continuously, and the interval pull time may be customized.
For the second mode, when the application program is detected to be started, the getallness message list method can be called once through the didfinish host withoptions, the latest character string message data is obtained according to the character string message list data api, the correct latest message quantity is displayed at the place where the total number of messages needs to be displayed, the latest character string message data is converted into a message body, the latest data is stored in a local cache by calling a real-time message body object, the local data is updated, meanwhile, a socket is used for starting long connection, and the character string message data returned by the second electronic device is monitored in real time. In particular, reference can be made to fig. 4.
For the third mode, when entering the message list page, the getallhistorymessage list may be called to obtain the history list of the string messages, read all the history string messages, and the first piece of history data of each message type is shown on the page to ensure that the user has data showing when entering the page to provide friendly user experience, then call the getallnewmessage list to pull the latest message data from the second electronic device side, and if the second electronic device returns the latest message, update the interface showing to the latest data, then prompt to display the unread quantity, and update it to the cache.
When a new message exists, the second electronic device can push the new message to the first electronic device from the remote end through Apns, and the first electronic device can analyze data when receiving the latest message. When a new message is acquired, a getAllNewMessageList method is called once, and the latest message data is acquired according to the message list data api. Converting the latest message data into a message body, calling a realm.add (message body object) to store the latest data in a local cache, and updating the local data.
Next, a data format of a message in the embodiment of the present application will be described.
The data format of the second electronic device side message in the embodiment of the present application may be as follows:
the message is a message body, and the data structure of the message body can be provided by the second electronic device or can be jointly formulated by the first electronic device and the second electronic device. The second electronic device may first generate a message list according to the format, and then push the message to the first electronic device according to the following message data format:
when the first electronic device receives the pushed message body, the push type can be determined according to the type of the message body, so that the source of the message body is distinguished, and different interfaces can be jumped according to the source of the message body. It will be appreciated that the message content in the message body is essentially the string message described above, i.e. the string message may be located in the "message content" field.
Correspondingly, the embodiment of the application also provides a method for realizing message display applied to the second electronic equipment, which comprises the following steps:
generating a character string message; the character string message comprises message configuration content and a type tag for indicating the type of the message configuration content, wherein the message configuration content comprises message content to be displayed;
And sending the character string message to the first electronic device so that the first electronic device extracts the type tag from the character string message, matching a first target character string corresponding to the message configuration content from the character string message according to a first matching rule corresponding to the type tag, determining a second target character string corresponding to the message content to be displayed from the first target character string, and configuring and displaying the message content to be displayed based on the first target character string, the second target character string and the configuration display rule corresponding to the type tag.
By the implementation method for message display provided by the embodiment of the application, after the first electronic device obtains the character string message from the second electronic device side, the configuration and display of the message content to be displayed are completed according to the character string message, wherein the message content to be displayed can be a text type message, a picture type message, a rich text type message, a hyperlink message or the like, and the configuration of the message can include but is not limited to text thickening, text color configuration, jump link configuration or the like of the corresponding message content.
It should be understood that, although the steps in the above-described flowcharts are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described above may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, and the order of execution of the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternately with at least a part of the sub-steps or stages of other steps or other steps.
Embodiment two:
based on the same inventive concept, an embodiment of the present application provides a device for implementing message display, which is applied to a first electronic device, and please refer to fig. 5, and the device includes:
a receiving module 501, configured to receive, by using an application on the first electronic device, a string message sent by a second electronic device; the character string message comprises message configuration content and a type tag for indicating the type of the message configuration content, wherein the message configuration content comprises message content to be displayed;
An extracting module 502, configured to extract the type tag from the string message;
a matching module 503, configured to match a first target string corresponding to the message configuration content from the string message according to a first matching rule corresponding to the type tag;
a determining module 504, configured to determine a second target string corresponding to the message content to be displayed from the first target string;
the configuration display module 505 is configured to implement configuration and display of the message content to be displayed based on the first target character string, the second target character string, and a configuration display rule corresponding to the type tag.
The embodiment of the application also provides a device for implementing message display, which is applied to a second electronic device, please refer to fig. 6, and the device includes:
a generating module 601, configured to generate a string message; the character string message comprises message configuration content and a type tag for indicating the type of the message configuration content, wherein the message configuration content comprises message content to be displayed;
the sending module 602 is configured to send the string message to the first electronic device, so that the first electronic device extracts the type tag from the string message, matches a first target string corresponding to the message configuration content from the string message according to a first matching rule corresponding to the type tag, determines a second target string corresponding to the message content to be displayed from the first target string, and implements configuration and display of the message content to be displayed based on the first target string, the second target string and a configuration display rule corresponding to the type tag.
It should be noted that, for simplicity of description, the content described in the above embodiment is not repeated in this embodiment.
Embodiment III:
based on the same inventive concept, embodiments of the present application provide an electronic device 700. The electronic device 700 includes a processor 701 and a memory 702, where the memory 702 stores a computer program, and the processor 701 and the memory 702 implement communications through a communication bus, and the processor 701 executes the computer program to implement the steps of the method in the first embodiment, which is not described herein.
It will be appreciated that the configuration shown in fig. 7 is merely illustrative, and that the electronic device may also include more or fewer components than shown in fig. 7, or have a different configuration than shown in fig. 7.
The processor 701 may be an integrated circuit chip having signal processing capabilities. The processor 701 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), application Specific Integrated Circuit (ASIC), an off-the-shelf programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. Which may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present application. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
Memory 702 may include, but is not limited to, random Access Memory (RAM), read Only Memory (ROM), programmable Read Only Memory (PROM), erasable read only memory (EPROM), electrically erasable read only memory (EEPROM), and the like.
The present embodiment also provides a computer readable storage medium, such as a floppy disk, an optical disk, a hard disk, a flash memory, a usb disk, an SD card, an MMC card, etc., in which one or more programs for implementing the above steps are stored, and the one or more programs may be executed by the one or more processors 501 to implement the steps of the method in the first embodiment, which is not described herein again.
It should be noted that, the illustrations provided in the present embodiment merely illustrate the basic concept of the present invention by way of illustration, and only the components related to the present invention are shown in the drawings and are not drawn according to the number, shape and size of the components in actual implementation, and the form, number and proportion of the components in actual implementation may be arbitrarily changed, and the layout of the components may be more complex. The structures, proportions, sizes, etc. shown in the drawings attached hereto are for illustration purposes only and are not intended to limit the scope of the invention, which is defined by the claims, but rather by the claims. Also, the terms such as "upper," "lower," "left," "right," "middle," and "a" and the like recited in the present specification are merely for descriptive purposes and are not intended to limit the scope of the invention, but are intended to provide relative positional changes or modifications without materially altering the technical context in which the invention may be practiced.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.

Claims (10)

1. A method for implementing message presentation, which is applied to a first electronic device, the method comprising:
receiving a character string message sent by a second electronic device through an application program on the first electronic device; the character string message comprises message configuration content and a type tag for indicating the type of the message configuration content, wherein the message configuration content comprises message content to be displayed;
Extracting the type tag from the string message;
matching a first target character string corresponding to the message configuration content from the character string message according to a first matching rule corresponding to the type tag;
determining a second target character string corresponding to the message content to be displayed from the first target character string;
and configuring and displaying the message content to be displayed based on the first target character string, the second target character string and the configuration display rule corresponding to the type tag.
2. The method for implementing message presentation according to claim 1, wherein the message configuration content further includes an attribute tag and an attribute value corresponding to the attribute tag;
the configuring and displaying the message content to be displayed based on the first target character string, the second target character string and the configuration rule corresponding to the type tag includes:
matching a third target character string corresponding to the attribute value from the first target character string according to a second matching rule corresponding to the attribute tag;
and configuring and displaying the message content to be displayed based on the second target character string, the third target character string and the configuration display rule corresponding to the type tag.
3. The method for implementing message presentation according to claim 2, wherein the implementing the configuration and display of the message content to be presented based on the second target string, the third target string, and the configuration display rule corresponding to the type tag includes:
replacing the character string message with the second target character string, and configuring a target variable into the third target character string to realize configuration and display of the message content to be displayed; the target variable is a variable corresponding to the attribute tag under the type tag.
4. The method for implementing message presentation according to claim 2, wherein when the attribute tag includes a link address tag, the implementing the configuration and display of the message content to be presented based on the second target string, the third target string, and a configuration display rule corresponding to the type tag includes:
and replacing the character string message with the second target character string, converting the third target character string into a target link, and associating the second target character string with the target link to realize the configuration and the display of the message content to be displayed.
5. The method for implementing message presentation according to claim 4, wherein the type tag includes a skip link tag, and the third target string includes module identification information of a target service module to be skipped, page identification information of a corresponding target page under the target service module, and transfer parameter information.
6. The method for implementing the message display method according to claim 1, wherein the receiving, by the application program on the first electronic device, the character string message sent by the second electronic device includes:
when the application program is in an activated state, the first electronic device periodically pulls the character string message from the second electronic device through the application program;
and/or the number of the groups of groups,
when the starting of the application program is detected, the first electronic equipment acquires the character string message from the second electronic equipment through the application program;
and/or the number of the groups of groups,
and when the current display page of the application program is detected to be updated, the first electronic equipment acquires the character string message from the second electronic equipment through the application program.
7. A method for implementing message presentation, which is applied to a second electronic device, the method comprising:
Generating a character string message; the character string message comprises message configuration content and a type tag for indicating the type of the message configuration content, wherein the message configuration content comprises message content to be displayed;
and sending the character string message to the first electronic device so that the first electronic device extracts the type tag from the character string message, matching a first target character string corresponding to the message configuration content from the character string message according to a first matching rule corresponding to the type tag, determining a second target character string corresponding to the message content to be displayed from the first target character string, and configuring and displaying the message content to be displayed based on the first target character string, the second target character string and the configuration display rule corresponding to the type tag.
8. An implementation apparatus for message presentation, which is applied to a first electronic device, the apparatus includes:
the receiving module is used for receiving the character string message sent by the second electronic equipment through the application program on the first electronic equipment; the character string message comprises message configuration content and a type tag for indicating the type of the message configuration content, wherein the message configuration content comprises message content to be displayed;
The extraction module is used for extracting the type tag from the character string message;
the matching module is used for matching a first target character string corresponding to the message configuration content from the character string message according to a first matching rule corresponding to the type tag;
the determining module is used for determining a second target character string corresponding to the message content to be displayed from the first target character string;
and the configuration display module is used for realizing the configuration and display of the message content to be displayed based on the first target character string, the second target character string and the configuration display rule corresponding to the type label.
9. An implementation apparatus for message presentation, which is applied to a second electronic device, the apparatus comprising:
the generation module is used for generating a character string message; the character string message comprises message configuration content and a type tag for indicating the type of the message configuration content, wherein the message configuration content comprises message content to be displayed;
the sending module is used for sending the character string message to the first electronic device so that the first electronic device can extract the type tag from the character string message, a first target character string corresponding to the message configuration content is matched from the character string message according to a first matching rule corresponding to the type tag, a second target character string corresponding to the message content to be displayed is determined from the first target character string, and configuration and display of the message content to be displayed are achieved based on the first target character string, the second target character string and the configuration display rule corresponding to the type tag.
10. An electronic device comprising a processor and a memory, the memory having stored therein a computer program, the processor executing the computer program to implement the method of any of claims 1-7.
CN202311272382.9A 2023-09-28 2023-09-28 Message display realization method and device and electronic equipment Pending CN117278513A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311272382.9A CN117278513A (en) 2023-09-28 2023-09-28 Message display realization method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311272382.9A CN117278513A (en) 2023-09-28 2023-09-28 Message display realization method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN117278513A true CN117278513A (en) 2023-12-22

Family

ID=89219493

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311272382.9A Pending CN117278513A (en) 2023-09-28 2023-09-28 Message display realization method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN117278513A (en)

Similar Documents

Publication Publication Date Title
EP3518124A1 (en) Webpage rendering method and related device
US9984408B1 (en) Method, medium, and system for live video cooperative shopping
US20170329565A1 (en) Information processing method, client, server, and computer-readable storage medium
CN111209374B (en) Data query display method, device, computer system and readable storage medium
CN106850406B (en) Content sharing method and device
CN113568699B (en) Content display method, device, equipment and storage medium
CN113242308B (en) Information pushing method, device, equipment and storage medium
CN114239504A (en) Form configuration method, device, equipment, readable storage medium and program product
CN112818111A (en) Document recommendation method and device, electronic equipment and medium
US20220245208A1 (en) Method for switching skin of mini-program page, and electronic device
CN112947918A (en) Data display method and device
CN111294288A (en) Traffic identification method and device, application program interface gateway and storage medium
CN108959393B (en) Dynamic picture processing method, device and storage medium
CN113656737A (en) Webpage content display method and device, electronic equipment and storage medium
CN110134920B (en) Pictogram compatible display method, device, terminal and computer readable storage medium
CN108062401B (en) Application recommendation method and device and storage medium
CN109614592B (en) Text processing method and device, storage medium and electronic equipment
CN117278513A (en) Message display realization method and device and electronic equipment
CN109391537B (en) Information processing method and device and computer storage medium
CN116150517A (en) Page processing method and device, electronic equipment and medium
CN113630612B (en) Data processing and data displaying method and device, electronic equipment and medium
CN115525834A (en) Method for screening and displaying messages, computer device and recording medium
US11258845B2 (en) Browser management system, browser management method, browser management program, and client program
CN111181836B (en) Message pushing method and device
CN114546343A (en) Generation method and device of activity page

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination