Pass the system timezone to server when signing up

This commit is contained in:
Grishka 2023-07-02 16:35:19 +03:00
parent d8dfa6017d
commit fe142c4626
2 changed files with 7 additions and 5 deletions

View File

@ -4,21 +4,22 @@ import org.joinmastodon.android.api.MastodonAPIRequest;
import org.joinmastodon.android.model.Token; import org.joinmastodon.android.model.Token;
public class RegisterAccount extends MastodonAPIRequest<Token>{ public class RegisterAccount extends MastodonAPIRequest<Token>{
public RegisterAccount(String username, String email, String password, String locale, String reason){ public RegisterAccount(String username, String email, String password, String locale, String reason, String timezone){
super(HttpMethod.POST, "/accounts", Token.class); super(HttpMethod.POST, "/accounts", Token.class);
setRequestBody(new Body(username, email, password, locale, reason)); setRequestBody(new Body(username, email, password, locale, reason, timezone));
} }
private static class Body{ private static class Body{
public String username, email, password, locale, reason; public String username, email, password, locale, reason, timeZone;
public boolean agreement=true; public boolean agreement=true;
public Body(String username, String email, String password, String locale, String reason){ public Body(String username, String email, String password, String locale, String reason, String timeZone){
this.username=username; this.username=username;
this.email=email; this.email=email;
this.password=password; this.password=password;
this.locale=locale; this.locale=locale;
this.reason=reason; this.reason=reason;
this.timeZone=timeZone;
} }
} }
} }

View File

@ -45,6 +45,7 @@ import org.jsoup.nodes.TextNode;
import org.jsoup.select.NodeVisitor; import org.jsoup.select.NodeVisitor;
import org.parceler.Parcels; import org.parceler.Parcels;
import java.time.ZoneId;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -189,7 +190,7 @@ public class SignupFragment extends ToolbarFragment{
edit.setError(null); edit.setError(null);
} }
errorFields.clear(); errorFields.clear();
new RegisterAccount(username, email, password.getText().toString(), getResources().getConfiguration().locale.getLanguage(), reason.getText().toString()) new RegisterAccount(username, email, password.getText().toString(), getResources().getConfiguration().locale.getLanguage(), reason.getText().toString(), ZoneId.systemDefault().getId())
.setCallback(new Callback<>(){ .setCallback(new Callback<>(){
@Override @Override
public void onSuccess(Token result){ public void onSuccess(Token result){