Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Register
Sign in
Toggle navigation
Menu
UPSMF
uphrh-smf-mobile
Commits
d8401882
Commit
d8401882
authored
2 years ago
by
devendra
Browse files
Options
Download
Plain Diff
Merge branch 'master' into two-lead-assessor
parents
9492ecd3
c313c276
master
two-lead-assessor
1 merge request
!3
Two lead assessor
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
android/app/src/main/AndroidManifest.xml
+1
-0
android/app/src/main/AndroidManifest.xml
lib/pages/application_details_page.dart
+13
-1
lib/pages/application_details_page.dart
lib/pages/inspection_summary.dart
+1
-0
lib/pages/inspection_summary.dart
lib/services/location_service.dart
+47
-0
lib/services/location_service.dart
pubspec.lock
+42
-0
pubspec.lock
pubspec.yaml
+1
-0
pubspec.yaml
windows/flutter/generated_plugin_registrant.cc
+3
-0
windows/flutter/generated_plugin_registrant.cc
windows/flutter/generated_plugins.cmake
+1
-0
windows/flutter/generated_plugins.cmake
with
109 additions
and
1 deletion
+109
-1
android/app/src/main/AndroidManifest.xml
+
1
−
0
View file @
d8401882
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
package=
"com.upsmf.beta"
>
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<application
android:label=
"UP SMF"
android:usesCleartextTraffic=
"true"
...
...
This diff is collapsed.
Click to expand it.
lib/pages/application_details_page.dart
+
13
−
1
View file @
d8401882
...
...
@@ -19,6 +19,8 @@ import 'package:smf_mobile/widgets/people_card.dart';
import
'package:smf_mobile/widgets/silverappbar_delegate.dart'
;
import
'package:flutter_gen/gen_l10n/app_localizations.dart'
;
import
'dart:async'
;
import
'package:geolocator/geolocator.dart'
;
import
'package:smf_mobile/services/location_service.dart'
;
// import 'package:connectivity_plus/connectivity_plus.dart';
// import 'package:smf_mobile/util/connectivity_helper.dart';
...
...
@@ -267,16 +269,26 @@ class _ApplicationDetailsPageState extends State<ApplicationDetailsPage>
Future
<
void
>
_submitInspection
()
async
{
bool
isInternetConnected
=
await
Helper
.
isInternetConnected
();
Position
position
;
// await Future.delayed(const Duration(milliseconds: 10));
if
(
isInternetConnected
)
{
_validateUser
();
}
try
{
position
=
await
LocationService
.
getCurrentPosition
();
}
catch
(
error
)
{
Helper
.
toastMessage
(
error
.
toString
());
return
;
}
if
(
_isleadInspector
)
{
Map
data
=
{
'applicationId'
:
widget
.
application
.
applicationId
,
'userId'
:
_userId
,
'dataObject'
:
_data
'dataObject'
:
_data
,
'latitude'
:
position
.
latitude
,
'longitude'
:
position
.
longitude
,
};
int
fieldsLength
=
_data
.
keys
.
length
;
...
...
This diff is collapsed.
Click to expand it.
lib/pages/inspection_summary.dart
+
1
−
0
View file @
d8401882
...
...
@@ -144,6 +144,7 @@ class _InspectionSummaryPageState extends State<InspectionSummaryPage> {
'Enter the summary of this inspection'
:
_summaryController
.
text
}
};
print
(
data
);
final
responseCode
=
await
Provider
.
of
<
ApplicationRespository
>(
context
,
listen:
false
)
.
submitInspection
(
isInternetConnected
,
data
);
...
...
This diff is collapsed.
Click to expand it.
lib/services/location_service.dart
0 → 100644
+
47
−
0
View file @
d8401882
import
'package:geolocator/geolocator.dart'
;
import
'package:smf_mobile/util/helper.dart'
;
class
LocationService
{
/// Determine the current position of the device.
///
/// When the location services are not enabled or permissions
/// are denied the `Future` will return an error.
static
Future
<
Position
>
getCurrentPosition
()
async
{
bool
serviceEnabled
;
LocationPermission
permission
;
// Test if location services are enabled.
serviceEnabled
=
await
Geolocator
.
isLocationServiceEnabled
();
permission
=
await
Geolocator
.
checkPermission
();
if
(
!
serviceEnabled
)
{
// Location services are not enabled don't continue
// accessing the position and request users of the
// App to enable the location services.
Helper
.
toastMessage
(
"Location service is turned off on the device, turn on to submit the form"
);
permission
=
await
Geolocator
.
requestPermission
();
}
if
(
permission
==
LocationPermission
.
denied
)
{
// permission = await Geolocator.requestPermission();
// Permissions are denied, next time you could try
// requesting permissions again (this is also where
// Android's shouldShowRequestPermissionRationale
// returned true. According to Android guidelines
// your App should show an explanatory UI now.
return
Future
.
error
(
'Location permissions are denied, turn on location to submit the form'
);
}
if
(
permission
==
LocationPermission
.
deniedForever
)
{
// Permissions are denied forever, handle appropriately.
return
Future
.
error
(
'Location permissions are permanently denied, turn on location to submit the form'
);
}
// When we reach here, permissions are granted and we can
// continue accessing the position of the device.
return
await
Geolocator
.
getCurrentPosition
(
desiredAccuracy:
LocationAccuracy
.
high
);
}
}
This diff is collapsed.
Click to expand it.
pubspec.lock
+
42
−
0
View file @
d8401882
...
...
@@ -371,6 +371,48 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "8.1.1"
geolocator:
dependency: "direct main"
description:
name: geolocator
url: "https://pub.dartlang.org"
source: hosted
version: "9.0.2"
geolocator_android:
dependency: transitive
description:
name: geolocator_android
url: "https://pub.dartlang.org"
source: hosted
version: "4.1.4"
geolocator_apple:
dependency: transitive
description:
name: geolocator_apple
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.3"
geolocator_platform_interface:
dependency: transitive
description:
name: geolocator_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "4.0.7"
geolocator_web:
dependency: transitive
description:
name: geolocator_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.6"
geolocator_windows:
dependency: transitive
description:
name: geolocator_windows
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.1"
google_fonts:
dependency: "direct main"
description:
...
...
This diff is collapsed.
Click to expand it.
pubspec.yaml
+
1
−
0
View file @
d8401882
...
...
@@ -56,6 +56,7 @@ dependencies:
image_cropper
:
^3.0.1
dio
:
^4.0.4
webview_flutter
:
^3.0.1
geolocator
:
^9.0.2
dev_dependencies
:
flutter_test
:
...
...
This diff is collapsed.
Click to expand it.
windows/flutter/generated_plugin_registrant.cc
+
3
−
0
View file @
d8401882
...
...
@@ -8,10 +8,13 @@
#include
<connectivity_plus_windows/connectivity_plus_windows_plugin.h>
#include
<flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
#include
<geolocator_windows/geolocator_windows.h>
void
RegisterPlugins
(
flutter
::
PluginRegistry
*
registry
)
{
ConnectivityPlusWindowsPluginRegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"ConnectivityPlusWindowsPlugin"
));
FlutterSecureStorageWindowsPluginRegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"FlutterSecureStorageWindowsPlugin"
));
GeolocatorWindowsRegisterWithRegistrar
(
registry
->
GetRegistrarForPlugin
(
"GeolocatorWindows"
));
}
This diff is collapsed.
Click to expand it.
windows/flutter/generated_plugins.cmake
+
1
−
0
View file @
d8401882
...
...
@@ -5,6 +5,7 @@
list
(
APPEND FLUTTER_PLUGIN_LIST
connectivity_plus_windows
flutter_secure_storage_windows
geolocator_windows
)
list
(
APPEND FLUTTER_FFI_PLUGIN_LIST
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets