This commit is contained in:
@@ -12,14 +12,10 @@ class MapflowRoutes {
|
||||
static const addExperience = '/experience/new';
|
||||
static const adminReviews = '/admin/reviews';
|
||||
|
||||
static String addExperienceLocation({
|
||||
required LatLng? coordinate,
|
||||
required bool hasTelegramAuth,
|
||||
}) {
|
||||
static String addExperienceLocation({required LatLng? coordinate}) {
|
||||
return Uri(
|
||||
path: addExperience,
|
||||
queryParameters: {
|
||||
'telegramAuth': hasTelegramAuth ? '1' : '0',
|
||||
if (coordinate != null) ...{
|
||||
'lat': coordinate.latitude.toString(),
|
||||
'lng': coordinate.longitude.toString(),
|
||||
@@ -46,7 +42,6 @@ GoRouter createAppRouter() {
|
||||
key: state.pageKey,
|
||||
child: AddExperienceFlow(
|
||||
coordinate: _coordinateFromQuery(queryParameters),
|
||||
hasTelegramAuth: queryParameters['telegramAuth'] != '0',
|
||||
),
|
||||
transitionsBuilder: (context, animation, _, child) {
|
||||
return SlideTransition(
|
||||
|
||||
@@ -120,11 +120,10 @@ class _MapContent extends StatelessWidget {
|
||||
child: _UserAvatar(
|
||||
user: state.currentUser,
|
||||
onAdminReviews: state.currentUser?.isAdmin == true
|
||||
? () => context.push('/admin/reviews')
|
||||
? () => context.push(MapflowRoutes.adminReviews)
|
||||
: null,
|
||||
onLogout: () {
|
||||
telegram_session.clearMapflowSession();
|
||||
placeCubit.load();
|
||||
telegram_session.reloadApp();
|
||||
},
|
||||
),
|
||||
@@ -225,12 +224,7 @@ class _MapContent extends StatelessWidget {
|
||||
}
|
||||
|
||||
void _openAddFlow(BuildContext context, LatLng? coordinate) {
|
||||
context.push(
|
||||
MapflowRoutes.addExperienceLocation(
|
||||
coordinate: coordinate,
|
||||
hasTelegramAuth: state.hasTelegramAuth,
|
||||
),
|
||||
);
|
||||
context.push(MapflowRoutes.addExperienceLocation(coordinate: coordinate));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -976,14 +970,9 @@ class _PlaceCarousel extends StatelessWidget {
|
||||
}
|
||||
|
||||
class AddExperienceFlow extends StatefulWidget {
|
||||
const AddExperienceFlow({
|
||||
super.key,
|
||||
required this.coordinate,
|
||||
required this.hasTelegramAuth,
|
||||
});
|
||||
const AddExperienceFlow({super.key, required this.coordinate});
|
||||
|
||||
final LatLng? coordinate;
|
||||
final bool hasTelegramAuth;
|
||||
|
||||
@override
|
||||
State<AddExperienceFlow> createState() => _AddExperienceFlowState();
|
||||
@@ -1137,19 +1126,22 @@ class _AddExperienceFlowState extends State<AddExperienceFlow> {
|
||||
Widget build(BuildContext context) {
|
||||
final tokens = context.mapflowTokens;
|
||||
final controller = context.read<PlaceCubit>();
|
||||
final hasTelegramAuth = context.select(
|
||||
(PlaceCubit cubit) => cubit.state.placeState?.hasTelegramAuth ?? false,
|
||||
);
|
||||
final informationProgress = (_informationUnits / _minimumInformationUnits)
|
||||
.clamp(0.0, 1.0);
|
||||
final content = switch (_step) {
|
||||
0 => _VoiceStep(
|
||||
placeName: '',
|
||||
promptHints: _voicePromptHints,
|
||||
hasTelegramAuth: widget.hasTelegramAuth,
|
||||
hasTelegramAuth: hasTelegramAuth,
|
||||
informationProgress: informationProgress,
|
||||
isRecording: _recording,
|
||||
isSubmitting: _submitting,
|
||||
micAllowed: _micAllowed,
|
||||
liveLevel: _liveLevel,
|
||||
canContinue: widget.hasTelegramAuth && informationProgress >= 1,
|
||||
canContinue: hasTelegramAuth && informationProgress >= 1,
|
||||
onToggleRecording: _toggleRecording,
|
||||
onNext: () async {
|
||||
if (_recording) {
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_web_plugins/url_strategy.dart';
|
||||
|
||||
import 'app/app.dart';
|
||||
import 'shared/auth/telegram_session.dart' as telegram_session;
|
||||
|
||||
void main() {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
usePathUrlStrategy();
|
||||
telegram_session.configureTelegramWebApp();
|
||||
runApp(const MapflowApp());
|
||||
}
|
||||
|
||||
@@ -71,5 +71,16 @@ void openExternalUrl(String url) {
|
||||
}
|
||||
|
||||
void reloadApp() {
|
||||
web.window.location.assign(web.window.location.origin);
|
||||
web.window.location.replace(_currentUrlWithoutTelegramLoginToken());
|
||||
}
|
||||
|
||||
String _currentUrlWithoutTelegramLoginToken() {
|
||||
final uri = Uri.parse(web.window.location.href);
|
||||
final queryParameters = Map<String, String>.of(uri.queryParameters)
|
||||
..remove('telegram_login');
|
||||
return uri
|
||||
.replace(
|
||||
queryParameters: queryParameters.isEmpty ? null : queryParameters,
|
||||
)
|
||||
.toString();
|
||||
}
|
||||
|
||||
+13
-13
@@ -5,18 +5,18 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: _fe_analyzer_shared
|
||||
sha256: a49d6cf99e8d8e7a8e93668d09ced0bbdb954d0b4fccc2f5f9241c6b87fad95c
|
||||
sha256: "8d7ff3948166b8ec5da0fbb5962000926b8e02f2ed9b3e51d1738905fbd4c98d"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "99.0.0"
|
||||
version: "93.0.0"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer
|
||||
sha256: "663efa951fb8a45e06f491223a604c93820598f20e6a99c25617a1576065e8b7"
|
||||
sha256: de7148ed2fcec579b19f122c1800933dfa028f6d9fd38a152b04b1516cec120b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "12.1.0"
|
||||
version: "10.0.1"
|
||||
archive:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -213,10 +213,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_style
|
||||
sha256: a4c1ccfee44c7e75ed80484071a5c142a385345e658fd8bd7c4b5c97e7198f98
|
||||
sha256: "29f7ecc274a86d32920b1d9cfc7502fa87220da41ec60b55f329559d5732e2b2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.8"
|
||||
version: "3.1.7"
|
||||
dbus:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -261,10 +261,10 @@ packages:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: ferry_generator
|
||||
sha256: f68c632e23c2ac5f493c05b92135d026cfbd58d658a5056cd8be612f599d505a
|
||||
sha256: "7c3ff4b262301055b33553e9c67c4c8495e93961987683e95a4f3a3ef212eaa3"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.12.0+5"
|
||||
version: "0.12.0+4"
|
||||
ferry_store:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -356,7 +356,7 @@ packages:
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
flutter_web_plugins:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.0"
|
||||
@@ -660,10 +660,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: meta
|
||||
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
|
||||
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.18.0"
|
||||
version: "1.17.0"
|
||||
mgrs_dart:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1057,10 +1057,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"
|
||||
sha256: "8161c84903fd860b26bfdefb7963b3f0b68fee7adea0f59ef805ecca346f0c7a"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.7.11"
|
||||
version: "0.7.10"
|
||||
typed_data:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
+3
-1
@@ -30,6 +30,8 @@ environment:
|
||||
dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_web_plugins:
|
||||
sdk: flutter
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
@@ -60,7 +62,7 @@ dev_dependencies:
|
||||
# package. See that file for information about deactivating specific lint
|
||||
# rules and activating additional ones.
|
||||
flutter_lints: ^6.0.0
|
||||
ferry_generator: ^0.12.0+5
|
||||
ferry_generator: ^0.12.0+4
|
||||
build_runner: ^2.15.0
|
||||
sw: ^0.1.5
|
||||
|
||||
|
||||
+2
-8
@@ -20,15 +20,8 @@
|
||||
<title>MapFlow</title>
|
||||
<link rel="manifest" href="manifest.json">
|
||||
<style>
|
||||
#sw-loading .sw-title,
|
||||
#sw-loading .sw-status,
|
||||
#sw-loading .sw-percentage {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
#sw-loading {
|
||||
background: #0d1b2a !important;
|
||||
gap: 0 !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@@ -86,9 +79,10 @@
|
||||
src="bootstrap.js"
|
||||
data-config='{
|
||||
"logo": "icons/Icon-192.png?v={{sw_version}}",
|
||||
"title": "MapFlow",
|
||||
"theme": "dark",
|
||||
"color": "#46d3b1",
|
||||
"showPercentage": false
|
||||
"showPercentage": true
|
||||
}'
|
||||
></script>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user