Skip to content

Conversation

@AhmedNMahran
Copy link
Collaborator

Based on issue #86

  • Using this library
  • Add a new auth module and integrate the aforementioned library within it
  • Wire up authentication into the Android sample app (we'll have to make one since it doesn't exist today)
  • Wire up authentication into the iOS sample app

Copy link
Collaborator

@mohamede1945 mohamede1945 left a 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.

Comment on lines +23 to +25
return asyncSequence(for: bookmarksRepository.getBookmarksFlow()).map { bookmarks in
bookmarks.compactMap { $0 as? Bookmark.PageBookmark }
}
Copy link
Collaborator

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.

Copy link
Collaborator Author

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(
Copy link
Collaborator

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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, please recheck @mohamede1945

Comment on lines 8 to 22
/**
* 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).
*/
Copy link
Collaborator

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:

  1. 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.
  2. 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.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mohamede1945 done, please recheck

@AhmedNMahran
Copy link
Collaborator Author

Thanks for the PR. Please let me know if you have any questions about my comments.

Thanks @mohamede1945 for your valuable comments, please check again now. Jazak Allah Khayran :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants