Skip to content

Commit

Permalink
feat: 0.0.12 caching and compass added, fix #26
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurBeaulieu committed Oct 19, 2024
1 parent 344181b commit c5eb99c
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 14 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ android {
multiDexEnabled true
minSdkVersion flutter.minSdkVersion
versionCode 11
versionName "0.0.11"
versionName "0.0.12"
targetSdkVersion 34
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
4 changes: 2 additions & 2 deletions lib/src/auth/login_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class LoginViewState extends State<LoginView> {
password,
).then((response) async {
if (response.statusCode == 200) { // HTTP/200, Alrighty
final parsedJson = jsonDecode(response.body);
final parsedJson = jsonDecode(utf8.decode(response.bodyBytes));
// Check server response validity, it must contain the token and its expiration date
if (parsedJson['expiry'] != null && parsedJson['token'] != null) {
bool authTokenUpdated = await widget.settingsController.updateAuthToken(
Expand Down Expand Up @@ -173,7 +173,7 @@ class LoginViewState extends State<LoginView> {
}
} else {
// Check server response to check for known errors
final parsedJson = jsonDecode(response.body);
final parsedJson = jsonDecode(utf8.decode(response.bodyBytes));
if (parsedJson['detail'] != null && parsedJson['detail'] == 'Invalid credentials') {
setState(() => errorMsg = AppLocalizations.of(context)!.authLoginInvalidCredentials);
} else if (parsedJson['detail'] != null && parsedJson['detail'] == 'No credentials provided') {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/auth/register_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class RegisterViewState extends State<RegisterView> {
widget.setAuthPage(2);
} else {
// Check server response to check for known errors
final parsedJson = jsonDecode(response.body);
final parsedJson = jsonDecode(utf8.decode(response.bodyBytes));
// Server sent back input with issues
if (parsedJson['username'] != null || parsedJson['password'] == null) {
if (parsedJson['username'] != null) {
Expand Down
18 changes: 17 additions & 1 deletion lib/src/map/map_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map_compass/flutter_map_compass.dart';
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
import 'package:flutter_map_math/flutter_geo_math.dart';
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
Expand Down Expand Up @@ -665,7 +666,7 @@ class MapViewState extends State<MapView> with TickerProviderStateMixin {
),
initialZoom: widget.settingsController.initZoom,
interactionOptions: const InteractionOptions(
flags: InteractiveFlag.pinchZoom | InteractiveFlag.drag
flags: InteractiveFlag.pinchZoom | InteractiveFlag.drag | InteractiveFlag.rotate
),
minZoom: 2,
maxZoom: 19,
Expand Down Expand Up @@ -903,6 +904,21 @@ class MapViewState extends State<MapView> with TickerProviderStateMixin {
? wipMarker
: [],
),
// Map compass
MapCompass.cupertino(
alignment: (widget.settingsController.leftHanded == true)
? Alignment.topLeft
: Alignment.topRight,
padding: EdgeInsets.only(
left: (widget.settingsController.leftHanded == true)
? SizeConfig.padding
: 0,
right: (widget.settingsController.leftHanded == true)
? 0
: SizeConfig.padding,
top: (3 * SizeConfig.padding) + MediaQuery.of(context).viewPadding.top + SizeConfig.iconSize,
),
),
// Map attribution
RichAttributionWidget(
alignment: (widget.settingsController.leftHanded == true)
Expand Down
6 changes: 4 additions & 2 deletions lib/src/map/modal/edit_marker_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,10 @@ class EditMarkerViewState extends State<EditMarkerView> {
showProgressBar: false,
);
}).whenComplete(() {
// Hide overlay loader anyway
context.loaderOverlay.hide();
if (context.mounted) {
// Hide overlay loader anyway
context.loaderOverlay.hide();
}
});
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/src/map/modal/new_marker_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ class NewMarkerViewState extends State<NewMarkerView> {
widget.markerData,
).then((response) async {
if (response.statusCode == 201) {
final parsedJson = jsonDecode(response.body);
final parsedJson = jsonDecode(utf8.decode(response.bodyBytes));
MarkerData newMark = MarkerData.fromJson(parsedJson);
widget.callback(
'spot',
Expand Down Expand Up @@ -216,7 +216,7 @@ class NewMarkerViewState extends State<NewMarkerView> {
widget.markerData,
).then((response) async {
if (response.statusCode == 201) {
final parsedJson = jsonDecode(response.body);
final parsedJson = jsonDecode(utf8.decode(response.bodyBytes));
MarkerData newMark = MarkerData.fromJson(parsedJson);
widget.callback(
'shop',
Expand Down Expand Up @@ -302,7 +302,7 @@ class NewMarkerViewState extends State<NewMarkerView> {
widget.markerData,
).then((response) async {
if (response.statusCode == 201) {
final parsedJson = jsonDecode(response.body);
final parsedJson = jsonDecode(utf8.decode(response.bodyBytes));
MarkerData newMark = MarkerData.fromJson(parsedJson);
widget.callback(
'bar',
Expand Down
2 changes: 1 addition & 1 deletion lib/src/settings/settings_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ class SettingsController with ChangeNotifier {
if (token != '') {
await ProfileService.getUserInfo(token).then((response) {
if (response.statusCode == 200) {
final parsedJson = jsonDecode(response.body);
final parsedJson = jsonDecode(utf8.decode(response.bodyBytes));
userId = parsedJson['id'];
username = parsedJson['username'];
email = parsedJson['email'];
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils/app_const.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter_dotenv/flutter_dotenv.dart';

class AppConst {
static const String appVersion = '0.0.11';
static const String appVersion = '0.0.12';
static const String serverVersion = '0.1.0';
// The server URL to reach, ensure no trailing slash remains
static const String baseURL = 'https://beercrackerz.org';
Expand Down
2 changes: 1 addition & 1 deletion lib/src/utils/size_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class SizeConfig {
// Icon sizes
inputIcon = (defaultSize * 2);
iconSize = 24;
mapMarkerSize = 30;
mapMarkerSize = 26;
// Font sizes
fontTextSmallSize = 12;
fontTextSize = 14;
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "7.0.2"
flutter_map_compass:
dependency: "direct main"
description:
name: flutter_map_compass
sha256: "9e036786b556676dff7d30aa04fdb95ed23eada3e739bafc5b75b2a512c12d0d"
url: "https://pub.dev"
source: hosted
version: "1.0.3"
flutter_map_location_marker:
dependency: "direct main"
description:
Expand Down
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: "The app for beer lovers, to share the best spot to crack a beer, o

publish_to: 'none'

version: 0.0.11+11
version: 0.0.12+12

environment:
sdk: '>=3.2.5 <4.0.0'
Expand All @@ -15,6 +15,7 @@ dependencies:
sdk: flutter
flutter_dotenv: ^5.1.0
flutter_map: ^7.0.1
flutter_map_compass: ^1.0.3
flutter_map_location_marker: ^9.0.0
flutter_map_math: ^0.1.7
flutter_map_tile_caching: ^9.1.1
Expand Down

0 comments on commit c5eb99c

Please sign in to comment.