mirror of
https://codeberg.org/tom79/Fedilab.git
synced 2024-12-22 16:50:04 +02:00
Fix a db issue
This commit is contained in:
parent
4a4315882f
commit
2e348a76b7
3 changed files with 28 additions and 13 deletions
|
@ -54,19 +54,10 @@ public class LoginActivity extends BaseActivity {
|
||||||
private final int PICK_IMPORT = 5557;
|
private final int PICK_IMPORT = 5557;
|
||||||
private boolean requestedAdmin;
|
private boolean requestedAdmin;
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
ThemeHelper.applyTheme(this);
|
|
||||||
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(LoginActivity.this);
|
|
||||||
setContentView(new FrameLayout(this));
|
|
||||||
|
|
||||||
Helper.addFragment(getSupportFragmentManager(), android.R.id.content, new FragmentLoginMain(), null, null, null);
|
private void manageItent(Intent intent) {
|
||||||
requestedAdmin = false;
|
if (intent != null && intent.getData() != null && intent.getData().toString().contains(REDIRECT_CONTENT_WEB + "?code=")) {
|
||||||
//The activity handles a redirect URI, it will extract token code and will proceed to authentication
|
String url = intent.getData().toString();
|
||||||
//That happens when the user wants to use an external browser
|
|
||||||
if (getIntent() != null && getIntent().getData() != null && getIntent().getData().toString().contains(REDIRECT_CONTENT_WEB + "?code=")) {
|
|
||||||
String url = getIntent().getData().toString();
|
|
||||||
Matcher matcher = Helper.codePattern.matcher(url);
|
Matcher matcher = Helper.codePattern.matcher(url);
|
||||||
if (!matcher.find()) {
|
if (!matcher.find()) {
|
||||||
Toasty.error(LoginActivity.this, getString(R.string.toast_code_error), Toast.LENGTH_LONG).show();
|
Toasty.error(LoginActivity.this, getString(R.string.toast_code_error), Toast.LENGTH_LONG).show();
|
||||||
|
@ -108,6 +99,27 @@ public class LoginActivity extends BaseActivity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onNewIntent(Intent intent) {
|
||||||
|
super.onNewIntent(intent);
|
||||||
|
manageItent(intent);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
ThemeHelper.applyTheme(this);
|
||||||
|
SharedPreferences sharedpreferences = PreferenceManager.getDefaultSharedPreferences(LoginActivity.this);
|
||||||
|
setContentView(new FrameLayout(this));
|
||||||
|
|
||||||
|
Helper.addFragment(getSupportFragmentManager(), android.R.id.content, new FragmentLoginMain(), null, null, null);
|
||||||
|
requestedAdmin = false;
|
||||||
|
//The activity handles a redirect URI, it will extract token code and will proceed to authentication
|
||||||
|
//That happens when the user wants to use an external browser
|
||||||
|
manageItent(getIntent());
|
||||||
|
}
|
||||||
|
|
||||||
public boolean requestedAdmin() {
|
public boolean requestedAdmin() {
|
||||||
return requestedAdmin;
|
return requestedAdmin;
|
||||||
}
|
}
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class Sqlite extends SQLiteOpenHelper {
|
||||||
+ COL_APP_CLIENT_ID + " TEXT NOT NULL, "
|
+ COL_APP_CLIENT_ID + " TEXT NOT NULL, "
|
||||||
+ COL_APP_CLIENT_SECRET + " TEXT NOT NULL, "
|
+ COL_APP_CLIENT_SECRET + " TEXT NOT NULL, "
|
||||||
+ COL_CREATED_AT + " TEXT NOT NULL,"
|
+ COL_CREATED_AT + " TEXT NOT NULL,"
|
||||||
+ COL_ADMIN + "INTEGER NOT NULL DEFAULT 0,"
|
+ COL_ADMIN + " INTEGER NOT NULL DEFAULT 0,"
|
||||||
+ COL_UPDATED_AT + " TEXT)";
|
+ COL_UPDATED_AT + " TEXT)";
|
||||||
private static final String CREATE_TABLE_TIMELINES = "CREATE TABLE IF NOT EXISTS " + TABLE_TIMELINES + " ("
|
private static final String CREATE_TABLE_TIMELINES = "CREATE TABLE IF NOT EXISTS " + TABLE_TIMELINES + " ("
|
||||||
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||||
|
|
|
@ -142,6 +142,9 @@ public class FragmentLoginMain extends Fragment {
|
||||||
binding.continueButton.setEnabled(false);
|
binding.continueButton.setEnabled(false);
|
||||||
NodeInfoVM nodeInfoVM = new ViewModelProvider(requireActivity()).get(NodeInfoVM.class);
|
NodeInfoVM nodeInfoVM = new ViewModelProvider(requireActivity()).get(NodeInfoVM.class);
|
||||||
nodeInfoVM.getNodeInfo(binding.loginInstance.getText().toString()).observe(requireActivity(), nodeInfo -> {
|
nodeInfoVM.getNodeInfo(binding.loginInstance.getText().toString()).observe(requireActivity(), nodeInfo -> {
|
||||||
|
if (nodeInfo == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
binding.continueButton.setEnabled(true);
|
binding.continueButton.setEnabled(true);
|
||||||
BaseMainActivity.software = nodeInfo.software.name.toUpperCase();
|
BaseMainActivity.software = nodeInfo.software.name.toUpperCase();
|
||||||
switch (nodeInfo.software.name.toUpperCase().trim()) {
|
switch (nodeInfo.software.name.toUpperCase().trim()) {
|
||||||
|
|
Loading…
Reference in a new issue