Skip to content
This repository has been archived by the owner on Feb 8, 2025. It is now read-only.

Commit

Permalink
login bug fix, version upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
nuclearfog committed Feb 6, 2023
1 parent b07e944 commit 46f1cc7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId 'org.nuclearfog.twidda'
minSdkVersion 21
targetSdkVersion 33
versionCode 71
versionName '3.0.3'
versionCode 72
versionName '3.0.4'
resConfigs 'en', 'de-rDE', 'zh-rCN'
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ public class ConnectionConfig {
private int apiType;

/**
* @param apiType default API type
*/
public ConnectionConfig(int apiType) {
public ConnectionConfig() {
hostname = "";
consumerKey = "";
consumerSecret = "";
this.apiType = apiType;
apiType = -1;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class LoginActivity extends AppCompatActivity implements ActivityResultCa

@Nullable
private String loginLink;
private ConnectionConfig connection = new ConnectionConfig(ConnectionConfig.API_TWITTER_2);
private ConnectionConfig connection;


@Override
Expand Down Expand Up @@ -108,19 +108,25 @@ protected void onCreate(@Nullable Bundle b) {

NetworkAdapter adapter = new NetworkAdapter(this);
connectionDialog = new ConnectionDialog(this);
connection = new ConnectionConfig();
hostSelector.setAdapter(adapter);

switch (settings.getLogin().getConfiguration()) {
case TWITTER1:
hostSelector.setSelection(1);
connection.setApiType(ConnectionConfig.API_TWITTER_1);
break;

case TWITTER2:
hostSelector.setSelection(1);
connection.setApiType(ConnectionConfig.API_TWITTER_2);
break;

case MASTODON:
hostSelector.setSelection(0);
connection.setApiType(ConnectionConfig.API_MASTODON);
break;
}

linkButton.setOnClickListener(this);
loginButton.setOnClickListener(this);
settingsButton.setOnClickListener(this);
Expand Down Expand Up @@ -243,19 +249,19 @@ else if (v.getId() == R.id.login_network_settings) {
} else if (hostSelector.getSelectedItemId() == NetworkAdapter.ID_MASTODON) {
connectionDialog.show(connection);
}
loginLink = null;
}
}


@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
// reset login link after provider change
loginLink = null;
if (id == NetworkAdapter.ID_TWITTER) {
connection.setApiType(ConnectionConfig.API_TWITTER_2);
} else if (id == NetworkAdapter.ID_MASTODON) {
connection.setApiType(ConnectionConfig.API_MASTODON);
}
loginLink = null;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public ConnectionDialog(Context context) {
super(context, R.style.ConfirmDialog);
requestWindowFeature(FEATURE_NO_TITLE);
setCanceledOnTouchOutside(false);
setCancelable(false);
setContentView(R.layout.dialog_connection);
ViewGroup root = findViewById(R.id.dialog_connection_root);
Button confirm = findViewById(R.id.dialog_connection_confirm);
Expand Down Expand Up @@ -189,6 +188,9 @@ public void show(ConnectionConfig connection) {
api1.setVisibility(View.GONE);
api2.setVisibility(View.GONE);
break;

default:
return;
}
// erase all error messages
if (api1.getError() != null)
Expand Down

0 comments on commit 46f1cc7

Please sign in to comment.