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

User Profile #10

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
60f537d
Branch Push
AnKiTk203 Jan 11, 2024
46773f7
Branch Push
AnKiTk203 Jan 11, 2024
361530f
Hello
AnKiTk203 Jan 11, 2024
bb1c615
Branch Push
AnKiTk203 Jan 15, 2024
cad3d9e
Branch Push
AnKiTk203 Jan 15, 2024
9658f5d
Updating
AnKiTk203 Jan 23, 2024
f8b14dd
Updating
AnKiTk203 Jan 23, 2024
436d58f
Updating
AnKiTk203 Jan 31, 2024
dc956af
Updating
AnKiTk203 Jan 31, 2024
eedc905
Updating
AnKiTk203 Jan 31, 2024
b33901d
Updating
AnKiTk203 Feb 15, 2024
8be69fb
Updating
AnKiTk203 Feb 15, 2024
f9664c1
access location button is enabled anduser address fragment is done be…
bishalpb2004 Feb 17, 2024
061e242
setting up
Gaurav-822 Mar 3, 2024
ef2ba92
Dev Branch Push
AnKiTk203 Mar 28, 2024
0d07e36
updating dev with main to integrate further pages
Gaurav-822 Mar 29, 2024
f89905b
updating dev with main to integrate further pages
Gaurav-822 Mar 29, 2024
f513cbe
updating dev with main to integrate further pages
Gaurav-822 Mar 29, 2024
f229544
updating dev with main to integrate further pages
Gaurav-822 Mar 29, 2024
3d83663
Unique Auth ID is successfully generated along with signup of the user
bishalpb2004 Mar 29, 2024
9ff8965
merge conflict resolved
bishalpb2004 Mar 29, 2024
947d942
merge conflict fixed
bishalpb2004 Mar 29, 2024
2cf5779
fixing merge conflicts
bishalpb2004 Mar 29, 2024
68f6d22
Merged authentication and resolved merge conflicts
bishalpb2004 Mar 29, 2024
b012208
navigation inculcated
Gaurav-822 Mar 30, 2024
f0f1262
minor ui fix
Gaurav-822 Mar 30, 2024
33d636f
Dev Branch Push
AnKiTk203 May 28, 2024
0fcd6dc
Merge remote-tracking branch 'origin/dev' into Ankit
AnKiTk203 Jun 4, 2024
b1ad013
LogOut Added
AnKiTk203 Jun 5, 2024
e10078b
gradle fix
AnKiTk203 Jun 13, 2024
129f50c
Email Verification
AnKiTk203 Jun 13, 2024
9e5103c
Email Verification
AnKiTk203 Jun 13, 2024
60c98d1
Navigation fix
AnKiTk203 Jun 13, 2024
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
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.

3 changes: 3 additions & 0 deletions .idea/deploymentTargetDropDown.xml

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

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

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

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

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

16 changes: 10 additions & 6 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ android {
}

// View Binding
buildFeatures {
viewBinding = true
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand All @@ -51,7 +48,7 @@ dependencies {
implementation("com.google.android.material:material:1.11.0")
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
implementation("com.google.firebase:firebase-auth:22.3.1")
implementation("com.google.firebase:firebase-database:20.3.0")
implementation("com.google.firebase:firebase-database:20.3.1")
implementation("com.google.firebase:firebase-auth-ktx:22.3.1")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
Expand All @@ -61,13 +58,20 @@ dependencies {

// Card View
implementation("androidx.cardview:cardview:1.0.0")

// Glide
implementation ("com.github.bumptech.glide:glide:4.16.0")
implementation("com.github.bumptech.glide:glide:4.16.0")
annotationProcessor("com.github.bumptech.glide:compiler:4.11.0")

// Coil
implementation("io.coil-kt:coil:2.5.0")
implementation("com.airbnb.android:lottie:6.0.0")


//Navigation dependency
val nav_version = "2.7.6"
//noinspection GradleDependency
implementation("androidx.navigation:navigation-fragment-ktx:$nav_version")
//noinspection GradleDependency
implementation("androidx.navigation:navigation-ui-ktx:$nav_version")

}
Original file line number Diff line number Diff line change
@@ -1,50 +1,101 @@
package com.example.deliveryapp.Fragments

import android.Manifest
import android.app.AlertDialog
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.activity.OnBackPressedCallback
import androidx.core.app.ActivityCompat
import androidx.core.content.ContextCompat
import androidx.fragment.app.Fragment
import androidx.navigation.NavController
import androidx.navigation.Navigation
import com.example.deliveryapp.R
import com.example.deliveryapp.databinding.FragmentAccessLocationBinding


class AccessLocation : Fragment() {


private lateinit var binding: FragmentAccessLocationBinding
private lateinit var navController: NavController

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
): View {
binding = FragmentAccessLocationBinding.inflate(inflater, container, false)
return binding.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)

navController= Navigation.findNavController(view)

navController = Navigation.findNavController(view)
binding.btnAccessLocation.setOnClickListener {
navController.navigate(R.id.action_accessLocation_to_animatedScreen)

if (checkLocationPermission()) {
// Permission granted, navigate to the next screen
navController.navigate(R.id.animatedScreen)
}
}

val callback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
// Log.d("TAG", "Pressed...")
// Do nothing or handle as needed
}
}

requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback)

// Check for permission on fragment start
}

