[Frontport] Fix add new account (#779)

Fix add new account

Co-authored-by: M M Arif <mmarif@swatian.com>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/779
Reviewed-by: 6543 <6543@noreply.codeberg.org>
This commit is contained in:
M M Arif 2020-11-17 19:56:16 +01:00 committed by 6543
parent 3aa819f3ef
commit 272fc78df9
3 changed files with 7 additions and 2 deletions

View File

@ -197,7 +197,7 @@ public class AddNewAccountActivity extends BaseActivity {
private void setupNewAccountWithToken(String instanceUrl, final String loginToken) { private void setupNewAccountWithToken(String instanceUrl, final String loginToken) {
Call<UserInfo> call = RetrofitClient.getApiInterface(ctx).getUserInfo("token " + loginToken); Call<UserInfo> call = RetrofitClient.getApiInterface(ctx, instanceUrl).getUserInfo("token " + loginToken);
call.enqueue(new Callback<UserInfo>() { call.enqueue(new Callback<UserInfo>() {

View File

@ -17,6 +17,7 @@ import javax.net.ssl.X509TrustManager;
import okhttp3.Cache; import okhttp3.Cache;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Retrofit; import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory; import retrofit2.converter.gson.GsonConverterFactory;
import retrofit2.converter.scalars.ScalarsConverterFactory; import retrofit2.converter.scalars.ScalarsConverterFactory;
@ -37,6 +38,9 @@ public class RetrofitClient {
int cacheSize = FilesData.returnOnlyNumber(tinyDB.getString("cacheSizeStr")) * 1024 * 1024; int cacheSize = FilesData.returnOnlyNumber(tinyDB.getString("cacheSizeStr")) * 1024 * 1024;
Cache cache = new Cache(new File(context.getCacheDir(), "responses"), cacheSize); Cache cache = new Cache(new File(context.getCacheDir(), "responses"), cacheSize);
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
try { try {
SSLContext sslContext = SSLContext.getInstance("TLS"); SSLContext sslContext = SSLContext.getInstance("TLS");
@ -45,6 +49,7 @@ public class RetrofitClient {
sslContext.init(null, new X509TrustManager[]{ memorizingTrustManager }, new SecureRandom()); sslContext.init(null, new X509TrustManager[]{ memorizingTrustManager }, new SecureRandom());
OkHttpClient.Builder okHttpClient = new OkHttpClient.Builder().cache(cache) OkHttpClient.Builder okHttpClient = new OkHttpClient.Builder().cache(cache)
//.addInterceptor(logging)
.sslSocketFactory(sslContext.getSocketFactory(), memorizingTrustManager) .sslSocketFactory(sslContext.getSocketFactory(), memorizingTrustManager)
.hostnameVerifier(memorizingTrustManager.wrapHostnameVerifier(HttpsURLConnection.getDefaultHostnameVerifier())) .hostnameVerifier(memorizingTrustManager.wrapHostnameVerifier(HttpsURLConnection.getDefaultHostnameVerifier()))
.addInterceptor(chain -> { .addInterceptor(chain -> {

View File

@ -71,7 +71,7 @@
android:textIsSelectable="true" android:textIsSelectable="true"
android:autoLink="web" android:autoLink="web"
android:textColorLink="@color/lightBlue" android:textColorLink="@color/lightBlue"
android:textSize="14sp" /> android:textSize="16sp" />
<LinearLayout <LinearLayout
android:id="@+id/commentReactionBadges" android:id="@+id/commentReactionBadges"