Skip to content
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

Code updated to run on SDK 33 and Gradle 7.5 #12

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
99b1b59
Code updated to run on SDK 33 and Gradle 7.5
graffiti75 Apr 14, 2023
d8ffa9d
Authentication flow implemented
graffiti75 Apr 16, 2023
c37e032
Updating Gradle for Koin Tests
graffiti75 Apr 16, 2023
70c3ce4
Authentication flow transferred to AuthenticationActivity
graffiti75 Apr 16, 2023
9d4e191
MapsActivity added to the project
graffiti75 Apr 16, 2023
35ec2f6
Maps implementation transferred to SelectLocationFragment
graffiti75 Apr 17, 2023
2457bc3
Navigation bugs fixed
graffiti75 Apr 17, 2023
78d4976
SelectLocationFragment refactored.
graffiti75 Apr 26, 2023
c76efc3
Removed unused methods on SelectLocationFragment
graffiti75 Apr 26, 2023
91f6ab0
Method onLocationSelected() added to setPoiClick() inside SelectLocat…
graffiti75 Apr 28, 2023
b088df2
Geofences added and Notification implemented
graffiti75 Apr 29, 2023
81ca5d2
Save button added on SelectLocationFragment
graffiti75 Apr 29, 2023
1dee279
Design added to ReminderDescriptionActivity
graffiti75 May 23, 2023
cbfad3b
Comments from latest commit removed
graffiti75 May 23, 2023
3ad4883
RemindersListViewModel tests added
graffiti75 May 26, 2023
3e1436d
SaveReminderViewModelTest tests added
graffiti75 May 26, 2023
d749465
RemindersActivityTest tests added
graffiti75 May 26, 2023
5b1c93a
ReminderListFragmentTest tests added
graffiti75 May 26, 2023
694ccd1
RemindersLocalRepositoryTest tests added
graffiti75 May 26, 2023
92c5c10
RemindersDaoTest tests added
graffiti75 May 26, 2023
13af776
Login re-enabled
graffiti75 May 26, 2023
2982664
Method checkIfUserIsLogged implemented on AuthenticationActivity
graffiti75 May 30, 2023
c8f4045
Map methods added to SelectLocationFragment
graffiti75 Jun 2, 2023
644840e
Comments from latest commit removed
graffiti75 Jun 2, 2023
1f25352
wrapEspressoIdlingResource added to RemindersLocalRepository
graffiti75 Jun 2, 2023
db83eef
Fixing code review spec from FakeDataSource.kt, lines 24 and 37
graffiti75 Jun 5, 2023
b0d8cf7
Declared on FakeDataSource the reminderList data as NotNull
graffiti75 Jun 5, 2023
f322768
Method enableMyLocation implemented on SelectLocationFragment
graffiti75 Jun 7, 2023
5176be6
Comments from latest commit removed
graffiti75 Jun 7, 2023
78e58c4
Dispatchers.Main added to method updateCurrentPoi
graffiti75 Jun 7, 2023
ac3c247
checkGeoFencePermissions added on SaveReminderFragment
graffiti75 Jun 8, 2023
3372bb9
Notifications now working for multiple triggering Geofences
graffiti75 Jun 8, 2023
71c0808
Small fixes on Notification feature
graffiti75 Jun 8, 2023
77c1c1a
Espresso test for Toast message added
graffiti75 Jun 12, 2023
b22af65
Trying to fix addingReminder_verifyIfToastIsCalled
graffiti75 Jun 14, 2023
e3e5ddc
Test addingReminder_verifyIfToastIsCalled fixed
graffiti75 Jun 15, 2023
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
1 change: 1 addition & 0 deletions starter/.idea/.name

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

6 changes: 6 additions & 0 deletions starter/.idea/compiler.xml

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

20 changes: 20 additions & 0 deletions starter/.idea/gradle.xml

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

6 changes: 6 additions & 0 deletions starter/.idea/kotlinc.xml

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

6 changes: 6 additions & 0 deletions starter/.idea/misc.xml

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

6 changes: 6 additions & 0 deletions starter/.idea/vcs.xml

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

100 changes: 52 additions & 48 deletions starter/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"
apply plugin: 'kotlin-android-extensions'
apply plugin: 'com.google.gms.google-services'
plugins {
id 'com.android.application'
id 'kotlin-android'
id 'kotlin-kapt'
id 'androidx.navigation.safeargs.kotlin'
id 'com.google.gms.google-services'
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin'
}

