Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,17 @@ class MainActivity : ComponentActivity() {
* follow Android) is loaded from it before the first frame, and saved to it in
* the background whenever they change it.
*
* Reference:
* Anthropic. (2026). Claude Code (Claude Opus 5.5) [Large language model].
* https://claude.com/claude-code
* Changed with the help of this AI tool (saving the theme choice, System option).
* Prompts:
* - "Okay so one thing I found was that dark mode doesn't stay if you select dark mode within
* the app. it disapears after app resets. Let's save it into the sqlite3 db we already have."
* - "Please make sure to also document and cite your changes."
* - "And then add a third button to the settings as system settings."
* @param savedInstanceState Previously saved activity state.
*/
// Reference:
// Anthropic. (2026). Claude Code (Claude Opus 5.5) [Large language model].
// https://claude.com/claude-code
// Changed with the help of this AI tool (saving the theme choice, System option).
// Prompts:
// - "Okay so one thing I found was that dark mode doesn't stay if you select dark mode within
// the app. it disappears after app resets. Let's save it into the sqlite3 db we already have."
// - "Please make sure to also document and cite your changes."
// - "And then add a third button to the settings as system settings."
@SuppressLint("HardwareIds")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Expand Down Expand Up @@ -328,6 +329,5 @@ class MainActivity : ComponentActivity() {
startupNotifPermission.launch(Manifest.permission.POST_NOTIFICATIONS)
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import androidx.core.app.NotificationCompat
import androidx.core.app.NotificationManagerCompat
import com.example.lambda_bbb_events.MainActivity
import com.example.lambda_bbb_events.R
import com.example.lambda_bbb_events.model.notification.Notification
import com.example.lambda_bbb_events.model.notifications.Notification
import com.example.lambda_bbb_events.model.repository.NotificationRepository
import com.example.lambda_bbb_events.model.local.NotificationHistoryStore
import com.example.lambda_bbb_events.model.notification.NotificationHistory
import com.example.lambda_bbb_events.model.notifications.NotificationHistory
import java.util.UUID
import com.example.lambda_bbb_events.model.local.NotificationCategoryStore
import com.example.lambda_bbb_events.model.notification.NotificationCategory
import com.example.lambda_bbb_events.model.notification.NotificationMode
import com.example.lambda_bbb_events.model.notifications.NotificationCategory
import com.example.lambda_bbb_events.model.notifications.NotificationMode

/**
* Builds notification and delivery as wel as preferences and history
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.example.lambda_bbb_events.model.local

import android.content.Context
import com.example.lambda_bbb_events.model.notification.NotificationCategory
import com.example.lambda_bbb_events.model.notification.NotificationMode
import com.example.lambda_bbb_events.model.notifications.NotificationCategory
import com.example.lambda_bbb_events.model.notifications.NotificationMode
import java.util.concurrent.TimeUnit

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.example.lambda_bbb_events.model.local

import android.content.Context
import com.example.lambda_bbb_events.model.notification.NotificationHistory
import com.example.lambda_bbb_events.model.notifications.NotificationHistory
import kotlinx.coroutines.channels.awaitClose
import kotlinx.coroutines.flow.callbackFlow
import android.content.SharedPreferences
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ data class WaitlistEntry (
init {
require(numberOfGuests >= 1) { "numberOfGuests must be at least 1" }
}

/**
* Updates the waitlist entry status to "declined".
* Updates the waitlist entry status to [WaitlistStatus.DECLINED].
*/
fun declineEntry() {
status = WaitlistStatus.DECLINED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import com.google.firebase.Timestamp
* Represents a private conversation between a camper and one other person: a campsite
* owner or a specific administrator.
*
* There is one conversation per pair of people, no matter how many of the owner's
* There is one conversation per a pair of people, no matter how many of the owner's
* campsites the camper is enrolled in, so each contact appears once. Each conversation
* contains multiple messages stored in a Firestore subcollection.
*
Expand Down Expand Up @@ -65,6 +65,7 @@ class Conversation(
* Whether [personId] is one of the two people in this conversation.
*
* @param personId Device ID to check.
* @return `true` if the person is a participant, `false` if otherwise.
*/
fun hasParticipant(personId: String): Boolean {
return personId.isNotBlank() &&
Expand All @@ -74,6 +75,8 @@ class Conversation(
/**
* Whether this conversation uses the one-per-pair ID scheme. Conversations from before
* it were kept per campsite and shared by all administrators, and are no longer shown.
*
* @return `true` if the conversation uses the current ID, `false` if otherwise.
*/
fun hasCurrentId(): Boolean {
val expectedId = when (type) {
Expand All @@ -91,6 +94,7 @@ class Conversation(
*
* @param userId Device ID of the camper.
* @param ownerId Device ID of the campsite owner.
* @return The generated owner conversation ID.
*/
fun ownerConversationId(userId: String, ownerId: String): String =
"owner_${userId}_${ownerId}"
Expand All @@ -100,6 +104,7 @@ class Conversation(
*
* @param userId Device ID of the camper.
* @param adminId Device ID of the administrator.
* @return The generated administrator conversation ID.
*/
fun adminConversationId(userId: String, adminId: String): String =
"admin_${userId}_${adminId}"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
package com.example.lambda_bbb_events.model.message

import com.google.firebase.Timestamp
/*
* Defines messages exchanged between users, campsite owners, and administrators.
*/

//Reference:
//Anthropic. (2026). Claude Code (Claude Opus 5.5) [Large language model].
//https://claude.com/claude-code
//The deleted property, canBeDeletedBy, and DELETED_TEXT were written with the help of this AI tool.
//Prompts:
//- "Also please clean up a database and offer a way for users to delete messages with a message
// deleted plus. Show also that messages are active."
//- "So to clarify I want to allow users and admins to remove messages."

/**
* Represents a message exchanged between users, campsite
Expand All @@ -15,15 +27,6 @@ import com.google.firebase.Timestamp
* @property deleted Whether the message was deleted. A deleted
* message keeps its place in the conversation,
* but its content is removed.
*
* Reference:
* Anthropic. (2026). Claude Code (Claude Opus 5.5) [Large language model].
* https://claude.com/claude-code
* The deleted property, canBeDeletedBy, and DELETED_TEXT were written with the help of this AI tool.
* Prompts:
* - "Also please clean up a database and offer a way for users to delete messages with a message
* deleted plus. Show also that messages are active."
* - "So to clarify I want to allow users and admins to remove messages."
*/
class Message(
val messageId: String = "",
Expand All @@ -40,24 +43,25 @@ class Message(
*
* @param personId Device ID of the person asking to delete the message.
* @param isAdmin Whether that person is an administrator.
* @return `true` if the person is allowed to delete message, `false` if otherwise.
*/
fun canBeDeletedBy(personId: String, isAdmin: Boolean): Boolean {
return !deleted && personId.isNotBlank() && (senderId == personId || isAdmin)
}

// Reference:
// Anthropic. (2026). Claude Code (Claude Opus 5.5) [Large language model].
// https://claude.com/claude-code
// Written with the help of this AI tool.
// Prompts:
// - "Can you combine the message timestamps because it's a bit weird to put it in multiple
// places for the same time."
/**
* Whether this message is part of the same group as [other], so only one of them needs
* to show the time: they have the same sender and were sent in the same minute.
*
* @param other A message next to this one in the conversation.
*
* Reference:
* Anthropic. (2026). Claude Code (Claude Opus 5.5) [Large language model].
* https://claude.com/claude-code
* Written with the help of this AI tool.
* Prompts:
* - "Can you combine the message timestamps because it's a bit weird to put it in multiple
* places for the same time."
* @return `true` if both messages have same sender and were sent same minute, `false` if otherwise.
*/
fun isGroupedWith(other: Message): Boolean {
return senderId == other.senderId &&
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package com.example.lambda_bbb_events.model.message

/*
* Defines messaging permissions between users and campsite owners.
*/

/**
* Represents a user's messaging access for a campsite.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ package com.example.lambda_bbb_events.model.message

import com.google.firebase.Timestamp

/*
* Stores notification preferences for individual contacts.
*/

/**
* Represents a user's notification preferences for a contact.
*
Expand All @@ -26,10 +30,8 @@ class NotificationPreference(
* or the temporary mute has not expired.
*/
fun isMuted(): Boolean {
if (!muted) return false

return mutedUntil?.let {
it.compareTo(Timestamp.now()) > 0
return muted && mutedUntil?.let {
it > Timestamp.now()
} ?: true
}
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,9 @@
package com.example.lambda_bbb_events.model.notification
package com.example.lambda_bbb_events.model.notifications

/*
* Model classes for notifications.
*
* TODO Notification Actions
*/


///** TO BE WORKED ON LATER FOR FURTHER NOTIF FUNCTION
// * Buttons and functionality for notification.
// *
// * @property notifType text of action buttons of notification.
// * @property actionType Identifier for
// */
//data class NotificationFunction(
// val notifType: String,
// val actionType: String
//)

/**
* A data class for notification structure .
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
package com.example.lambda_bbb_events.model.notification
package com.example.lambda_bbb_events.model.notifications

/*
* Defines notification categories and delivery modes.
*/

/**
* Represents the categories of system notifications.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
package com.example.lambda_bbb_events.model.notification
package com.example.lambda_bbb_events.model.notifications

/*
* Defines notification history entries saved locally for each user.
*/

/**
* Represents a notification saved in the user's history.
*
* @property id Unique identifier of the notification.
* @property title Title of the notification.
* @property message Body text of the notification.
* @property timestamp Time when the notification was saved, in milliseconds.
*/
data class NotificationHistory(
val id: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import com.google.firebase.Timestamp
import com.google.firebase.firestore.DocumentSnapshot
import com.google.firebase.firestore.FirebaseFirestore
import kotlinx.coroutines.tasks.await
/*
* Retrieves admin notification and message logs from Firebase.
*/

/**
* Repository responsible for retrieving notification and message
Expand Down Expand Up @@ -35,7 +38,7 @@ class AdminLogRepository(
*
* @return A list of notification logs.
*/
suspend fun getNotificationLogs(): List<AdminLog> {
fun getNotificationLogs(): List<AdminLog> {
// TODO: Retrieve notification logs once implemented.
return emptyList()
}
Expand Down
Loading
Loading