Skip to content
This repository has been archived by the owner on May 19, 2023. It is now read-only.

Commit

Permalink
Dev to master (#69)
Browse files Browse the repository at this point in the history
* Test PR (#51)

* Added database schema, functions and paging data UI handling (#15)

* Adding CONTRIBUTING.md

* Added CONTRIBUTING.md and squashed commits

* Updated branch naming convention

Updated branch naming convention with github-username

* 1. Added database schema (entity)
2. Added database functions (dao)
3. Added how to fetch paging data
4. Added LazyColumn UI with paging data with different states like loading, success, error

Signed-off-by: Rajesh Hadiya <[email protected]>

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>

* Added CODEOWNERS files (#33)

* Adding CONTRIBUTING.md

* Added CONTRIBUTING.md and squashed commits

* Updated branch naming convention

Updated branch naming convention with github-username

* 1. Added database schema (entity)
2. Added database functions (dao)
3. Added how to fetch paging data
4. Added LazyColumn UI with paging data with different states like loading, success, error

Signed-off-by: Rajesh Hadiya <[email protected]>

* Added CODEOWNERS files. (#19)

* Adding CODEOWNERS files.

Still needed to add the Default reviewer for the two teams.

* Update CODEOWNERS

* fix the validation issues on GitHub.

* updated owners for all the branches.

* updated the Wrong branch combinations.

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>

* Create main.yml

* Update main.yml

* Update main.yml

* Added PR template + Updated .gitignore files (#42)

Added the PR Templates +  .gitignore

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>

* Revert "Test PR (#51)" (#53)

This reverts commit 6f05260.

* Revert "Test PR (#51)" (#53) (#54)

This reverts commit 6f05260.

Co-authored-by: Rajesh Hadiya <[email protected]>

* Branch hadiyarajesh (#55)

* Added new line in Constants.kt

* Note card ui component added which will be inflated in lazy column to show all notes (#35)

* Added CODEOWNERS files (#33)

* Adding CONTRIBUTING.md

* Added CONTRIBUTING.md and squashed commits

* Updated branch naming convention

Updated branch naming convention with github-username

* 1. Added database schema (entity)
2. Added database functions (dao)
3. Added how to fetch paging data
4. Added LazyColumn UI with paging data with different states like loading, success, error

Signed-off-by: Rajesh Hadiya <[email protected]>

* Added CODEOWNERS files. (#19)

* Adding CODEOWNERS files.

Still needed to add the Default reviewer for the two teams.

* Update CODEOWNERS

* fix the validation issues on GitHub.

* updated owners for all the branches.

* updated the Wrong branch combinations.

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>

* NoteCardView for all notes ui made

* Create main.yml

* Update main.yml

* Update main.yml

* Some improvements done generalised the code

* Some ui improvements and code to inflate all card views added

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>
Co-authored-by: Rajesh Hadiya <[email protected]>

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Swapnil bhojwani <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>

* WorkerManager and Notification support for reminders added AND detekt and Ktlint support Added (#66)

* Base Integration of Detekt Analytics tool done.

* added the detekt as pre-push git-hooks.

* Enabled the ktlint and also added it into the pre-push git-hooks.

* change order and define the taks to generate output in some dir

* change some files and tasks and testing that pre-push is working or not

* manually it is running but while push it is not working

* code cleanup.

* tried once more that scripts is working or not

* fixed detekt and lint errors.

* fixed detekt errors.

* Working on Notification and WorkManager

* Working on Notification and WorkManager

* Working on Notification and WorkManager

* n

* modified

* changed gitignore

* refactoring

* refactoring

* Update misc.xml

* Update gradle.xml

* Update gradle.xml

* Update gradle.xml

* Update misc.xml

* Delete misc.xml

* Delete gradle.xml

* Update gradle.xml

* Update gradle.xml

* Update misc.xml

* changed NoteXApp to myContent

* added NotificationDTO.kt

* Update misc.xml

* Update gradle.xml

* Update gradle.xml

* Update gradle.xml

* Update misc.xml

* Update gradle.xml

* Update gradle.xml

* Update misc.xml

* detekt requested changes applied

* ktlint changes applied

* ktlint changes applied

Co-authored-by: Abhinav Suman <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>
Co-authored-by: MosesATJTC <[email protected]>
Co-authored-by: Arunshaik2001 <[email protected]>
Co-authored-by: Shaik Ahron <[email protected]>

* Branch hadiyarajesh (#68)

* Added new line in Constants.kt

* Note card ui component added which will be inflated in lazy column to show all notes (#35)

* Added CODEOWNERS files (#33)

* Adding CONTRIBUTING.md

* Added CONTRIBUTING.md and squashed commits

* Updated branch naming convention

Updated branch naming convention with github-username

* 1. Added database schema (entity)
2. Added database functions (dao)
3. Added how to fetch paging data
4. Added LazyColumn UI with paging data with different states like loading, success, error

Signed-off-by: Rajesh Hadiya <[email protected]>

* Added CODEOWNERS files. (#19)

* Adding CODEOWNERS files.

Still needed to add the Default reviewer for the two teams.

* Update CODEOWNERS

* fix the validation issues on GitHub.

* updated owners for all the branches.

* updated the Wrong branch combinations.

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>

* NoteCardView for all notes ui made

* Create main.yml

* Update main.yml

* Update main.yml

* Some improvements done generalised the code

* Some ui improvements and code to inflate all card views added

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>
Co-authored-by: Rajesh Hadiya <[email protected]>

* Narendra ju/feature/folders setup (#45)

* Added CODEOWNERS files (#33)

* Adding CONTRIBUTING.md

* Added CONTRIBUTING.md and squashed commits

* Updated branch naming convention

Updated branch naming convention with github-username

* 1. Added database schema (entity)
2. Added database functions (dao)
3. Added how to fetch paging data
4. Added LazyColumn UI with paging data with different states like loading, success, error

Signed-off-by: Rajesh Hadiya <[email protected]>

* Added CODEOWNERS files. (#19)

* Adding CODEOWNERS files.

Still needed to add the Default reviewer for the two teams.

* Update CODEOWNERS

* fix the validation issues on GitHub.

* updated owners for all the branches.

* updated the Wrong branch combinations.

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>

* Create main.yml

* Update main.yml

* Update main.yml

* Added PR template + Updated .gitignore files (#42)

Added the PR Templates +  .gitignore

* added the groundwork for the folders section in NoteX App

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>
Co-authored-by: Rajesh Hadiya <[email protected]>

* Repository and ViewModel implementation for all notes screen. Issue #16 (#61)

* Branch sajalsj (#62)

* 1. view model added for Add note screen
2. UI WIP for add note screen

* 1. view model added for Add note screen
2. Add and edit screen UI complete

* Made changes written in PR

* Narendra ju/feature/folders setup (#45)

* Added CODEOWNERS files (#33)

* Adding CONTRIBUTING.md

* Added CONTRIBUTING.md and squashed commits

* Updated branch naming convention

Updated branch naming convention with github-username

* 1. Added database schema (entity)
2. Added database functions (dao)
3. Added how to fetch paging data
4. Added LazyColumn UI with paging data with different states like loading, success, error

Signed-off-by: Rajesh Hadiya <[email protected]>

* Added CODEOWNERS files. (#19)

* Adding CODEOWNERS files.

Still needed to add the Default reviewer for the two teams.

* Update CODEOWNERS

* fix the validation issues on GitHub.

* updated owners for all the branches.

* updated the Wrong branch combinations.

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>

* Create main.yml

* Update main.yml

* Update main.yml

* Added PR template + Updated .gitignore files (#42)

Added the PR Templates +  .gitignore

* added the groundwork for the folders section in NoteX App

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>
Co-authored-by: Rajesh Hadiya <[email protected]>

* Repository and ViewModel implementation for all notes screen. Issue #16 (#61)

* 1. view model added for Add note screen
2. UI WIP for add note screen

* 1. view model added for Add note screen
2. Add and edit screen UI complete

* Made changes written in PR

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: sajal jain <[email protected]>
Co-authored-by: Narendra Nath Chatterjee <[email protected]>
Co-authored-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>
Co-authored-by: Rajesh Hadiya <[email protected]>
Co-authored-by: virunarala <[email protected]>

* Simba/feature/note folder screen UI (#49)

* Adding more UI changes

* Working on NoteFolder UI section

* Update NoteFolderScreen.kt

* Undid changes

* Fixed spacing between two row elems

* Added viewModel & minor changes to FolderRepository

* Added routes and deleted redundant data classes

* Added folder icon and minor changes

* Added spacing and string resources

* Resolved merge conflicts

Co-authored-by: Rajesh Hadiya <[email protected]>

* Note card ui component added which will be inflated in lazy column to show all notes (#35)

* Added CODEOWNERS files (#33)

* Adding CONTRIBUTING.md

* Added CONTRIBUTING.md and squashed commits

* Updated branch naming convention

Updated branch naming convention with github-username

* 1. Added database schema (entity)
2. Added database functions (dao)
3. Added how to fetch paging data
4. Added LazyColumn UI with paging data with different states like loading, success, error

Signed-off-by: Rajesh Hadiya <[email protected]>

* Added CODEOWNERS files. (#19)

* Adding CODEOWNERS files.

Still needed to add the Default reviewer for the two teams.

* Update CODEOWNERS

* fix the validation issues on GitHub.

* updated owners for all the branches.

* updated the Wrong branch combinations.

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>

* NoteCardView for all notes ui made

* Create main.yml

* Update main.yml

* Update main.yml

* Some improvements done generalised the code

* Some ui improvements and code to inflate all card views added

Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>
Co-authored-by: Rajesh Hadiya <[email protected]>

* Updated FoldersScreen with NoteFolderScreen in NoteXNavigation.kt

Signed-off-by: Rajesh Hadiya <[email protected]>

* Update Type.kt

* Update AllNotesComponents.kt

Signed-off-by: Rajesh Hadiya <[email protected]>
Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Swapnil bhojwani <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>
Co-authored-by: Narendra Nath Chatterjee <[email protected]>
Co-authored-by: virunarala <[email protected]>
Co-authored-by: Sajal Jain <[email protected]>
Co-authored-by: sajal jain <[email protected]>

* 1. Updated app for first production release
2. Code cleanup and UI changes
3. Updated app to use compose BOM instead of separate libraries

Signed-off-by: Rajesh Hadiya <[email protected]>

Signed-off-by: Rajesh Hadiya <[email protected]>
Signed-off-by: Rajesh Hadiya <[email protected]>
Co-authored-by: Hritik Kumar Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>
Co-authored-by: Swapnil bhojwani <[email protected]>
Co-authored-by: Geet Gobind Singh <[email protected]>
Co-authored-by: Abhinav Suman <[email protected]>
Co-authored-by: MosesATJTC <[email protected]>
Co-authored-by: Arunshaik2001 <[email protected]>
Co-authored-by: Shaik Ahron <[email protected]>
Co-authored-by: Narendra Nath Chatterjee <[email protected]>
Co-authored-by: virunarala <[email protected]>
Co-authored-by: Sajal Jain <[email protected]>
Co-authored-by: sajal jain <[email protected]>
  • Loading branch information
13 people authored Oct 29, 2022
1 parent 68ed9e6 commit 92973c8
Show file tree
Hide file tree
Showing 67 changed files with 2,617 additions and 208 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This is a workflow to verify that Android build is successful.

name: Android Build test

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master", "dev", "branch_hadiyarajesh", "branch_loveleen", "branch_geet", "branch_siddu"]
pull_request:
branches: [ "master", "dev", "branch_hadiyarajesh", "branch_loveleen", "branch_geet", "branch_siddu"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build_project"
build_project:
name: Build NoteX Android project
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11

# Provide required permission to gradle
- name: Change gradle wrapper permissions
run: chmod +x ./gradlew

# Build Android project
- name: Build Project
run: ./gradlew assemble
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ local.properties

# Android Studio / IntelliJ IDEA
*.iws
/.idea
/.idea/libraries
/.idea/tasks.xml
/.idea/caches
Expand All @@ -24,6 +25,7 @@ local.properties
/.idea/modules.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
/.idea/misc.xml
/out/

.DS_Store
Expand Down
3 changes: 0 additions & 3 deletions .idea/.gitignore

This file was deleted.

2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 18 additions & 12 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ android {

object LibVersion {
const val composeVersion = "1.2.0"
const val composeCompilerVersion = "1.2.0"
const val composeCompilerVersion = "1.3.2"
const val navigationComposeVersion = "2.5.1"
const val roomVersion = "2.4.2"
const val dataStoreVersion = "1.0.0"
Expand All @@ -88,23 +88,28 @@ object LibVersion {
}

dependencies {
implementation("androidx.core:core-ktx:1.8.0")
implementation("androidx.activity:activity-compose:1.5.1")
val composeBom = platform("androidx.compose:compose-bom:2022.10.00")

implementation("androidx.core:core-ktx:1.9.0")
implementation("androidx.activity:activity-compose:1.6.1")
implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.5.1")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4")
implementation("androidx.compose.ui:ui:${LibVersion.composeVersion}")
implementation("androidx.compose.ui:ui-tooling-preview:${LibVersion.composeVersion}")
implementation("androidx.compose.material3:material3:1.0.0-alpha16")
implementation(composeBom)
implementation("androidx.compose.material3:material3")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.navigation:navigation-compose:${LibVersion.navigationComposeVersion}")
implementation("androidx.datastore:datastore-preferences:${LibVersion.dataStoreVersion}")
implementation("androidx.paging:paging-compose:1.0.0-alpha16")
// DO NOT upgrade desugar_jdk_libs to 1.2.0
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.1.6")
implementation("androidx.paging:paging-compose:1.0.0-alpha17")
implementation("androidx.work:work-runtime-ktx:2.7.1")
coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:1.2.0")

implementation("androidx.hilt:hilt-navigation-compose:1.0.0")
implementation("com.google.dagger:hilt-android:${rootProject.extra["hiltVersion"]}")
implementation("androidx.hilt:hilt-work:1.0.0")
kapt("com.google.dagger:hilt-android-compiler:${rootProject.extra["hiltVersion"]}")
kapt("androidx.hilt:hilt-compiler:1.0.0")

implementation("androidx.room:room-runtime:${LibVersion.roomVersion}")
implementation("androidx.room:room-ktx:${LibVersion.roomVersion}")
implementation("androidx.room:room-paging:${LibVersion.roomVersion}")
kapt("androidx.room:room-compiler:${LibVersion.roomVersion}")
Expand All @@ -130,7 +135,8 @@ dependencies {
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.3")
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
androidTestImplementation("androidx.compose.ui:ui-test-junit4:${LibVersion.composeVersion}")
debugImplementation("androidx.compose.ui:ui-tooling:${LibVersion.composeVersion}")
debugImplementation("androidx.compose.ui:ui-test-manifest:${LibVersion.composeVersion}")
androidTestImplementation("androidx.compose.ui:ui-test-junit4")
androidTestImplementation(composeBom)
debugImplementation("androidx.compose.ui:ui-tooling")
debugImplementation("androidx.compose.ui:ui-test-manifest")
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
package com.hadiyarajesh.notex

import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4

import androidx.test.platform.app.InstrumentationRegistry
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith

import org.junit.Assert.*

/**
* Instrumented test, which will execute on an Android device.
*
Expand All @@ -21,4 +19,4 @@ class ExampleInstrumentedTest {
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.hadiyarajesh.notex", appContext.packageName)
}
}
}
8 changes: 8 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<provider
android:name="androidx.startup.InitializationProvider"
android:authorities="${applicationId}.androidx-startup"
tools:node="remove">
</provider>

<receiver android:name=".reminder.notification.NotificationBroadCastReceiver"/>
</application>

</manifest>
15 changes: 14 additions & 1 deletion app/src/main/java/com/hadiyarajesh/notex/MyApplication.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
package com.hadiyarajesh.notex

import android.app.Application
import androidx.hilt.work.HiltWorkerFactory
import androidx.work.Configuration
import dagger.hilt.android.HiltAndroidApp
import javax.inject.Inject

@HiltAndroidApp
class MyApplication: Application()
class MyApplication : Application(), Configuration.Provider {

@Inject
lateinit var workerFactory: HiltWorkerFactory

override fun getWorkManagerConfiguration(): Configuration {
return Configuration.Builder()
.setWorkerFactory(workerFactory)
.build()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ package com.hadiyarajesh.notex.database.converter

import androidx.room.TypeConverter
import java.time.Instant
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter

object InstantConverter {
@JvmStatic
Expand All @@ -11,4 +15,13 @@ object InstantConverter {
@JvmStatic
@TypeConverter
fun toInstant(value: String?): Instant? = value?.let { Instant.parse(value) }

@JvmStatic
@TypeConverter
fun getLocalDate(instant: Instant): LocalDate {
val localDateTime: LocalDateTime =
LocalDateTime.ofInstant(instant, ZoneOffset.systemDefault())
val formatter = DateTimeFormatter.ofPattern("yyyyMMdd")
return LocalDate.parse(localDateTime.format(formatter), formatter)
}
}
33 changes: 26 additions & 7 deletions app/src/main/java/com/hadiyarajesh/notex/database/dao/NoteDao.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
package com.hadiyarajesh.notex.database.dao

import androidx.paging.PagingSource
import androidx.room.*
import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Transaction
import com.hadiyarajesh.notex.database.entity.Note
import com.hadiyarajesh.notex.utility.InternalUseOnly
import java.time.Instant
Expand All @@ -20,6 +25,17 @@ interface NoteDao {
updateFolderModificationProperty(parentFolderId)
}

/**
* This method will update the provided Note and also modify the updatedOn field of the containing Folder(if the note is in a folder)
*/
@Transaction
suspend fun updateNote(note: Note, parentFolderId: Long?) {
insertOrUpdate(note)
parentFolderId?.let {
updateFolderModificationProperty(folderId = parentFolderId, updatedOn = note.updatedOn)
}
}

@InternalUseOnly
@Query("UPDATE Note SET parentFolderId = :parentFolderId WHERE noteId = :noteId")
suspend fun attachNoteToFolder(noteId: Long, parentFolderId: Long)
Expand All @@ -29,7 +45,7 @@ interface NoteDao {
suspend fun updateFolderModificationProperty(folderId: Long, updatedOn: Instant = Instant.now())

@Query("SELECT * FROM Note WHERE noteId = :noteId")
fun getById(noteId: Long): Note
suspend fun getById(noteId: Long): Note

/**
* This method wil only return non-deleted notes.
Expand All @@ -49,24 +65,27 @@ interface NoteDao {
* Mark a note as deleted (archived)
*/
@Query("UPDATE Note SET archived = 1 WHERE noteId = :noteId")
fun markAsArchived(noteId: Long)
suspend fun markAsArchived(noteId: Long)

@Query("UPDATE Note SET archived = 0 WHERE noteId = :noteId")
suspend fun markAsUnarchived(noteId: Long)

@Delete
fun delete(note: Note)
suspend fun delete(note: Note): Int

@Query("DELETE FROM Note WHERE noteId = :noteId")
fun deleteById(noteId: Long)
suspend fun deleteById(noteId: Long): Int

/**
* Permanently delete all notes that are already archived.
*/
@Query("DELETE FROM Note WHERE archived = 1")
fun deleteAllArchivedNotes()
suspend fun deleteAllArchivedNotes(): Int

/**
* WARNING: USE WITH CAUTION
* Permanently delete all notes
*/
@Query("DELETE FROM Note")
fun deleteAll()
suspend fun deleteAll(): Int
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import java.time.Instant
@Dao
interface ReminderDao {
@Insert(onConflict = OnConflictStrategy.REPLACE)
suspend fun insertOrUpdate(reminder: Reminder)
suspend fun insertOrUpdate(reminder: Reminder): Long

/**
* This method will add reminder to folder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ data class Folder(
val title: String,
val description: String?,
val folderType: FolderType,
//HexCode of a color
// HexCode of a color
val color: String? = null,
val createdOn: Instant,
val updatedOn: Instant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ data class Note(
val content: String?,
val archived: Boolean,
val archivedOn: Instant? = null,
//HexCode of a color
// HexCode of a color
val color: String? = null,
val createdOn: Instant,
val updatedOn: Instant,
val parentFolderId: Long? = null,
)

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ data class Reminder(
val cancelledOn: Instant? = null,
val completed: Boolean,
val completedOn: Instant?,
//HexCode of a color
// HexCode of a color
val color: String? = null,
val createdOn: Instant,
val updatedOn: Instant,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.converter.moshi.MoshiConverterFactory
import javax.inject.Singleton

@Module
@InstallIn(SingletonComponent::class)
Expand Down
9 changes: 8 additions & 1 deletion app/src/main/java/com/hadiyarajesh/notex/di/ScopeModule.kt
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package com.hadiyarajesh.notex.di

import com.hadiyarajesh.notex.reminder.notification.NotificationHelper
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import javax.inject.Singleton

@InstallIn(SingletonComponent::class)
@Module
Expand All @@ -18,4 +19,10 @@ class ScopeModule {
fun provideCoroutineScope(): CoroutineScope {
return CoroutineScope(SupervisorJob() + Dispatchers.IO)
}

@Singleton
@Provides
fun provideNotificationHelper(): NotificationHelper {
return NotificationHelper()
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
package com.hadiyarajesh.notex.network.api

interface NoteApi {
}
interface NoteApi
Loading

0 comments on commit 92973c8

Please sign in to comment.