Information interaction method, device and model-view-representation architecture
Through the view model layer, the life cycle status of the target view is perceived and the view is updated in the non-destructed state, which solves the problems of low development efficiency and high cost in the MVC architecture, realizes automated view updates, reduces the burden on developers and reduces the cost of the client. cost.
Patent Information
- Application Number
- CN202010720054.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-23
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2040-08-23
AI Technical Summary
In the model-view-controller architecture, as the project scale and R&D personnel increase, development efficiency is low and complexity is high, resulting in developers needing to manually determine the view life cycle status for updates, which increases the workload and client costs.
By introducing the view model layer, it receives update data and determines the life cycle state of the target view. It only updates the view in the non-destruction state, reducing the need for developers to write code and embedding it in the client.
It reduces the workload of developers, reduces the cost of clients, and improves project development efficiency.
Smart Images

Figure CN111930761B
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of Internet technology, and in particular to an information interaction method, device, and model-view-presenter architecture. Background Art
[0002] In the past, system development was generally based on the Model-View-Controller (MVC) architecture. As development projects became larger and larger, and more and more R&D personnel participated, the MVC architecture became too complex and the project development efficiency was low. Currently, project development has developed in the direction of modularization, low coupling and high cohesion. It is very common to develop projects based on the Model-View-Presenter (Model-View-Presenter) architecture.
[0003] At present, the model-view-presenter architecture is mainly divided into three layers, namely the presenter layer, the model layer and the view layer. Among them, the separation of the model layer and the view layer is achieved by using the presenter layer. The main program logic is implemented in the presenter layer. The presenter layer is not directly related to the specific view layer. The presenter layer and the view layer interact through interfaces. When changing the view layer, the presenter layer can remain unchanged. Model-view-presenter. Summary of the invention
[0004] This disclosure section is provided to introduce concepts in a brief form, which will be described in detail in the detailed description section below. This disclosure section is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] The embodiments of the present disclosure provide an information interaction method, device, and model-view-presenter architecture.
[0006] In a first aspect, an embodiment of the present disclosure provides an information interaction method, which includes: receiving update data of a target view; sending the update data to a view model layer to instruct the view model layer to perform the following view update operation: determining the life cycle state of the target view; in response to determining that the life cycle state of the target view is in a non-destructed state, updating the target view based on the update data.
[0007] In a second aspect, an embodiment of the present disclosure provides an information interaction device, which includes: a receiving module for receiving update data of a target view; a sending module for sending the update data to a view model layer to instruct the view model layer to perform the following view update operation: determining the life cycle state of the target view; and in response to determining that the life cycle state of the target view is in a non-destructed state, updating the target view based on the update data.
[0008] In a third aspect, an embodiment of the present disclosure provides a model-view-presenter architecture, comprising: a view layer, for receiving a user's preset operation on a target view, and sending information of an update operation generated according to the preset operation to a presenter layer; a presenter layer, for receiving the information of the update operation, and sending an update information acquisition request triggered by the information of the update operation to the model layer; a model layer, for acquiring update data according to the received update information acquisition request, and sending the update data to a view model layer; a view model layer, for performing the following view update operations: determining the life cycle state of the target view; in response to determining that the life cycle state of the target view is in a non-destructed state, determining an updated target view for display based on the update data; and sending the updated target view to the view layer for display.
[0009] In a fourth aspect, an embodiment of the present disclosure provides an electronic device, comprising: one or more processors; a storage device on which one or more programs are stored, and when the one or more programs are executed by the one or more processors, the one or more processors implement the information interaction method described in the first aspect.
[0010] In a fifth aspect, an embodiment of the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the information interaction method described in the first aspect above.
[0011] The information interaction method, device and model-view-presenter architecture provided by the embodiments of the present disclosure receive update data of the target view; send the update data to the view model layer to instruct the view model layer to perform the following view update operation: determine the life cycle state of the target view; in response to determining that the life cycle state of the target view is in a non-destructed state, update the target view based on the update data. The above scheme senses the life cycle state of the target view through the view model layer, and updates the target view when the target view is in a non-destructed state, replacing the process in which the developer writes the code for determining the life cycle state of the target view and embeds the above code in the relevant client of the terminal device. On the one hand, it reduces the workload of the developer, and on the other hand, it can reduce the cost of the client. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale.
[0013] Figure 1 is a flow chart of an embodiment of the information interaction method according to the present disclosure;
[0014] Figure 2 is a structural schematic diagram of an embodiment of an information interaction device according to the present disclosure;
[0015] Figure 3 is a structural diagram of an embodiment of a model-view-presenter architecture according to the present disclosure;
[0016] Figure 4 An exemplary system architecture in which the information interaction method of an embodiment of the present disclosure can be applied;
[0017] Figure 5 The diagram is a schematic diagram of a basic structure of an electronic device provided according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0018] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0019] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0020] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0021] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0022] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0023] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0024] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present disclosure may be combined with each other.
[0025] To facilitate a better understanding of the embodiments of the present disclosure, the following explains the terms that may appear in the embodiments of the present disclosure:
[0026] The Model-View-Presenter (MVP) architecture evolved from the Model-View-Controller (MVC) architecture and is divided into three layers: the Model layer, the View layer, and the Presenter layer. The Model layer is responsible for data access operations, such as reading and writing to the database, network data requests, etc. The View layer is responsible for displaying data and providing a friendly interface for interaction with users. The Presenter layer is used to bridge the View layer and the Model layer and process business logic. In the Model-View-Presenter architecture, the Model layer and the View layer cannot interact directly. The Presenter layer can obtain the required data from the Model layer, perform some appropriate processing, and then hand it over to the View layer for display. In this way, the View layer is isolated from the Model layer through the Presenter layer, so that there is no coupling between the View layer and the Model layer, and the business logic is also extracted from the View layer.
[0027] Please refer to Figure 1 , which shows a flow chart of an embodiment of the information interaction method according to the present disclosure, such as Figure 1 As shown, the information interaction method may include the following steps 101 to 102.
[0028] Step 101: receiving update data of a target view.
[0029] In this embodiment, the above information interaction method can be executed by the model layer.
[0030] The target view may include, for example, a list view or an image view presented in a page; the update data may include, for example, information content for updating text information, image information, etc. in the target view. For example, for a student list including student A, student B, and student C, the corresponding update data may be student D. Here, student D may be used to replace any one of the other three students, or student D may be added to the student list to obtain an updated student list.
[0031] The Model layer can obtain the updated data of the target view and receive the updated data, and then send the updated data to the view model layer (ViewModel layer) so that the ViewModel layer can perform corresponding view update operations based on the updated data.
[0032] Step 102, sending the update data to the view model layer to instruct the view model layer to perform the following view update operation: determining the life cycle state of the target view; in response to determining that the life cycle state of the target view is in a non-destroyed state, updating the target view based on the update data.
[0033] After receiving the update data sent by the Model layer, the ViewModel layer can detect the life cycle state of the target view. The life cycle state here can correspond to, for example, the survival state and the destruction state of the target view, and the above survival state can include, for example, the active state, the paused state, etc. of the target view.
[0034] The active state of the target view may be a state in which the target view obtains focus in the system. When the target view is in the active state, the user may perform related operations on the target view.
[0035] The target view is in the paused state, which means that the target view does not have the focus in the system, but is still visible to the user. For example, when a transparent layer that is invisible to the user is displayed on the target view, or when there is a dialog layer on the target view, the target view is in the paused state. The user cannot perform operations on the target view in the paused state.
[0036] In practice, the life cycle state may correspond to the visible state and invisible state of the target view (for example, the alive state may correspond to the visible state, and the destroyed state may correspond to the invisible state). If the target view is in the visible state when updating the target view, the corresponding target view may be updated. The visible state here may include the state in which the target view can be seen by the user, and the invisible state may include the state in which the target view cannot be seen by the user.
[0037] Therefore, after receiving the update data of the target view, the ViewModel layer can detect the life cycle state corresponding to the target view to determine whether to update the target view using the received update data through its life cycle state.
[0038] When the ViewModel layer determines that the life cycle state of the target view is in a non-destructed state (survival state), the target view can be updated using the acquired update data. For example, the current target view is a list view including bananas, strawberries, pitaya, and peaches, and the update data corresponding to the list view is "apple". When it is determined that the life cycle state of the list view is in a non-destructed state, the update data can be added to the list view. The updated list view can include apples, that is, the updated target view includes bananas, strawberries, pitaya, peaches, and apples.
[0039] In the prior art, after the Model layer obtains data, it needs to determine the life cycle state of the target view through the code embedded in the relevant client of the terminal device to determine whether to update the target view. In this way, the developer needs to first write the code for determining the life cycle state of the target view, and then embed the code into the relevant client, which brings a heavy workload to the developer.
[0040] In this embodiment, the update data of the target view is first received; then, the update data is sent to the view model layer to instruct the view model layer to perform the following view update operations: determining the life cycle state of the target view; in response to determining that the life cycle state of the target view is in a non-destructed state, updating the target view based on the update data. The life cycle state of the target view is perceived by the view model layer, and when the target view is in a non-destructed state, the target view is updated, which replaces the process in which the developer writes the code for determining the life cycle state of the target view and embeds the above code in the relevant client of the terminal device, thereby reducing the workload of the developer.
[0041] In some optional implementations, the above-mentioned determination of the life cycle state of the target view may include: determining the life cycle state of the target view according to the life state parameters corresponding to the target view sent by the preset life state monitoring component.
[0042] In some application scenarios, the above-mentioned preset life state monitoring component can be used to monitor the life cycle status of the target view. After the preset life state monitoring component monitors the life state parameters, the life state parameters can be sent to the ViewModel layer. After receiving the life state parameters, the ViewModel layer can determine the life cycle state of the target view based on the life state parameters.
[0043] In practice, the above-mentioned preset life state monitoring component can be determined according to the specific operating system. For example, in the Android system (Android), the life state monitoring component (LifeCycle component, which can monitor the life cycle changes of the view in the Android system) set by the Android system can be used to monitor the life state parameters of the target view. LifeCycle can pass the monitored life state parameters to Livedata. Livedata can determine the life cycle state of the target view based on the above-mentioned life state parameters. Livedata can be used as the storage content of the view model layer. In this way, the view model layer can determine the life cycle state of the target view through Livedata. In the Apple operating system (IOS), the corresponding life state monitoring component (RxLifecycle, the IOS system can monitor the life cycle changes of the view) can be used to monitor the life state parameters corresponding to the target view, and the monitored life state parameters are sent to the ViewModel layer, so that the ViewModel layer can determine the life cycle state of the target view. The Android system and the Apple system here are well-known operating systems in the prior art, and those skilled in the art understand their working principles and will not be repeated here.
[0044] After the ViewModel layer determines that the life cycle state of the target view is a non-destruct state based on the received life state parameters, the target view can be updated based on the received update data. For example, when the life cycle state of the target view is determined to be a non-destruct state based on the life state parameters, the data to be updated representing the time 12:00 in the current target view can be updated to 12:01.
[0045] In these optional implementations, by using the above-mentioned preset life state monitoring component to monitor the life state parameters corresponding to the target view, and determining the life cycle state of the target view based on the life state parameters, the process of developers writing code for determining the life cycle of the target view and embedding the above code in the relevant client of the terminal device is replaced. On the one hand, it can reduce the burden on developers, and on the other hand, it can reduce costs.
[0046] In some optional implementations, before sending the update data to the view model layer, the information interaction method further includes: converting the update data into display data corresponding to the target view.
[0047] After the Model layer receives the update data, it can process the received update data accordingly. The processed update data (that is, display data) can be directly displayed in the target view. For example, if the received update data is "2020, 6, 8", when the update data here represents the date, the update data can be converted into a conventional format for representing the date, and the display data is obtained: 2020.06.08.
[0048] After converting the update data into the display data, in response to determining that the life cycle state of the target view is in a non-destructed state, updating the target view based on the update data may include: updating the target view based on the display data.
[0049] The ViewModel layer can update the target view according to the display data so that the user can intuitively see the corresponding information content. For example, after updating the target view with the above display data "2020.06.08", "2020.06.08" can be displayed in the target view, and then the user can see the corresponding information content "2020.06.08".
[0050] In some optional implementations, before determining the life cycle state of the target view, the view update operation further includes: storing presentation data.
[0051] After the Model layer converts the update data into the corresponding display data, it can be sent to the ViewModel layer, which stores the display data so that the display data will not be lost. When it is detected that the life cycle state of the target view is not destroyed, the corresponding display data can be directly extracted to update the target view.
[0052] In some optional implementations, in response to determining that the life cycle state of the target view is in a non-destroyed state, updating the target view based on the update data includes: in response to determining that the life cycle state of the target view is in a non-destroyed state, sending the display data to the view layer, so that the view layer updates the target view according to the display data.
[0053] After receiving the display data, the View layer can update the target view based on the display data (that is, display the display data) to obtain the information content that the user wants to browse. For example, if the display data is "2020.07.17", the View layer can use the display data to update the target view, and the information content of "2020.07.17" can be displayed in the View layer.
[0054] In some optional implementations, before the above step 101, the information interaction method also includes: receiving an update information acquisition request sent by the presentation layer, the update information acquisition request is triggered by the presentation layer according to the update operation information sent by the view layer, and the update operation information is generated by the view layer according to the preset operation performed by the user.
[0055] The user can perform a preset operation on the target view on the user terminal to instruct the user terminal to display the corresponding updated target view. The preset operation here can be, for example, a downward sliding operation in the current interface, or a triggering operation on a preset update control, which can substantially indicate an operation to update the target view. The preset update control here can include, for example, a preset button, etc.
[0056] When the View layer detects that the user has performed the above preset operation, it can generate update operation information corresponding to the preset operation. The update operation information here may include information corresponding to the preset operation, for example, corresponding to the preset operation of adding information content, and the update operation information can represent information that triggers the add button in the current view to add information content. After the View layer generates the above update operation information, it can be sent to the Presenter layer. After the Presenter layer receives the update operation information, it can trigger a corresponding update information acquisition request and send the update information acquisition request to the Model layer, so that the Model layer can obtain the corresponding update data according to the update information acquisition request.
[0057] For example, when the user clicks the download button in the target view to obtain a preset operation of a cloud image, the preset operation can be detected by the View layer, and then the View layer can send the generated corresponding update operation information (that is, the information of obtaining the cloud image corresponding to the above-mentioned click operation) to the Presenter layer, and then the Presenter layer can trigger an update information acquisition request such as "Please obtain the cloud image". The Presenter layer then sends the update information acquisition request to the Model layer so that the Model layer can obtain the corresponding target cloud image. In some application scenarios, the update information acquisition request can include acquisition location information corresponding to the update data, such as the website address of the production update data, the corresponding website information, etc. In this way, when the Model layer obtains the update data, it can quickly and accurately obtain the corresponding update data based on the corresponding acquisition location information.
[0058] In some optional implementations, the update operation includes at least one of the following: an insert operation, a delete operation, a modify operation, or a query operation.
[0059] The above-mentioned insertion operation may, for example, include a preset operation of clicking an "Insert" button to insert year information, identity information or brief introduction information, etc. into the current list, and then a target list with the above-mentioned year information, identity information or brief introduction information, etc. added may be obtained; the above-mentioned deletion operation may, for example, include a preset operation of long pressing the object to be deleted "pear" to delete "pear" from the current list containing "apple", "banana" and "pear", and then a target list containing only "apple" and "banana" may be obtained; the above-mentioned modification operation may, for example, include a preset operation of replacing a landscape picture in the current view with a person's photo; the above-mentioned query operation may, for example, include a preset operation of clicking a "Query" button to query the logistics information of the target goods, etc.
[0060] In some optional implementations, the view update operation may further include: in response to determining that the life cycle state of the target view is in a destroyed state, not updating the target view.
[0061] That is to say, if the ViewModel layer detects that the life cycle state of the target view is in the destroyed state, the target view may not be updated. For example, after the Model layer obtains the updated data, but before the target view is updated with the updated data, the user closes the application corresponding to the target view. At this time, the target view can be regarded as being in the destroyed state, and the ViewModel layer may not update the target view. In these optional implementations, when the life cycle of the target view is in the destroyed state, if the updated data of the target view is received, the target view does not need to be updated. This reduces the resource consumption caused by background updates of the target view.
[0062] Further, after the target view is not updated in response to determining that the lifecycle state of the target view is in the destroyed state, the view update operation further includes: in response to determining that the target view is not updated, clearing update data of the target view.
[0063] In some application scenarios, if the ViewModel layer determines that the target view will not be updated, it can delete the previously stored update data to free up memory.
[0064] Please refer to Figure 2 , which shows a schematic diagram of the structure of an embodiment of an information interaction device according to the present disclosure, such as Figure 2 As shown, the information interaction device includes a receiving module 201 and a sending module 202. The receiving module 201 is used to receive the update data of the target view; the sending module 202 is used to send the update data to the view model layer to instruct the view model layer to perform the following view update operations: determine the life cycle state of the target view; in response to determining that the life cycle state of the target view is in a non-destructed state, update the target view based on the update data.
[0065] It should be noted that the specific processing of the receiving module 201 and the sending module 202 of the information interaction device and the technical effects thereof can be referred to respectively. Figure 1 The relevant descriptions of step 101 to step 102 in the corresponding embodiment are not repeated here.
[0066] In some optional implementations of this embodiment, the sending module 202 is further used to instruct the view model layer: determine the life cycle state of the target view according to the life state parameters corresponding to the target view sent by the preset life state monitoring component.
[0067] In some optional implementations of this embodiment, the information interaction device further includes a conversion module, which is used to: convert the update data into display data corresponding to the target view before sending the update data to the view model layer. And the sending module 202 is further used to instruct the view model layer to update the target view based on the display data.
[0068] In some optional implementations of this embodiment, the sending module 202 is further used to instruct the view model layer to store the presentation data before determining the life cycle state of the target view.
[0069] In some optional implementations of this embodiment, the sending module 202 is further used to instruct the view model layer: in response to determining that the life cycle state of the target view is in a non-destructed state, send the display data to the view layer, so that the view layer updates the target view according to the display data.
[0070] In some optional implementations of this embodiment, the information interaction device also includes a first receiving module, which is used to: before receiving the update data of the target view, receive an update information acquisition request sent by the presentation layer, the update information acquisition request is triggered by the presentation layer according to the information of the update operation sent by the view layer, and the update operation information is generated by the view layer according to the preset operation performed by the user.
[0071] In some optional implementations of this embodiment, the update operation includes at least one of the following: an insert operation, a delete operation, a modify operation, or a query operation.
[0072] In some optional implementations of this embodiment, the view update operation further includes: in response to determining that the life cycle state of the target view is in a destroyed state, not updating the target view.
[0073] In some optional implementations of this embodiment, the sending module 202 is further used to instruct the view model layer: in response to determining that the life cycle state of the target view is in a destroyed state and after not updating the target view, perform the following view update operation: in response to determining that the target view is not to be updated, clear the update data of the target view.
[0074] Please refer to Figure 3 , which shows a structural diagram of an embodiment of the model-view-presenter architecture according to the present disclosure, such as Figure 3 As shown, the model-view-presenter architecture may include a view layer 301, a presenter layer 302, a model layer 303, and a view model layer 304. The view layer 301 is used to receive a preset operation of a user on a target view, and send information of an update operation generated according to the preset operation to the presenter layer 302; the presenter layer 302 is used to receive information of an update operation, and send an update information acquisition request triggered by the information of the update operation to the model layer 303; the model layer 303 is used to acquire update data according to the received update information acquisition request, and send the update data to the view model layer 304; the view model layer 304 is used to perform the following view update operations: determining the life cycle state of the target view; in response to determining that the life cycle state of the target view is in a non-destructed state, determining an update target view for display based on the update data; and sending the update target view to the view layer 301 for display.
[0075] For example, in the article browsing interface, the user performs a preset operation of sliding down to obtain the article information of the next page. At this time, the view layer 301 receives the sliding operation and generates the corresponding update operation information according to the sliding operation. The update operation information here can be, for example, the information of "slide down to obtain the article information of the next page". And the update operation information can be sent to the presentation layer 302; after the presentation layer 302 receives the update operation information, it can trigger the corresponding update information acquisition request of "request to obtain the article information of the next page of the current page", and can send the update information acquisition request to the model layer 303. After receiving the update information acquisition request, the model layer 302 can know the specific information data to be obtained, and perform the acquisition operation, download the article information corresponding to the next page and transmit it to the view model layer 304 for storage. After receiving the article information corresponding to the next page, the view model layer 304 can detect whether the current life cycle state of the target view is a non-destructed state. Here, if it is detected that the user is still staying in the above current page and waiting to browse the next page after the update or retaining the above current page, which is essentially the detection result that the target view is in a non-destroyed state, the above current page can be updated based on the acquired article information of the next page, that is, the article information of the next page is displayed to the user in the user interface. If it is detected that the user has closed the application for browsing the article or exited the page for browsing the article, which is essentially the detection result that the target view is in a destroyed state, the current page may not be updated.
[0076] In the prior art, after the Model layer obtains data, it needs to determine the life cycle state of the target view through the code embedded in the relevant client of the terminal device to determine whether to update the target view. In this way, the developer needs to first write the code for determining the life cycle state of the target view, and then embed the code into the relevant client, which brings a heavy workload to the developer.
[0077] This embodiment monitors the life cycle state of the target view in the View layer through the newly added view model layer 304 (ViewModel layer), implements the life cycle state awareness function of the model-view-presenter architecture, and can update the target view when it is perceived that the target view in the View layer is in a non-destructed state, thereby reducing the workload of developers.
[0078] Please refer to Figure 4 , which shows an exemplary system architecture in which the information interaction method of an embodiment of the present disclosure can be applied.
[0079] like Figure 4As shown, the system architecture may include terminal devices 401, 402, 403, a network 404, and a server 405. The network 404 is used to provide a medium for a communication link between the terminal devices 401, 402, 403 and the server 405. The network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The above-mentioned terminal devices and servers may communicate using any currently known or future developed network protocols such as HTTP (HyperText Transfer Protocol), and may be interconnected with digital data communications (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), internets (e.g., the Internet), and peer-to-peer networks (e.g., Ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
[0080] The terminal devices 401, 402, 403 can interact with the server 405 through the network 404 to receive or send messages, etc. Various client applications can be installed on the terminal devices 401, 402, 403, such as video publishing applications, search applications, and news information applications.
[0081] Terminal devices 401, 402, 403 can be hardware or software. When terminal devices 401, 402, 403 are hardware, they can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, Moving Picture Experts Group Audio Layer 3), MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Group Audio Layer 4) players, laptop computers and desktop computers, etc. When terminal devices 401, 402, 403 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, software or software modules used to provide distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0082] Server 405 can be a server that can provide various services, such as receiving update data acquisition requests sent by terminal devices 401, 402, and 403, analyzing and processing the update data acquisition requests, and sending the analysis and processing results (such as update data corresponding to the above-mentioned update data acquisition requests) to terminal devices 401, 402, and 403.
[0083] It should be noted that the information interaction method provided in the embodiment of the present disclosure can be executed by a terminal device, and accordingly, the information interaction device can be set in the terminal device.
[0084] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0085] Reference below Figure 5 , which shows an electronic device (eg, Figure 4 Schematic diagram of the structure of the terminal device in the system. Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0086] like Figure 5 As shown, the electronic device may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the electronic device are also stored. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0087] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although Figure 5 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0088] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 509, or installed from a storage device 508, or installed from a ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0089] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0090] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0091] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: receives update data of the target view; sends the update data to the view model layer to instruct the view model layer to perform the following view update operations: determines the life cycle state of the target view; in response to determining that the life cycle state of the target view is in a non-destructed state, updates the target view based on the update data.
[0092] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0093] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0094] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of the module does not limit the unit itself in some cases. For example, the receiving module may also be described as a "module for receiving update data of the target view".
[0095] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0096] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0097] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0098] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0099] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
Claims
1. An information interaction method, It is characterized in that include: The model layer receives updated data from the target view; The update data is sent to the view model layer to instruct the view model layer to perform the following view update operation: determining the life cycle state of the target view; In response to determining that the life cycle state of the target view is in a non-destroyed state, updating the target view based on the update data; Before sending the update data to the view model layer, the method further includes: the model layer converting the update data into display data corresponding to the target view; and In response to determining that the life cycle state of the target view is in a non-destructed state, updating the target view based on the update data includes: The target view is updated based on the presentation data.
2. The method according to claim 1, It is characterized in that Determining the life cycle state of the target view includes: The life cycle state of the target view is determined according to the life state parameter corresponding to the target view sent by the preset life state monitoring component.
3. The method according to claim 1, It is characterized in that Before determining the life cycle state of the target view, the view update operation further includes: The presentation data is stored.
4. The method according to claim 1, It is characterized in that In response to determining that the life cycle state of the target view is in a non-destructed state, updating the target view based on the update data includes: In response to determining that the life cycle state of the target view is in a non-destructed state, the presentation data is sent to a view layer, so that the view layer updates the target view according to the presentation data.
5. The method according to claim 1, It is characterized in that Before receiving the update data of the target view, the method further includes: Receive an update information acquisition request sent by the presentation layer, wherein the update information acquisition request is triggered by the presentation layer according to the update operation information sent by the view layer, and the update operation information is generated by the view layer according to a preset operation performed by the user.
6. The method according to claim 5, It is characterized in that The update operation includes at least one of the following: an insert operation, a delete operation, a modify operation or a query operation.
7. The method according to claim 1, It is characterized in that The view update operation further includes: In response to determining that the lifecycle state of the target view is in a destroyed state, the target view is not updated.
8. The method according to claim 7, It is characterized in that After the target view is not updated in response to determining that the life cycle state of the target view is in the destroyed state, the view update operation further includes: In response to determining not to update the target view, update data of the target view is cleared.
9. An information interaction device, It is characterized in that include: Receiving module: The model layer is used to receive updated data of the target view; A sending module, used to send the update data to the view model layer to instruct the view model layer to perform the following view update operation: determine the life cycle state of the target view; In response to determining that the life cycle state of the target view is in a non-destroyed state, updating the target view based on the update data; A conversion module, the model layer is used to convert the update data into display data corresponding to the target view before sending the update data to the view model layer; as well as In response to determining that the life cycle state of the target view is in a non-destructed state, updating the target view based on the update data includes: The target view is updated based on the presentation data.
10. A model-view-presenter architecture, It is characterized in that include: The view layer is used to receive the preset operation of the user on the target view, and send the update operation information generated according to the preset operation to the presenter layer; The presenter layer is used to receive the update operation information and send an update information acquisition request triggered by the update operation information to the model layer; The model layer is used to obtain update data according to the received update information acquisition request, and send the update data to the view model layer; The view model layer is used to perform the following view update operations: determine the life cycle state of the target view; In response to determining that the life cycle state of the target view is in a non-destroyed state, determining an updated target view for display based on the update data; as well as Sending the updated target view to the view layer for display; The model layer is further used to convert the update data into display data corresponding to the target view before sending the update data to the view model layer; as well as In response to determining that the life cycle state of the target view is in a non-destructed state, updating the target view based on the update data includes: The target view is updated based on the presentation data.
11. An electronic device, It is characterized in that include: one or more processors; A storage device having one or more programs stored thereon, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of claims 1-8.
12. A computer readable medium having a computer program stored thereon, It is characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
