-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #238 from RunTerror/new_beacon_branch
Auth home and cubit module migration
- Loading branch information
Showing
74 changed files
with
5,004 additions
and
1,479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import 'package:beacon/Bloc/data/models/user/user_model.dart'; | ||
import 'package:beacon/locator.dart'; | ||
|
||
class UserModelConfig { | ||
UserModel _userModel = UserModel(authToken: 'null'); | ||
UserModel get userModel => _userModel; | ||
|
||
Future<bool> updateUser(UserModel updateUserDetails) async { | ||
_userModel = updateUserDetails; | ||
return localApi.saveUser(updateUserDetails); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import 'package:geolocator/geolocator.dart'; | ||
|
||
class LocationService { | ||
static Future<Position> getCurrentLocation() async { | ||
bool serviceEnabled; | ||
LocationPermission permission; | ||
|
||
serviceEnabled = await Geolocator.isLocationServiceEnabled(); | ||
|
||
if (!serviceEnabled) { | ||
return Future.error('Location service is disabled.'); | ||
} | ||
|
||
permission = await Geolocator.checkPermission(); | ||
|
||
if (permission == LocationPermission.denied) { | ||
permission = await Geolocator.requestPermission(); | ||
if (permission == LocationPermission.denied) { | ||
return Future.error('Location permission is denied'); | ||
} | ||
} | ||
|
||
if (permission == LocationPermission.deniedForever) { | ||
return Future.error('Location permission is permanently denied.'); | ||
} | ||
|
||
return await Geolocator.getCurrentPosition( | ||
desiredAccuracy: LocationAccuracy.high); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.