-
Notifications
You must be signed in to change notification settings - Fork 2
Feature: Mobile OAuth #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…form-agnostic functions without expect/actual need
…UI .borderedProminent style in AuthView.swift
mohamede1945
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Please let me know if you have any questions about my comments.
| return asyncSequence(for: bookmarksRepository.getBookmarksFlow()).map { bookmarks in | ||
| bookmarks.compactMap { $0 as? Bookmark.PageBookmark } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than getBookmarksFlow, I would prefer getPageBookmarks. It narrows the query scope to page bookmarks and cast the types in the kmp lib.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mohamede1945 I agree with you, but for this specific point, the aim was to fix compilation errors, so the changes made was to add missing functions and rename some variables to compile successfully without touching the logic.
should be done when handling the bookmarks logic insha'Allah.
| // Handle OAuth redirect | ||
| if url.scheme == "com.quran.oauth" && url.host == "callback" { | ||
| // Notify the app about the OAuth callback | ||
| NotificationCenter.default.post( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would not use NotificationCenter here. I think just passing a closure around will be better from type safety and concurrency perspectives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, please recheck @mohamede1945
| /** | ||
| * ViewModel for managing OAuth authentication on iOS. | ||
| * | ||
| * Implements OAuth 2.0 with PKCE (RFC 7636) for secure mobile authentication. | ||
| * Handles: | ||
| * - PKCE code generation (code_verifier and code_challenge) | ||
| * - ASWebAuthenticationSession for secure OAuth consent screen | ||
| * - OAuth redirect callback processing | ||
| * - Token storage in iOS Keychain | ||
| * - Token refresh and validation | ||
| * | ||
| * Uses Combine framework for reactive state management and SwiftUI integration. | ||
| * Follows CLAUDE.md architecture by separating UI state (ObservableObject) from | ||
| * business logic (AuthenticationManager). | ||
| */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is what we really want to do here:
- I believe the idea is to use a kmp lib that we can share between iOS & Android rather than implementing the whole logic in iOS.
- In fact, we have this logic implemented in quran-ios repo, so even if we decided not to use the kmp lib, we don't want to rewrite the code we already have.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mohamede1945 done, please recheck
…thRepositoryImpl.kt
Thanks @mohamede1945 for your valuable comments, please check again now. Jazak Allah Khayran :) |
Based on issue #86