It still does not work, but its one step closer to working

This commit is contained in:
LucasGGamerM
2022-12-28 10:45:15 -03:00
parent 3f773a52cc
commit 46b842afc4
3 changed files with 32 additions and 2 deletions

View File

@@ -1,4 +1,20 @@
package org.joinmastodon.android.api.requests.accounts;
public class SetPrivateNote {
import org.joinmastodon.android.api.MastodonAPIRequest;
import org.joinmastodon.android.model.PrivateNote;
public class SetPrivateNote extends MastodonAPIRequest<PrivateNote>{
public SetPrivateNote(String id, String note){
super(MastodonAPIRequest.HttpMethod.POST, "/accounts/"+id+"/note", PrivateNote.class);
Request req = new Request(note);
setRequestBody(req);
}
public static class Request{
public String comment;
public Request(String note){
this.comment = note;
}
}
}

View File

@@ -53,6 +53,7 @@ import org.joinmastodon.android.api.requests.accounts.GetAccountRelationships;
import org.joinmastodon.android.api.requests.accounts.GetAccountStatuses;
import org.joinmastodon.android.api.requests.accounts.GetOwnAccount;
import org.joinmastodon.android.api.requests.accounts.SetAccountFollowed;
import org.joinmastodon.android.api.requests.accounts.SetPrivateNote;
import org.joinmastodon.android.api.requests.accounts.UpdateAccountCredentials;
import org.joinmastodon.android.api.session.AccountSessionManager;
import org.joinmastodon.android.fragments.account_list.FollowerListFragment;
@@ -61,6 +62,7 @@ import org.joinmastodon.android.fragments.report.ReportReasonChoiceFragment;
import org.joinmastodon.android.model.Account;
import org.joinmastodon.android.model.AccountField;
import org.joinmastodon.android.model.Attachment;
import org.joinmastodon.android.model.PrivateNote;
import org.joinmastodon.android.model.Relationship;
import org.joinmastodon.android.ui.SimpleViewHolder;
import org.joinmastodon.android.ui.SingleImagePhotoViewerListener;
@@ -306,7 +308,13 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
}
private void onClickNoteSave() {
noteEdit.getText().toString();
Toast.makeText(getActivity(), "Its going here", Toast.LENGTH_LONG).show();
currentRequest = new SetPrivateNote(profileAccountID, noteEdit.getText().toString()).setCallback(new SimpleCallback<PrivateNote>(this) {
@Override
public void onSuccess(PrivateNote result) {
Toast.makeText(getActivity(), "Success", Toast.LENGTH_LONG).show();
}
});
}
@Override

View File

@@ -0,0 +1,6 @@
package org.joinmastodon.android.model;
public class PrivateNote extends BaseModel{
public String id;
public String note;
}