Skip to content

Commit e6e71ad

Browse files
EKIRJASTO-287 Hide bookmark sync feature in UI (#193)
* Hide sync bookmark toggle button in UI All XML code used to display the bookmark sync toggle in Settings tab of E-kirjasto app is now commented out. Note that no code was not removed in this task. The toggle was only visible to the logged-in user, and if enabled, the user's book bookmarks should have been synchronised between the application and the server. However, since this feature is not available in E-kirjasto, we are hiding the toggle and related texts from the UI for now. Ref. EKIRJASTO-287, EKIRJASTO-288 * Disable sync bookmark toggle button functionality All Kotlin code used to handle the sync bookmarks toggle button in Settings tab of the E-kirjasto app is now commented out. Note that no code was removed in this task. The toggle was only visible to the logged-in user, and if enabled, the user's book bookmarks should have been synchronised between the application and the server. However, since this feature is not available in E-kirjasto, we are disabling the functions and variables used to display the sync toggle button in the UI for now. Ref. EKIRJASTO-287, EKIRJASTO-288 * Add comments to clarify the code being commented-out Ref. EKIRJASTO-287, EKIRJASTO-288
1 parent a8d7ed2 commit e6e71ad

File tree

2 files changed

+46
-34
lines changed

2 files changed

+46
-34
lines changed

simplified-ui-accounts/src/main/java/org/nypl/simplified/ui/accounts/ekirjasto/EKirjastoAccountFragment.kt

Lines changed: 34 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import android.view.View.GONE
66
import android.view.View.INVISIBLE
77
import android.view.View.VISIBLE
88
import android.widget.Button
9-
import android.widget.ProgressBar
9+
//import android.widget.ProgressBar
1010
import android.widget.TextView
11-
import androidx.appcompat.widget.SwitchCompat
12-
import androidx.constraintlayout.widget.ConstraintLayout
11+
//import androidx.appcompat.widget.SwitchCompat
12+
//import androidx.constraintlayout.widget.ConstraintLayout
1313
import androidx.core.os.bundleOf
1414
import androidx.fragment.app.Fragment
1515
import androidx.fragment.app.viewModels
@@ -26,8 +26,8 @@ import org.nypl.simplified.accounts.api.AccountLoginState.AccountLoggingInWaitin
2626
import org.nypl.simplified.accounts.api.AccountLoginState.AccountLoginFailed
2727
import org.nypl.simplified.accounts.api.AccountLoginState.AccountNotLoggedIn
2828
import org.nypl.simplified.android.ktx.supportActionBar
29-
import org.nypl.simplified.bookmarks.api.BookmarkSyncEnableResult
30-
import org.nypl.simplified.bookmarks.api.BookmarkSyncEnableStatus
29+
//import org.nypl.simplified.bookmarks.api.BookmarkSyncEnableResult
30+
//import org.nypl.simplified.bookmarks.api.BookmarkSyncEnableStatus
3131
import org.nypl.simplified.listeners.api.FragmentListenerType
3232
import org.nypl.simplified.listeners.api.fragmentListeners
3333
import org.nypl.simplified.profiles.controller.api.ProfileAccountLoginRequest
@@ -67,17 +67,20 @@ class EKirjastoAccountFragment : Fragment(R.layout.account_ekirjasto){
6767
private lateinit var buttonRegisterPasskey: Button
6868
private lateinit var buttonDependents: Button
6969
private lateinit var eulaStatement: TextView
70+
/*
71+
Bookmark syncing is not currently supported in E-kirjasto
7072
private lateinit var syncBookmarks: ConstraintLayout
73+
private lateinit var bookmarkSyncProgress: ProgressBar
74+
private lateinit var bookmarkSyncCheck: SwitchCompat
75+
private lateinit var bookmarkStatement: TextView
76+
*/
7177
private lateinit var buttonFeedback: Button
7278
private lateinit var buttonPrivacyPolicy: Button
7379
private lateinit var buttonUserAgreement: Button
7480
private lateinit var buttonAccessibilityStatement: Button
7581
private lateinit var buttonLicenses: Button
7682
private lateinit var buttonInstructions: Button
7783
private lateinit var versionText: TextView
78-
private lateinit var bookmarkSyncProgress: ProgressBar
79-
private lateinit var bookmarkSyncCheck: SwitchCompat
80-
private lateinit var bookmarkStatement: TextView
8184
private lateinit var buttonPreferences: Button
8285

8386
//inherited elements
@@ -109,30 +112,34 @@ class EKirjastoAccountFragment : Fragment(R.layout.account_ekirjasto){
109112
this.buttonDependents = view.findViewById(R.id.buttonInviteDependents)
110113
this.eulaStatement = view.findViewById(R.id.eulaStatement)
111114
this.buttonAccessibilityStatement = view.findViewById(R.id.accessibilityStatement)
112-
this.syncBookmarks = view.findViewById(R.id.accountSyncBookmarks)
113-
this.bookmarkStatement = view.findViewById(R.id.accountSyncBookmarksStatement)
115+
// this.syncBookmarks = view.findViewById(R.id.accountSyncBookmarks)
116+
// this.bookmarkStatement = view.findViewById(R.id.accountSyncBookmarksStatement)
114117
this.buttonFeedback = view.findViewById(R.id.buttonFeedback)
115118
this.buttonPrivacyPolicy = view.findViewById(R.id.buttonPrivacyPolicy)
116119
this.buttonUserAgreement = view.findViewById(R.id.buttonUserAgreement)
117120
this.buttonLicenses = view.findViewById(R.id.buttonLicenses)
118121
this.buttonInstructions = view.findViewById(R.id.buttonInstructions)
119122
this.versionText = view.findViewById(R.id.appVersion)
120-
this.bookmarkSyncCheck = view.findViewById(R.id.accountSyncBookmarksCheck)
123+
// this.bookmarkSyncCheck = view.findViewById(R.id.accountSyncBookmarksCheck)
121124
this.buttonPreferences = view.findViewById(R.id.buttonPreferences)
122125

123126

124127
this.toolbar =
125128
view.rootView.findViewWithTag(PalaceToolbar.palaceToolbarName)
129+
/*
126130
this.bookmarkSyncProgress =
127131
view.findViewById(R.id.accountSyncProgress)
132+
*/
128133

129134
this.viewModel.accountLive.observe(this.viewLifecycleOwner) {
130135
this.reconfigureAccountUI()
131136
}
132137

138+
/*
133139
this.viewModel.accountSyncingSwitchStatus.observe(this.viewLifecycleOwner){ status ->
134140
this.reconfigureBookmarkSyncingSwitch(status)
135141
}
142+
*/
136143

137144
this.reconfigureAccountUI()
138145
}
@@ -157,13 +164,13 @@ class EKirjastoAccountFragment : Fragment(R.layout.account_ekirjasto){
157164
onTryRegisterPasskey()
158165
}
159166

160-
/*
161-
* Configure the bookmark syncing switch to enable/disable syncing permissions.
162-
*/
167+
/*
168+
//Configure the bookmark syncing switch to enable/disable syncing permissions.
163169
164170
this.bookmarkSyncCheck.setOnCheckedChangeListener { _, isChecked ->
165171
this.viewModel.enableBookmarkSyncing(isChecked)
166172
}
173+
*/
167174

168175
/*
169176
* Hide the toolbar and back arrow if there is no page to return to (e.g. coming from a deep link).
@@ -294,8 +301,8 @@ class EKirjastoAccountFragment : Fragment(R.layout.account_ekirjasto){
294301
buttonLoginPasskey.visibility = VISIBLE
295302
buttonRegisterPasskey.visibility = GONE
296303
}
297-
this.syncBookmarks.visibility = GONE
298-
this.bookmarkStatement.visibility = GONE
304+
// this.syncBookmarks.visibility = GONE
305+
// this.bookmarkStatement.visibility = GONE
299306
this.eulaStatement.visibility = VISIBLE
300307
}
301308

@@ -336,7 +343,7 @@ class EKirjastoAccountFragment : Fragment(R.layout.account_ekirjasto){
336343
buttonLoginPasskey.visibility = VISIBLE
337344
buttonRegisterPasskey.visibility = GONE
338345
}
339-
this.syncBookmarks.visibility = GONE
346+
// this.syncBookmarks.visibility = GONE
340347

341348
}
342349

@@ -348,9 +355,9 @@ class EKirjastoAccountFragment : Fragment(R.layout.account_ekirjasto){
348355
buttonLoginPasskey.visibility = GONE
349356
buttonRegisterPasskey.visibility = VISIBLE
350357
}
351-
this.syncBookmarks.visibility = VISIBLE
352-
this.bookmarkStatement.visibility = VISIBLE
353-
this.bookmarkSyncProgress.visibility = INVISIBLE
358+
// this.syncBookmarks.visibility = VISIBLE
359+
// this.bookmarkStatement.visibility = VISIBLE
360+
// this.bookmarkSyncProgress.visibility = INVISIBLE
354361
this.eulaStatement.visibility = GONE
355362
}
356363

@@ -460,16 +467,16 @@ class EKirjastoAccountFragment : Fragment(R.layout.account_ekirjasto){
460467
return android.os.Build.VERSION.SDK_INT >= 28
461468
}
462469

470+
/*
471+
Bookmark syncing is not currently supported in E-kirjasto
472+
463473
private fun reconfigureBookmarkSyncingSwitch(status: BookmarkSyncEnableStatus) {
464-
/*
465-
* Remove the checked-change listener, because setting `isChecked` will trigger the listener.
466-
*/
474+
475+
// Remove the checked-change listener, because setting `isChecked` will trigger the listener.
467476
468477
this.bookmarkSyncCheck.setOnCheckedChangeListener(null)
469478
470-
/*
471-
* Otherwise, the switch is doing something that interests us...
472-
*/
479+
//Otherwise, the switch is doing something that interests us...
473480
474481
val account = this.viewModel.account
475482
return when (status) {
@@ -504,5 +511,6 @@ class EKirjastoAccountFragment : Fragment(R.layout.account_ekirjasto){
504511
}
505512
}
506513
}
514+
*/
507515

508516
}

