T
T
tutam2018-07-25 20:21:33
Android
tutam, 2018-07-25 20:21:33

Where does the code go in smali?

In java code, the method looks like this:

private void processCode(Call<CodeResponse> call) {
        call.enqueue(new Callback<CodeResponse>() {
            public void onResponse(Call<CodeResponse> call, Response<CodeResponse> response) {
                call = response.code();
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.append("On Response:");
                stringBuilder.append(call);
                Log.d("EnterCodeResponse", stringBuilder.toString());
                if (call == 200) {
                    EnteringCode.this.tinyDB.putObject(Constants.CODE_RESPONSE, response.body());
                    EnteringCode.this.startActivity(new Intent(EnteringCode.this.getActivity(), ChooseFruit.class));
                    return;
                }
                try {
                    EnteringCode.this.activity.setHomeErrorMessage(new JSONObject(response.errorBody().string()).getString("message"));
                } catch (Call<CodeResponse> call2) {
                    call2.printStackTrace();
                }
                EnteringCode.this.activity.hideProgressBar();
                EnteringCode.this.activity.showErrorDialog();
            }

            public void onFailure(Call<CodeResponse> call, Throwable th) {
                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.append("On Failure: ");
                stringBuilder.append(th.getMessage());
                Log.d("EnterCodeResponse", stringBuilder.toString());
            }
        });
    }

Same method in smali:
.method private processCode(Lretrofit2/Call;)V
    .locals 1
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lretrofit2/Call<",
            "Lcom/example/myapp/model/response/CodeResponse;",
            ">;)V"
        }
    .end annotation

    .line 145
    new-instance v0, Lcom/example/myapp/EnteringCode$2;

    invoke-direct {v0, p0}, Lcom/example/myapp/EnteringCode$2;-><init>(Lcom/example/myapp/EnteringCode;)V

    invoke-interface {p1, v0}, Lretrofit2/Call;->enqueue(Lretrofit2/Callback;)V

    return-void
.end method

I'm interested in this condition: Where can I find this condition in smali?
if (call == 200) {...}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question