Skip to content

Commit 6f4281b

Browse files
committed
Remove RTL not needed in some pages
1 parent a1924c4 commit 6f4281b

File tree

4 files changed

+14
-66
lines changed

4 files changed

+14
-66
lines changed

src/Bible.Alarm/Platforms/Android/Services/AndroidAuto/AndroidAutoScheduleHelper.cs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ public static class AndroidAutoScheduleHelper
1616
{
1717
private static readonly ILogger logger = Log.ForContext(typeof(AndroidAutoScheduleHelper));
1818

19-
// Unicode directional control characters for RTL support
20-
private const char RightToLeftMark = '\u200F';
21-
private const char LeftToRightMark = '\u200E';
22-
2319
/// <summary>
2420
/// Loads schedule state items from Fluxor ApplicationState.
2521
/// Returns empty list if state is not initialized or no schedules are available.
@@ -60,7 +56,6 @@ public static string BuildScheduleTitle(ScheduleStateItem scheduleItem)
6056
{
6157
if (scheduleItem.BiblePublicationScheduleId.HasValue)
6258
{
63-
var isRtl = string.Equals(scheduleItem.BiblePublicationLanguageDirection, "rtl", StringComparison.OrdinalIgnoreCase);
6459
var hasSectionStructure = PublicationTypeHelper.HasSectionStructure(scheduleItem.BiblePublicationCode);
6560

6661
if (hasSectionStructure)
@@ -90,16 +85,15 @@ public static string BuildScheduleTitle(ScheduleStateItem scheduleItem)
9085

9186
if (title != null)
9287
{
93-
return isRtl ? $"{RightToLeftMark}{title}" : title;
88+
return title;
9489
}
9590
}
9691
else
9792
{
9893
// Drama/Video: Show track title
9994
if (!string.IsNullOrWhiteSpace(scheduleItem.BiblePublicationTrackTitle))
10095
{
101-
var title = scheduleItem.BiblePublicationTrackTitle;
102-
return isRtl ? $"{RightToLeftMark}{title}" : title;
96+
return scheduleItem.BiblePublicationTrackTitle;
10397
}
10498
}
10599
}
@@ -117,7 +111,6 @@ public static string BuildScheduleTitle(ScheduleStateItem scheduleItem)
117111
public static string BuildScheduleSubtitle(ScheduleStateItem scheduleItem)
118112
{
119113
var subtitleParts = new List<string>();
120-
var isRtl = string.Equals(scheduleItem.BiblePublicationLanguageDirection, "rtl", StringComparison.OrdinalIgnoreCase);
121114

122115
// Add schedule name with bullet points only if not empty
123116
if (!string.IsNullOrWhiteSpace(scheduleItem.Name))
@@ -136,23 +129,18 @@ public static string BuildScheduleSubtitle(ScheduleStateItem scheduleItem)
136129

137130
if (!string.IsNullOrWhiteSpace(languageName))
138131
{
139-
// Apply RTL marker to the language name if needed
140-
var rtlLanguageName = isRtl ? $"{RightToLeftMark}{languageName}" : languageName;
141-
142132
// Add music note emoji (🎵) to the right of language text if music is enabled
143133
// Using emoji instead of single note symbol for larger, more visible appearance
144134
var languageText = scheduleItem.MusicEnabled
145-
? $"{rtlLanguageName} 🎵"
146-
: rtlLanguageName;
135+
? $"{languageName} 🎵"
136+
: languageName;
147137
subtitleParts.Add(languageText);
148138
}
149139
}
150140

151141
if (subtitleParts.Count > 0)
152142
{
153-
var subtitle = string.Join(" ", subtitleParts);
154-
// Apply RTL marker to the entire subtitle if RTL
155-
return isRtl ? $"{RightToLeftMark}{subtitle}" : subtitle;
143+
return string.Join(" ", subtitleParts);
156144
}
157145

158146
// Fallback: show status and time if no Bible reading schedule

src/Bible.Alarm/ViewModels/ScheduleListItemViewModel.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,6 @@ public string Language
208208
private set => subtitleManager.Language = value;
209209
}
210210

211-
private FlowDirection contentFlowDirection = FlowDirection.LeftToRight;
212-
213-
/// <summary>
214-
/// Gets the FlowDirection for content based on the selected language direction.
215-
/// </summary>
216-
public FlowDirection ContentFlowDirection
217-
{
218-
get => contentFlowDirection;
219-
private set => SetProperty(ref contentFlowDirection, value);
220-
}
221211

