Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Sivan22/otzaria
Browse files Browse the repository at this point in the history
  • Loading branch information
Sivan22 committed Sep 1, 2024
2 parents 14cdb64 + 3c6ed24 commit de53911
Show file tree
Hide file tree
Showing 19 changed files with 378 additions and 53 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/conventional-pr-title.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: "Conventional PR Title"

on:
pull_request_target:
types:
- opened
- reopened
- edited
- synchronize

permissions:
pull-requests: write

jobs:
main:
name: Validate PR title
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
id: lint_pr_title
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.lint_pr_title.outputs.error_message != null)
with:
header: pr-title-lint-error
message: |
Hey there and thank you for opening this pull request! 👋🏼
We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.
Details:
```
${{ steps.lint_pr_title.outputs.error_message }}
```
# Delete a previous comment when the issue has been resolved
- if: ${{ steps.lint_pr_title.outputs.error_message == null }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-title-lint-error
delete: true
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Key features of the project:
* The app is designed to be as user friendly as possible.
* A thorough selection process has been undertaken to ensure that the books are suitable for the Torah community
* the library is flexible, means that you can add or remove books from the library.
* fast search engine, including the user-added books.
* the app supports the following formats: TXT, Docx and PDF.

I hope that my work will help the Torah community to learn easiely and effectively anytime and anywhere.
Expand Down Expand Up @@ -151,15 +152,12 @@ See the Wiki section for documentation.
<!-- ROADMAP -->
## Roadmap

- [ ] Add ViewModel layer
- [ ] Transfer database to isar
- [ ] Add business logic layer by switching the state management library to Bloc.
- [ ] Transfer books data from text files to SQLite database
- [ ] add option for semantic search using an embedding ML model and vector database
- [ ] language Support
- [ ] English
- [X] Hebrew
- [ ] full-text search with index
- [ ] add more features
- [ ] search for references
- [ ] save history

See the [open issues](https://github.com/sivan22/otzaria/issues) for a full list of proposed features (and known issues).

Expand Down Expand Up @@ -211,8 +209,12 @@ Project Link: [https://github.com/sivan22/otzaria](https://github.com/sivan22/ot
## Acknowledgments

the project was avavilable because of Sefaria's amazing project.

<img src="https://camo.githubusercontent.com/e704c2ea3f05768971b48a30a7372daa4aaba4ea36327ae485ccd0ed76af3830/68747470733a2f2f7777772e736566617269612e6f72672f7374617469632f696d672f706f77657265642d62792d736566617269612d62616467652e706e673f6d" alt="drawing" width="100"/>
<br>
and Dicta association, by which many important books were added.
<br>
<br>
<img src="images/safria logo.png" alt="ספריא" width="154" height="80"/>
<img src="images/dicta_logo.jpg" alt="דיקטה" width="154" height="80"/>

the PDF viewer is powered by [pdfrx](https://pub.dev/packages/pdfrx).

Expand Down
Binary file added images/dicta_logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/safria logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions ios/Flutter/Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "Generated.xcconfig"
1 change: 1 addition & 0 deletions ios/Flutter/Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "Generated.xcconfig"
44 changes: 44 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
22 changes: 15 additions & 7 deletions lib/models/app_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,21 @@ class AppModel with ChangeNotifier {
Hive.box(name: 'tabs').put("key-current-tab", currentTab);
}

void addBookmark(
bool addBookmark(
{required String ref, required Book book, required int index}) {
bookmarks.add(Bookmark(ref: ref, book: book, index: index));
// write to disk
Hive.box(name: 'bookmarks').put('key-bookmarks', bookmarks);
// Check if a bookmark with the same ref, book, and index already exists
bool bookmarkExists = bookmarks.any((bookmark) =>
bookmark.ref == ref &&
bookmark.book.title == book.title &&
bookmark.index == index);

if (!bookmarkExists) {
bookmarks.add(Bookmark(ref: ref, book: book, index: index));
// write to disk
Hive.box(name: 'bookmarks').put('key-bookmarks', bookmarks);
return true;
}
return false;
}

void removeBookmark(int index) {
Expand All @@ -330,9 +340,7 @@ class AppModel with ChangeNotifier {

void addHistory(
{required String ref, required Book book, required int index}) {
if (book is TextBook) {
history.insert(0, Bookmark(ref: ref, book: book, index: index));
}
history.insert(0, Bookmark(ref: ref, book: book, index: index));
// write to disk
Hive.box(name: 'history').put('key-history', history);
}
Expand Down
46 changes: 26 additions & 20 deletions lib/screens/pdf_book_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,31 +60,37 @@ class _PdfBookViewrState extends State<PdfBookViewr>
),
actions: [
IconButton(
icon: const Icon(Icons.bookmark_add),
tooltip: 'הוספת סימניה',
onPressed: () {
int index = widget.tab.pdfViewerController.isReady
? widget.tab.pdfViewerController.pageNumber!
: 1;
Provider.of<AppModel>(context, listen: false).addBookmark(
ref: '${widget.tab.title} עמוד $index',
book: widget.tab.book,
index: index);
// notify user
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('הסימניה נוספה בהצלחה'),
),
);
}
}),
icon: const Icon(
Icons.bookmark_add,
),
tooltip: 'הוספת סימניה',
onPressed: () {
int index = widget.tab.pdfViewerController.isReady
? widget.tab.pdfViewerController.pageNumber!
: 1;
bool bookmarkAdded = Provider.of<AppModel>(context, listen: false)
.addBookmark(
ref: '${widget.tab.title} עמוד $index',
book: widget.tab.book,
index: index);
// notify user
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(bookmarkAdded
? 'הסימניה נוספה בהצלחה'
: 'הסימניה כבר קיימת'),
),
);
}
},
),
IconButton(
icon: const Icon(
Icons.zoom_in,
),
tooltip: 'הגדל',
onPressed: () => widget..tab.pdfViewerController.zoomUp(),
onPressed: () => widget.tab.pdfViewerController.zoomUp(),
),
IconButton(
icon: const Icon(Icons.zoom_out),
Expand Down
26 changes: 14 additions & 12 deletions lib/screens/text_book_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,23 @@ class _TextBookViewerState extends State<TextBookViewer>
),
//button to add a bookmark
IconButton(
onPressed: () {
() async {
int index = widget
.tab.positionsListener.itemPositions.value.first.index;
Provider.of<AppModel>(context, listen: false).addBookmark(
ref: await utils.refFromIndex(
index, widget.tab.tableOfContents),
book: widget.tab.book,
index: index);
}();
onPressed: () async {
int index = widget
.tab.positionsListener.itemPositions.value.first.index;
String ref = await utils.refFromIndex(
index, widget.tab.tableOfContents);
bool bookmarkAdded = Provider.of<AppModel>(context, listen: false)
.addBookmark(
ref: ref,
book: widget.tab.book,
index: index);
// notify user
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('הסימניה נוספה בהצלחה'),
SnackBar(
content: Text(bookmarkAdded
? 'הסימניה נוספה בהצלחה'
: 'הסימניה כבר קיימת'),
),
);
}
Expand Down
1 change: 1 addition & 0 deletions macos/Flutter/Flutter-Debug.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
1 change: 1 addition & 0 deletions macos/Flutter/Flutter-Release.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
#include "ephemeral/Flutter-Generated.xcconfig"
43 changes: 43 additions & 0 deletions macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
platform :osx, '10.14'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_macos_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
target 'RunnerTests' do
inherit! :search_paths
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_macos_build_settings(target)
end
end
73 changes: 73 additions & 0 deletions macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
PODS:
- FlutterMacOS (1.0.0)
- isar_flutter_libs (1.0.0):
- FlutterMacOS
- package_info_plus (0.0.1):
- FlutterMacOS
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- pdfrx (0.0.1):
- Flutter
- FlutterMacOS
- printing (1.0.0):
- FlutterMacOS
- screen_retriever (0.0.1):
- FlutterMacOS
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- url_launcher_macos (0.0.1):
- FlutterMacOS
- window_manager (0.2.0):
- FlutterMacOS

DEPENDENCIES:
- FlutterMacOS (from `Flutter/ephemeral`)
- isar_flutter_libs (from `Flutter/ephemeral/.symlinks/plugins/isar_flutter_libs/macos`)
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- pdfrx (from `Flutter/ephemeral/.symlinks/plugins/pdfrx/darwin`)
- printing (from `Flutter/ephemeral/.symlinks/plugins/printing/macos`)
- screen_retriever (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
- window_manager (from `Flutter/ephemeral/.symlinks/plugins/window_manager/macos`)

EXTERNAL SOURCES:
FlutterMacOS:
:path: Flutter/ephemeral
isar_flutter_libs:
:path: Flutter/ephemeral/.symlinks/plugins/isar_flutter_libs/macos
package_info_plus:
:path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos
path_provider_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin
pdfrx:
:path: Flutter/ephemeral/.symlinks/plugins/pdfrx/darwin
printing:
:path: Flutter/ephemeral/.symlinks/plugins/printing/macos
screen_retriever:
:path: Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos
shared_preferences_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
url_launcher_macos:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
window_manager:
:path: Flutter/ephemeral/.symlinks/plugins/window_manager/macos

SPEC CHECKSUMS:
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
isar_flutter_libs: 43385c99864c168fadba7c9adeddc5d38838ca6a
package_info_plus: fa739dd842b393193c5ca93c26798dff6e3d0e0c
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c
pdfrx: 8c711fadb19f76c70e3326ceaa718fe4b6703c37
printing: 1dd6a1fce2209ec240698e2439a4adbb9b427637
screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
url_launcher_macos: d2691c7dd33ed713bf3544850a623080ec693d95
window_manager: 3a1844359a6295ab1e47659b1a777e36773cd6e8

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

COCOAPODS: 1.15.2
Loading

0 comments on commit de53911

Please sign in to comment.