mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2024-12-16 15:48:13 +08:00
Merge remote-tracking branch 'remotes/main/master' into self-signed
# Conflicts: # app/src/main/java/org/mian/gitnex/clients/RetrofitClient.java
This commit is contained in:
commit
ae0009f553
@ -72,18 +72,18 @@ public class FileDiffActivity extends BaseActivity {
|
|||||||
|
|
||||||
mProgressBar.setVisibility(View.VISIBLE);
|
mProgressBar.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
String fileDiffName = tinyDb.getString("issueNumber")+".diff";
|
String pullIndex = tinyDb.getString("issueNumber");
|
||||||
|
|
||||||
getFileContents(tinyDb.getString("instanceUrlWithProtocol"), repoOwner, repoName, fileDiffName);
|
getPullDiffContent(tinyDb.getString("instanceUrlWithProtocol"), repoOwner, repoName, pullIndex);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getFileContents(String instanceUrl, String owner, String repo, String filename) {
|
private void getPullDiffContent(String instanceUrl, String owner, String repo, String filename) {
|
||||||
|
|
||||||
Call<ResponseBody> call = RetrofitClient
|
Call<ResponseBody> call = RetrofitClient
|
||||||
.getInstance(instanceUrl, getApplicationContext())
|
.getInstance(instanceUrl, getApplicationContext())
|
||||||
.getApiInterface()
|
.getWebInterface()
|
||||||
.getFileDiffContents(owner, repo, filename);
|
.getPullDiffContent(owner, repo, filename);
|
||||||
|
|
||||||
call.enqueue(new Callback<ResponseBody>() {
|
call.enqueue(new Callback<ResponseBody>() {
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package org.mian.gitnex.clients;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import org.mian.gitnex.interfaces.ApiInterface;
|
import org.mian.gitnex.interfaces.ApiInterface;
|
||||||
|
import org.mian.gitnex.interfaces.WebInterface;
|
||||||
import org.mian.gitnex.helpers.ssl.MemorizingTrustManager;
|
import org.mian.gitnex.helpers.ssl.MemorizingTrustManager;
|
||||||
import org.mian.gitnex.util.AppUtil;
|
import org.mian.gitnex.util.AppUtil;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -83,4 +84,8 @@ public class RetrofitClient {
|
|||||||
return retrofit.create(ApiInterface.class);
|
return retrofit.create(ApiInterface.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WebInterface getWebInterface() {
|
||||||
|
return retrofit.create(WebInterface.class);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -255,9 +255,6 @@ public interface ApiInterface {
|
|||||||
@GET("repos/{owner}/{repo}/pulls") // get repository pull requests
|
@GET("repos/{owner}/{repo}/pulls") // get repository pull requests
|
||||||
Call<List<PullRequests>> getPullRequests(@Header("Authorization") String token, @Path("owner") String owner, @Path("repo") String repo, @Query("page") int page, @Query("state") String state, @Query("limit") int limit);
|
Call<List<PullRequests>> getPullRequests(@Header("Authorization") String token, @Path("owner") String owner, @Path("repo") String repo, @Query("page") int page, @Query("state") String state, @Query("limit") int limit);
|
||||||
|
|
||||||
@GET("{owner}/{repo}/pulls/{filename}") // get pull diff file contents
|
|
||||||
Call<ResponseBody> getFileDiffContents(@Path("owner") String owner, @Path("repo") String repo, @Path("filename") String fileName);
|
|
||||||
|
|
||||||
@POST("repos/{owner}/{repo}/pulls/{index}/merge") // merge a pull request
|
@POST("repos/{owner}/{repo}/pulls/{index}/merge") // merge a pull request
|
||||||
Call<ResponseBody> mergePullRequest(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("index") int index, @Body MergePullRequest jsonStr);
|
Call<ResponseBody> mergePullRequest(@Header("Authorization") String token, @Path("owner") String ownerName, @Path("repo") String repoName, @Path("index") int index, @Body MergePullRequest jsonStr);
|
||||||
|
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package org.mian.gitnex.interfaces;
|
||||||
|
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
import retrofit2.Call;
|
||||||
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.Path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Author M M Arif
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface WebInterface {
|
||||||
|
|
||||||
|
@GET("{owner}/{repo}/pulls/{index}.diff") // get pull diff file contents
|
||||||
|
Call<ResponseBody> getPullDiffContent(@Path("owner") String owner, @Path("repo") String repo, @Path("index") String pullIndex);
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user