Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/Trufi-Core 3.2.0 stable #629

Merged
merged 57 commits into from
Sep 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
6fbd1e6
[Fixed] CertificatedLetsencrypt android <= 7.1.1
GustavoTCh Apr 18, 2022
d680c87
[feature] unusing certified ssl in web
GustavoTCh Apr 20, 2022
6ecae36
[Feature] config uni-link
GustavoTCh Apr 22, 2022
34bc42f
[Feature] share route button
GustavoTCh Apr 22, 2022
1d422e1
[Feature] share itinerary
GustavoTCh Apr 22, 2022
c671b6c
[Feature] use correct route
GustavoTCh Apr 22, 2022
b356ab9
[Feature] add google_maps_flutter ^2.1.4 package
GustavoTCh Apr 29, 2022
685a5e2
[Faeture] support widget marker in googleMaps
GustavoTCh Apr 29, 2022
bcf5fca
[Feature] support other maps providers
GustavoTCh Apr 29, 2022
0e22505
[Refactor] remove double cacheTileProvider
GustavoTCh Apr 29, 2022
2431137
[Feature] implement google and leaflet map route
GustavoTCh Apr 29, 2022
bd3db35
[Feature] implement leaflet=google map transport
GustavoTCh Apr 29, 2022
8cbeca9
[Feat] implement leaflet=google map chooseLocation
GustavoTCh Apr 29, 2022
9b85ef4
[Feature] use MapProviders in TrufiCore
GustavoTCh Apr 29, 2022
1c34adf
[Cleanup] remove un used files
GustavoTCh Apr 29, 2022
220f5db
[Feature] using TrufiLatLng in all code
GustavoTCh Apr 29, 2022
ddb1521
[Refactor] move map buttons
GustavoTCh Apr 29, 2022
2059ae4
[feature] move marker configuration
GustavoTCh Apr 29, 2022
2e27a80
[Feature] update package to version: 3.1.0
GustavoTCh Apr 29, 2022
823c1ee
[Feature] correct size yourlocation in google map
GustavoTCh Apr 29, 2022
182e0ab
[Feature] add method to trufiLatLng
GustavoTCh May 5, 2022
b75ddaa
[Feature] update version
GustavoTCh May 19, 2022
92dec51
[Feature] update name Microbus
GustavoTCh Jun 15, 2022
daf7caf
[Feature] improve ui
GustavoTCh Jun 15, 2022
eee15d7
[Feature] create abstracts class for maps
GustavoTCh Jun 18, 2022
73f18cc
[Feature] hide share buttons
GustavoTCh Jun 18, 2022
03124dc
[Fixed] use correct server
GustavoTCh Jun 18, 2022
26964fb
[Feature] onReady map in leaflet
GustavoTCh Jun 18, 2022
5acfbc7
Merge branch 'main' into feat/share-routes
GustavoTCh Jun 18, 2022
1634c5d
[FIxed] clean lint
GustavoTCh Jun 18, 2022
cd20350
[Feature] use minSdkVersion default
GustavoTCh Jun 18, 2022
093bf28
[Feat] update feedbackTitle
GustavoTCh Jun 27, 2022
8f2a830
[Feat] add whatsappIcon
GustavoTCh Jun 27, 2022
8b6cf92
[Feat] add bottomPaddingButtons in leaftle map
GustavoTCh Jun 30, 2022
39b27a4
[Feature] autogenerate files
GustavoTCh Jul 27, 2022
d96c47c
[Feat] update maps
GustavoTCh Jul 27, 2022
0a37959
Merge remote-tracking branch 'origin/develop' into fix/correct-ui-beh…
GustavoTCh Jul 27, 2022
464a395
[Feature] remove google map
GustavoTCh Jul 27, 2022
043d9fe
[Feature] clean value
GustavoTCh Jul 27, 2022
9529fd4
[Feature] comment ios 9.0
GustavoTCh Jul 27, 2022
6d7346c
[Feature] refactor code
GustavoTCh Jul 27, 2022
1c5a345
[Cleanup] fix linter
GustavoTCh Jul 27, 2022
8c855ef
[Feature] add CertificatedLetsencryptAndroid
GustavoTCh Jul 27, 2022
a1fb9f5
[Feature] parameterize share base uri
GustavoTCh Jul 28, 2022
ddf2f55
[Feature] configure shareBaseUri for example
GustavoTCh Jul 28, 2022
481a1c5
[Feature] update version to trufi-core _v3.2.0
GustavoTCh Jul 28, 2022
da21ae6
[Feature] configure url_launcher ios
GustavoTCh Jul 28, 2022
36b395c
[Fixed] resolve error in package device_info_plus
GustavoTCh Aug 9, 2022
2ad71f9
[Feat] parameterize RequestPlanService in blocProviders
GustavoTCh Aug 9, 2022
f21f332
[Fix] use correct routeColor
GustavoTCh Aug 9, 2022
3e14544
[Fix] remove duplication MapRouteCubit
GustavoTCh Aug 9, 2022
61e59fc
[Fix] error code color
GustavoTCh Aug 9, 2022
8a7274f
[Fix] correct color leaftlet map route
GustavoTCh Aug 11, 2022
d03062f
[Fix] resolve overFlowed when per > 1
GustavoTCh Aug 20, 2022
dbf817e
[Feat] Create AppUniqueId for session
GustavoTCh Sep 11, 2022
f3941ca
[Feat] Add UniqueAppId in Requests and Queries
GustavoTCh Sep 11, 2022
d531894
[Cleanup] Remove unused code
GustavoTCh Sep 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<!-- App Links -->
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="trufi.example" android:pathPrefix="/app" />
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
Expand Down
7 changes: 7 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@
<string>????</string>
<key>CFBundleVersion</key>
<string>$(FLUTTER_BUILD_NUMBER)</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>https</string>
<string>http</string>
<string>sms</string>
<string>tel</string>
</array>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSLocationAlwaysUsageDescription</key>
Expand Down
6 changes: 6 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:trufi_core/base/blocs/map_configuration/map_configuration_cubit.dart';
import 'package:trufi_core/base/models/trufi_latlng.dart';
import 'package:trufi_core/base/utils/certificates_letsencrypt_android.dart';
import 'package:trufi_core/base/utils/graphql_client/hive_init.dart';
import 'package:trufi_core/base/widgets/drawer/menu/social_media_item.dart';
import 'package:trufi_core/default_values.dart';
Expand All @@ -9,6 +10,7 @@ import 'package:trufi_core/trufi_router.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
await CertificatedLetsencryptAndroid.workAroundCertificated();
await initHiveForFlutter();
runApp(
TrufiApp(
Expand Down Expand Up @@ -41,6 +43,10 @@ void main() async {
urlSocialMedia: const UrlSocialMedia(
urlFacebook: 'https://www.facebook.com/Example',
),
shareBaseUri: Uri(
scheme: "https",
host: "trufi.example",
),
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ packages:
path: ".."
relative: true
source: path
version: "3.1.0"
version: "3.2.0"
tuple:
dependency: transitive
description:
Expand Down
18 changes: 14 additions & 4 deletions lib/base/models/journey_plan/leg.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Leg extends Equatable {
static const _points = "points";
static const _mode = "mode";
static const _route = "route";
static const _routeColor = "routeColor";
static const _routeLongName = "routeLongName";
static const _toPlace = "to";
static const _fromPlace = "from";
Expand All @@ -18,6 +19,7 @@ class Leg extends Equatable {
final String points;
final TransportMode transportMode;
final TransportRoute? route;
final String? routeColor;
final String? shortName;
final String? routeLongName;
final double distance;
Expand All @@ -34,6 +36,7 @@ class Leg extends Equatable {
required this.points,
required this.transportMode,
required this.route,
required this.routeColor,
required this.shortName,
required this.routeLongName,
required this.distance,
Expand All @@ -58,6 +61,7 @@ class Leg extends Equatable {
? TransportRoute.fromJson(json[_route] as Map<String, dynamic>)
: null)
: null,
routeColor: json[_routeColor] as String?,
shortName: json[_route] != null
? ((json[_route] is String) && json[_route] != ''
? json[_route] as String
Expand Down Expand Up @@ -90,6 +94,7 @@ class Leg extends Equatable {
_legGeometry: {_points: points},
_mode: transportMode.name,
_route: route?.toJson() ?? shortName,
_routeColor: routeColor,
_routeLongName: routeLongName,
_distance: distance,
_duration: duration.inSeconds,
Expand All @@ -107,6 +112,7 @@ class Leg extends Equatable {
String? points,
TransportMode? transportMode,
TransportRoute? route,
String? routeColor,
String? shortName,
String? routeLongName,
double? distance,
Expand All @@ -126,6 +132,7 @@ class Leg extends Equatable {
points: points ?? this.points,
transportMode: transportMode ?? this.transportMode,
route: route ?? this.route,
routeColor: routeColor ?? this.routeColor,
shortName: shortName ?? this.shortName,
routeLongName: routeLongName ?? this.routeLongName,
distance: distance ?? this.distance,
Expand Down Expand Up @@ -159,15 +166,17 @@ class Leg extends Equatable {
return route?.shortName ?? (route?.longName ?? (shortName ?? ''));
}

int? get codeColor => int.tryParse('0xFF${route?.color ?? routeColor}');

Color get primaryColor {
return route?.color != null
? Color(int.tryParse('0xFF${route?.color}')!)
return codeColor != null
? Color(codeColor!)
: transportMode.color;
}

Color get backgroundColor {
return route?.color != null
? Color(int.tryParse('0xFF${route?.color}')!)
return codeColor!= null
? Color(codeColor!)
: transportMode.backgroundColor;
}

Expand All @@ -176,6 +185,7 @@ class Leg extends Equatable {
points,
transportMode,
route,
routeColor,
shortName,
routeLongName,
distance,
Expand Down
19 changes: 15 additions & 4 deletions lib/base/models/map_provider/leaflet_map_collection.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/material.dart';
import 'package:trufi_core/base/models/map_provider/trufi_map_definition.dart';
import 'package:trufi_core/base/pages/transport_list/transport_list_detail/maps/map_transport_provider.dart';
import 'package:trufi_core/base/pages/home/widgets/trufi_map_route/maps/map_route_provider.dart';
Expand All @@ -10,12 +11,22 @@ class LeafletMapCollection implements ITrufiMapProvider {
}

@override
MapRouteProvider mapRouteProvider() {
return LeafletMapRouteProvider.create();
MapRouteProvider mapRouteProvider({
Uri? shareBaseItineraryUri,
WidgetBuilder? overlapWidget,
}) {
return LeafletMapRouteProvider.create(
shareBaseItineraryUri: shareBaseItineraryUri,
overlapWidget: overlapWidget,
);
}

@override
MapTransportProvider mapTransportProvider() {
return LeafletMapTransportProvider.create();
MapTransportProvider mapTransportProvider({
Uri? shareBaseRouteUri,
}) {
return LeafletMapTransportProvider.create(
shareBaseRouteUri: shareBaseRouteUri,
);
}
}
12 changes: 10 additions & 2 deletions lib/base/models/map_provider/trufi_map_definition.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ import 'package:trufi_core/base/pages/transport_list/services/models.dart';

abstract class ITrufiMapProvider {
MapChooseLocationProvider mapChooseLocationProvider();
MapRouteProvider mapRouteProvider();
MapTransportProvider mapTransportProvider();
MapRouteProvider mapRouteProvider({
Uri? shareBaseItineraryUri,
WidgetBuilder? overlapWidget,
});
MapTransportProvider mapTransportProvider({
Uri? shareBaseRouteUri,
});
}

////////////////////////////////////////////////
Expand All @@ -17,6 +22,7 @@ abstract class ITrufiMapProvider {
abstract class MapChooseLocationProvider {
ITrufiMapController get trufiMapController;
MapChooseLocationBuilder get mapChooseLocationBuilder;
MapChooseLocationProvider rebuild();
}

abstract class IMapChooseLocation extends Widget {
Expand Down Expand Up @@ -49,6 +55,8 @@ typedef MapRouteBuilder = Widget Function(
abstract class MapTransportProvider {
ITrufiMapController get trufiMapController;
MapTransportBuilder get mapTransportBuilder;
Uri? get shareBaseRouteUri;
MapTransportProvider rebuild();
}

typedef MapTransportBuilder = Widget Function(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class FeedbackLocalizationDe extends FeedbackLocalization {
String get menuFeedback => 'Feedback';

@override
String get feedbackTitle => 'E-Mail senden';
String get feedbackTitle => 'Send us a comment';

@override
String get feedbackContent => 'Haben Sie Vorschläge für unsere App oder haben Sie Fehler in den Daten gefunden? Wir würden gerne von Ihnen hören! Bitte geben Sie Ihre E-Mail-Adresse oder Ihre Telefonnummer an, damit wir Ihnen antworten können.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class FeedbackLocalizationEn extends FeedbackLocalization {
String get menuFeedback => 'Send Feedback';

@override
String get feedbackTitle => 'Please e-mail us';
String get feedbackTitle => 'Send us a comment';

@override
String get feedbackContent => 'Do you have suggestions for our app or found some errors in the data? We would love to hear from you! Please make sure to add your email address or telephone, so we can respond to you.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class FeedbackLocalizationEs extends FeedbackLocalization {
String get menuFeedback => 'Enviar comentarios';

@override
String get feedbackTitle => 'Envíanos un correo electrónico';
String get feedbackTitle => 'Envíanos un comentario';

@override
String get feedbackContent => '¿Tienes sugerencias para nuestra aplicación o has encontrado algunos errores en los datos? ¡Nos encantaría saberlo! Asegúrate de agregar tu dirección de correo electrónico o teléfono para que podamos responderte.';
Expand Down
8 changes: 4 additions & 4 deletions lib/base/pages/home/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ class _HomePageState extends State<HomePage>
children: [
BlocListener<MapRouteCubit, MapRouteState>(
listener: (buildContext, state) {
repaintMap(mapRouteCubit, state);
// TODO fix trufiMapController.onReady
// widget.mapRouteProvider.trufiMapController.onReady
// .then((_) {});
widget.mapRouteProvider.trufiMapController.onReady
.then((_) {
repaintMap(mapRouteCubit, state);
});
},
child: CustomScrollableContainer(
openedPosition: 200,
Expand Down
6 changes: 4 additions & 2 deletions lib/base/pages/home/map_route_cubit/map_route_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ class MapRouteCubit extends Cubit<MapRouteState> {

CancelableOperation<Plan?>? currentFetchPlanOperation;

MapRouteCubit(String otpEndpoint)
: _requestManager = RestRequestPlanService(otpEndpoint: otpEndpoint),
MapRouteCubit(String otpEndpoint,
{RequestPlanService? customRequestPlanService})
: _requestManager = customRequestPlanService ??
RestRequestPlanService(otpEndpoint: otpEndpoint),
super(const MapRouteState()) {
_load();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:trufi_core/base/models/trufi_place.dart';
import 'package:trufi_core/base/pages/home/services/exception/fetch_online_exception.dart';
import 'package:trufi_core/base/pages/home/services/request_plan_service.dart';
import 'package:trufi_core/base/utils/packge_info_platform.dart';
import 'package:trufi_core/base/utils/trufi_app_id.dart';

class RestRequestPlanService implements RequestPlanService {
static const String searchPath = '/geocode';
Expand Down Expand Up @@ -56,8 +57,9 @@ class RestRequestPlanService implements RequestPlanService {
Future<http.Response> _fetchRequest(Uri request) async {
try {
final packageInfoVersion = await PackageInfoPlatform.version();
final uniqueId = TrufiAppId.getUniqueId;
return await http.get(request, headers: {
"User-Agent": "Trufi/$packageInfoVersion",
"User-Agent": "Trufi/$packageInfoVersion/$uniqueId",
});
} on Exception catch (e) {
throw FetchOnlineRequestException(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ class ModeLeg extends StatelessWidget {
Widget build(BuildContext context) {
final perc = legLength.abs() / 10;
return SizedBox(
width: (maxWidth * perc) >= 24 ? (maxWidth * perc) : 24,
width: perc > 1
? maxWidth
: (maxWidth * perc) >= 24
? (maxWidth * perc)
: 24,
height: 30,
child: IconTransport(
bacgroundColor: leg.backgroundColor,
Expand Down Expand Up @@ -53,7 +57,11 @@ class WaitLeg extends StatelessWidget {
Widget build(BuildContext context) {
final perc = legLength.abs() / 10;
return SizedBox(
width: (maxWidth * perc) >= 24 ? (maxWidth * perc) : 24,
width: perc > 1
? maxWidth
: (maxWidth * perc) >= 24
? (maxWidth * perc)
: 24,
height: 30,
child: IconTransport(
bacgroundColor: TransportMode.walk.backgroundColor,
Expand Down Expand Up @@ -88,7 +96,11 @@ class RouteLeg extends StatelessWidget {
Widget build(BuildContext context) {
final perc = legLength.abs() / 10;
return SizedBox(
width: (maxWidth * perc) >= 24 ? (maxWidth * perc) : 24,
width: perc > 1
? maxWidth
: (maxWidth * perc) >= 24
? (maxWidth * perc)
: 24,
height: 30,
child: ClipRRect(
child: IconTransport(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import 'package:trufi_core/base/models/journey_plan/plan.dart';
import 'package:trufi_core/base/models/trufi_latlng.dart';
import 'package:trufi_core/base/pages/home/map_route_cubit/map_route_cubit.dart';
import 'package:trufi_core/base/pages/home/widgets/trufi_map_route/load_location.dart';
// import 'package:trufi_core/base/pages/home/widgets/trufi_map_route/maps/share_itinerary_button.dart';
import 'package:trufi_core/base/pages/home/widgets/trufi_map_route/maps/share_itinerary_button.dart';
import 'package:trufi_core/base/widgets/base_maps/leaflet_maps/leaflet_map.dart';
import 'package:trufi_core/base/widgets/base_maps/leaflet_maps/leaflet_map_controller.dart';
import 'package:trufi_core/base/widgets/base_maps/leaflet_maps/utils/leaflet_map_utils.dart';
Expand All @@ -21,11 +21,13 @@ import 'package:trufi_core/base/widgets/screen/screen_helpers.dart';
class LeafletMapRoute extends StatefulWidget {
final LeafletMapController trufiMapController;
final AsyncExecutor asyncExecutor;
final Uri? shareBaseItineraryUri;
final WidgetBuilder? overlapWidget;
const LeafletMapRoute({
Key? key,
required this.trufiMapController,
required this.asyncExecutor,
this.shareBaseItineraryUri,
this.overlapWidget,
}) : super(key: key);

Expand Down Expand Up @@ -91,8 +93,12 @@ class _LeafletMapRouteState extends State<LeafletMapRoute>
key: _cropButtonKey,
onPressed: _handleOnCropPressed,
),
// const Padding(padding: EdgeInsets.all(4.0)),
// if (mapRouteState.isPlanCorrect) const ShareItineraryButton(),
const Padding(padding: EdgeInsets.all(4.0)),
if (mapRouteState.isPlanCorrect &&
widget.shareBaseItineraryUri != null)
ShareItineraryButton(
shareBaseItineraryUri: widget.shareBaseItineraryUri!,
),
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,18 @@ class LeafletMapRouteProvider implements MapRouteProvider {
required this.mapRouteBuilder,
});

factory LeafletMapRouteProvider.create({WidgetBuilder? overlapWidget}) {
factory LeafletMapRouteProvider.create({
Uri? shareBaseItineraryUri,
WidgetBuilder? overlapWidget,
}) {
final trufiMapController = LeafletMapController();
return LeafletMapRouteProvider(
trufiMapController: trufiMapController,
mapRouteBuilder: (mapContext, asyncExecutor) {
return LeafletMapRoute(
trufiMapController: trufiMapController,
asyncExecutor: asyncExecutor,
shareBaseItineraryUri: shareBaseItineraryUri,
overlapWidget: overlapWidget,
);
},
Expand Down
Loading