Product | technology drops



DoraemonKit /’dɔ:ra:’emɔ N /, short for DoKit, Chinese name Doraemon, means to be able to provide his master with A variety of tools. Is a fully functional client (iOS, Android) R & D assistant.

— — –



▎ Development Background

Every App with a small scale always has some offline test function codes, such as environment switching function, frame rate viewing function, etc. The switching entry of these functions is often placed in various entrances, such as some special gestures, double clicking statusBar, double clicking a function block, Or create a keyWindow and always put it at the top of the App, etc. In addition, there are many similar offline function modules in each App, such as frame rate view, memory and CPU monitoring, etc., but now basically each App has its own implementation.

We had accumulated some tools in the designated driver terminal, which was convenient for our development and testing. Later, our group undertook the development of more apps, but found that this tool could not be transplanted to other apps. The implementation scheme at that time was still closely coupled with the business, so it could not achieve universality. So I thought, which of these tools can be extracted as a general tool and which can be used as a business tool. Use the generic component tools as an SDK that every app can use, and provide an extensible way for business tools to be added. The result was Doraemonkit, a collection of tools.

DoraemonKit is a function set panel, which allows each App to quickly access some commonly used or not implemented auxiliary development tools, test efficiency tools, visual AIDS, and perfect access to Doraemon panel you have implemented closely coupled with the business of some non-common auxiliary tools. Powerful, easy access, easy to expand.

▎ Summary

1. DoraemonKit can quickly make your business test code unified management here, unified closure;

DoraemonKit built-in many common tools, avoid repeated implementation, one access, you will have a powerful tool set.

▎ Effect demonstration



DoKit homepage demo

▎ Built-in function modules

▎ Common tools

1. App information viewing

Quickly check the channel of mobile phone information, App information and permission information to avoid the trouble of finding or viewing the source code of the project in mobile phone Settings;

2. Sandbox browsing

App internal file browsing function, support deletion and preview, and can be uploaded to PC through AirDrop or other sharing methods, for more detailed operation;

3. MockGPS

App can locate all parts of the country, support map status and manual input latitude and longitude;

3. Any door of H5

Students can quickly input the H5 page address to view the effect of the page;

4. The Crash

It is convenient to print the Crash stack locally.

5. Child thread UI

Quickly locate which UI operations are rendered in the non-main thread to avoid unnecessary problems.

6. Clear local data

Delete all data in sandbox with one click;

7. NSLog

Print all NSLog information to the UI interface to avoid the embarrassment of not being able to adjust without the development certificate;

8. Lumberjack

Every CocoaLumberjack log information is displayed on the App interface, so there is no need to export logs.

▎ performance detection

1. The frame rate

App frame rate information provides waveform view function, making the trend of frame rate monitoring more obvious;

2. CPU

App CPU usage information provides waveform view function, which makes the TREND of CPU monitoring more vivid.

3. The memory

App memory usage information provides waveform view function, making the trend of memory monitoring more distinct;

3. The traffic

Intercept the internal traffic information of the App, providing waveform display, traffic summary display, traffic list display, traffic screening, traffic details, and uniformly intercept the traffic information, becoming our own “Charles” in the App;

4. Caton

Lock the time when the App is stuck and print out the corresponding code call stack;

5. The custom

You can choose which options you want to monitor, including FPS, CPU, memory, and traffic. After monitoring, the data can be saved locally or exported for more detailed analysis.

6. The Load time

Load function time is an important factor in iOS startup performance optimization. This function can print the time of all Load functions for developers’ reference.

▎ Visual tools

1. Color straws

Convenient designer UI bug, check each component of the color value is set correctly;

2. Check components

You can grab any UI control and view their detailed information, including control name, control position, background color, font color, font size;

3. Align the ruler

Refer to the test tool of the Android system, which can capture screen coordinates in real time and check whether components are aligned.

4. Element border lines

Draw the border of each UI component, which has some reference significance for component layout.

▎iOS access guide

1.1. Cocoapods dependency

1    pod 'DoraemonKit/Core'.'~ > 1.1.7', :configurations => ['Debug']
2    pod 'DoraemonKit/WithLogger'.'~ > 1.1.7', :configurations => ['Debug']
3    pod 'DoraemonKit/WithGPS'.'~ > 1.1.7', :configurations => ['Debug']
4    pod 'DoraemonKit/WithLoad'.'~ > 1.1.7', :configurations => ['Debug']
Copy the code

The Core subspec must be introduced as the Core.

If your logging is based on CocoaLumberjack, you can also include the WithLogger SubSpec.

There are some compatibility issues with MockGPS (mostly good, click here for details), and if your app has problems with MockGPS, you don’t need to include the WithGPS SubSpec.

Tip: Integrate only in the Debug environment, not online. There are hook operations that pollute the online code.

1.2. Access mode using the DoraemonKit built-in tool set

Add the code when the App starts

1#ifdef DEBUG
2#import <DoraemonKit/DoraemonManager.h>
3#endif
4
5- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
6    #ifdef DEBUG
7        [[DoraemonManager shareInstance] install];
8    #endif
9}
Copy the code

The above steps give you access to all of DorameonKit’s built-in tools. If you want to add your own business-related tool code to DoraemonKit for unified management, you can follow step 3 to do so.

1.3. Add custom test modules to Doraemon panel (not necessary)

Click here for details

▎Android app Access guide

2.1. Gradle dependencies

1dependencies {
2    ...
3    debugImplementation 'com. Didichuxing. Doraemonkit: doraemonkit: 1.1.3'
4    releaseImplementation 'com. Didichuxing. Doraemonkit: doraemonkit - no - op: 1.1.3'5... 6}Copy the code

2.2. Initialization

Initialize when the App starts.

1@Override
 2public void onCreate() {3... 4 DoraemonKit. Install (application) 5 6 / / H5 arbitrary door function need, must not 7 DoraemonKit. SetWebDoorCallback (new WebDoorManager.WebDoorCallback() {8 @override 9 public void overrideUrlLoading(Context Context, String s) {8 @override 9 public void overrideUrlLoading(Context Context, String s) 13}Copy the code

For more customizations, see: Click here

Source address: Github project page

▎ END