Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Java API #1257

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions build/android/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ private void run()

{
Context finalContext = context;
context.getGlobalObject().set(context, JavaScriptValue.create("print"), JavaScriptJavaCallbackFunctionObject.create(context, "print", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
context.getGlobalObject().set(context, JavaScriptString.create("print"), JavaScriptJavaCallbackFunctionObject.create(context, "print", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
@Override
public Optional<JavaScriptValue> callback(JavaScriptValue javaScriptValue, JavaScriptValue[] javaScriptValues) {
public Optional<JavaScriptValue> callback(Context context, JavaScriptValue javaScriptValue, JavaScriptValue[] javaScriptValues) {
StringBuffer sb = new StringBuffer();
sb.append(str);
sb.append('\n');
Expand Down Expand Up @@ -118,9 +118,9 @@ public void run() {
}
}));

context.getGlobalObject().set(context, JavaScriptValue.create("load"), JavaScriptJavaCallbackFunctionObject.create(context, "run", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
context.getGlobalObject().set(context, JavaScriptString.create("load"), JavaScriptJavaCallbackFunctionObject.create(context, "run", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
@Override
public Optional<JavaScriptValue> callback(JavaScriptValue javaScriptValue, JavaScriptValue[] javaScriptValues) {
public Optional<JavaScriptValue> callback(Context context, JavaScriptValue javaScriptValue, JavaScriptValue[] javaScriptValues) {
Optional<JavaScriptString> s = javaScriptValues[0].toString(finalContext);
if (s.isPresent()) {
try {
Expand All @@ -137,9 +137,9 @@ public Optional<JavaScriptValue> callback(JavaScriptValue javaScriptValue, JavaS
}
}));

context.getGlobalObject().set(context, JavaScriptValue.create("run"), JavaScriptJavaCallbackFunctionObject.create(context, "run", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
context.getGlobalObject().set(context, JavaScriptString.create("run"), JavaScriptJavaCallbackFunctionObject.create(context, "run", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
@Override
public Optional<JavaScriptValue> callback(JavaScriptValue javaScriptValue, JavaScriptValue[] javaScriptValues) {
public Optional<JavaScriptValue> callback(Context context, JavaScriptValue javaScriptValue, JavaScriptValue[] javaScriptValues) {
long sm = System.currentTimeMillis();
Optional<JavaScriptString> s = javaScriptValues[0].toString(finalContext);
if (s.isPresent()) {
Expand All @@ -149,16 +149,16 @@ public Optional<JavaScriptValue> callback(JavaScriptValue javaScriptValue, JavaS
}
}));

context.getGlobalObject().set(context, JavaScriptValue.create("read"), JavaScriptJavaCallbackFunctionObject.create(context, "read", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
context.getGlobalObject().set(context, JavaScriptString.create("read"), JavaScriptJavaCallbackFunctionObject.create(context, "read", 1, false, new JavaScriptJavaCallbackFunctionObject.Callback() {
@Override
public Optional<JavaScriptValue> callback(JavaScriptValue javaScriptValue, JavaScriptValue[] javaScriptValues) {
public Optional<JavaScriptValue> callback(Context context, JavaScriptValue javaScriptValue, JavaScriptValue[] javaScriptValues) {
Optional<JavaScriptString> s = javaScriptValues[0].toString(finalContext);
if (s.isPresent()) {
FileReader in = null;
try {
byte[] chars = Files.readAllBytes(Paths.get(s.get().toJavaString()));
String fileContent = new String(chars);
return Optional.of(JavaScriptValue.create(fileContent));
return Optional.of(JavaScriptString.create(fileContent));
}
catch (Exception ex) {
return Optional.empty();
Expand Down
1 change: 0 additions & 1 deletion build/android/escargot/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ task sourcesJar(type: Jar) {

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
android.libraryVariants.all { variant ->
if (variant.name == 'release') {
owner.classpath += variant.javaCompileProvider.get().classpath
Expand Down
1 change: 1 addition & 0 deletions build/android/escargot/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
-keep class com.samsung.lwe.escargot.* { *; }
-keep enum com.samsung.lwe.escargot.* { *; }
1 change: 1 addition & 0 deletions build/android/escargot/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
#-renamesourcefileattribute SourceFile

-keep class com.samsung.lwe.escargot.* { *; }
-keep enum com.samsung.lwe.escargot.* { *; }
Loading