simplified-ui-accounts/src/main/res/layout/account_ekirjasto.xml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,21 +78,24 @@
7878
android:text="@string/accountEULAStatement"
7979
android:textAppearance="@style/TextAppearance.AppCompat.Small" />
8080

81+
<!--
82+
Bookmark syncing is not currently supported in E-kirjasto
83+
8184
<androidx.constraintlayout.widget.ConstraintLayout
8285
android:id="@+id/accountSyncBookmarks"
8386
android:layout_width="match_parent"
8487
android:layout_height="48dp"
8588
android:layout_marginTop="32dp"
8689
android:background="@color/EkirjastoSettingsBookmarkBackground">
8790
88-
<!-- <View-->
89-
<!-- android:layout_width="0dp"-->
90-
<!-- android:layout_height="1dp"-->
91-
<!-- android:background="@color/PalaceDividerColor"-->
92-
<!-- app:layout_constraintEnd_toEndOf="parent"-->
93-
<!-- app:layout_constraintStart_toStartOf="parent"-->
94-
<!-- app:layout_constraintTop_toTopOf="parent"-->
95-
<!-- app:layout_constraintBottom_toBottomOf="parent"/>-->
91+
<View
92+
android:layout_width="0dp"
93+
android:layout_height="1dp"
94+
android:background="@color/PalaceDividerColor"
95+
app:layout_constraintBottom_toBottomOf="parent"
96+
app:layout_constraintEnd_toEndOf="parent"
97+
app:layout_constraintStart_toStartOf="parent"
98+
app:layout_constraintTop_toTopOf="parent" />
9699
97100
<TextView
98101
android:id="@+id/accountSyncBookmarksLabel"
@@ -142,6 +145,7 @@
142145
android:layout_height="wrap_content"
143146
android:paddingBottom="32dp"
144147
android:text="@string/account_sync_bookmarks_statement" />
148+
-->
145149

146150
</LinearLayout>
147151

0 commit comments

Comments
 (0)