Skip to content

Commit

Permalink
reg
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbxyyx committed Nov 23, 2024
1 parent cc0123d commit 3f682fc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ protected void onCreate(Bundle savedInstanceState) {
btn_send_code.setOnClickListener((v) -> {
String user = et_login_user.getText().toString();
String password = et_login_password.getText().toString();
bookNetHelper.sendCode(user, password, new DataCallback<JsonNode>() {
String nickname = et_nickname.getText().toString();
bookNetHelper.sendCode(user, password, nickname, new DataCallback<JsonNode>() {
@Override
public void call(JsonNode dataObject, Throwable err) {
runOnUiThread(() -> {
Expand All @@ -69,7 +70,7 @@ public void call(JsonNode dataObject, Throwable err) {
String nickname = et_nickname.getText().toString();
LoadingDialog loading = new LoadingDialog(this);
loading.show();
bookNetHelper.registrationWithNickname(user, password, code, nickname, new DataCallback<String>() {
bookNetHelper.registration(user, password, code, nickname, new DataCallback<String>() {
@Override
public void call(String str, Throwable err) {
runOnUiThread(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ public void onResponse(@NonNull Call call, @NonNull Response response) throws IO
});
}

public void sendCode(String email, String password, DataCallback dataCallback) {
public void sendCode(String email, String password, String nickname, DataCallback dataCallback) {
Map<String, Object> object = new HashMap<>();
String reqUrl = zurl + "/papi/user/verification/send-code";
object.put("method", "POST");
Expand All @@ -528,7 +528,7 @@ public void sendCode(String email, String password, DataCallback dataCallback) {
Map<String, Object> data = new HashMap<>();
data.put("email", email);
data.put("password", password);
data.put("name", email.split("\\@")[0]);
data.put("name", Common.isBlank(nickname) ? Common.urlEncode(email.split("\\@")[0]) : Common.urlEncode(nickname));
data.put("rx", "215");
data.put("action", "registration");
data.put("redirectUrl", "");
Expand Down Expand Up @@ -640,7 +640,7 @@ public void onResponse(@NonNull Call call, @NonNull Response response) throws IO
});
}

public void registrationWithNickname(String email, String password, String verifyCode, String nickname, DataCallback dataCallback) {
public void registration(String email, String password, String verifyCode, String nickname, DataCallback dataCallback) {
Map<String, Object> object = new HashMap<>();
String reqUrl = zurl + "/rpc.php";
object.put("method", "POST");
Expand Down Expand Up @@ -714,10 +714,6 @@ public void onResponse(@NonNull Call call, @NonNull Response response) throws IO
});
}

public void registration(String email, String password, String verifyCode, DataCallback dataCallback) {
registrationWithNickname(email, password, verifyCode, email.split("\\@")[0], dataCallback);
}

public void cloudSync(Book book, DataCallback dataCallback) {
cloudSyncMeta(book, dataCallback);
cloudSyncRaw(book, dataCallback);
Expand Down
16 changes: 8 additions & 8 deletions app/src/main/res/layout/activity_registration.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
android:singleLine="true"
android:hint="请输入邮箱" />

<EditText
android:id="@+id/et_nickname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:singleLine="true"
android:hint="请输入昵称" />

<EditText
android:id="@+id/et_login_password"
android:layout_width="match_parent"
Expand Down Expand Up @@ -48,14 +56,6 @@

</LinearLayout>

<EditText
android:id="@+id/et_nickname"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:singleLine="true"
android:hint="请输入昵称" />

<Button
android:id="@+id/btn_registration"
android:layout_width="match_parent"
Expand Down

0 comments on commit 3f682fc

Please sign in to comment.