Skip to content

Commit

Permalink
last updates
Browse files Browse the repository at this point in the history
  • Loading branch information
arda-copur committed Aug 1, 2024
1 parent e1a85f4 commit 8d8832f
Show file tree
Hide file tree
Showing 15 changed files with 162 additions and 29 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "interactive"
}
6 changes: 3 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ if (flutterVersionName == null) {

android {
namespace "com.example.fam_works"
compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 34
ndkVersion flutter.ndkVersion

compileOptions {
Expand All @@ -46,8 +46,8 @@ android {
applicationId "com.example.fam_works"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
targetSdkVersion flutter.targetSdkVersion
minSdkVersion 21
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
Expand Down
2 changes: 2 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<application
android:label="fam_works"
android:name="${applicationName}"
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.8.0'
repositories {
google()
mavenCentral()
Expand Down
2 changes: 1 addition & 1 deletion lib/core/base/settings_view_mobx.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ abstract class _SettingsViewModelBase with Store {
void incrementNumber () {
myNumber++;
}
}
}
2 changes: 2 additions & 0 deletions lib/core/constants/app_texts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ class AppTexts {
static const String createAccount = "Hesap Oluştur";
static const String againWelcome = "Tekrar Hoşgeldiniz";
static const String clickForLogin = "Giriş yapmak için tıklayın";
static const String login = "Giriş";
static const String dontHaveAccount = 'Hesabınız\ yok mu? Kayıt olun';
}
33 changes: 33 additions & 0 deletions lib/core/providers/bottom_provider.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';

class BottomProvider extends ChangeNotifier {
int _selectedIndex = 0;
int get selectedIndex => _selectedIndex;
final String _imageUrl ='https://cf.ltkcdn.net/family/images/std/200821-800x533r1-family.jpg';
String get imageUrl => _imageUrl;
final String _imageFileName = 'fam.jpg';
String get imageFileName => _imageFileName;
final String _homeLabel = "Ev";
String get homeLabel => _homeLabel;
final String _activityLabel = "Aktivite";
String get activityLabel => _activityLabel;
final String _chatLabel = "Sohbet";
String get chatLabel => _chatLabel;
final String _profileLabel = "Profil";
String get profileLabel => _profileLabel;
final String _pastTasks = "Geçmiş Görevler";
String get pastTasks => _pastTasks;
final String _pastActivities = "Geçmiş Aktiviteler";
String get pastActivities => _pastActivities;
final String _famSummary = "Aile Özeti";
String get famSummary => _famSummary;
final String _exit = "Çıkış";
String get exit => _exit;

void _onItemTapped(int index) {
_selectedIndex = index;
notifyListeners();
}

get onItemTapped => _onItemTapped;
}
38 changes: 28 additions & 10 deletions lib/core/providers/location_provider.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:firebase_auth/firebase_auth.dart';

class LocationProvider with ChangeNotifier {
Position? _currentPosition;
Position ? _lastPosition;

Position? get currentPosition => _currentPosition;
Position? get lastPosition => _lastPosition;

Future<void> getCurrentLocation() async {
bool serviceEnabled;
Expand All @@ -15,7 +15,6 @@ class LocationProvider with ChangeNotifier {
// Konum servislerinin etkin olup olmadığını kontrol edin.
serviceEnabled = await Geolocator.isLocationServiceEnabled();
if (!serviceEnabled) {
// Konum servisleri etkin değilse, kullanıcıya bildir.
return Future.error('Location services are disabled.');
}

Expand All @@ -24,20 +23,39 @@ class LocationProvider with ChangeNotifier {
if (permission == LocationPermission.denied) {
permission = await Geolocator.requestPermission();
if (permission == LocationPermission.denied) {
// İzin reddedildi.
return Future.error('Location permissions are denied');
}
}

if (permission == LocationPermission.deniedForever) {
// İzin kalıcı olarak reddedildi.
return Future.error(
'Location permissions are permanently denied, we cannot request permissions.');
return Future.error('Location permissions are permanently denied, we cannot request permissions.');
}

// Konumu alın ve bildirimde bulunun.
// Konumu alın ve Firestore'a kaydedin.
_currentPosition = await Geolocator.getCurrentPosition();

notifyListeners();

// Firebase Auth ile şu anki kullanıcıyı alın
User? user = FirebaseAuth.instance.currentUser;
if (user != null) {
DocumentSnapshot userDoc = await FirebaseFirestore.instance
.collection('users')
.doc(user.uid)
.get();

String name = userDoc['name'] ?? 'Kullanıcı';
String homeCode = userDoc['homeCode'];

await FirebaseFirestore.instance
.collection('locations')
.doc(user.uid) // Kullanıcıya özgü belgeyi güncelle
.set({
'latitude': _currentPosition!.latitude,
'longitude': _currentPosition!.longitude,
'name': name,
'homeCode': homeCode,
}, SetOptions(merge: true)); // Belgeyi güncellemek için `merge: true` kullanılır

notifyListeners();
}
}
}
13 changes: 0 additions & 13 deletions lib/core/providers/register_provider.dart

This file was deleted.

21 changes: 21 additions & 0 deletions lib/feature/extensions/image_extension.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
enum ImageItems { image1, image2, image3, image4 }

extension ImageItemsExtension on ImageItems {
String _imagePath() {
switch (this) {
case ImageItems.image1:
return "image1";

case ImageItems.image2:
return "image2";

case ImageItems.image3:
return "image3";

case ImageItems.image4:
return "image4";
}
}

String get imagePath => "assets/${_imagePath()}.jpg";
}
17 changes: 17 additions & 0 deletions lib/feature/services/auth/user_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,21 @@ class UserAuth {
print("Error: $e");
}
}



Future<void> loginUser(String email, String password,context) async {
try {
UserCredential userCredential =
await FirebaseAuth.instance.signInWithEmailAndPassword(
email: email,
password: password,
);
User user = userCredential.user!;

NavigatorHelper.navigateToView(context, 'rotate');
} on FirebaseAuthException catch (e) {
print("Error: $e");
}
}
}
1 change: 0 additions & 1 deletion lib/feature/services/connectivity.dart

This file was deleted.

2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:fam_works/core/providers/bottom_provider.dart';
import 'package:fam_works/core/providers/location_provider.dart';
import 'package:fam_works/core/providers/media_provider.dart';
import 'package:fam_works/core/providers/auth_module_provider.dart.dart';
import 'package:fam_works/feature/services/auth/user_status.dart';
Expand All @@ -21,6 +22,7 @@ void main() async {
ChangeNotifierProvider(create: (_) => AuthModuleProvider()),
ChangeNotifierProvider(create: (_) => MediaProvider()),
ChangeNotifierProvider(create: (_) => BottomProvider()),
ChangeNotifierProvider(create: (_) => LocationProvider()),
],
child: const MyApp(),
),
Expand Down
48 changes: 48 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,54 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.0"
geolocator:
dependency: "direct main"
description:
name: geolocator
sha256: "6cb9fb6e5928b58b9a84bdf85012d757fd07aab8215c5205337021c4999bad27"
url: "https://pub.dev"
source: hosted
version: "11.1.0"
geolocator_android:
dependency: transitive
description:
name: geolocator_android
sha256: "00c7177a95823dd3ee35ef42fd8666cd27d219ae14cea472ac76a21dff43000b"
url: "https://pub.dev"
source: hosted
version: "4.6.0"
geolocator_apple:
dependency: transitive
description:
name: geolocator_apple
sha256: bc2aca02423ad429cb0556121f56e60360a2b7d694c8570301d06ea0c00732fd
url: "https://pub.dev"
source: hosted
version: "2.3.7"
geolocator_platform_interface:
dependency: transitive
description:
name: geolocator_platform_interface
sha256: "386ce3d9cce47838355000070b1d0b13efb5bc430f8ecda7e9238c8409ace012"
url: "https://pub.dev"
source: hosted
version: "4.2.4"
geolocator_web:
dependency: transitive
description:
name: geolocator_web
sha256: "49d8f846ebeb5e2b6641fe477a7e97e5dd73f03cbfef3fd5c42177b7300fb0ed"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
geolocator_windows:
dependency: transitive
description:
name: geolocator_windows
sha256: "53da08937d07c24b0d9952eb57a3b474e29aae2abf9dd717f7e1230995f13f0e"
url: "https://pub.dev"
source: hosted
version: "0.2.3"
glob:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ dependencies:
#Network
http: ^1.0.0
connectivity_plus: ^5.0.2
geolocator: ^11.0.0



Expand Down

0 comments on commit 8d8832f

Please sign in to comment.