@@ -43,6 +43,7 @@ public class EditConfiguration extends Fragment implements OnClickListener, Back
43
43
private transient EditText nextcloudUrlText ;
44
44
private transient EditText nextcloudUsernameText ;
45
45
private transient EditText nextcloudPasswordText ;
46
+ private transient TextView dbxTokenLabel ;
46
47
47
48
public EditConfiguration (List <String > strings ) {
48
49
this .strings = new ArrayList <>(strings );
@@ -71,11 +72,7 @@ public void onClick(View view) {
71
72
String useSelfSignedCertString = Boolean .valueOf (useSelfSignedCert .isChecked ()).toString ();
72
73
Log .d (TAG , "Saving configuration (password not shown here): " + url + ", " + user + ", " + useSelfSignedCertString );
73
74
74
- boolean errorsOccured = false ;
75
-
76
- if (!errorsOccured ) {
77
- InterfaceWithRust .INSTANCE .set_configuration (Arrays .asList (url , user , password , useSelfSignedCertString , strings .get (5 )));
78
- }
75
+ InterfaceWithRust .INSTANCE .set_configuration (Arrays .asList (url , user , password , useSelfSignedCertString , strings .get (5 )));
79
76
} else if (view .getId () == R .id .editConfigurationCancelButton ) {
80
77
Log .d (TAG , "Clicked Cancel in configuration" );
81
78
InterfaceWithRust .INSTANCE .go_to_menu (JavaMenu .Main ());
@@ -96,14 +93,14 @@ public void onClick(View view) {
96
93
@ Override
97
94
public void onResume () {
98
95
super .onResume ();
99
- String token = strings . get ( 5 );
100
-
101
- if (token == null || token . isEmpty () ) {
102
- String retrieved_token_from_shared_preferences = Auth . getOAuth2Token ( );
103
- if ( retrieved_token_from_shared_preferences != null ) {
104
- token = retrieved_token_from_shared_preferences ;
105
- InterfaceWithRust . INSTANCE . go_to_menu ( JavaMenu . SetDbToken ( token ));
106
- }
96
+
97
+ String retrieved_token_from_shared_preferences = Auth . getOAuth2Token ();
98
+ if (retrieved_token_from_shared_preferences != null ) {
99
+ strings . set ( 5 , retrieved_token_from_shared_preferences );
100
+ dbxTokenLabel . setText (( strings . get ( 5 ) == null || strings . get ( 5 ). isEmpty ()) ?
101
+ "Press the button below to acquire a new authentication token." :
102
+ "A token is acquired. Press the button below if you want to renew."
103
+ );
107
104
}
108
105
}
109
106
@@ -135,6 +132,7 @@ private void prepareUiElements(View v) {
135
132
"Press the button below to acquire a new authentication token." :
136
133
"A token is acquired. Press the button below if you want to renew."
137
134
);
135
+ this .dbxTokenLabel = dbxTokenLabel ;
138
136
}
139
137
140
138
@ Override
0 commit comments