Skip to content

Commit

Permalink
👽 Ditch location mpti906. #28
Browse files Browse the repository at this point in the history
  • Loading branch information
iqfareez committed Feb 7, 2021
1 parent 096c4ba commit 0ae0548
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 11 deletions.
1 change: 1 addition & 0 deletions .fvm/flutter_sdk
3 changes: 3 additions & 0 deletions .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"flutterSdkVersion": "beta"
}
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />

<application
android:name="io.flutter.app.FlutterApplication"
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void main() async {

notifLaunch = await notifsPlugin.getNotificationAppLaunchDetails();
await initNotifications(notifsPlugin);
requestIOSPermissions(notifsPlugin);
// requestIOSPermissions(notifsPlugin);

initGetStorage();

Expand Down
26 changes: 16 additions & 10 deletions lib/views/ZoneChooser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import 'package:geolocator/geolocator.dart';
import 'package:get_storage/get_storage.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:waktusolatmalaysia/CONSTANTS.dart';
import 'package:waktusolatmalaysia/blocs/mpti906_location_bloc.dart';
import 'package:waktusolatmalaysia/models/mpti906api_location.dart';
import 'package:waktusolatmalaysia/networking/Response.dart';
import 'package:waktusolatmalaysia/utils/LocationData.dart';
import 'package:waktusolatmalaysia/utils/location/locationDatabase.dart';
import 'package:waktusolatmalaysia/utils/location/location_coordinate.dart';
Expand Down Expand Up @@ -183,7 +180,6 @@ Future openshowModalBottomSheet(BuildContext context, Function callback) async {
globalIndex = selectedIndex;
callback();
GetPrayerTime.updateUI(selectedIndex);
// showSnackbarLocationSaved(context);
}
}
});
Expand Down Expand Up @@ -214,8 +210,6 @@ class GetGPS extends StatefulWidget {

class _GetGPSState extends State<GetGPS> {
LocationCoordinate locationCoordinate;
// Mpti906LocationBloc _mpti906bloc;
// LocationData.getCurrentLocation();

@override
void initState() {
Expand Down Expand Up @@ -265,16 +259,28 @@ class _GetGPSState extends State<GetGPS> {
future: _getAllLocationData(),
builder: (context, AsyncSnapshot<LocationCoordinateData> snapshot) {
print('FutureBuilder in ZonChooser: ${snapshot.data}');
//TODO: Check for error
//TODOl Code optimization
if (snapshot.connectionState == ConnectionState.done) {

if (snapshot.connectionState == ConnectionState.waiting) {
return Loading(
loadingMessage: 'Getting location',
);
} else if (snapshot.connectionState == ConnectionState.done) {
return Completed(
jakimCode: snapshot.data.zone,
place: snapshot.data.lokasi,
onCallback: widget.callback,
);
} else if (snapshot.hasError) {
return Error(
errorMessage: snapshot.error.toString(),
);
} else {
return Error(
errorMessage:
'Unknown error. Please file a bug report to developer',
onRetryPressed: _getAllLocationData,
);
}
return Text(snapshot.toString());
},
),
),
Expand Down

0 comments on commit 0ae0548

Please sign in to comment.