2019-06-03 23:25:05 +02:00
|
|
|
package org.mian.gitnex.activities;
|
|
|
|
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.view.View;
|
|
|
|
import android.widget.ArrayAdapter;
|
2020-10-20 20:09:07 +02:00
|
|
|
import android.widget.AutoCompleteTextView;
|
2019-06-03 23:25:05 +02:00
|
|
|
import android.widget.Button;
|
|
|
|
import android.widget.EditText;
|
2019-10-24 17:48:00 +02:00
|
|
|
import android.widget.RadioGroup;
|
2019-10-22 17:27:33 +02:00
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.appcompat.app.AlertDialog;
|
2022-04-18 09:10:54 +02:00
|
|
|
import org.gitnex.tea4j.v2.models.AccessToken;
|
|
|
|
import org.gitnex.tea4j.v2.models.CreateAccessTokenOption;
|
2022-04-22 17:18:38 +02:00
|
|
|
import org.gitnex.tea4j.v2.models.GeneralAPISettings;
|
2022-04-18 09:10:54 +02:00
|
|
|
import org.gitnex.tea4j.v2.models.ServerVersion;
|
|
|
|
import org.gitnex.tea4j.v2.models.User;
|
2019-10-22 17:27:33 +02:00
|
|
|
import org.mian.gitnex.R;
|
2019-06-03 23:25:05 +02:00
|
|
|
import org.mian.gitnex.clients.RetrofitClient;
|
2021-04-13 20:56:50 +02:00
|
|
|
import org.mian.gitnex.database.api.BaseApi;
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
import org.mian.gitnex.database.api.UserAccountsApi;
|
2020-08-06 17:31:31 +02:00
|
|
|
import org.mian.gitnex.database.models.UserAccount;
|
2021-01-26 16:10:31 +01:00
|
|
|
import org.mian.gitnex.databinding.ActivityLoginBinding;
|
2022-03-28 19:57:47 +02:00
|
|
|
import org.mian.gitnex.helpers.AppUtil;
|
|
|
|
import org.mian.gitnex.helpers.NetworkStatusObserver;
|
|
|
|
import org.mian.gitnex.helpers.PathsHelper;
|
|
|
|
import org.mian.gitnex.helpers.Toasty;
|
|
|
|
import org.mian.gitnex.helpers.UrlHelper;
|
|
|
|
import org.mian.gitnex.helpers.Version;
|
2021-12-19 13:39:08 +01:00
|
|
|
import org.mian.gitnex.structs.Protocol;
|
2020-06-30 16:43:27 +02:00
|
|
|
import java.net.URI;
|
2020-03-19 14:54:20 +01:00
|
|
|
import java.nio.charset.StandardCharsets;
|
2019-06-03 23:25:05 +02:00
|
|
|
import java.util.List;
|
2019-11-13 16:52:49 +01:00
|
|
|
import java.util.UUID;
|
2020-06-30 16:43:27 +02:00
|
|
|
import io.mikael.urlbuilder.UrlBuilder;
|
2019-06-03 23:25:05 +02:00
|
|
|
import okhttp3.Credentials;
|
|
|
|
import retrofit2.Call;
|
|
|
|
import retrofit2.Callback;
|
|
|
|
|
|
|
|
/**
|
2022-04-18 09:10:54 +02:00
|
|
|
* @author M M Arif
|
2019-06-03 23:25:05 +02:00
|
|
|
*/
|
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
public class LoginActivity extends BaseActivity {
|
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
private enum LoginType {BASIC, TOKEN}
|
2020-06-28 17:11:59 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
private Button loginButton;
|
|
|
|
private EditText instanceUrlET, loginUidET, loginPassword, otpCode, loginTokenCode;
|
2020-10-20 20:09:07 +02:00
|
|
|
private AutoCompleteTextView protocolSpinner;
|
2020-05-17 18:14:06 +02:00
|
|
|
private RadioGroup loginMethod;
|
|
|
|
private String device_id = "token";
|
2020-10-20 20:09:07 +02:00
|
|
|
private String selectedProtocol;
|
2019-06-03 23:25:05 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
private URI instanceUrl;
|
|
|
|
private Version giteaVersion;
|
2022-04-22 17:18:38 +02:00
|
|
|
private int maxResponseItems = 50;
|
|
|
|
private int defaultPagingNumber = 25;
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
@Override
|
|
|
|
public void onCreate(Bundle savedInstanceState) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
super.onCreate(savedInstanceState);
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2021-01-26 16:10:31 +01:00
|
|
|
ActivityLoginBinding activityLoginBinding = ActivityLoginBinding.inflate(getLayoutInflater());
|
2021-01-26 18:43:25 +01:00
|
|
|
setContentView(activityLoginBinding.getRoot());
|
2021-01-26 16:10:31 +01:00
|
|
|
|
2021-03-03 15:10:23 +01:00
|
|
|
NetworkStatusObserver networkStatusObserver = NetworkStatusObserver.getInstance(ctx);
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2021-01-26 16:10:31 +01:00
|
|
|
loginButton = activityLoginBinding.loginButton;
|
|
|
|
instanceUrlET = activityLoginBinding.instanceUrl;
|
|
|
|
loginUidET = activityLoginBinding.loginUid;
|
|
|
|
loginPassword = activityLoginBinding.loginPasswd;
|
|
|
|
otpCode = activityLoginBinding.otpCode;
|
|
|
|
protocolSpinner = activityLoginBinding.httpsSpinner;
|
|
|
|
loginMethod = activityLoginBinding.loginMethod;
|
|
|
|
loginTokenCode = activityLoginBinding.loginTokenCode;
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2021-01-26 16:10:31 +01:00
|
|
|
activityLoginBinding.appVersion.setText(AppUtil.getAppVersion(appCtx));
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-10-20 20:09:07 +02:00
|
|
|
ArrayAdapter<Protocol> adapterProtocols = new ArrayAdapter<>(LoginActivity.this, R.layout.list_spinner_items, Protocol.values());
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2021-07-23 17:41:19 +02:00
|
|
|
instanceUrlET.setText(getIntent().getStringExtra("instanceUrl"));
|
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
protocolSpinner.setAdapter(adapterProtocols);
|
2021-01-14 17:33:50 +01:00
|
|
|
protocolSpinner.setSelection(0);
|
2020-10-20 20:09:07 +02:00
|
|
|
protocolSpinner.setOnItemClickListener((parent, view, position, id) -> {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-10-20 20:09:07 +02:00
|
|
|
selectedProtocol = String.valueOf(parent.getItemAtPosition(position));
|
|
|
|
|
|
|
|
if(selectedProtocol.equals(String.valueOf(Protocol.HTTP))) {
|
|
|
|
Toasty.warning(ctx, getResources().getString(R.string.protocolError));
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
2020-10-20 20:09:07 +02:00
|
|
|
});
|
2020-03-28 15:49:08 +01:00
|
|
|
|
2020-10-20 20:09:07 +02:00
|
|
|
if(R.id.loginToken == loginMethod.getCheckedRadioButtonId()) {
|
|
|
|
AppUtil.setMultiVisibility(View.GONE, findViewById(R.id.login_uidLayout), findViewById(R.id.login_passwdLayout), findViewById(R.id.otpCodeLayout));
|
|
|
|
findViewById(R.id.loginTokenCodeLayout).setVisibility(View.VISIBLE);
|
2022-02-22 07:23:46 +01:00
|
|
|
} else {
|
2020-10-20 20:09:07 +02:00
|
|
|
AppUtil.setMultiVisibility(View.VISIBLE, findViewById(R.id.login_uidLayout), findViewById(R.id.login_passwdLayout), findViewById(R.id.otpCodeLayout));
|
|
|
|
findViewById(R.id.loginTokenCodeLayout).setVisibility(View.GONE);
|
|
|
|
}
|
2020-04-12 21:04:02 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
loginMethod.setOnCheckedChangeListener((group, checkedId) -> {
|
|
|
|
if(checkedId == R.id.loginToken) {
|
2020-10-20 20:09:07 +02:00
|
|
|
AppUtil.setMultiVisibility(View.GONE, findViewById(R.id.login_uidLayout), findViewById(R.id.login_passwdLayout), findViewById(R.id.otpCodeLayout));
|
|
|
|
findViewById(R.id.loginTokenCodeLayout).setVisibility(View.VISIBLE);
|
2022-02-22 07:23:46 +01:00
|
|
|
} else {
|
2020-10-20 20:09:07 +02:00
|
|
|
AppUtil.setMultiVisibility(View.VISIBLE, findViewById(R.id.login_uidLayout), findViewById(R.id.login_passwdLayout), findViewById(R.id.otpCodeLayout));
|
|
|
|
findViewById(R.id.loginTokenCodeLayout).setVisibility(View.GONE);
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
|
|
|
});
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-02-22 07:23:46 +01:00
|
|
|
networkStatusObserver.registerNetworkStatusListener(hasNetworkConnection -> runOnUiThread(() -> {
|
|
|
|
if(hasNetworkConnection) {
|
|
|
|
enableProcessButton();
|
|
|
|
} else {
|
|
|
|
disableProcessButton();
|
|
|
|
loginButton.setText(getResources().getString(R.string.btnLogin));
|
|
|
|
Toasty.error(ctx, getResources().getString(R.string.checkNetConnection));
|
|
|
|
}
|
|
|
|
}));
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
loadDefaults();
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
loginButton.setOnClickListener(view -> {
|
2020-05-17 18:14:06 +02:00
|
|
|
disableProcessButton();
|
|
|
|
login();
|
2020-06-28 17:11:59 +02:00
|
|
|
});
|
|
|
|
}
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
private void login() {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
try {
|
2020-04-12 21:04:02 +02:00
|
|
|
|
2020-10-20 20:09:07 +02:00
|
|
|
if(selectedProtocol == null) {
|
|
|
|
|
|
|
|
Toasty.error(ctx, getResources().getString(R.string.protocolEmptyError));
|
|
|
|
enableProcessButton();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
String loginUid = loginUidET.getText().toString();
|
|
|
|
String loginPass = loginPassword.getText().toString();
|
|
|
|
String loginToken = loginTokenCode.getText().toString().trim();
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
LoginType loginType = (loginMethod.getCheckedRadioButtonId() == R.id.loginUsernamePassword) ? LoginType.BASIC : LoginType.TOKEN;
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
URI rawInstanceUrl = UrlBuilder.fromString(UrlHelper.fixScheme(instanceUrlET.getText().toString(), "http")).toUri();
|
2020-06-30 16:43:27 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
instanceUrl = UrlBuilder.fromUri(rawInstanceUrl).withScheme(selectedProtocol.toLowerCase()).withPath(PathsHelper.join(rawInstanceUrl.getPath(), "/api/v1/"))
|
2020-06-30 16:43:27 +02:00
|
|
|
.toUri();
|
2019-10-24 19:42:09 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
// cache values to make them available the next time the user wants to log in
|
2020-06-28 17:11:59 +02:00
|
|
|
tinyDB.putString("loginType", loginType.name().toLowerCase());
|
2020-06-30 16:43:27 +02:00
|
|
|
tinyDB.putString("instanceUrlRaw", instanceUrlET.getText().toString());
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
if(instanceUrlET.getText().toString().equals("")) {
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-08-06 17:16:51 +02:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.emptyFieldURL));
|
2020-06-28 17:11:59 +02:00
|
|
|
enableProcessButton();
|
|
|
|
return;
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
if(loginType == LoginType.BASIC) {
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-06-30 16:43:27 +02:00
|
|
|
if(otpCode.length() != 0 && otpCode.length() != 6) {
|
|
|
|
|
2020-08-06 17:16:51 +02:00
|
|
|
Toasty.warning(ctx, getResources().getString(R.string.loginOTPTypeError));
|
2020-06-30 16:43:27 +02:00
|
|
|
enableProcessButton();
|
|
|
|
return;
|
|
|
|
}
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
if(loginUid.equals("")) {
|
2020-08-06 17:16:51 +02:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.emptyFieldUsername));
|
2020-05-17 18:14:06 +02:00
|
|
|
enableProcessButton();
|
|
|
|
return;
|
|
|
|
}
|
2020-06-28 17:11:59 +02:00
|
|
|
|
|
|
|
if(loginPass.equals("")) {
|
2020-08-06 17:16:51 +02:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.emptyFieldPassword));
|
2020-05-17 18:14:06 +02:00
|
|
|
enableProcessButton();
|
|
|
|
return;
|
|
|
|
}
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-06-30 16:43:27 +02:00
|
|
|
int loginOTP = (otpCode.length() > 0) ? Integer.parseInt(otpCode.getText().toString().trim()) : 0;
|
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
versionCheck(loginUid, loginPass, loginOTP, loginToken, loginType);
|
2019-10-22 17:27:33 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
|
|
|
else {
|
2019-10-22 17:27:33 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
if(loginToken.equals("")) {
|
2019-10-22 17:27:33 +02:00
|
|
|
|
2020-08-06 17:16:51 +02:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.loginTokenError));
|
2020-05-17 18:14:06 +02:00
|
|
|
enableProcessButton();
|
|
|
|
return;
|
|
|
|
}
|
2019-10-22 17:27:33 +02:00
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
versionCheck(loginUid, loginPass, 123, loginToken, loginType);
|
2022-04-22 17:18:38 +02:00
|
|
|
serverPageLimitSettings();
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
2019-10-22 17:27:33 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
}
|
|
|
|
catch(Exception e) {
|
2019-10-22 17:27:33 +02:00
|
|
|
|
2020-08-06 17:16:51 +02:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.malformedUrl));
|
2020-06-28 17:11:59 +02:00
|
|
|
enableProcessButton();
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
|
|
|
}
|
2019-10-22 17:27:33 +02:00
|
|
|
|
2022-04-22 17:18:38 +02:00
|
|
|
private void serverPageLimitSettings() {
|
|
|
|
|
|
|
|
Call<GeneralAPISettings> generalAPISettings = RetrofitClient.getApiInterface(ctx).getGeneralAPISettings();
|
|
|
|
generalAPISettings.enqueue(new Callback<>() {
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onResponse(@NonNull final Call<GeneralAPISettings> generalAPISettings, @NonNull retrofit2.Response<GeneralAPISettings> response) {
|
|
|
|
|
|
|
|
if(response.code() == 200 && response.body() != null) {
|
|
|
|
|
|
|
|
if(response.body().getMaxResponseItems() != null) {
|
|
|
|
maxResponseItems = Math.toIntExact(response.body().getMaxResponseItems());
|
|
|
|
}
|
|
|
|
if(response.body().getDefaultPagingNum() != null) {
|
|
|
|
defaultPagingNumber = Math.toIntExact(response.body().getDefaultPagingNum());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void onFailure(@NonNull Call<GeneralAPISettings> generalAPISettings, @NonNull Throwable t) {
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
private void versionCheck(final String loginUid, final String loginPass, final int loginOTP, final String loginToken,
|
2020-07-29 16:27:47 +02:00
|
|
|
final LoginType loginType) {
|
2019-10-22 17:27:33 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
Call<ServerVersion> callVersion;
|
2020-06-28 17:11:59 +02:00
|
|
|
|
|
|
|
if(!loginToken.equals("")) {
|
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
callVersion = RetrofitClient.getApiInterface(ctx, instanceUrl.toString(), "token " + loginToken).getVersion();
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
|
|
|
else {
|
2020-06-28 17:11:59 +02:00
|
|
|
|
|
|
|
String credential = Credentials.basic(loginUid, loginPass, StandardCharsets.UTF_8);
|
|
|
|
|
2022-04-09 11:23:49 +02:00
|
|
|
if (loginOTP != 0) {
|
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
callVersion = RetrofitClient.getApiInterface(ctx, instanceUrl.toString(), credential).getVersion(loginOTP);
|
2022-04-09 11:23:49 +02:00
|
|
|
} else {
|
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
callVersion = RetrofitClient.getApiInterface(ctx, instanceUrl.toString(), credential).getVersion();
|
2022-04-09 11:23:49 +02:00
|
|
|
}
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
2019-10-22 17:27:33 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
callVersion.enqueue(new Callback<>() {
|
2019-10-22 17:27:33 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
@Override
|
2022-04-18 09:10:54 +02:00
|
|
|
public void onResponse(@NonNull final Call<ServerVersion> callVersion, @NonNull retrofit2.Response<ServerVersion> responseVersion) {
|
2020-03-31 21:04:08 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
if(responseVersion.code() == 200) {
|
2020-03-31 21:04:08 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
ServerVersion version = responseVersion.body();
|
2020-05-17 18:14:06 +02:00
|
|
|
assert version != null;
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-09-04 16:33:37 +02:00
|
|
|
if(!Version.valid(version.getVersion())) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-08-06 17:16:51 +02:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.versionUnknown));
|
2020-05-17 18:14:06 +02:00
|
|
|
enableProcessButton();
|
2020-06-28 17:11:59 +02:00
|
|
|
return;
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
2020-03-31 21:04:08 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
giteaVersion = new Version(version.getVersion());
|
2020-09-04 16:33:37 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
if(giteaVersion.less(getString(R.string.versionLow))) {
|
2020-03-31 16:41:50 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(ctx).setTitle(getString(R.string.versionAlertDialogHeader))
|
|
|
|
.setMessage(getResources().getString(R.string.versionUnsupportedOld, version.getVersion())).setIcon(R.drawable.ic_warning)
|
2020-06-28 17:11:59 +02:00
|
|
|
.setCancelable(true);
|
2019-10-22 17:27:33 +02:00
|
|
|
|
2021-10-04 15:35:34 +02:00
|
|
|
alertDialogBuilder.setNeutralButton(getString(R.string.cancelButton), (dialog, which) -> {
|
2019-10-22 17:27:33 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
dialog.dismiss();
|
|
|
|
enableProcessButton();
|
2020-06-28 17:11:59 +02:00
|
|
|
});
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
alertDialogBuilder.setPositiveButton(getString(R.string.textContinue), (dialog, which) -> {
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
dialog.dismiss();
|
2020-11-02 16:17:00 +01:00
|
|
|
login(loginType, loginUid, loginPass, loginOTP, loginToken);
|
2020-05-17 18:14:06 +02:00
|
|
|
});
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
alertDialogBuilder.create().show();
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
else if(giteaVersion.lessOrEqual(getString(R.string.versionHigh))) {
|
2020-06-28 17:11:59 +02:00
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
login(loginType, loginUid, loginPass, loginOTP, loginToken);
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
|
|
|
else {
|
2020-06-28 17:11:59 +02:00
|
|
|
|
2020-08-06 17:16:51 +02:00
|
|
|
Toasty.warning(ctx, getResources().getString(R.string.versionUnsupportedNew));
|
2020-11-02 16:17:00 +01:00
|
|
|
login(loginType, loginUid, loginPass, loginOTP, loginToken);
|
2020-06-28 17:11:59 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
|
|
|
else if(responseVersion.code() == 403) {
|
2020-03-31 16:41:50 +02:00
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
login(loginType, loginUid, loginPass, loginOTP, loginToken);
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
|
|
|
}
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
private void login(LoginType loginType, String loginUid, String loginPass, int loginOTP, String loginToken) {
|
2020-07-29 16:27:47 +02:00
|
|
|
|
|
|
|
// ToDo: before store/create token: get UserInfo to check DB/AccountManager if there already exist a token
|
|
|
|
// the setup methods then can better handle all different cases
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
if(loginType == LoginType.BASIC) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
setup(loginUid, loginPass, loginOTP);
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
2020-07-29 16:27:47 +02:00
|
|
|
else if(loginType == LoginType.TOKEN) { // Token
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
setupUsingExistingToken(loginToken);
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
|
|
|
}
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
@Override
|
2022-04-18 09:10:54 +02:00
|
|
|
public void onFailure(@NonNull Call<ServerVersion> callVersion, @NonNull Throwable t) {
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2022-04-06 17:27:02 +02:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.genericServerResponseError));
|
2020-05-17 18:14:06 +02:00
|
|
|
enableProcessButton();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
private void setupUsingExistingToken(final String loginToken) {
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
Call<User> call = RetrofitClient.getApiInterface(ctx, instanceUrl.toString(), "token " + loginToken).userGetCurrent();
|
2019-10-24 19:42:09 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
call.enqueue(new Callback<>() {
|
2020-04-13 10:01:56 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
@Override
|
2022-04-18 09:10:54 +02:00
|
|
|
public void onResponse(@NonNull Call<User> call, @NonNull retrofit2.Response<User> response) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
User userDetails = response.body();
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
switch(response.code()) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
case 200:
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
assert userDetails != null;
|
2019-06-03 23:25:05 +02:00
|
|
|
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
// insert new account to db if does not exist
|
2022-04-18 09:10:54 +02:00
|
|
|
String accountName = userDetails.getLogin() + "@" + instanceUrl;
|
2021-04-13 20:56:50 +02:00
|
|
|
UserAccountsApi userAccountsApi = BaseApi.getInstance(ctx, UserAccountsApi.class);
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
assert userAccountsApi != null;
|
2021-04-13 20:56:50 +02:00
|
|
|
boolean userAccountExists = userAccountsApi.userAccountExists(accountName);
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
UserAccount account;
|
2021-04-13 20:56:50 +02:00
|
|
|
if(!userAccountExists) {
|
2022-04-22 17:18:38 +02:00
|
|
|
long accountId = userAccountsApi.createNewAccount(accountName, instanceUrl.toString(), userDetails.getLogin(), loginToken, giteaVersion.toString(), maxResponseItems, defaultPagingNumber);
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
account = userAccountsApi.getAccountById((int) accountId);
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
}
|
2020-08-04 22:50:04 +02:00
|
|
|
else {
|
|
|
|
userAccountsApi.updateTokenByAccountName(accountName, loginToken);
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
userAccountsApi.login(userAccountsApi.getAccountByName(accountName).getAccountId());
|
|
|
|
account = userAccountsApi.getAccountByName(accountName);
|
2020-08-04 22:50:04 +02:00
|
|
|
}
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
AppUtil.switchToAccount(LoginActivity.this, account);
|
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
enableProcessButton();
|
|
|
|
startActivity(new Intent(LoginActivity.this, MainActivity.class));
|
|
|
|
finish();
|
2020-06-28 17:11:59 +02:00
|
|
|
break;
|
|
|
|
case 401:
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-08-06 17:16:51 +02:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.unauthorizedApiError));
|
2020-06-28 17:11:59 +02:00
|
|
|
enableProcessButton();
|
|
|
|
break;
|
|
|
|
default:
|
2020-10-29 14:13:19 +01:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.genericApiError, response.code()));
|
2020-06-28 17:11:59 +02:00
|
|
|
enableProcessButton();
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
|
|
|
}
|
2019-11-15 20:39:09 +01:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
@Override
|
2022-04-18 09:10:54 +02:00
|
|
|
public void onFailure(@NonNull Call<User> call, @NonNull Throwable t) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
2020-05-17 18:14:06 +02:00
|
|
|
enableProcessButton();
|
|
|
|
}
|
|
|
|
});
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
private void setup(final String loginUid, final String loginPass, final int loginOTP) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
final String credential = Credentials.basic(loginUid, loginPass, StandardCharsets.UTF_8);
|
2020-07-29 16:27:47 +02:00
|
|
|
final String tokenName = "gitnex-app-" + device_id;
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
Call<List<AccessToken>> call;
|
2020-05-17 18:14:06 +02:00
|
|
|
if(loginOTP != 0) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
call = RetrofitClient.getApiInterface(ctx, instanceUrl.toString(), credential).userGetTokens(loginOTP, loginUid, null, null);
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
|
|
|
else {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
call = RetrofitClient.getApiInterface(ctx, instanceUrl.toString(), credential).userGetTokens(loginUid, null, null);
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
call.enqueue(new Callback<>() {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
@Override
|
2022-04-18 09:10:54 +02:00
|
|
|
public void onResponse(@NonNull Call<List<AccessToken>> call, @NonNull retrofit2.Response<List<AccessToken>> response) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
List<AccessToken> userTokens = response.body();
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
if(response.code() == 200) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
assert userTokens != null;
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
for(AccessToken t : userTokens) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
if(t.getName().equals(tokenName)) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
// this app had created an token on this instance before
|
|
|
|
// -> since it looks like GitNex forgot the secret we have to delete it first
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
Call<Void> delToken;
|
2020-07-29 16:27:47 +02:00
|
|
|
if(loginOTP != 0) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
delToken = RetrofitClient.getApiInterface(ctx, instanceUrl.toString(), credential)
|
|
|
|
.userDeleteAccessToken(loginOTP, loginUid, String.valueOf(t.getId()));
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
2020-07-29 16:27:47 +02:00
|
|
|
else {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
delToken = RetrofitClient.getApiInterface(ctx, instanceUrl.toString(), credential).userDeleteAccessToken(loginUid, String.valueOf(t.getId()));
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
delToken.enqueue(new Callback<>() {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
@Override
|
2022-04-18 09:10:54 +02:00
|
|
|
public void onResponse(@NonNull Call<Void> delToken, @NonNull retrofit2.Response<Void> response) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
if(response.code() == 204) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
setupToken(loginUid, loginPass, loginOTP, tokenName);
|
2020-07-29 16:27:47 +02:00
|
|
|
}
|
|
|
|
else {
|
2020-03-31 21:04:53 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.genericApiError, response.code()));
|
2020-07-29 16:27:47 +02:00
|
|
|
enableProcessButton();
|
|
|
|
}
|
|
|
|
}
|
2020-03-31 21:04:53 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
@Override
|
2022-04-18 09:10:54 +02:00
|
|
|
public void onFailure(@NonNull Call<Void> delToken, @NonNull Throwable t) {
|
2020-03-31 21:04:53 +02:00
|
|
|
|
2020-08-06 17:16:51 +02:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.malformedJson));
|
2020-07-29 16:27:47 +02:00
|
|
|
enableProcessButton();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
2020-03-31 21:04:53 +02:00
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
setupToken(loginUid, loginPass, loginOTP, tokenName);
|
2020-07-29 16:27:47 +02:00
|
|
|
}
|
|
|
|
else {
|
2020-03-31 21:04:53 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.genericApiError, response.code()));
|
2020-07-29 16:27:47 +02:00
|
|
|
enableProcessButton();
|
|
|
|
}
|
|
|
|
}
|
2020-03-31 21:04:53 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
@Override
|
2022-04-18 09:10:54 +02:00
|
|
|
public void onFailure(@NonNull Call<List<AccessToken>> call, @NonNull Throwable t) {
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
|
2020-08-06 17:16:51 +02:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.malformedJson));
|
2020-07-29 16:27:47 +02:00
|
|
|
enableProcessButton();
|
|
|
|
}
|
|
|
|
});
|
2020-03-31 21:04:53 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
}
|
2020-03-31 21:04:53 +02:00
|
|
|
|
2020-11-02 16:17:00 +01:00
|
|
|
private void setupToken(final String loginUid, final String loginPass, final int loginOTP, final String tokenName) {
|
2020-03-31 21:04:53 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
final String credential = Credentials.basic(loginUid, loginPass, StandardCharsets.UTF_8);
|
2020-03-31 21:04:53 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
CreateAccessTokenOption createUserToken = new CreateAccessTokenOption().name(tokenName);
|
|
|
|
Call<AccessToken> callCreateToken;
|
2020-03-31 21:04:53 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
if(loginOTP != 0) {
|
2020-03-31 21:04:53 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
callCreateToken = RetrofitClient.getApiInterface(ctx, instanceUrl.toString(), credential)
|
|
|
|
.userCreateToken(loginOTP, loginUid, createUserToken);
|
2020-07-29 16:27:47 +02:00
|
|
|
}
|
|
|
|
else {
|
2020-04-02 23:07:20 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
callCreateToken = RetrofitClient.getApiInterface(ctx, instanceUrl.toString(), credential)
|
|
|
|
.userCreateToken(loginUid, createUserToken);
|
2020-07-29 16:27:47 +02:00
|
|
|
}
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
callCreateToken.enqueue(new Callback<>() {
|
2020-04-07 08:05:42 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
@Override
|
2022-04-18 09:10:54 +02:00
|
|
|
public void onResponse(@NonNull Call<AccessToken> callCreateToken, @NonNull retrofit2.Response<AccessToken> responseCreate) {
|
2020-04-07 08:05:42 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
if(responseCreate.code() == 201) {
|
2020-04-07 08:05:42 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
AccessToken newToken = responseCreate.body();
|
2020-07-29 16:27:47 +02:00
|
|
|
assert newToken != null;
|
2020-04-07 08:05:42 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
if(!newToken.getSha1().equals("")) {
|
2020-04-07 08:05:42 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
Call<User> call = RetrofitClient.getApiInterface(ctx, instanceUrl.toString(), "token " + newToken.getSha1()).userGetCurrent();
|
2020-04-07 08:05:42 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
call.enqueue(new Callback<>() {
|
2020-04-07 08:05:42 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
@Override
|
2022-04-18 09:10:54 +02:00
|
|
|
public void onResponse(@NonNull Call<User> call, @NonNull retrofit2.Response<User> response) {
|
2020-04-07 08:05:42 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
User userDetails = response.body();
|
2020-04-07 08:05:42 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
switch(response.code()) {
|
2020-04-07 08:05:42 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
case 200:
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
assert userDetails != null;
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
|
|
|
|
// insert new account to db if does not exist
|
2022-04-18 09:10:54 +02:00
|
|
|
String accountName = userDetails.getLogin() + "@" + instanceUrl;
|
2021-04-13 20:56:50 +02:00
|
|
|
UserAccountsApi userAccountsApi = BaseApi.getInstance(ctx, UserAccountsApi.class);
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
assert userAccountsApi != null;
|
2021-04-13 20:56:50 +02:00
|
|
|
boolean userAccountExists = userAccountsApi.userAccountExists(accountName);
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
UserAccount account;
|
2021-04-13 20:56:50 +02:00
|
|
|
if(!userAccountExists) {
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
long accountId = userAccountsApi
|
2022-04-18 09:10:54 +02:00
|
|
|
.createNewAccount(accountName, instanceUrl.toString(), userDetails.getLogin(), newToken.getSha1(),
|
2022-04-22 17:18:38 +02:00
|
|
|
giteaVersion.toString(), maxResponseItems, defaultPagingNumber);
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
account = userAccountsApi.getAccountById((int) accountId);
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
}
|
2020-08-04 22:50:04 +02:00
|
|
|
else {
|
|
|
|
userAccountsApi.updateTokenByAccountName(accountName, newToken.getSha1());
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
account = userAccountsApi.getAccountByName(accountName);
|
2020-08-04 22:50:04 +02:00
|
|
|
}
|
Implement drafts, introduce Room persistence library for db (#139)
Fix no draft message
translation updates
format improvements
typo update
some renaming refactors
Use better naming convention
remove duplicate source
arrange draft titles
enhance click listener area
Launch drafts from reply screen and clean up
Add message draft saved
update repositories tasks
Update user accounts repository with thread, remove async tasks
remove async task in drafts
update layout, change async to thread in drafts
Merge branch 'master' into pull_139
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
Merge branch 'pull_139' of codeberg.org:gitnex/GitNex into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139
Merge branch 'master' into pull_139 and fix conflicts
# Conflicts:
# app/build.gradle
# app/src/main/java/org/mian/gitnex/activities/LoginActivity.java
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/activities/ReplyToIssueActivity.java
# app/src/main/java/org/mian/gitnex/adapters/MyReposListAdapter.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
# app/src/main/res/values/strings.xml
Code Format
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/res/values/strings.xml
Go to draft, save on type and other fixes
delete all drafts, added messages where needed
delete draft
Force logout
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/src/main/java/org/mian/gitnex/activities/MainActivity.java
# app/src/main/java/org/mian/gitnex/helpers/StaticGlobalVariables.java
check if account data is null, we need to log the user out for the 1st time.
Merge branch 'master' into 15-comments-draft
fix repo owner, name sequence
Add comments for test, show drafts list
Add repos to db
Add account to db and other refactors to the code
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
Merge branch 'master' into 15-comments-draft
# Conflicts:
# app/build.gradle
# app/src/main/AndroidManifest.xml
Merge branch 'master' into 15-comments-draft
merge
more queries, added dao repositories, layout update
Added queries in dao
some refactor. added models, dao, entities (accounts, repositories, drafts)
WIP on implementing drafts, introduced Room persistence library for db.
Co-authored-by: M M Arif <mmarif@swatian.com>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/139
Reviewed-by: opyale <opyale@noreply.codeberg.org>
2020-07-04 22:51:55 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
AppUtil.switchToAccount(LoginActivity.this, account);
|
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
startActivity(new Intent(LoginActivity.this, MainActivity.class));
|
|
|
|
finish();
|
|
|
|
break;
|
|
|
|
case 401:
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-08-06 17:16:51 +02:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.unauthorizedApiError));
|
2020-05-17 18:14:06 +02:00
|
|
|
enableProcessButton();
|
2020-06-28 17:11:59 +02:00
|
|
|
break;
|
|
|
|
default:
|
2020-10-29 14:13:19 +01:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.genericApiError, response.code()));
|
2020-05-17 18:14:06 +02:00
|
|
|
enableProcessButton();
|
|
|
|
}
|
2020-06-28 17:11:59 +02:00
|
|
|
}
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
@Override
|
2022-04-18 09:10:54 +02:00
|
|
|
public void onFailure(@NonNull Call<User> call, @NonNull Throwable t) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-08-06 17:16:51 +02:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.genericError));
|
2020-06-28 17:11:59 +02:00
|
|
|
enableProcessButton();
|
|
|
|
}
|
|
|
|
});
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
|
|
|
}
|
2020-07-29 16:27:47 +02:00
|
|
|
else if(responseCreate.code() == 500) {
|
2020-04-02 19:04:54 +02:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
Toasty.error(ctx, getResources().getString(R.string.genericApiError, responseCreate.code()));
|
2020-05-17 18:14:06 +02:00
|
|
|
enableProcessButton();
|
|
|
|
}
|
|
|
|
}
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
@Override
|
2022-04-18 09:10:54 +02:00
|
|
|
public void onFailure(@NonNull Call<AccessToken> createUserToken, @NonNull Throwable t) {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2022-04-18 09:10:54 +02:00
|
|
|
Toasty.error(ctx, ctx.getString(R.string.genericServerResponseError));
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-07-29 16:27:47 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
private void loadDefaults() {
|
|
|
|
|
|
|
|
if(tinyDB.getString("loginType").equals(LoginType.BASIC.name().toLowerCase())) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
loginMethod.check(R.id.loginUsernamePassword);
|
|
|
|
}
|
|
|
|
else {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
loginMethod.check(R.id.loginToken);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!tinyDB.getString("instanceUrlRaw").equals("")) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
instanceUrlET.setText(tinyDB.getString("instanceUrlRaw"));
|
|
|
|
}
|
|
|
|
|
2022-04-09 11:23:49 +02:00
|
|
|
if(getAccount() != null && getAccount().getAccount() != null) {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
Don't use TinyDB as cache (#1034)
Do not use TinyDB as a cache or a way to send data between activities.
### How is this working
Instead of saving everything into the TinyDB, I created three `Context`s (a `RepositoryContext`, an `IssueContext` and an `AccountContext`). All are used to store things like API or database values/models and additional data, e.g. the `RepositoryContext` also contains information about the current filter state of a repository (issues, pull requests, releases/tags and milestones). These are sent using `Intent`s and `Bundle`s between activities and fragments. Changing a field (e.g. filter state) in any fragment changes it also for the whole repository (or at least it should do so).
Due to the size of the changes (after https://codeberg.org/gitnex/GitNex/commit/c9172f85efafd9f25739fdd8385e1904b711ea41, Git says `154 files changed, 3318 insertions(+), 3835 deletions(-)`) **I highly recommend you to create a beta/pre release before releasing a stable version**.
Additional changes:
* after logging out, the account remains in the account list (with a note) and you can log in again (you can't switch to this account)
* repositories and organizations are clickable on user profiles
* deleted two unused classes
Once finished, hopefully
* closes #354
* replaces #897
* fixes #947
* closes #1001
* closes #1015
* marks #876 and #578 as `Wontfix` since they are not necessary at this point
* and all the other TinyDB issues
Co-authored-by: qwerty287 <ndev@web.de>
Co-authored-by: M M Arif <mmarif@noreply.codeberg.org>
Co-authored-by: 6543 <6543@obermui.de>
Reviewed-on: https://codeberg.org/gitnex/GitNex/pulls/1034
Reviewed-by: 6543 <6543@noreply.codeberg.org>
Co-authored-by: qwerty287 <qwerty287@noreply.codeberg.org>
Co-committed-by: qwerty287 <qwerty287@noreply.codeberg.org>
2022-03-13 03:59:13 +01:00
|
|
|
loginUidET.setText(getAccount().getAccount().getUserName());
|
2020-06-28 17:11:59 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!tinyDB.getString("uniqueAppId").isEmpty()) {
|
|
|
|
device_id = tinyDB.getString("uniqueAppId");
|
|
|
|
}
|
|
|
|
else {
|
2020-10-29 14:13:19 +01:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
device_id = UUID.randomUUID().toString();
|
|
|
|
tinyDB.putString("uniqueAppId", device_id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-05-17 18:14:06 +02:00
|
|
|
private void disableProcessButton() {
|
2019-06-03 23:25:05 +02:00
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
loginButton.setText(R.string.processingText);
|
|
|
|
loginButton.setEnabled(false);
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void enableProcessButton() {
|
|
|
|
|
2020-06-28 17:11:59 +02:00
|
|
|
loginButton.setText(R.string.btnLogin);
|
|
|
|
loginButton.setEnabled(true);
|
2020-05-17 18:14:06 +02:00
|
|
|
}
|
2019-06-03 23:25:05 +02:00
|
|
|
|
|
|
|
}
|