Add documentation and tools, refactor BookmarksView for DI, update mocks, and improve project structure
- Add CHANGELOG.md, CODE_OF_CONDUCT.md, and Contribute.md for documentation and community standards - Add tools/add_spdx_header.sh for SPDX license header management - Refactor BookmarksView and BookmarksViewModel to support dependency injection via UseCaseFactory - Add retroactive extension for String: Identifiable in StringExtension.swift - Update MockUseCaseFactory and MockGetBookmarksUseCase to provide mock data for previews and tests - Update README.md: add TestFlight info, changelog link, HTTPS/local network note, and move planned features to changelog
This commit is contained in:
parent
930779169b
commit
07384215eb
24
CHANGELOG.md
Normal file
24
CHANGELOG.md
Normal file
@ -0,0 +1,24 @@
|
||||
# Changelog
|
||||
|
||||
All changes to this project will be documented in this file.
|
||||
|
||||
## 1.0.0
|
||||
|
||||
**Initial release:**
|
||||
- Browse and manage bookmarks (All, Unread, Favorites, Archive, Article, Videos, Pictures)
|
||||
- Share Extension for adding URLs from Safari and other apps
|
||||
- Swipe actions for quick bookmark management
|
||||
- Native iOS design with Dark Mode support
|
||||
- Full iPad Support with Multi-Column Split View
|
||||
- Font Customization
|
||||
- Article View with Reading Time and Word Count
|
||||
- Search functionality
|
||||
- Support for tags
|
||||
|
||||
## [Unreleased]
|
||||
### Planned Features
|
||||
- [ ] Add support for bookmark filtering and sorting options
|
||||
- [ ] Offline sync with Core Data
|
||||
- [ ] Add support for collection management
|
||||
- [ ] Add offline sync capabilities
|
||||
- [ ] Add support for custom themes
|
||||
58
CODE_OF_CONDUCT.md
Normal file
58
CODE_OF_CONDUCT.md
Normal file
@ -0,0 +1,58 @@
|
||||
# Code of Conduct
|
||||
|
||||
This project follows the Contributor Covenant v2.1.
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our community include:
|
||||
|
||||
- Demonstrating empathy and kindness toward other people
|
||||
- Being respectful of differing opinions, viewpoints, and experiences
|
||||
- Giving and gracefully accepting constructive feedback
|
||||
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
|
||||
- Focusing on what is best not just for us as individuals, but for the overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
- The use of sexualized language or imagery, and sexual attention or advances of any kind
|
||||
- Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others’ private information, such as a physical or email address, without their explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at mooonki:matrix.org. All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
1. Correction
|
||||
2. Warning
|
||||
3. Temporary Ban
|
||||
4. Permanent Ban
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
59
Contribute.md
Normal file
59
Contribute.md
Normal file
@ -0,0 +1,59 @@
|
||||
# Contributing to Readeck (iOS)
|
||||
|
||||
Welcome! Thank you for your interest in contributing to the iOS app for Readeck. There are many ways you can help, whether through code, testing, feedback, or documentation.
|
||||
|
||||
**Please make sure to read and follow our [Code of Conduct](CODE_OF_CONDUCT.md) before contributing.**
|
||||
|
||||
## How to Contribute
|
||||
|
||||
### 1. Report Issues
|
||||
|
||||
If you find a bug or experience a problem with the iOS app, please open an issue in the repository. Describe the issue as clearly as possible and include screenshots or crash logs if available.
|
||||
|
||||
### 2. Suggest Features
|
||||
|
||||
Have an idea for a new feature or improvement? Open a feature request issue and describe your idea. You are also welcome to discuss ideas in the forum or the Matrix chat (#readeck:matrix.org) or contact me directly: mooonki:matrix.org.
|
||||
|
||||
### 3. Contribute Code
|
||||
|
||||
Pull requests are welcome! Here’s how to get started:
|
||||
|
||||
1. Fork the repository and clone it locally.
|
||||
2. Set up your development environment (see below).
|
||||
3. Create a new branch for your changes.
|
||||
4. Write clean, well-documented code and follow the existing coding standards.
|
||||
5. Test your changes (unit and UI tests).
|
||||
6. Open a pull request and describe your changes.
|
||||
|
||||
### 4. Translations
|
||||
|
||||
Help translate the iOS app! If you want to add or improve a language, edit the `Localizable.xcstrings` file and submit a pull request.
|
||||
|
||||
### 5. Improve Documentation
|
||||
|
||||
Help improve the README.md, Contribute.md, or other documentation. Good documentation benefits everyone!
|
||||
|
||||
## Setting Up the Development Environment
|
||||
|
||||
1. Install Xcode (latest version recommended).
|
||||
2. Clone the repository:
|
||||
```
|
||||
git clone https://codeberg.org/readeck/readeck-ios.git
|
||||
```
|
||||
3. Install dependencies (if any, e.g., Swift Packages).
|
||||
4. Open the project in Xcode: `readeck.xcodeproj`
|
||||
5. Build and run on a simulator or device.
|
||||
|
||||
## Community & Support
|
||||
|
||||
- Forum: [Readeck Forum](https://readeck.org/forum)
|
||||
- Matrix: #readeck:matrix.org
|
||||
- Issues: In the respective repository on Codeberg or Github
|
||||
|
||||
## Code of Conduct
|
||||
|
||||
Please follow the [Code of Conduct](https://readeck.org/en/contribute) and be respectful in all interactions.
|
||||
|
||||
---
|
||||
|
||||
Thank you for helping make Readeck better!
|
||||
17
README.md
17
README.md
@ -8,6 +8,12 @@ A native iOS client for [readeck](https://readeck.org) bookmark management.
|
||||
The official repository is on Codeberg:
|
||||
https://codeberg.org/readeck/readeck
|
||||
|
||||
## TestFlight Beta Access
|
||||
|
||||
A public TestFlight beta for the Readeck iOS app will be available soon.
|
||||
|
||||
If you are interested in joining the internal beta, please contact me directly at mooonki:matrix.org.
|
||||
|
||||
## Features
|
||||
|
||||
- Browse and manage bookmarks (All, Unread, Favorites, Archive, Article, Videos, Pictures)
|
||||
@ -27,6 +33,7 @@ After installing the app:
|
||||
2. Enter your readeck server URL and credentials
|
||||
3. The app will automatically load your bookmarks
|
||||
|
||||
Notice: Local Network Addresses are supported. If you use external Domains, you need to add a HTTPS Certificate to your readeck server. Apple does not allow to use HTTP on iOS for external domains in release versions. If you want to use HTTP, you are free to use the beta version of the app, where the HTTP is supported.
|
||||
|
||||
## Share Extension
|
||||
|
||||
@ -37,13 +44,9 @@ The app includes a Share Extension that allows adding bookmarks directly from Sa
|
||||
3. Enter a title if you want and hit save
|
||||
4. The bookmark is automatically added to your collection
|
||||
|
||||
## Planned Features
|
||||
- [ ] Add support for bookmark filtering and sorting options
|
||||
- [ ] Add support for tags
|
||||
- [ ] Offline sync with Core Data
|
||||
- [ ] Add support for collection management
|
||||
- [ ] Add offline sync capabilities
|
||||
- [ ] Add support for custom themes
|
||||
## Versions
|
||||
|
||||
[see Changelog](./CHANGELOG.md)
|
||||
|
||||
|
||||
## Contributing
|
||||
|
||||
@ -609,7 +609,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = readeck/readeck.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 2;
|
||||
CURRENT_PROJECT_VERSION = 3;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"readeck/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = 8J69P655GN;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
@ -653,7 +653,7 @@
|
||||
CODE_SIGN_ENTITLEMENTS = readeck/readeck.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 2;
|
||||
CURRENT_PROJECT_VERSION = 3;
|
||||
DEVELOPMENT_ASSET_PATHS = "\"readeck/Preview Content\"";
|
||||
DEVELOPMENT_TEAM = 8J69P655GN;
|
||||
ENABLE_HARDENED_RUNTIME = YES;
|
||||
|
||||
@ -6,7 +6,7 @@ struct BookmarksView: View {
|
||||
|
||||
// MARK: States
|
||||
|
||||
@State private var viewModel = BookmarksViewModel()
|
||||
@State private var viewModel: BookmarksViewModel
|
||||
@State private var showingAddBookmark = false
|
||||
@State private var selectedBookmarkId: String?
|
||||
@State private var showingAddBookmarkFromShare = false
|
||||
@ -20,11 +20,12 @@ struct BookmarksView: View {
|
||||
let tag: String?
|
||||
|
||||
// MARK: Initializer
|
||||
init(state: BookmarkState, type: [BookmarkType], selectedBookmark: Binding<Bookmark?>, tag: String? = nil) {
|
||||
init(viewModel: BookmarksViewModel = .init(), state: BookmarkState, type: [BookmarkType], selectedBookmark: Binding<Bookmark?>, tag: String? = nil) {
|
||||
self.state = state
|
||||
self.type = type
|
||||
self._selectedBookmark = selectedBookmark
|
||||
self.tag = tag
|
||||
self.viewModel = viewModel
|
||||
}
|
||||
|
||||
// MARK: Environments
|
||||
@ -147,13 +148,6 @@ struct BookmarksView: View {
|
||||
AddBookmarkView(prefilledURL: shareURL, prefilledTitle: shareTitle)
|
||||
}
|
||||
)
|
||||
/*.alert("Fehler", isPresented: .constant(viewModel.errorMessage != nil)) {
|
||||
Button("OK", role: .cancel) {
|
||||
viewModel.errorMessage = nil
|
||||
}
|
||||
} message: {
|
||||
Text(viewModel.errorMessage ?? "")
|
||||
}*/
|
||||
.onAppear {
|
||||
Task {
|
||||
await viewModel.loadBookmarks(state: state, type: type, tag: tag)
|
||||
@ -170,7 +164,11 @@ struct BookmarksView: View {
|
||||
}
|
||||
}
|
||||
|
||||
// String Identifiable Extension für navigationDestination
|
||||
extension String: Identifiable {
|
||||
public var id: String { self }
|
||||
#Preview {
|
||||
BookmarksView(
|
||||
viewModel: .init(MockUseCaseFactory()),
|
||||
state: .archived,
|
||||
type: [.article],
|
||||
selectedBookmark: .constant(nil),
|
||||
tag: nil)
|
||||
}
|
||||
|
||||
@ -4,9 +4,9 @@ import SwiftUI
|
||||
|
||||
@Observable
|
||||
class BookmarksViewModel {
|
||||
private let getBooksmarksUseCase: PGetBookmarksUseCase = DefaultUseCaseFactory.shared.makeGetBookmarksUseCase()
|
||||
private let updateBookmarkUseCase: PUpdateBookmarkUseCase = DefaultUseCaseFactory.shared.makeUpdateBookmarkUseCase()
|
||||
private let deleteBookmarkUseCase: PDeleteBookmarkUseCase = DefaultUseCaseFactory.shared.makeDeleteBookmarkUseCase()
|
||||
private let getBooksmarksUseCase: PGetBookmarksUseCase
|
||||
private let updateBookmarkUseCase: PUpdateBookmarkUseCase
|
||||
private let deleteBookmarkUseCase: PDeleteBookmarkUseCase
|
||||
|
||||
var bookmarks: BookmarksPage?
|
||||
var isLoading = false
|
||||
@ -32,7 +32,11 @@ class BookmarksViewModel {
|
||||
}
|
||||
}
|
||||
|
||||
init() {
|
||||
init(_ factory: UseCaseFactory = DefaultUseCaseFactory.shared) {
|
||||
getBooksmarksUseCase = factory.makeGetBookmarksUseCase()
|
||||
updateBookmarkUseCase = factory.makeUpdateBookmarkUseCase()
|
||||
deleteBookmarkUseCase = factory.makeDeleteBookmarkUseCase()
|
||||
|
||||
setupNotificationObserver()
|
||||
}
|
||||
|
||||
|
||||
@ -15,4 +15,4 @@ struct StatView: View {
|
||||
}
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
10
readeck/UI/Extension/StringExtension.swift
Normal file
10
readeck/UI/Extension/StringExtension.swift
Normal file
@ -0,0 +1,10 @@
|
||||
//
|
||||
// File.swift
|
||||
// readeck
|
||||
//
|
||||
// Created by Ilyas Hallak on 18.07.25.
|
||||
//
|
||||
|
||||
extension String: @retroactive Identifiable {
|
||||
public var id: String { self }
|
||||
}
|
||||
@ -113,7 +113,9 @@ class MockReadBookmarkUseCase: PReadBookmarkUseCase {
|
||||
|
||||
class MockGetBookmarksUseCase: PGetBookmarksUseCase {
|
||||
func execute(state: BookmarkState?, limit: Int?, offset: Int?, search: String?, type: [BookmarkType]?, tag: String?) async throws -> BookmarksPage {
|
||||
BookmarksPage(bookmarks: [], currentPage: 1, totalCount: 0, totalPages: 1, links: nil)
|
||||
BookmarksPage(bookmarks: [
|
||||
Bookmark.mock
|
||||
], currentPage: 1, totalCount: 0, totalPages: 1, links: nil)
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,3 +178,9 @@ class MockSaveServerSettingsUseCase: PSaveServerSettingsUseCase {
|
||||
class MockAddTextToSpeechQueueUseCase: PAddTextToSpeechQueueUseCase {
|
||||
func execute(bookmarkDetail: BookmarkDetail) {}
|
||||
}
|
||||
|
||||
fileprivate extension Bookmark {
|
||||
static let mock: Bookmark = .init(
|
||||
id: "123", title: "title", url: "https://example.com", href: "https://example.com", description: "description", authors: ["Tom"], created: "", published: "", updated: "", siteName: "example.com", site: "https://example.com", readingTime: 2, wordCount: 20, hasArticle: true, isArchived: false, isDeleted: false, isMarked: true, labels: ["Test"], lang: "EN", loaded: false, readProgress: 0, documentType: "", state: 0, textDirection: "ltr", type: "", resources: .init(article: nil, icon: nil, image: nil, log: nil, props: nil, thumbnail: nil)
|
||||
)
|
||||
}
|
||||
|
||||
@ -129,6 +129,7 @@ struct SettingsServerView: View {
|
||||
.cornerRadius(10)
|
||||
}
|
||||
.disabled(!viewModel.canLogin || viewModel.isLoading)
|
||||
#if DEBUG
|
||||
Button("Debug-Anmeldung") {
|
||||
viewModel.username = "admin"
|
||||
viewModel.password = "Diggah123"
|
||||
@ -136,6 +137,7 @@ struct SettingsServerView: View {
|
||||
}
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
Button(action: {
|
||||
|
||||
39
tools/add_spdx_header.sh
Normal file
39
tools/add_spdx_header.sh
Normal file
@ -0,0 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
# spdx header info
|
||||
# (edit below if you want to change copyright or license)
|
||||
desired_header="// SPDX-FileCopyrightText: © 2025 Ilyas Hallak <ilhallak@gmail.com>\n//\n// SPDX-License-Identifier: MIT\n"
|
||||
|
||||
dry_run=false
|
||||
if [[ "$1" == "--dry-run" ]]; then
|
||||
dry_run=true
|
||||
echo "running in dry-run mode. no files will be changed."
|
||||
fi
|
||||
|
||||
# go to project root (where this script lives)
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
# look for all .swift files, but skip the tools folder itself
|
||||
find . -type f -name "*.swift" ! -path "./tools/*" | while read -r file; do
|
||||
# check if the header is already there
|
||||
if ! grep -q "SPDX-License-Identifier: MIT" "$file"; then
|
||||
if $dry_run; then
|
||||
echo "[dry run] would add header to: $file"
|
||||
else
|
||||
# make a tmp file for the new content
|
||||
tmpfile=$(mktemp)
|
||||
# stick the header and the original content together
|
||||
printf "%b\n" "$desired_header" > "$tmpfile"
|
||||
cat "$file" >> "$tmpfile"
|
||||
# overwrite the original file with the new one
|
||||
mv "$tmpfile" "$file"
|
||||
echo "header added: $file"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if $dry_run; then
|
||||
echo "dry run complete. no files were changed."
|
||||
else
|
||||
echo "done! all swift files now have the spdx header (if not already present)."
|
||||
fi
|
||||
Loading…
x
Reference in New Issue
Block a user