private fun checkLocationPermission(): Boolean {
val context = requireContext()
if (ContextCompat.checkSelfPermission(
context,
Manifest.permission.ACCESS_FINE_LOCATION
) != PackageManager.PERMISSION_GRANTED
) {
// Permission not granted, request it
if (ActivityCompat.shouldShowRequestPermissionRationale(
requireActivity(),
Manifest.permission.ACCESS_FINE_LOCATION
)
) {
// Show an explanation to the user if they have denied permission previously
AlertDialog.Builder(context)
.setTitle("Location Permission Needed")
.setMessage("This app needs the Location permission to function properly. Please allow.")
.setPositiveButton("OK") { _, _ ->
requestLocationPermission()
}
.setNegativeButton("Cancel") { dialog, _ ->
dialog.dismiss()
}
.create()
.show()
} else {
// No explanation needed, request the permission
requestLocationPermission()
}
return false
}
// Permission already granted
return true
}

private fun requestLocationPermission() {
ActivityCompat.requestPermissions(
requireActivity(),
arrayOf(Manifest.permission.ACCESS_FINE_LOCATION),
LOCATION_PERMISSION_REQUEST_CODE
)
}

}
companion object {
private const val LOCATION_PERMISSION_REQUEST_CODE = 1001
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package com.example.deliveryapp.Fragments

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.activity.OnBackPressedCallback
import androidx.navigation.NavController
import androidx.navigation.Navigation
import com.example.deliveryapp.R
import com.example.deliveryapp.databinding.FragmentLocationBinding

class LocationFragment : Fragment() {

private lateinit var navController: NavController
private lateinit var binding:FragmentLocationBinding
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
// Inflate the layout for this fragment
binding=FragmentLocationBinding.inflate(inflater,container,false)
return binding.root

}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
navController=Navigation.findNavController(view)



binding.btnAddLocation.setOnClickListener {
navController.navigate(R.id.action_locationFragment_to_addressFragment)
}

val callback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
// Log.d("TAG", "Pressed...")
}
}

requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback)

}
}
46 changes: 33 additions & 13 deletions app/src/main/java/com/example/deliveryapp/Fragments/LoginPage.kt
Original file line number Diff line number Diff line change
@@ -1,25 +1,29 @@
package com.example.deliveryapp.Fragments

import android.content.Intent
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.activity.OnBackPressedCallback
import androidx.fragment.app.Fragment
import androidx.navigation.NavController
import androidx.navigation.Navigation
import androidx.navigation.fragment.findNavController
import com.example.deliveryapp.R
import com.example.deliveryapp.databinding.FragmentLoginPageBinding
import com.google.android.gms.tasks.OnCompleteListener
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.database.DatabaseReference
import com.google.firebase.database.FirebaseDatabase


class LoginPage : Fragment() {

private lateinit var auth: FirebaseAuth
private lateinit var binding: FragmentLoginPageBinding
private lateinit var navController: NavController
private lateinit var databaseRef: DatabaseReference

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
Expand Down Expand Up @@ -51,6 +55,10 @@ class LoginPage : Fragment() {

navController=Navigation.findNavController(view)
auth=FirebaseAuth.getInstance()
databaseRef=FirebaseDatabase.getInstance()
.reference.child("Users")
.child(auth.currentUser?.uid.toString())

}

private fun registerEvents() {
Expand All @@ -68,19 +76,31 @@ class LoginPage : Fragment() {
val pattern=Regex("nits.ac.in")
val check=pattern.containsMatchIn(email)

if ( email.isNotEmpty() && pass.isNotEmpty() && check==true){

auth.signInWithEmailAndPassword(email,pass).addOnCompleteListener(
OnCompleteListener {
if (it.isSuccessful){
Toast.makeText(context,"Login Successfully", Toast.LENGTH_SHORT).show()
navController.navigate(R.id.action_loginPage_to_emptyActivity)

}else{
Toast.makeText(context,it.exception?.message, Toast.LENGTH_SHORT).show()
if (email.isNotEmpty() && pass.isNotEmpty() && check){

auth.signInWithEmailAndPassword(email,pass)
.addOnCompleteListener {
if (it.isSuccessful) {
val verification = auth.currentUser?.isEmailVerified
when(verification){
true -> {
Toast.makeText(context, "Login Successfully", Toast.LENGTH_SHORT).show()
findNavController().navigate(R.id.action_loginPage_to_locationFragment)
}
else -> Toast.makeText(requireContext(), "Please Verify Your Email", Toast.LENGTH_SHORT).show()
}
} else {
Toast.makeText(
context,
"Kindly Sign Up By Clicking SignUp button",
Toast.LENGTH_SHORT
).show()
}
}
)

}else{

Toast.makeText(context,"Please fill up all the necessary details",Toast.LENGTH_SHORT).show()

}

Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/example/deliveryapp/Fragments/SignIn.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.example.deliveryapp.Fragments

import android.os.Bundle
import androidx.fragment.app.Fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
Expand Down Expand Up @@ -34,15 +34,15 @@ class SignIn : Fragment() {
binding.btnSignUp.setOnClickListener {
navController.navigate(R.id.action_signIn_to_signUpPage)
}


val callback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {
// Log.d("TAG", "Pressed...")
}
}

requireActivity().onBackPressedDispatcher.addCallback(viewLifecycleOwner, callback)


}


Expand Down
Loading