@@ -43,6 +43,7 @@ public class EditConfiguration extends Fragment implements OnClickListener, Back
4343 private transient EditText nextcloudUrlText ;
4444 private transient EditText nextcloudUsernameText ;
4545 private transient EditText nextcloudPasswordText ;
46+ private transient TextView dbxTokenLabel ;
4647
4748 public EditConfiguration (List <String > strings ) {
4849 this .strings = new ArrayList <>(strings );
@@ -71,11 +72,7 @@ public void onClick(View view) {
7172 String useSelfSignedCertString = Boolean .valueOf (useSelfSignedCert .isChecked ()).toString ();
7273 Log .d (TAG , "Saving configuration (password not shown here): " + url + ", " + user + ", " + useSelfSignedCertString );
7374
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 )));
7976 } else if (view .getId () == R .id .editConfigurationCancelButton ) {
8077 Log .d (TAG , "Clicked Cancel in configuration" );
8178 InterfaceWithRust .INSTANCE .go_to_menu (JavaMenu .Main ());
@@ -96,14 +93,14 @@ public void onClick(View view) {
9693 @ Override
9794 public void onResume () {
9895 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+ );
107104 }
108105 }
109106
@@ -135,6 +132,7 @@ private void prepareUiElements(View v) {
135132 "Press the button below to acquire a new authentication token." :
136133 "A token is acquired. Press the button below if you want to renew."
137134 );
135+ this .dbxTokenLabel = dbxTokenLabel ;
138136 }
139137
140138 @ Override
0 commit comments