| 
						 
							
							
							
						 
					 | 
				
			
			 | 
			 | 
			
				@@ -1,16 +1,20 @@
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				package org.mian.gitnex.activities;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import androidx.annotation.NonNull;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.annotation.SuppressLint;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.content.Context;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.graphics.drawable.GradientDrawable;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.os.Bundle;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.util.Log;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.view.View;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.view.inputmethod.InputMethodManager;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.widget.AdapterView;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.widget.ArrayAdapter;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.widget.Button;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.widget.EditText;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.widget.ImageView;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.widget.Spinner;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import android.widget.TextView;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import androidx.annotation.NonNull;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import com.hendraanggrian.appcompat.socialview.Mention;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import com.hendraanggrian.appcompat.widget.MentionArrayAdapter;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import com.hendraanggrian.appcompat.widget.SocialAutoCompleteTextView;
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -19,10 +23,13 @@ import org.mian.gitnex.clients.RetrofitClient;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.mian.gitnex.helpers.AlertDialogs;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.mian.gitnex.helpers.Authorization;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.mian.gitnex.helpers.Toasty;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.mian.gitnex.helpers.VersionCheck;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.mian.gitnex.models.Collaborators;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.mian.gitnex.models.MergePullRequest;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.mian.gitnex.models.MergePullRequestSpinner;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.mian.gitnex.util.AppUtil;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import org.mian.gitnex.util.TinyDB;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.util.ArrayList;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import java.util.List;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import okhttp3.ResponseBody;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				import retrofit2.Call;
 | 
			
		
		
	
	
		
			
				
					
					| 
						
					 | 
				
			
			 | 
			 | 
			
				@@ -35,234 +42,267 @@ import retrofit2.Response;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				public class MergePullRequestActivity extends BaseActivity {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    public ImageView closeActivity;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    private View.OnClickListener onClickListener;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					public ImageView closeActivity;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private View.OnClickListener onClickListener;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    final Context ctx = this;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					final Context ctx = this;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    private SocialAutoCompleteTextView mergePR;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    private ArrayAdapter<Mention> defaultMentionAdapter;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    private Button mergeButton;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private SocialAutoCompleteTextView mergeDescription;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private EditText mergeTitle;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private Spinner mergeModeSpinner;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private ArrayAdapter<Mention> defaultMentionAdapter;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private Button mergeButton;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private String Do;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    @Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    protected int getLayoutResourceId(){
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        return R.layout.activity_merge_pull_request;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					@Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					protected int getLayoutResourceId() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    @Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    public void onCreate(Bundle savedInstanceState) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        super.onCreate(savedInstanceState);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						return R.layout.activity_merge_pull_request;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        boolean connToInternet = AppUtil.haveNetworkConnection(getApplicationContext());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        TinyDB tinyDb = new TinyDB(getApplicationContext());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					@SuppressLint("SetTextI18n")
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					@Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					public void onCreate(Bundle savedInstanceState) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						super.onCreate(savedInstanceState);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        mergePR = findViewById(R.id.mergePR);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        mergePR.setShowSoftInputOnFocus(true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						boolean connToInternet = AppUtil.haveNetworkConnection(getApplicationContext());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						TinyDB tinyDb = new TinyDB(getApplicationContext());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        mergePR.requestFocus();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        assert imm != null;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        imm.showSoftInput(mergePR, InputMethodManager.SHOW_IMPLICIT);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        defaultMentionAdapter = new MentionArrayAdapter<>(this);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        loadCollaboratorsList();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeModeSpinner = findViewById(R.id.mergeSpinner);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeDescription = findViewById(R.id.mergeDescription);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeTitle = findViewById(R.id.mergeTitle);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        mergePR.setMentionAdapter(defaultMentionAdapter);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeTitle.requestFocus();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						assert imm != null;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						imm.showSoftInput(mergeTitle, InputMethodManager.SHOW_IMPLICIT);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        closeActivity = findViewById(R.id.close);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        TextView toolbar_title = findViewById(R.id.toolbar_title);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						setMergeAdapter();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if(!tinyDb.getString("issueTitle").isEmpty()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            toolbar_title.setText(tinyDb.getString("issueTitle"));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeModeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        initCloseListener();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        closeActivity.setOnClickListener(onClickListener);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							@Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        mergeButton = findViewById(R.id.mergeButton);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								MergePullRequestSpinner mergeId = (MergePullRequestSpinner) parent.getSelectedItem();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								Do = mergeId.getId();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if(!connToInternet) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            disableProcessButton();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							@Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							public void onNothingSelected(AdapterView<?> parent) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        } else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            mergeButton.setOnClickListener(mergePullRequest);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						});
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						defaultMentionAdapter = new MentionArrayAdapter<>(this);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						loadCollaboratorsList();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeDescription.setMentionAdapter(defaultMentionAdapter);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    public void loadCollaboratorsList() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						closeActivity = findViewById(R.id.close);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						TextView toolbar_title = findViewById(R.id.toolbar_title);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        final TinyDB tinyDb = new TinyDB(getApplicationContext());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if(!tinyDb.getString("issueTitle").isEmpty()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							toolbar_title.setText(tinyDb.getString("issueTitle"));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							mergeTitle.setText(tinyDb.getString("issueTitle") + " (#" + tinyDb.getString("issueNumber")+ ")");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        final String instanceUrl = tinyDb.getString("instanceUrl");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        final String loginUid = tinyDb.getString("loginUid");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        String repoFullName = tinyDb.getString("repoFullName");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        String[] parts = repoFullName.split("/");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        final String repoOwner = parts[0];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        final String repoName = parts[1];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						initCloseListener();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						closeActivity.setOnClickListener(onClickListener);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Call<List<Collaborators>> call = RetrofitClient
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                .getInstance(instanceUrl, getApplicationContext())
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                .getApiInterface()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                .getCollaborators(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeButton = findViewById(R.id.mergeButton);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        call.enqueue(new Callback<List<Collaborators>>() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if(!connToInternet) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            @Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            public void onResponse(@NonNull Call<List<Collaborators>> call, @NonNull Response<List<Collaborators>> response) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							disableProcessButton();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if (response.isSuccessful()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    assert response.body() != null;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    String fullName = "";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    for (int i = 0; i < response.body().size(); i++) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        if(!response.body().get(i).getFull_name().equals("")) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                            fullName = response.body().get(i).getFull_name();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                        defaultMentionAdapter.add(
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                                new Mention(response.body().get(i).getUsername(), fullName, response.body().get(i).getAvatar_url()));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							mergeButton.setOnClickListener(mergePullRequest);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    Log.i("onResponse", String.valueOf(response.code()));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private void setMergeAdapter() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						TinyDB tinyDb = new TinyDB(getApplicationContext());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            @Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            public void onFailure(@NonNull Call<List<Collaborators>> call, @NonNull Throwable t) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                Log.i("onFailure", t.toString());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						ArrayList<MergePullRequestSpinner> mergeList = new ArrayList<>();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        });
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeList.add(new MergePullRequestSpinner("merge", getResources().getString(R.string.mergeOptionMerge)));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeList.add(new MergePullRequestSpinner("rebase", getResources().getString(R.string.mergeOptionRebase)));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeList.add(new MergePullRequestSpinner("rebase-merge", getResources().getString(R.string.mergeOptionRebaseCommit)));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						//squash merge works only on gitea v1.11.5 and higher due to a bug
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if(VersionCheck.compareVersion("1.11.5", tinyDb.getString("giteaVersion")) < 1) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							mergeList.add(new MergePullRequestSpinner("squash", getResources().getString(R.string.mergeOptionSquash)));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    private void initCloseListener() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        onClickListener = new View.OnClickListener() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            @Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            public void onClick(View view) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                finish();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        };
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						ArrayAdapter<MergePullRequestSpinner> adapter = new ArrayAdapter<>(ctx, R.layout.spinner_item, mergeList);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeModeSpinner.setAdapter(adapter);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    private View.OnClickListener mergePullRequest = new View.OnClickListener() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        public void onClick(View v) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            processMergePullRequest();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    };
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    private void processMergePullRequest() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					public void loadCollaboratorsList() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        String mergePRDT = mergePR.getText().toString();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        boolean connToInternet = AppUtil.haveNetworkConnection(getApplicationContext());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						final TinyDB tinyDb = new TinyDB(getApplicationContext());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        if(!connToInternet) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						final String instanceUrl = tinyDb.getString("instanceUrl");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						final String loginUid = tinyDb.getString("loginUid");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						String repoFullName = tinyDb.getString("repoFullName");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						String[] parts = repoFullName.split("/");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						final String repoOwner = parts[0];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						final String repoName = parts[1];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            Toasty.info(getApplicationContext(), getResources().getString(R.string.checkNetConnection));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            return;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						Call<List<Collaborators>> call = RetrofitClient.getInstance(instanceUrl, getApplicationContext()).getApiInterface().getCollaborators(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						call.enqueue(new Callback<List<Collaborators>>() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        disableProcessButton();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        String doWhat = "merge";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        mergeFunction(doWhat, mergePRDT);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							@Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							public void onResponse(@NonNull Call<List<Collaborators>> call, @NonNull Response<List<Collaborators>> response) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								if(response.isSuccessful()) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    private void mergeFunction(String doWhat, String mergePRDT) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									assert response.body() != null;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									String fullName = "";
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									for(int i = 0; i < response.body().size(); i++) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										if(!response.body().get(i).getFull_name().equals("")) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
											fullName = response.body().get(i).getFull_name();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
										defaultMentionAdapter.add(new Mention(response.body().get(i).getUsername(), fullName, response.body().get(i).getAvatar_url()));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        final TinyDB tinyDb = new TinyDB(getApplicationContext());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        final String instanceUrl = tinyDb.getString("instanceUrl");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        final String loginUid = tinyDb.getString("loginUid");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        String repoFullName = tinyDb.getString("repoFullName");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        String[] parts = repoFullName.split("/");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        final String repoOwner = parts[0];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        final String repoName = parts[1];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        final int prIndex = Integer.parseInt(tinyDb.getString("issueNumber"));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									Log.i("onResponse", String.valueOf(response.code()));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        MergePullRequest mergePR = new MergePullRequest(doWhat, mergePRDT, null);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        Call<ResponseBody> call = RetrofitClient
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                .getInstance(instanceUrl, getApplicationContext())
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                .getApiInterface()
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                .mergePullRequest(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName, prIndex, mergePR);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        call.enqueue(new Callback<ResponseBody>() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							@Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							public void onFailure(@NonNull Call<List<Collaborators>> call, @NonNull Throwable t) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            @Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            public void onResponse(@NonNull Call<ResponseBody> call, @NonNull retrofit2.Response<ResponseBody> response) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								Log.i("onFailure", t.toString());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                if(response.code() == 200) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						});
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    Toasty.info(getApplicationContext(), getString(R.string.mergePRSuccessMsg));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    tinyDb.putBoolean("prMerged", true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    tinyDb.putBoolean("resumePullRequests", true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    finish();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private void initCloseListener() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                else if(response.code() == 401) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						onClickListener = view -> finish();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    enableProcessButton();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle),
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                            getResources().getString(R.string.alertDialogTokenRevokedMessage),
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                            getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton),
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                            getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private View.OnClickListener mergePullRequest = v -> processMergePullRequest();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                else if(response.code() == 404) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private void processMergePullRequest() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    enableProcessButton();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    Toasty.info(getApplicationContext(), getString(R.string.mergePR404ErrorMsg));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						String mergePRDesc = mergeDescription.getText().toString();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						String mergePRTitle = mergeTitle.getText().toString();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						boolean connToInternet = AppUtil.haveNetworkConnection(getApplicationContext());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    enableProcessButton();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                    Toasty.info(getApplicationContext(), getString(R.string.genericError));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						if(!connToInternet) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							Toasty.info(getApplicationContext(), getResources().getString(R.string.checkNetConnection));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							return;
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            @Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                Log.e("onFailure", t.toString());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				                enableProcessButton();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				            }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						disableProcessButton();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeFunction(Do, mergePRDesc, mergePRTitle);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        });
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private void mergeFunction(String Do, String mergePRDT, String mergeTitle) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    private void disableProcessButton() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						final TinyDB tinyDb = new TinyDB(getApplicationContext());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        mergeButton.setEnabled(false);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        GradientDrawable shape =  new GradientDrawable();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        shape.setCornerRadius( 8 );
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        shape.setColor(getResources().getColor(R.color.hintColor));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        mergeButton.setBackground(shape);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						final String instanceUrl = tinyDb.getString("instanceUrl");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						final String loginUid = tinyDb.getString("loginUid");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						final String instanceToken = "token " + tinyDb.getString(loginUid + "-token");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						String repoFullName = tinyDb.getString("repoFullName");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						String[] parts = repoFullName.split("/");
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						final String repoOwner = parts[0];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						final String repoName = parts[1];
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						final int prIndex = Integer.parseInt(tinyDb.getString("issueNumber"));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						MergePullRequest mergePR = new MergePullRequest(Do, mergePRDT, mergeTitle);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    private void enableProcessButton() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						Call<ResponseBody> call = RetrofitClient.getInstance(instanceUrl, getApplicationContext()).getApiInterface().mergePullRequest(Authorization.returnAuthentication(getApplicationContext(), loginUid, instanceToken), repoOwner, repoName, prIndex, mergePR);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        mergeButton.setEnabled(true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        GradientDrawable shape =  new GradientDrawable();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        shape.setCornerRadius( 8 );
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        shape.setColor(getResources().getColor(R.color.btnBackground));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				        mergeButton.setBackground(shape);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						call.enqueue(new Callback<ResponseBody>() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				    }
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							@Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							public void onResponse(@NonNull Call<ResponseBody> call, @NonNull retrofit2.Response<ResponseBody> response) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								if(response.code() == 200) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									Toasty.info(getApplicationContext(), getString(R.string.mergePRSuccessMsg));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									tinyDb.putBoolean("prMerged", true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									tinyDb.putBoolean("resumePullRequests", true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									finish();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								else if(response.code() == 401) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									enableProcessButton();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									AlertDialogs.authorizationTokenRevokedDialog(ctx, getResources().getString(R.string.alertDialogTokenRevokedTitle), getResources().getString(R.string.alertDialogTokenRevokedMessage), getResources().getString(R.string.alertDialogTokenRevokedCopyNegativeButton), getResources().getString(R.string.alertDialogTokenRevokedCopyPositiveButton));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								else if(response.code() == 404) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									enableProcessButton();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									Toasty.info(getApplicationContext(), getString(R.string.mergePR404ErrorMsg));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								else {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									enableProcessButton();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
									Toasty.info(getApplicationContext(), getString(R.string.genericError));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							@Override
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							public void onFailure(@NonNull Call<ResponseBody> call, @NonNull Throwable t) {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								Log.e("onFailure", t.toString());
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
								enableProcessButton();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
							}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						});
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private void disableProcessButton() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeButton.setEnabled(false);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						GradientDrawable shape = new GradientDrawable();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						shape.setCornerRadius(8);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						shape.setColor(getResources().getColor(R.color.hintColor));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeButton.setBackground(shape);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					private void enableProcessButton() {
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeButton.setEnabled(true);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						GradientDrawable shape = new GradientDrawable();
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						shape.setCornerRadius(8);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						shape.setColor(getResources().getColor(R.color.btnBackground));
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
						mergeButton.setBackground(shape);
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
					}
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				
 | 
			
		
		
	
		
			
				 | 
				 | 
			
			 | 
			 | 
			
				}
 | 
			
		
		
	
	
		
			
				
					
					| 
						 
							
							
							
						 
					 | 
				
			
			 | 
			 | 
			
				 
 |