Skip to content

Commit 65568f5

Browse files
committed
Use new c functions
1 parent c74bbee commit 65568f5

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

OpacityCore/src/main/cpp/OpacityCore.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ Java_com_opacitylabs_opacitycore_OpacityCore_init(
388388
java_object = env->NewGlobalRef(thiz);
389389
char *err;
390390
const char *api_key_str = env->GetStringUTFChars(api_key, nullptr);
391-
int result = opacity_core::init(api_key_str, dry_run,
391+
int result = opacity_core::opacity_init(api_key_str, dry_run,
392392
static_cast<int>(environment_enum),
393393
show_errors_in_webview, &err);
394394
if (result != opacity_core::OPACITY_OK) {
@@ -441,7 +441,7 @@ Java_com_opacitylabs_opacitycore_OpacityCore_getNative(JNIEnv *env,
441441
const char *name_str = env->GetStringUTFChars(name, nullptr);
442442
const char *params_str =
443443
params != nullptr ? env->GetStringUTFChars(params, nullptr) : nullptr;
444-
int status = opacity_core::get(name_str, params_str, &res, &err);
444+
int status = opacity_core::opacity_get(name_str, params_str, &res, &err);
445445
return createOpacityResponse(env, status, res, err);
446446
}
447447

OpacityCore/src/main/jni/include/sdk.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ typedef void (*IosPrepareRequestFn)(const char*);
1818

1919
typedef void (*IosSetRequestHeaderFn)(const char*, const char*);
2020

21-
typedef void (*IosPresentWebviewFn)(void);
21+
typedef void (*IosPresentWebviewFn)(bool);
2222

2323
typedef void (*IosCloseWebviewFn)(void);
2424

@@ -82,6 +82,8 @@ typedef const char *(*GetDeviceCpuFn)(void);
8282

8383
typedef const char *(*GetDeviceCodenameFn)(void);
8484

85+
typedef void (*IosWebviewChangeUrlFn)(const char*);
86+
8587

8688

8789

@@ -164,13 +166,13 @@ extern const int32_t OPACITY_ENVIRONMENT_STAGING;
164166

165167
extern const int32_t OPACITY_ENVIRONMENT_PRODUCTION;
166168

167-
int32_t init(const char *api_key_str,
168-
bool dry_run,
169-
int32_t backend_environment,
170-
bool show_errors_in_webview,
171-
char **error_ptr);
169+
int32_t opacity_init(const char *api_key_str,
170+
bool dry_run,
171+
int32_t backend_environment,
172+
bool show_errors_in_webview,
173+
char **error_ptr);
172174

173-
int32_t get(const char *name, const char *params, char **res_ptr, char **err_ptr);
175+
int32_t opacity_get(const char *name, const char *params, char **res_ptr, char **err_ptr);
174176

175177
void free_string(char *ptr);
176178

@@ -237,7 +239,8 @@ void register_ios_callbacks(IosPrepareRequestFn ios_prepare_request,
237239
GetScreenDensityFn get_screen_density,
238240
GetScreenDpiFn get_screen_dpi,
239241
GetDeviceCpuFn get_device_cpu,
240-
GetDeviceCodenameFn get_device_codename);
242+
GetDeviceCodenameFn get_device_codename,
243+
IosWebviewChangeUrlFn ios_webview_change_url);
241244

242245
extern void secure_set(const char *key, const char *value);
243246

@@ -247,14 +250,16 @@ extern void android_prepare_request(const char *url);
247250

248251
extern void android_set_request_header(const char *key, const char *value);
249252

250-
extern void android_present_webview(bool intercept_requests);
253+
extern void android_present_webview(bool should_intercept);
251254

252255
extern void android_close_webview(void);
253256

254257
extern const char *android_get_browser_cookies_for_current_url(void);
255258

256259
extern const char *android_get_browser_cookies_for_domain(const char *domain);
257260

261+
extern void android_webview_change_url(const char *url);
262+
258263
#ifdef __cplusplus
259264
} // extern "C"
260265
#endif // __cplusplus

0 commit comments

Comments
 (0)