1. Introduction
# 1. Introduction
By registering specific proxy methods, certain default behaviors of the SDK can be overridden.
# 2. General Usage
Before launching the Mini-Program, use finclip_register_proxy to register a specific proxy method, passing in a callback function. Inside the callback function, you must call finclip_callback_success to return a result for the received callback_id.
void callback(const char *appid, const char *res, void *input, int callback_id, const char *params) {
auto* result = finclip_create_params();
finclip_params_set(result, b"key", b"value");
finclip_params_set(result, b"foo", b"bar");
finclip_callback_success(callback_id, result);
finclip_destory_params(result);
}
finclip_register_proxy("proxy_name", callback, input);
# 3. List of Available Proxy Methods
# 3.1 get_user_info
Customizes the return value of wx.getUserInfo
# 3.2 get_user_profile
Customizes the return value of wx.getUserProfile
# 3.3 offline_basic
Sets the Base Library Offline Package
void callback(const char *appid, const char *res, void *input, int callback_id, const char *params) {
auto* result = finclip_create_params();
finclip_params_set(result, "path", "c:/path/to/offline/basic.zip");
finclip_callback_success(callback_id, result);
finclip_destory_params(result);
}
finclip_register_proxy("offline_basic", callback, input);
# 3.4 offline_applet
Sets the Mini-Program Offline Package
void callback(const char *appid, const char *res, void *input, int callback_id, const char *params) {
auto* result = finclip_create_params();
finclip_params_set(result, "path", "c:/path/to/offline/applet.zip");
finclip_callback_success(callback_id, result);
finclip_destory_params(result);
}
finclip_register_proxy("offline_applet", callback, input);
# 3.5 proxy_h5_cookie
Customizes H5 cookies
void callback(const char *appid, const char *res, void *input, int callback_id, const char *params) {
auto* result = finclip_create_params();
char *cookies = "[
{"name": "test_0001", "value": "testing_value_0001", "domain": "finclip.com", "path": "/"},
{"name": "test_0002", "value": "testing_value_0002", "domain": "finclip.com", "path": "/", "expire_year": 2026, "expire_month": 12, "expire_day": 5},
]";
auto* result = finclip_create_params();
finclip_params_set(result, "cookielist", cookies);
finclip_callback_success(callback_id, result);
finclip_destory_params(result);
}
finclip_register_proxy("proxy_h5_cookie", callback,input);
# 3.6 more_custom_menu
Customizes More Menu items
void callback(const char *appid, const char *res, void *input, int callback_id, const char *params) {
char *str = "\{
"data": [\
{\
"id": "abcde",\
"name": "foo",\
"type": 0\
},\
{\
"id": "qwert",\
"name": "bar",\
"type": 1\
}\
]
}";
auto* result = finclip_build_params(str);
finclip_callback_success(callback_id, result);
finclip_destory_params(result);
}
finclip_register_proxy("more_custom_menu", callback, input);
# 3.7 more_custom_menu_click
Customizes the More Menu click event. This callback is triggered when a user clicks a custom More Menu item. The params contains detailed information about the clicked menu item.
void callback(const char *appid, const char *res, void *input, int callback_id, const char *params) {
printf("%s\n", params);
auto* result = finclip_create_params();
finclip_callback_success(callback_id, result);
finclip_destory_params(result);
}
finclip_register_proxy("more_custom_menu_click", callback, input);
# 3.8 Gray Release Extension Parameter Configuration
In addition to the default gray release configuration items provided by our platform, you can also add some gray control items based on business data. In this case, the business parameters will be read by the Mini-Program upon opening via the following proxy method.
Sample code:
// Proxy callback function
void callback(const char *appid, const char *res, void *input, int callback_id, const char *params) {
printf("%s\n", params);
auto* result = finclip_create_params();
finclip_params_set(result, "key1", "value1");
finclip_params_set(result, "key2", "value2");
finclip_callback_success(callback_id, result);
finclip_destory_params(result);
}
// Register proxy method
finclip_register_proxy("gray_release", callback, input);