222212
public bool MusicEnabled => Schedule?.MusicEnabled ?? false;
223213

@@ -324,7 +314,6 @@ private void RefreshSubTitleFromState(ScheduleStateItem? providedScheduleStateIt
324314
providedScheduleStateItem,
325315
value => SubTitle = value,
326316
value => Language = value,
327-
value => ContentFlowDirection = value,
328317
OnPropertyChanged);
329318
}
330319

@@ -350,7 +339,6 @@ await subtitleManager.RefreshTrackNameAsync(
350339
force,
351340
value => SubTitle = value,
352341
value => Language = value,
353-
value => ContentFlowDirection = value,
354342
OnPropertyChanged);
355343
}
356344

src/Bible.Alarm/ViewModels/ScheduleListItemViewModelHelpers/ScheduleListItemSubtitleManager.cs

Lines changed: 8 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ public sealed class ScheduleListItemSubtitleManager(
1818
{
1919
private string subtitle = string.Empty;
2020
private string language = string.Empty;
21-
private FlowDirection flowDirection = FlowDirection.LeftToRight;
2221

2322
public string SubTitle
2423
{
@@ -32,17 +31,11 @@ public string Language
3231
set => language = value;
3332
}
3433

35-
public FlowDirection FlowDirection
36-
{
37-
get => flowDirection;
38-
set => flowDirection = value;
39-
}
40-
4134
/// <summary>
4235
/// Refreshes subtitle from ScheduleStateItem in state (uses pre-populated SectionName).
4336
/// Falls back to async database lookup if SectionName is not available in state.
4437
/// </summary>
45-
public void RefreshSubTitleFromState(int scheduleId, ScheduleStateItem? providedScheduleStateItem, Action<string> setSubTitle, Action<string> setLanguage, Action<FlowDirection> setFlowDirection, Action<string> onPropertyChanged)
38+
public void RefreshSubTitleFromState(int scheduleId, ScheduleStateItem? providedScheduleStateItem, Action<string> setSubTitle, Action<string> setLanguage, Action<string> onPropertyChanged)
4639
{
4740
if (scheduleId <= 0)
4841
{
@@ -66,7 +59,7 @@ public void RefreshSubTitleFromState(int scheduleId, ScheduleStateItem? provided
6659

6760
if (scheduleStateItem?.BiblePublicationScheduleId.HasValue == true)
6861
{
69-
UpdateLanguageFromState(scheduleStateItem, setLanguage, setFlowDirection, onPropertyChanged);
62+
UpdateLanguageFromState(scheduleStateItem, setLanguage, onPropertyChanged);
7063
var subtitle = BuildSubtitleFromState(scheduleStateItem);
7164

7265
logger.Debug("ScheduleListItemSubtitleManager: RefreshSubTitleFromState - Built subtitle: '{Subtitle}' for schedule {ScheduleId}", subtitle, scheduleId);
@@ -103,21 +96,21 @@ public void RefreshSubTitleFromState(int scheduleId, ScheduleStateItem? provided
10396
else
10497
{
10598
logger.Debug("ScheduleListItemSubtitleManager: RefreshSubTitleFromState - No BiblePublicationScheduleId for schedule {ScheduleId}, clearing language", scheduleId);
106-
ClearLanguage(setLanguage, setFlowDirection, onPropertyChanged);
99+
ClearLanguage(setLanguage, onPropertyChanged);
107100
}
108101

109102
// Only fall back to async lookup if display names are not expected to be populated
110103
logger.Debug("ScheduleListItemSubtitleManager: RefreshSubTitleFromState - Falling back to async lookup for schedule {ScheduleId}", scheduleId);
111-
_ = RefreshTrackNameAsync(scheduleId, force: false, setSubTitle, setLanguage, setFlowDirection, onPropertyChanged);
104+
_ = RefreshTrackNameAsync(scheduleId, force: false, setSubTitle, setLanguage, onPropertyChanged);
112105
}
113106
catch (Exception e)
114107
{
115108
logger.Error(e, "An error happened while refreshing subtitle from state for schedule {ScheduleId}", scheduleId);
116-
_ = RefreshTrackNameAsync(scheduleId, force: false, setSubTitle, setLanguage, setFlowDirection, onPropertyChanged);
109+
_ = RefreshTrackNameAsync(scheduleId, force: false, setSubTitle, setLanguage, onPropertyChanged);
117110
}
118111
}
119112

120-
private static void UpdateLanguageFromState(ScheduleStateItem scheduleStateItem, Action<string> setLanguage, Action<FlowDirection> setFlowDirection, Action<string> onPropertyChanged)
113+
private static void UpdateLanguageFromState(ScheduleStateItem scheduleStateItem, Action<string> setLanguage, Action<string> onPropertyChanged)
121114
{
122115
if (!string.IsNullOrWhiteSpace(scheduleStateItem.BiblePublicationLanguageName))
123116
{
@@ -132,14 +125,6 @@ private static void UpdateLanguageFromState(ScheduleStateItem scheduleStateItem,
132125
setLanguage(string.Empty);
133126
}
134127
onPropertyChanged("Language");
135-
136-
// Update flow direction based on language direction
137-
var direction = scheduleStateItem.BiblePublicationLanguageDirection ?? "ltr";
138-
var flowDirection = string.Equals(direction, "rtl", StringComparison.OrdinalIgnoreCase)
139-
? FlowDirection.RightToLeft
140-
: FlowDirection.LeftToRight;
141-
setFlowDirection(flowDirection);
142-
onPropertyChanged("ContentFlowDirection");
143128
}
144129

145130
private static string BuildSubtitleFromState(ScheduleStateItem scheduleStateItem)
@@ -183,19 +168,17 @@ private static string BuildSubtitleFromState(ScheduleStateItem scheduleStateItem
183168
}
184169
}
185170

186-
private static void ClearLanguage(Action<string> setLanguage, Action<FlowDirection> setFlowDirection, Action<string> onPropertyChanged)
171+
private static void ClearLanguage(Action<string> setLanguage, Action<string> onPropertyChanged)
187172
{
188173
setLanguage(string.Empty);
189174
onPropertyChanged("Language");
190-
setFlowDirection(FlowDirection.LeftToRight);
191-
onPropertyChanged("ContentFlowDirection");
192175
}
193176

194177
/// <summary>
195178
/// Async fallback method for refreshing track name from database.
196179
/// Only used if SectionName is not available in state.
197180
/// </summary>
198-
public async Task RefreshTrackNameAsync(int scheduleId, bool force, Action<string> setSubTitle, Action<string> setLanguage, Action<FlowDirection> setFlowDirection, Action<string> onPropertyChanged)
181+
public async Task RefreshTrackNameAsync(int scheduleId, bool force, Action<string> setSubTitle, Action<string> setLanguage, Action<string> onPropertyChanged)
199182
{
200183
if (scheduleId <= 0)
201184
{
@@ -209,7 +192,6 @@ public async Task RefreshTrackNameAsync(int scheduleId, bool force, Action<strin
209192
.FirstOrDefault(s => s.Id == scheduleId);
210193

211194
string language = string.Empty;
212-
string direction = "ltr";
213195
if (scheduleStateItem != null)
214196
{
215197
if (!string.IsNullOrWhiteSpace(scheduleStateItem.BiblePublicationLanguageName))
@@ -220,17 +202,12 @@ public async Task RefreshTrackNameAsync(int scheduleId, bool force, Action<strin
220202
{
221203
language = scheduleStateItem.BiblePublicationLanguageCode;
222204
}
223-
direction = scheduleStateItem.BiblePublicationLanguageDirection ?? "ltr";
224205
}
225206

226207
// Run database operations off UI thread
227208
var displayName = await Task.Run(async () =>
228209
await displayService.GetTrackDisplayNameAsync(scheduleId, force));
229210

230-
var flowDirection = string.Equals(direction, "rtl", StringComparison.OrdinalIgnoreCase)
231-
? FlowDirection.RightToLeft
232-
: FlowDirection.LeftToRight;
233-
234211
// Update UI on main thread
235212
await MainThread.InvokeOnMainThreadAsync(() =>
236213
{
@@ -243,10 +220,6 @@ await MainThread.InvokeOnMainThreadAsync(() =>
243220
// Update Language property
244221
setLanguage(language);
245222
onPropertyChanged("Language");
246-
247-
// Update FlowDirection property
248-
setFlowDirection(flowDirection);
249-
onPropertyChanged("ContentFlowDirection");
250223
});
251224
}
252225
catch (Exception e)

src/Bible.Alarm/Views/Home.xaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,7 @@
462462
Text="{Binding SubTitle}"
463463
TextColor="{DynamicResource PrimaryTextColor}"
464464
LineBreakMode="TailTruncation"
465-
MaxLines="2"
466-
FlowDirection="{Binding ContentFlowDirection}" />
465+
MaxLines="2" />
467466
</VerticalStackLayout>
468467
<Grid Grid.Row="2"
469468
Grid.Column="0"

0 commit comments

Comments
 (0)