android {
compileSdkVersion rootProject.compileSdkVersion
buildToolsVersion "29.0.2"
namespace 'com.udacity.project4'
compileSdk 33

defaultConfig {
applicationId "com.udacity.project4"
minSdkVersion rootProject.minSdkVersion
targetSdkVersion rootProject.targetSdkVersion
minSdk rootProject.minSdkVersion
targetSdk rootProject.targetSdkVersion
versionCode 1
versionName "1.0"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand All @@ -31,58 +34,55 @@ android {
returnDefaultValues = true
}

//dataBinding {
// enabled = true
// enabledForTests = true
//}
// dataBinding {
// enabled = true
// enabledForTests = true
// }
buildFeatures {
dataBinding true
}
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

// App dependencies
implementation "androidx.appcompat:appcompat:$appCompatVersion"
implementation "androidx.legacy:legacy-support-v4:$androidXLegacySupport"
implementation "androidx.annotation:annotation:$androidXAnnotations"

implementation "androidx.cardview:cardview:$cardVersion"
// implementation "androidx.legacy:legacy-support-v4:$androidXLegacySupport"
// implementation "androidx.annotation:annotation:$androidXAnnotations"
implementation "androidx.swiperefreshlayout:swiperefreshlayout:$swipeRefreshVersion"
// implementation "androidx.cardview:cardview:$cardVersion"
implementation "com.google.android.material:material:$materialVersion"
implementation "androidx.recyclerview:recyclerview:$recyclerViewVersion"
// implementation "androidx.recyclerview:recyclerview:$recyclerViewVersion"
implementation "androidx.constraintlayout:constraintlayout:$constraintVersion"

implementation 'com.google.code.gson:gson:2.8.5'
// implementation 'com.google.code.gson:gson:2.8.5'

// Architecture Components
//Navigation dependencies
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-rc1'
Copy link
Member

Choose a reason for hiding this comment

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

@graffiti75 Do you see the first change of this PR is not required here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

New PR created: #14

kapt "androidx.lifecycle:lifecycle-compiler:$archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-extensions:$archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$archLifecycleVersion"
// Architecture Components & Navigation dependencies
// kapt "androidx.lifecycle:lifecycle-compiler:$archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-extensions:$archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$archLifecycleVersion"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$archLifecycleKtxVersion"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$archLifecycleKtxVersion"
implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion"
implementation "androidx.test.espresso:espresso-idling-resource:$espressoVersion"

//Room dependencies
implementation "androidx.room:room-ktx:$roomVersion"
// Room dependencies
implementation "androidx.room:room-runtime:$roomVersion"
kapt "androidx.room:room-compiler:$roomVersion"
// Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:$roomVersion"

//Coroutines Dependencies
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"

//Koin
implementation "org.koin:koin-android:$koinVersion"
implementation "org.koin:koin-androidx-viewmodel:$koinVersion"
// Coroutines Dependencies
// implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"

// Koin
implementation "io.insert-koin:koin-android:$koinVersion"
implementation "io.insert-koin:koin-core:$koinVersion"

// Dependencies for local unit tests
testImplementation "junit:junit:$junitVersion"
testImplementation "org.hamcrest:hamcrest-all:$hamcrestVersion"
// testImplementation "org.hamcrest:hamcrest-all:$hamcrestVersion"
testImplementation "androidx.arch.core:core-testing:$archTestingVersion"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
testImplementation "org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion"
Expand All @@ -104,23 +104,27 @@ dependencies {
androidTestImplementation "androidx.arch.core:core-testing:$archTestingVersion"
androidTestImplementation "org.robolectric:annotations:$robolectricVersion"
androidTestImplementation "androidx.test.espresso:espresso-core:$espressoVersion"
// Testing code for more advanced views such as the DatePicker and RecyclerView.
// It also contains accessibility checks and a class called CountingIdlingResource.
androidTestImplementation "androidx.test.espresso:espresso-contrib:$espressoVersion"
androidTestImplementation "androidx.test.espresso:espresso-intents:$espressoVersion"
androidTestImplementation "androidx.test.espresso.idling:idling-concurrent:$espressoVersion"
androidTestImplementation "junit:junit:$junitVersion"
// Once https://issuetracker.google.com/127986458 is fixed this can be testImplementation
implementation "androidx.fragment:fragment-testing:$fragmentVersion"
// Testing code should not be included in the main code.
// Once https://issuetracker.google.com/128612536 is fixed this can be fixed.
debugImplementation "androidx.fragment:fragment-testing:$fragmentTestingVersion"
implementation "androidx.test:core:$androidXTestCoreVersion"
implementation "androidx.fragment:fragment:$fragmentVersion"
// implementation "androidx.fragment:fragment:$fragmentVersion"
androidTestImplementation "org.mockito:mockito-core:$mockitoVersion"
androidTestImplementation "com.linkedin.dexmaker:dexmaker-mockito:$dexMakerVersion"
androidTestImplementation('org.koin:koin-test:2.0.1') { exclude group: 'org.mockito' }

// androidTestImplementation('org.koin:koin-test:2.0.1') { exclude group: 'org.mockito' }
androidTestImplementation "io.insert-koin:koin-test:$koinVersion"

// Maps & Geofencing
implementation "com.google.android.gms:play-services-location:$playServicesLocationVersion"
implementation "com.google.android.gms:play-services-maps:$playServicesMapsVersion"

//Maps & Geofencing
implementation "com.google.android.gms:play-services-location:$playServicesVersion"
implementation "com.google.android.gms:play-services-maps:$playServicesVersion"


}
// Firebase
implementation "com.firebaseui:firebase-ui-auth:$firebaseUiAuthVersion"
implementation "com.google.firebase:firebase-auth-ktx:$firebaseAuthKtxVersion"
}
47 changes: 47 additions & 0 deletions starter/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"project_info": {
"project_number": "423316326245",
"project_id": "locationreminder-80efc",
"storage_bucket": "locationreminder-80efc.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:423316326245:android:a33b5cc75ea0375d7a838c",
"android_client_info": {
"package_name": "com.udacity.project4"
}
},
"oauth_client": [
{
"client_id": "423316326245-vg0vfgi6s4avapcmptbj3l314s7l4o66.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.udacity.project4",
"certificate_hash": "8daf07abce85f500329c4babccc42573b5ffeed4"
}
},
{
"client_id": "423316326245-8fjtl5af57sanqo7cvf9850cigltbkb5.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyB9Y3uogCpRJbOC-bliKYlzjhL-__57OZY"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "423316326245-0gidq5ki1qov5ms3cnsoa50obfd3v3p3.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ import org.koin.androidx.viewmodel.dsl.viewModel
import org.koin.core.context.startKoin
import org.koin.core.context.stopKoin
import org.koin.dsl.module
import org.koin.test.AutoCloseKoinTest
import org.koin.test.KoinTest
import org.koin.test.get

@RunWith(AndroidJUnit4::class)
@LargeTest
//END TO END test to black box test the app
class RemindersActivityTest :
AutoCloseKoinTest() {// Extended Koin Test - embed autoclose @after method to close Koin after every test
// Extended Koin Test - embed autoclose @After method to close Koin after every test
class RemindersActivityTest : KoinTest {

// Source:
// https://medium.com/koin-developers/unboxing-koin-2-1-7f1133ebb790

private lateinit var repository: ReminderDataSource
private lateinit var appContext: Application
Expand All @@ -34,7 +37,8 @@ class RemindersActivityTest :
*/
@Before
fun init() {
stopKoin()//stop the original app koin
// Stop the original app koin
stopKoin()
appContext = getApplicationContext()
val myModule = module {
viewModel {
Expand All @@ -52,20 +56,19 @@ class RemindersActivityTest :
single { RemindersLocalRepository(get()) as ReminderDataSource }
single { LocalDB.createRemindersDao(appContext) }
}
//declare a new koin module

// Declare a new koin module
startKoin {
modules(listOf(myModule))
}
//Get our real repository
// Get our real repository
repository = get()

//clear the data to start fresh
// Clear the data to start fresh
runBlocking {
repository.deleteAllReminders()
}
}


// TODO: add End to End testing to the app

}
// TODO: Add End to End testing to the app
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@ import org.junit.Test

@ExperimentalCoroutinesApi
@RunWith(AndroidJUnit4::class)
//Unit test the DAO
// Unit test the DAO
@SmallTest
class RemindersDaoTest {

// TODO: Add testing implementation to the RemindersDao.kt

// TODO: Add testing implementation to the RemindersDao.kt
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ import org.junit.runner.RunWith
@MediumTest
class RemindersLocalRepositoryTest {

// TODO: Add testing implementation to the RemindersLocalRepository.kt

// TODO: Add testing implementation to the RemindersLocalRepository.kt
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ import org.mockito.Mockito.verify

@RunWith(AndroidJUnit4::class)
@ExperimentalCoroutinesApi
//UI Testing
// UI Testing
@MediumTest
class ReminderListFragmentTest {

// TODO: test the navigation of the fragments.
// TODO: test the displayed data on the UI.
// TODO: add testing for the error messages.
// TODO: Test the navigation of the fragments.
// TODO: Test the displayed data on the UI.
// TODO: Add testing for the error messages.
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ package com.udacity.project4.util
import android.view.View
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.testing.FragmentScenario
import androidx.test.core.app.ActivityScenario
import androidx.test.espresso.IdlingResource
import java.util.UUID
import java.util.*

/**
* An espresso idling resource implementation that reports idle status for all data binding
Expand Down Expand Up @@ -104,8 +103,10 @@ fun DataBindingIdlingResource.monitorActivity(
/**
* Sets the fragment from a [FragmentScenario] to be used from [DataBindingIdlingResource].
*/
/*
fun DataBindingIdlingResource.monitorFragment(fragmentScenario: FragmentScenario<out Fragment>) {
fragmentScenario.onFragment {
this.activity = it.requireActivity()
}
}
*/
9 changes: 6 additions & 3 deletions starter/app/src/debug/res/values/google_maps_api.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
<resources>
<!-- TODO: Before you run your application, you need a Google Maps API key.-->
<string name="google_maps_key" templateMergeStrategy="preserve" translatable="false"></string>
</resources>
<!--
TODO: Before you run your application, you need a Google Maps API key.
-->
<string name="google_maps_key" templateMergeStrategy="preserve"
translatable="false">AIzaSyC6hBgGRJHLlKoosvbR-nPUg0w5Lg3cbWs</string>
</resources>
Loading