-
Notifications
You must be signed in to change notification settings - Fork 3
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
Handle user states #65
Conversation
WalkthroughThe updates span across three core files aiming to improve data handling, user state notifications, and database rules. The Changes
Sequence Diagram(s)sequenceDiagram
participant Scheduler
participant CloudFunctions
participant Database
Scheduler->>CloudFunctions: Triggers serviceCheck every 30 minutes
CloudFunctions->>Database: Queries for stale user data
Database-->>CloudFunctions: Returns stale user data
CloudFunctions->>Database: Processes and updates stale user data
participant Firestore
participant RuleCheck
User->>Firestore: Requests data read/update
Firestore->>RuleCheck: Verifies isAuthorized() and isSpaceMember()
RuleCheck-->>Firestore: Authorization result
Firestore-->>User: Permits or denies access based on validation
participant NotificationService
participant GeoFence
GeoFence->>CloudFunctions: Triggers updateUserStateNotification on document creation
CloudFunctions->>NotificationService: Checks user state and condition for notifications
NotificationService->>User: Sends notification if conditions are met
Recent review detailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Additional context usedBiome
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 5
Outside diff range and nitpick comments (4)
app/src/main/java/com/canopas/yourspace/domain/utils/ContextExt.kt (1)
22-33
: The update to useNetworkCapabilities
is a good improvement for network connectivity checks, enhancing reliability and future-proofing the code.Consider adding a comment explaining why
NetworkCapabilities
is used overNetworkInfo
based on the Android version, which could help in future maintenance.app/src/main/java/com/canopas/yourspace/ui/component/UserBatteryStatus.kt (1)
16-24
: Updated the function to useApiUser
instead ofApiUserSession
, aligning with the new user management strategy.Consider adding a comment explaining the change from
session
touser
to clarify the context for future developers.data/src/main/java/com/canopas/yourspace/data/models/user/ApiUser.kt (1)
25-40
: Added new fieldsstate
,battery_pct
, andupdated_at
to theApiUser
class to enhance user state management.Consider documenting these new fields in the class to explain their usage and impact, which could be beneficial for future developers and API consumers.
data/src/main/java/com/canopas/yourspace/data/service/auth/AuthService.kt (1)
124-125
: Optimized theupdateUserSessionState
function to avoid unnecessary updates by checking if the current state matches the new state.Consider adding a comment explaining why this check is important, as it helps in understanding the logic and avoiding redundant operations.
data/src/main/java/com/canopas/yourspace/data/service/auth/AuthService.kt
Show resolved
Hide resolved
data/src/main/java/com/canopas/yourspace/data/service/user/ApiUserService.kt
Outdated
Show resolved
Hide resolved
data/src/main/java/com/canopas/yourspace/data/service/user/ApiUserService.kt
Outdated
Show resolved
Hide resolved
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.
Actionable comments posted: 3
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.
Actionable comments posted: 5
Summary by CodeRabbit
New Features
Refactor
Bug Fixes