~repos /only-bible-app

#kotlin#android#ios

git clone https://pyrossh.dev/repos/only-bible-app.git

The only bible app you will ever need. No ads. No in-app purchases. No distractions.


e03b54e9 pyrossh

2 years ago
fix audio with eng titles
lib/atom.dart CHANGED
@@ -68,14 +68,18 @@ class _ListenerWrapper {
68
68
  class AsyncAtom<P extends String, E extends Future> {
69
69
  final Map<P, E> cache = {};
70
70
  final E Function(P) callback;
71
+ final int cacheSize;
71
72
 
72
- AsyncAtom({required this.callback});
73
+ AsyncAtom({required this.callback, this.cacheSize = 1});
73
74
 
74
75
  E getValue(P param) {
75
76
  if (cache.containsKey(param)) {
76
77
  return cache[param]!;
77
78
  }
78
79
  final v = callback(param);
80
+ if (cache.length >= cacheSize) {
81
+ cache.clear();
82
+ }
79
83
  cache[param] = v;
80
84
  return v;
81
85
  }
lib/l10n/app_bn.arb CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "languageCode": "bn",
2
3
  "audioVoice": "bn-IN-TanishaaNeural",
3
4
  "title": "শুধুমাত্র বাইবেল অ্যাপ",
4
5
  "languageTitle": "Bengali",
lib/l10n/app_en.arb CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "languageCode": "en",
2
3
  "audioVoice": "en-GB-RyanNeural",
3
4
  "title": "Only Bible App",
4
5
  "languageTitle": "English",
lib/l10n/app_gu.arb CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "languageCode": "gu",
2
3
  "audioVoice": "gu-IN-DhwaniNeural",
3
4
  "title": "ફક્ત બાઇબલ એપ્લિકેશન",
4
5
  "languageTitle": "Gujarati",
lib/l10n/app_hi.arb CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "languageCode": "hi",
2
3
  "audioVoice": "hi-IN-SwaraNeural",
3
4
  "title": "केवल बाइबिल ऐप",
4
5
  "languageTitle": "Hindi",
lib/l10n/app_kn.arb CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "languageCode": "kn",
2
3
  "hasAudio": "true",
3
4
  "audioVoice": "kn-IN-GaganNeural",
4
5
  "title": "ಬೈಬಲ್ ಮಾತ್ರರ",
lib/l10n/app_ml.arb CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "languageCode": "ml",
2
3
  "audioVoice": "ml-IN-SobhanaNeural",
3
4
  "title": "ബൈബിൾ ആപ്പ് മാത്രം",
4
5
  "languageTitle": "Malayalam",
lib/l10n/app_ne.arb CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "languageCode": "ne",
2
3
  "audioVoice": "ne-NP-HemkalaNeural",
3
4
  "title": "केवल बाइबल एप",
4
5
  "languageTitle": "Nepali",
lib/l10n/app_or.arb CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "languageCode": "or",
2
3
  "audioVoice": "",
3
4
  "title": "କେବଳ ବାଇବଲ ଆପ୍ |",
4
5
  "languageTitle": "Oriya",
lib/l10n/app_pa.arb CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "languageCode": "pa",
2
3
  "audioVoice": "",
3
4
  "title": "ਸਿਰਫ਼ ਬਾਈਬਲ ਐਪ",
4
5
  "languageTitle": "Punjabi",
lib/l10n/app_ta.arb CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "languageCode": "ta",
2
3
  "audioVoice": "ta-IN-PallaviNeural",
3
4
  "title": "பைபிள் ஆப் மட்டுமே",
4
5
  "languageTitle": "Tamil",
lib/l10n/app_te.arb CHANGED
@@ -1,4 +1,5 @@
1
1
  {
2
+ "languageCode": "te",
2
3
  "audioVoice": "te-IN-ShrutiNeural",
3
4
  "title": "బైబిల్ యాప్ మాత్రమే",
4
5
  "languageTitle": "Telugu",
lib/sheets/actions_sheet.dart CHANGED
@@ -14,7 +14,7 @@ class ActionsSheet extends StatelessWidget {
14
14
  final bottom = isIOS() ? 20.0 : 0.0;
15
15
  final iconColor = darkMode.value ? Colors.white.withOpacity(0.9) : Colors.black.withOpacity(0.9);
16
16
  final audioIcon = isPlaying.watch(context) ? Icons.pause_circle_outline : Icons.play_circle_outline;
17
- final audioEnabled = context.hasAudio;
17
+ final audioEnabled = context.currentLang.audioVoice != "";
18
18
  return Container(
19
19
  height: context.actionsHeight,
20
20
  color: Theme.of(context).colorScheme.background,
lib/state.dart CHANGED
@@ -61,7 +61,7 @@ updateCurrentBible(BuildContext context, String code, String name) async {
61
61
  Future<Bible> loadBible(String name) async {
62
62
  final bytes = await rootBundle.load("assets/bibles/$name.txt");
63
63
  final books = getBibleFromText(name, utf8.decode(bytes.buffer.asUint8List(), allowMalformed: false));
64
- // await Future.delayed(Duration(seconds: 2));
64
+ // await Future.delayed(Duration(seconds: 2));
65
65
  return Bible(
66
66
  name: name,
67
67
  books: books,
@@ -146,7 +146,7 @@ final Atom<List<Verse>> selectedVerses = Atom<List<Verse>>(
146
146
  initialValue: [],
147
147
  update: (List<Verse> verses) {
148
148
  selectedVerses.value = verses;
149
- // selectedVerses.notifyChanged();
149
+ // selectedVerses.notifyChanged();
150
150
  },
151
151
  );
152
152
 
@@ -157,8 +157,8 @@ void clearSelections() {
157
157
  Color? getHighlight(Verse v) {
158
158
  final key = "${v.book}:${v.chapter}:${v.index}:highlight";
159
159
  if (box.hasData(key)) {
160
- // box.remove(key);
160
+ // box.remove(key);
161
- // print(box.read(key));
161
+ // print(box.read(key));
162
162
  final index = box.read<int>(key);
163
163
  if (index == null) {
164
164
  return null;
@@ -213,9 +213,9 @@ TextStyle getHighlightStyle(BuildContext context, Verse v) {
213
213
  );
214
214
  }
215
215
  if (darkMode.watch(context)) {
216
- // return TextStyle(
216
+ // return TextStyle(
217
- // color: getHighlight(v) ?? context.theme.colorScheme.onBackground,
217
+ // color: getHighlight(v) ?? context.theme.colorScheme.onBackground,
218
- // );
218
+ // );
219
219
  return TextStyle(
220
220
  backgroundColor: getHighlight(v)?.withOpacity(0.7),
221
221
  color: getHighlight(v) != null ? Colors.white : context.theme.colorScheme.onBackground,
@@ -269,7 +269,7 @@ onPlay(BuildContext context, Bible bible) async {
269
269
  for (final v in versesToPlay) {
270
270
  final pathname = "${bible.name}|${v.book}|${v.chapter}|${v.index}";
271
271
  try {
272
- final list = await convertText(context.l.audioVoice, v.text);
272
+ final list = await convertText(context.currentLang.audioVoice, v.text);
273
273
  await player.setAudioSource(BufferAudioSource(list));
274
274
  await player.play();
275
275
  await player.stop();
@@ -303,6 +303,6 @@ deleteNote(BuildContext context, Verse v) {
303
303
  box.remove("${v.book}:${v.chapter}:${v.index}:note");
304
304
  box.save();
305
305
  hideNoteField(context);
306
- // TODO: hack to re-render this page
306
+ // TODO: hack to re-render this page
307
307
  selectedVerses.notifyChanged();
308
308
  }
lib/utils.dart CHANGED
@@ -38,7 +38,7 @@ extension AppContext on BuildContext {
38
38
  ? lookupAppLocalizations(const Locale("en"))
39
39
  : AppLocalizations.of(this)!;
40
40
 
41
- get hasAudio => l.audioVoice != "";
41
+ AppLocalizations get currentLang => supportedLocalizations.firstWhere((el) => el.languageCode == languageCode.value);
42
42
 
43
43
  double get actionsHeight {
44
44
  if (isIOS()) {