GitNex/app/src/main/java/org/mian/gitnex/helpers/Authorization.java
opyale 98cf1a1976 Improve file type handling. (#841)
Removing file size selection dialog in favor of hardcoded value.

Adding warning to file size picker and minor improvements.

Bump dependencies and gradle

Merge branch 'master' of https://codeberg.org/gitnex/GitNex into improve-filetype-recognition

Improving credits, adding symlink and submodule icons to FilesAdapter and removing unused libraries.

Minor improvements and bug fixes.

Add true progress indication routine for copying streams.

Merge branch 'master' of https://codeberg.org/gitnex/GitNex into improve-filetype-recognition

Performance and memory usage improvements

Notification improvements

Renaming StaticGlobalVariables to Constants

Overall improvements and fixes.

Merge branch 'master' of https://codeberg.org/gitnex/GitNex into improve-filetype-recognition

Add additional image formats.

Adding audio and video categories.

Merge branch 'master' of https://codeberg.org/gitnex/GitNex into improve-filetype-recognition

Improve file type handling.

Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/841
Reviewed-by: M M Arif <mmarif@noreply.codeberg.org>
Co-Authored-By: opyale <opyale@noreply.codeberg.org>
Co-Committed-By: opyale <opyale@noreply.codeberg.org>
2021-03-21 16:56:54 +01:00

35 lines
738 B
Java

package org.mian.gitnex.helpers;
import android.content.Context;
import okhttp3.Credentials;
/**
* Author M M Arif
*/
public class Authorization {
public static String get(Context context) {
TinyDB tinyDb = TinyDB.getInstance(context);
String loginUid = tinyDb.getString("loginUid");
if(tinyDb.getBoolean("basicAuthFlag") &&
!tinyDb.getString("basicAuthPassword").isEmpty()) {
return Credentials.basic(loginUid, tinyDb.getString("basicAuthPassword"));
}
return "token " + tinyDb.getString(loginUid + "-token");
}
public static String getWeb(Context context) {
TinyDB tinyDb = TinyDB.getInstance(context);
return Credentials.basic("", tinyDb.getString(tinyDb.getString("loginUid") + "-token"));
}
}