Event response method and device
By using the preset view object response object sequence and reflection mechanism to simplify event response in application development, the problems of cumbersome event delivery and slow response speed are solved, and development efficiency and response speed are improved.
Patent Information
- Application Number
- CN202010579242.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-06-23
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2040-06-23
AI Technical Summary
During the application development process, existing technology is difficult to efficiently respond to events generated by user operations, resulting in a cumbersome event delivery process and a lot of redundant code, which affects development efficiency and response speed.
By creating events corresponding to user operations, and using the preset view object response object sequence to find the response object, the response object is controlled to complete the event response based on the reflection mechanism, avoiding layer-by-layer transmission and judgment, and simplifying the event processing process.
It improves application development efficiency, reduces redundant code, improves event response speed, and reduces terminal response delay.
Smart Images

Figure CN113835697B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and in particular to an event response method and device. Background Art
[0002] With the rapid development and popularization of mobile Internet, a large number of applications have emerged based on mobile terminals to provide various services to meet the daily needs of users. Since many applications need to rely on interaction with users to provide services, how to respond to events generated by user operations is one of the issues that must be considered and solved during the development of some applications.
[0003] In the process of implementing the present application, the inventor found that: each application is usually composed according to a certain structure, including each page of the application is designed according to a certain view structure. On this basis, the events generated by user operations are usually transmitted layer by layer according to the view structure, and each layer receives the transmitted events in turn and determines whether it can respond. If it cannot respond to the event, it continues to pass it to the next object until an object that can respond to the event is found to complete the response to the event. Summary of the invention
[0004] The embodiments of the present disclosure provide an event response method and device.
[0005] In a first aspect, an embodiment of the present disclosure provides an event response method, the method comprising: in response to detecting a user operation on an application, creating an event corresponding to the user operation; passing the event to a view object corresponding to the user operation; determining a response object for the event based on a preset response object sequence corresponding to the view object, wherein the response object sequence is determined based on a view hierarchy of the application; and controlling the response object to respond to the event.
[0006] In some embodiments, controlling the response object to respond to the event includes: controlling the response object to respond to the event based on a reflection mechanism.
[0007] In some embodiments, based on the reflection mechanism, controlling the response object to respond to the event includes: obtaining a preset string corresponding to the event; reflecting the string to determine the response method corresponding to the event; controlling the response object to execute the response method to complete the response to the event.
[0008] In some embodiments, the application is an IOS application; and the sequence of response objects corresponding to the view object is a response chain corresponding to the view object.
[0009] In a second aspect, an embodiment of the present disclosure provides an event response device, which includes: a creation unit, configured to create an event corresponding to a user operation in response to detecting a user operation on an application; a delivery unit, configured to deliver the event to a view object corresponding to the user operation; a determination unit, configured to determine a response object of the event based on a preset sequence of response objects corresponding to the view object, wherein the sequence of response objects is determined based on a view hierarchy of the application; and a response unit, configured to control the response object to respond to the event.
[0010] In some embodiments, the response unit is further configured to: control the response object to respond to the event based on a reflection mechanism.
[0011] In some embodiments, the response unit is further configured to: obtain a preset string corresponding to the event; determine a response method corresponding to the event through reflection of the string; and control the response object to execute the response method to complete the response to the event.
[0012] In some embodiments, the application is an IOS application; and the sequence of response objects corresponding to the view object is a response chain corresponding to the view object.
[0013] In a third aspect, an embodiment of the present disclosure provides a terminal, comprising: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by one or more processors, the one or more processors implement the method described in any implementation manner in the first aspect.
[0014] In a fourth 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 method described in any implementation manner in the first aspect.
[0015] The event response method and device provided by the embodiments of the present disclosure create an event corresponding to a user operation and pass the event to a view object associated with the user operation, and then use a preset response object sequence corresponding to the view object to search for the response object of the event, and control the response object of the found event to complete the response to the event. Thus, the response object of the event can be directly found using the preset response object sequence, without the need for the view object to pass the event layer by layer and make judgments at each layer. In this way, for developers, for each event, there is no need to destroy the code structure of each layer, thereby avoiding the implementation of a large amount of redundant code at each layer and improving the development efficiency of the application. For users, responding to events in a simple way helps to improve the event response speed of the application, thereby reducing the response delay of the terminal. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Other features, objects and advantages of the present disclosure will become more apparent from the detailed description of non-limiting embodiments made with reference to the following drawings:
[0017] Figure 1 is an exemplary system architecture diagram in which an embodiment of the present disclosure may be applied;
[0018] Figure 2 is a flow chart of an embodiment of an event response method according to the present disclosure;
[0019] Figure 3 is a flow chart of another embodiment of the event response method according to the present disclosure;
[0020] Figure 4 is a schematic diagram of an application scenario of an event response method according to an embodiment of the present disclosure;
[0021] Figure 5 is a schematic diagram of the structure of an embodiment of an event response device according to the present disclosure;
[0022] Figure 6 It is a schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION
[0023] The present disclosure is further described in detail below in conjunction with the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the relevant invention are shown in the accompanying drawings.
[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. The present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0025] Figure 1 An exemplary architecture 100 is shown to which an embodiment of an event response method or an event response apparatus of the present disclosure can be applied.
[0026] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0027] The terminal devices 101, 102, 103 interact with the server 105 through the network 104 to receive or send messages, etc. Various client applications may be installed on the terminal devices 101, 102, 103. For example, browser applications, search applications, instant messaging tools, social platform software, information flow applications, etc.
[0028] Terminal devices 101, 102, 103 can be hardware or software. When terminal devices 101, 102, 103 are hardware, they can be various electronic devices, including but not limited to smart phones, tablet computers, e-book readers, laptop portable computers and desktop computers, etc. When terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above. It can be implemented as multiple software or software modules (for example, multiple software or software modules for providing distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0029] The server 105 may be a server providing various services, such as a backend server providing support for client applications installed on the terminal devices 101, 102, 103. The server 105 may receive requests sent by the terminal devices 101, 102, 103 and respond, and feed back the response results to the terminal devices 101, 102, 103.
[0030] It should be noted that the above client application can also be used offline. In this case, the use of the client application does not require the interaction of the server 105, and the server 105 and the network 104 may not exist.
[0031] It should be noted that the event response method provided in the embodiments of the present disclosure is generally executed by the terminal devices 101 , 102 , 103 , and accordingly, the event response device is generally provided in the terminal devices 101 , 102 , 103 .
[0032] It should also be noted that the server 105 itself can also be regarded as a terminal device, and various types of applications can also be installed on the server 105. The application installed on the server 105 can also detect user operations and respond to the corresponding events. In this case, the event response method can also be executed by the server 105, and accordingly, the event response device can also be set in the server 105. At this time, the exemplary system architecture 100 may not have terminal devices 101, 102, 103 and network 104.
[0033] It should be noted that the server 105 can be hardware or software. When the server 105 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or it can be implemented as a single server. When the server 105 is software, it can be implemented as multiple software or software modules (for example, multiple software or software modules for providing distributed services), or it can be implemented as a single software or software module. No specific limitation is made here.
[0034] It should be understood that Figure 1 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 the implementation requirements.
[0035] Continue to refer Figure 2 , which shows a process 200 of an embodiment of an event response method according to the present disclosure. The event response method comprises the following steps:
[0036] Step 201: In response to detecting a user operation on an application, an event corresponding to the user operation is created.
[0037] In this embodiment, the application may refer to the execution subject of the event response method of the present disclosure (such as Figure 1 The client application installed on the terminal devices 101, 102, and 103 shown in the figure. Depending on the different execution entities, the application can be different types of applications. For example, the execution entity can use the Android operating system. In this case, the application can be an Android application. For another example, the execution entity can use the IOS operating system. In this case, the application can be an IOS application.
[0038] User operations may refer to various operations that can be detected and received by the application. For example, click operations, sliding operations, etc. When the above-mentioned execution subject detects a user operation on the application, it can create an event (such as Event) corresponding to the user operation. The created event can be used to characterize the user operation. It should be understood that the created event can indicate various attribute information of the user operation (such as the type and time of the user operation, etc.).
[0039] It should be noted that the method of creating events may be different for different types of execution entities (such as different operating systems, etc.), different types of applications (such as applications developed in different languages, etc.) and other actual application scenarios.
[0040] Step 202: pass the event to the view object corresponding to the user operation.
[0041] In this embodiment, the view object corresponding to the user operation may refer to the object of the view (such as View) when the user operation occurs. For example, when the user operation is an operation of contacting the display device (such as a display screen) of the above-mentioned execution subject, the view object corresponding to the user operation may be the object of the view where the user touches the display screen.
[0042] As an example, when a user clicks a button on the homepage of a client application installed on the execution subject, the execution subject can notify the operating system to create an event indicating the detected user operation when detecting the contact of the user's finger or stylus pen with its screen. The operating system can then pass the created event to the event queue of the currently running client application. The client application will then pass the event in the event queue to the object of the view where the button clicked by the user is located.
[0043] Step 203: Determine the response object of the event according to a preset response object sequence corresponding to the view object.
[0044] In this embodiment, the response object sequence corresponding to the view object may refer to a preset response object sequence corresponding to the view corresponding to the view object. In other words, a response object sequence corresponding to each view of the application may be preset in advance.
[0045] Among them, the response object sequence corresponding to each view can be determined according to the view hierarchy of the application. Generally, the view hierarchy of the application has been determined during the development phase of the application, that is, the view hierarchy of the application is pre-designed. The view hierarchy of the application can be used to characterize the hierarchical relationship between the views of the application. For example, which subviews are included under the root view, and which other subviews each subview has, etc. Specifically, the response object sequence corresponding to each view can be composed of the objects of each view included in the path from the view to the root view in hierarchical order.
[0046] It should be understood that the response object sequence corresponding to each view includes the view, that is, the view Figure 1 In some cases, it can also respond to events corresponding to user operations. For each view, the object of the view can be determined according to the actual application scenario. For example, the object of the view can be the created view object, or the view controller corresponding to the view, etc.
[0047] For each event corresponding to a user operation, the response object of the event can be pre-designed according to the actual application requirements during the application development stage. At this time, it is only necessary to search for the preset response object corresponding to the event from the response object sequence corresponding to the view object corresponding to the user operation.
[0048] Step 204: Control the response object to respond to the event.
[0049] In this embodiment, when a response object that can respond to the event is found from the response object sequence corresponding to the view object, the response object can be further used to complete the response to the event corresponding to the user operation, that is, complete the response to the user operation.
[0050] In some optional implementations of this embodiment, when the application is an IOS application, the above response object sequence may be a responder chain. The responder chain is designed natively by IOS and can completely connect all participating objects according to the hierarchical relationship.
[0051] In the event transmission and processing process of the iOS system, events are usually transmitted layer by layer according to the view hierarchy. After receiving the event, each layer determines whether it can respond. If it cannot respond, it continues to pass it to the next layer, and so on.
[0052] By using the response chain to find the response object of the event corresponding to the currently detected user operation, that is, using the response chain to find the level that can respond to the current event, the response chain can be put into play to simplify application development and increase the speed of application development.
[0053] The method provided by the above-mentioned embodiment of the present disclosure presets a response object sequence corresponding to each view, and then after detecting a user operation and creating a corresponding event, the response object that can respond to the event can be directly found from the response object sequence of the view object corresponding to the user operation, so as to complete the response to the user operation using the found response object. In this way, when processing event transmission, the object of each view does not need to implement operations such as receiving events transmitted by objects of other views, judging whether it can respond, and further transmitting the event to objects of other views when it cannot respond, that is, it is not necessary to continuously perform transparent transmission between objects, nor is it necessary to invade the corresponding code into each level, thereby avoiding developers from implementing a large amount of redundant code to ensure the simplicity and high maintainability of the code structure related to each view. At the same time, based on this event transmission and response processing method, the processing speed of events corresponding to user operations can be improved, thereby reducing the response delay to user operations.
[0054] Further references Figure 3 , which shows a process 300 of another embodiment of an event response method. The process 300 of the event response method includes the following steps:
[0055] Step 301: In response to detecting a user operation on an application, an event corresponding to the user operation is created.
[0056] Step 302: pass the event to the view object corresponding to the user operation.
[0057] Step 303: Determine the response object of the event according to a preset response object sequence corresponding to the view object.
[0058] Step 304: Based on the reflection mechanism, control the response object to respond to the event.
[0059] In this embodiment, the reflection mechanism is a mechanism for indirectly operating the target object. In the running state of the application, an object of any class can be constructed, the class to which any object belongs, the member variables and methods of any class can be understood, and the properties and methods of any object can be called, etc. The reflection mechanism is a well-known technology that is currently widely studied and applied, and will not be described in detail here.
[0060] By using the reflection mechanism, controlling the response object to respond to events can improve the flexibility of the application and save a lot of processing resources during the operation of the application, thereby helping to improve the flexibility and convenience of application updates.
[0061] In some optional implementations of this embodiment, the reflection mechanism can be used to control the response object to complete the response to the event through the following steps: obtaining a preset string corresponding to the event; reflecting the string to determine the response method corresponding to the event; controlling the response object to execute the response method to complete the response to the event.
[0062] For each event generated by a user operation, a corresponding string can be pre-set by a technician. For example, the string can be set to be the same as the method name of the method that the response object of the event completes the response to the event. Afterwards, the string can be used for reflection to find the response method corresponding to the string from the methods that the response object of the event can call, and then the response object can call the response method found by reflection to complete the response to the event. In this way, the flexibility of the application code can be further improved, thereby improving the scalability of the application.
[0063] The specific execution process of the above steps 301, 302, 303 and the contents not described in detail can be referred to Figure 2 The relevant descriptions of the relevant contents in the corresponding embodiments are not repeated here.
[0064] Continue to see Figure 4 , Figure 4 FIG. 4 is an exemplary application scenario 400 of the event response method according to this embodiment. Figure 4 In the application scenario, the user browses the page using the terminal 401. As shown in the figure, the page includes two buttons. One button is used to indicate loading more information, and the other button is used to indicate returning to the previous page.
[0065] The position of the view where the button "Load More" is located is shown in the dotted box indicated by reference numeral 4011, and the position of the view where the button "Back" is located is shown in the dotted box indicated by reference numeral 4012. The views where these two buttons are located are subviews of the view where the current page is located. The position of the view where the current page is located is shown in the dotted box indicated by reference numeral 4013 in the figure.
[0066] After the user clicks the Load More button, a corresponding click event is created, and then the corresponding response chain "BT1View-topView(BT1View)-Window-Application" of the button can be used to find the object that can respond to the click event. Among them, "BT1View" is the view object corresponding to the button "Load More". "topView" is the parent view of the view corresponding to "BT1View", that is, the view object corresponding to the current page. "Window" refers to the window object where the current page is located. "Application" refers to the application that displays the current page.
[0067] Through the response chain search, it can be determined that the view object corresponding to the current page responds to the click event. Then, the pre-set string "LoadMore" corresponding to the click event can be used for reflection to find the method "LoadMore()" that can be called by the view object corresponding to the current page, and the view object corresponding to the current page calls this method to complete the response to the click event, that is, to display more information to the user on the current page (as shown by the label 401 in the figure).
[0068] The method provided by the above-mentioned embodiment of the present disclosure uses the response object sequence to find the response object of the event corresponding to the user operation, and uses the reflection mechanism to find the response method of the event corresponding to the user operation, that is, uses the response chain to find the level that can respond to the current event, and then uses the reflection mechanism to find the behavior that can handle the event, so that the response object calls the found response method to complete the response to the event corresponding to the user operation. In this way, remote communication between any two objects involved in event transmission can be realized without the need for continuous transparent transmission between each object, which helps to improve event transmission and response efficiency, and helps to improve the flexibility of application code and the scalability of applications.
[0069] Further references Figure 5 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an event response device, which is similar to Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0070] like Figure 5As shown, the event response device 500 provided in this embodiment includes a creation unit 501, a transmission unit 502, a determination unit 503 and a response unit 504. The creation unit 501 is configured to create an event corresponding to the user operation in response to detecting a user operation on an application; the transmission unit 502 is configured to transmit the event to the view object corresponding to the user operation; the determination unit 503 is configured to determine the response object of the event according to a preset response object sequence corresponding to the view object, wherein the response object sequence is determined according to the view hierarchy of the application; and the response unit 504 is configured to control the response object to respond to the event.
[0071] In this embodiment, in the event response device 500, the specific processing of the creation unit 501, the transmission unit 502, the determination unit 503 and the response unit 504 and the technical effects thereof can be referred to in Figure 2 The relevant descriptions of step 201, step 202, step 203 and step 204 in the corresponding embodiment are not repeated here.
[0072] In some optional implementations of this embodiment, the above-mentioned response unit 504 is further configured to: control the response object to respond to the event based on the reflection mechanism.
[0073] In some optional implementations of this embodiment, the above-mentioned response unit 504 is further configured to: obtain a preset string corresponding to the event; determine the response method corresponding to the event through reflection of the string; control the response object to execute the response method to complete the response to the event.
[0074] In some optional implementations of this embodiment, the application is an IOS application; and the response object sequence corresponding to the view object is a response chain corresponding to the view object.
[0075] The device provided by the above-mentioned embodiment of the present disclosure creates an event corresponding to the user operation in response to detecting the user operation on the application through a creation unit; the transmission unit transmits the event to the view object corresponding to the user operation; the determination unit determines the response object of the event according to a preset response object sequence corresponding to the view object, wherein the response object sequence is determined according to the view hierarchy of the application; the response unit controls the response object to respond to the event, thereby avoiding developers from implementing a large amount of redundant code to ensure the simplicity and high maintainability of the code structure related to each view. At the same time, based on this event transmission and response processing method, the processing speed of the event corresponding to the user operation can be improved, thereby reducing the response delay to the user operation.
[0076] Reference below Figure 6 , which shows an electronic device (eg, Figure 1The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The terminal device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0077] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0078] Typically, the following devices may be connected to the I / O interface 605: an input device 606 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 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, 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. Figure 6 Each block shown in the figure may represent one device, or may represent multiple devices as required.
[0079] 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 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 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0080] It should be noted that the computer-readable medium described in the embodiments of the present disclosure 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 embodiments of the present disclosure, the computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device. In the embodiments of the present disclosure, the 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 electromagnetic signals, optical signals, 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.
[0081] The computer-readable medium may be included in the terminal device, or may exist independently without being installed in the terminal device. The computer-readable medium carries one or more programs. When the one or more programs are executed by the terminal device, the terminal device: creates an event corresponding to the user operation in response to detecting a user operation on the application; transmits the event to the view object corresponding to the user operation; determines the response object of the event according to a preset response object sequence corresponding to the view object, wherein the response object sequence is determined according to the view hierarchy of the application; and controls the response object to respond to the event.
[0082] Computer program code for performing the operations of embodiments of the present disclosure may be written in one or more programming languages or a combination thereof, including 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 a user's computer, partially on a user's computer, as a separate software package, partially on a 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 via 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., via the Internet using an Internet service provider).
[0083] 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.
[0084] The units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. The described units may also be provided in a processor, for example, may be described as: a processor including a creation unit, a transfer unit, a determination unit, and a response unit. The names of these units do not constitute limitations on the units themselves in certain circumstances, for example, the creation unit may also be described as "a unit that creates an event corresponding to a user operation in response to detecting a user operation on an application."
[0085] 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 the invention involved in the embodiments of the present disclosure is not limited to the technical solutions formed by a specific combination of the above-mentioned technical features, but should also cover other technical solutions formed by any combination of the above-mentioned technical features or their equivalent features without departing from the above-mentioned inventive concept. For example, the above-mentioned features are replaced with the technical features with similar functions disclosed in the embodiments of the present disclosure (but not limited to) to form a technical solution.
Claims
1. An incident response method, comprising: In response to detecting a user operation on an application, creating an event corresponding to the user operation; Passing the event to an event queue of a currently running client application, so that the client application passes the event in the event queue to a view object corresponding to the user operation; Determining a response object for the event according to a preset response object sequence corresponding to the view object, wherein the response object sequence is determined according to a view hierarchy structure of the application; Controlling the response object to respond to the event; Wherein, controlling the response object to respond to the event includes: Based on the reflection mechanism, controlling the response object to respond to the event; Wherein, controlling the response object to respond to the event based on the reflection mechanism includes: Get the preset character string corresponding to the event; Reflecting the string to determine a response method corresponding to the event; The response object is controlled to execute the response method to complete the response to the event.
2. The method according to claim 1, wherein: The application is an IOS application; and The sequence of response objects corresponding to the view object is the response chain corresponding to the view object.
3. An event response device, wherein: The device comprises: a creating unit, configured to, in response to detecting a user operation on an application, create an event corresponding to the user operation; A transmitting unit, configured to transmit the event to an event queue of a currently running client application, so that the client application transmits the event in the event queue to a view object corresponding to the user operation; a determining unit configured to determine a response object of the event according to a preset response object sequence corresponding to the view object, wherein the response object sequence is determined according to a view hierarchy structure of the application; a response unit, configured to control the response object to respond to the event; Wherein, the response unit is further configured to: Based on the reflection mechanism, controlling the response object to respond to the event; Wherein, the response unit is further configured to: Get the preset character string corresponding to the event; Reflecting the string to determine a response method corresponding to the event; The response object is controlled to execute the response method to complete the response to the event.
4. The device according to claim 3, wherein: The application is an IOS application; and The sequence of response objects corresponding to the view object is the response chain corresponding to the view object.
5. A terminal, comprising: one or more processors; a storage device having one or more programs stored thereon; When the one or more programs are executed by the one or more processors, the one or more processors implement the method as claimed in claim 1 or 2.
6. A computer readable medium having a computer program stored thereon, wherein: When the program is executed by a processor, the method according to claim 1 or 2 is implemented.
