Skip to content

Commit dde32a2

Browse files
committed
feat(android): fix java templates
1 parent 2ad3f18 commit dde32a2

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

templates/android/docs/java/example.md.twig

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class MainActivity extends AppCompatActivity {
2424

2525
{{ service.name | caseUcfirst }} {{ service.name | caseCamel }} = new {{ service.name | caseUcfirst }}(client);
2626

27-
{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}new Continuation<Response>() {
27+
{{ service.name | caseCamel }}.{{ method.name | caseCamel }}({% if method.parameters.all | length == 0 %}new Continuation<Object>() {
2828
@NotNull
2929
@Override
3030
public CoroutineContext getContext() {
@@ -38,22 +38,28 @@ public class MainActivity extends AppCompatActivity {
3838
if (o instanceof Result.Failure) {
3939
Result.Failure failure = (Result.Failure) o;
4040
throw failure.exception;
41-
} else {
42-
Response response = (Response) o;
41+
}{% if method.type != "webAuth" %} else {
42+
Response response = (Response) o;
43+
json = response.body().string();
44+
}{% endif %}
45+
4346
}
4447
} catch (Throwable th) {
4548
Log.e("ERROR", th.toString());
4649
}
4750
}
4851
});{% endif %}
4952

53+
{% if method.type == "webAuth" %}
54+
this,
55+
{% endif %}
5056
{% for parameter in method.parameters.all %}
5157
{% if parameter.required %}
5258
{{ parameter | paramExample }}{% if not loop.last %}, {% endif %}
5359

5460
{% endif %}
5561
{% if loop.last %}
56-
new Continuation<Response>() {
62+
new Continuation<Object>() {
5763
@NotNull
5864
@Override
5965
public CoroutineContext getContext() {
@@ -67,9 +73,11 @@ public class MainActivity extends AppCompatActivity {
6773
if (o instanceof Result.Failure) {
6874
Result.Failure failure = (Result.Failure) o;
6975
throw failure.exception;
70-
} else {
76+
}{% if method.type != "webAuth" %} else {
7177
Response response = (Response) o;
72-
}
78+
json = response.body().string();
79+
}{% endif %}
80+
7381
} catch (Throwable th) {
7482
Log.e("ERROR", th.toString());
7583
}

0 commit comments

Comments
 (0)