forked from mirrors/Fedilab
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 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);
|
||||
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
|
||||
if (getIntent() != null && getIntent().getData() != null && getIntent().getData().toString().contains(REDIRECT_CONTENT_WEB + "?code=")) {
|
||||
String url = getIntent().getData().toString();
|
||||
private void manageItent(Intent intent) {
|
||||
if (intent != null && intent.getData() != null && intent.getData().toString().contains(REDIRECT_CONTENT_WEB + "?code=")) {
|
||||
String url = intent.getData().toString();
|
||||
Matcher matcher = Helper.codePattern.matcher(url);
|
||||
if (!matcher.find()) {
|
||||
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() {
|
||||
return requestedAdmin;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ public class Sqlite extends SQLiteOpenHelper {
|
|||
+ COL_APP_CLIENT_ID + " TEXT NOT NULL, "
|
||||
+ COL_APP_CLIENT_SECRET + " 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)";
|
||||
private static final String CREATE_TABLE_TIMELINES = "CREATE TABLE IF NOT EXISTS " + TABLE_TIMELINES + " ("
|
||||
+ COL_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
|
||||
|
|
|
@ -142,6 +142,9 @@ public class FragmentLoginMain extends Fragment {
|
|||
binding.continueButton.setEnabled(false);
|
||||
NodeInfoVM nodeInfoVM = new ViewModelProvider(requireActivity()).get(NodeInfoVM.class);
|
||||
nodeInfoVM.getNodeInfo(binding.loginInstance.getText().toString()).observe(requireActivity(), nodeInfo -> {
|
||||
if (nodeInfo == null) {
|
||||
return;
|
||||
}
|
||||
binding.continueButton.setEnabled(true);
|
||||
BaseMainActivity.software = nodeInfo.software.name.toUpperCase();
|
||||
switch (nodeInfo.software.name.toUpperCase().trim()) {
|
||||
|
|
Loading…
Reference in a new issue