diff --git a/Core/Localization/NumberFormatter+Extension.swift b/Core/Localization/NumberFormatter+Extension.swift index 804e06ba..4f54bbd0 100644 --- a/Core/Localization/NumberFormatter+Extension.swift +++ b/Core/Localization/NumberFormatter+Extension.swift @@ -49,7 +49,7 @@ extension NumberFormatter { public static var arabicNumberFormatter: NumberFormatter = { let formatter = NumberFormatter() - formatter.locale = Locale(identifier: "ar") + formatter.locale = Locale(identifier: "ar-SA") return formatter }() } diff --git a/Features/AyahMenuFeature/AyahMenuViewModel.swift b/Features/AyahMenuFeature/AyahMenuViewModel.swift index 977ff158..bdd6ecde 100644 --- a/Features/AyahMenuFeature/AyahMenuViewModel.swift +++ b/Features/AyahMenuFeature/AyahMenuViewModel.swift @@ -148,7 +148,8 @@ final class AyahMenuViewModel { logger.info("AyahMenu: share. Verses: \(deps.verses)") Task { if let lines = try? await retrieveSelectedAyahText() { - listener?.shareText(lines, in: self.deps.sourceView, at: self.deps.pointInView) + let withNewLines = lines.joined(separator: "\n") + listener?.shareText([withNewLines], in: self.deps.sourceView, at: self.deps.pointInView) } } } diff --git a/Features/NotesFeature/NotesViewModel.swift b/Features/NotesFeature/NotesViewModel.swift index 8be981bb..c54e9605 100644 --- a/Features/NotesFeature/NotesViewModel.swift +++ b/Features/NotesFeature/NotesViewModel.swift @@ -73,17 +73,23 @@ final class NotesViewModel: ObservableObject { func prepareNotesForSharing() async throws -> String { try await crasher.recordError("Failed to share notes") { var notesText = [String]() - for note in await notes { - let title = if let noteContent = note.note.note, noteContent != "" { - "\(noteContent.trimmingCharacters(in: .newlines))\n\n" + let notes: [NoteItem] = await self.notes + for (index, note) in notes.enumerated() { + let title: [String] = if let noteContent = note.note.note, noteContent != "" { + [ + "\(noteContent.trimmingCharacters(in: .newlines))", "", + ] } else { - "" + [] } - let verses = try await textRetriever.textForVerses(Array(note.note.verses)).joined(separator: "\n") + let verses = try await textRetriever.textForVerses(Array(note.note.verses)) - notesText.append("\(title)\(verses)") + notesText.append(contentsOf: title + verses) + if index != notes.count - 1 { + notesText.append(contentsOf: ["", "", ""]) + } } - return notesText.joined(separator: "\n\n\n\n") + return notesText.joined(separator: "\n") } }