Remove Web Only Api
Dieser Commit ist enthalten in:
Ursprung
96e9c9264b
Commit
4a03e7d48a
|
@ -31,7 +31,7 @@ import 'package:steamwar_multitool/src/delegates/delegates.dart';
|
|||
import 'package:steamwar_multitool/src/screens/event/components/dialogs/dialogs.dart';
|
||||
import 'package:steamwar_multitool/src/types/types.dart';
|
||||
import 'package:steamwar_multitool/src/util/constants.dart';
|
||||
import 'package:steamwar_multitool/src/util/event_fight_exporter.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class EventFightList extends HookConsumerWidget {
|
||||
final EventExtended eventData;
|
||||
|
@ -326,9 +326,13 @@ class EventFightList extends HookConsumerWidget {
|
|||
),
|
||||
];
|
||||
},
|
||||
onSelected: (value) {
|
||||
onSelected: (value) async {
|
||||
if (value == "export") {
|
||||
openExportedFights(fights.value, event.name);
|
||||
final url = Uri.parse(
|
||||
"https://steamwar.de/eventplanner-api/events/${event.id}/csv?auth=${await ref.read(userDataProvider.future).then((value) => value.key)}");
|
||||
if (await canLaunchUrl(url)) {
|
||||
await launchUrl(url, webOnlyWindowName: "_blank");
|
||||
}
|
||||
} else if (value == "display") {
|
||||
showDialog(
|
||||
context: context,
|
||||
|
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* This file is a part of the SteamWar software.
|
||||
*
|
||||
* Copyright (C) 2023 SteamWar.de-Serverteam
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:html';
|
||||
|
||||
import 'package:csv/csv.dart';
|
||||
import 'package:steamwar_multitool/src/types/types.dart';
|
||||
|
||||
/*
|
||||
Start,BlueTeam,RedTeam,WinnerTeam
|
||||
|
||||
*/
|
||||
|
||||
Uri exportFights(List<EventFight> fights, String eventName) {
|
||||
List<List<String>> csv = [];
|
||||
csv.add(['Start', 'BlueTeam', 'RedTeam', 'WinnerTeam', 'Group']);
|
||||
for (var fight in fights) {
|
||||
csv.add([
|
||||
fight.start.toString(),
|
||||
fight.blueTeam.name,
|
||||
fight.redTeam.name,
|
||||
fight.winner.name,
|
||||
fight.group ?? "Ungrouped"
|
||||
]);
|
||||
}
|
||||
|
||||
return Uri.dataFromBytes(
|
||||
Encoding.getByName("utf-8")!
|
||||
.encode(const ListToCsvConverter(eol: "\n").convert(csv)),
|
||||
mimeType: "text/csv",
|
||||
);
|
||||
}
|
||||
|
||||
void openExportedFights(List<EventFight> fights, String eventName) async {
|
||||
final uri = exportFights(fights, eventName);
|
||||
window.open(uri.toString(), "export");
|
||||
}
|
|
@ -6,6 +6,10 @@
|
|||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||
|
||||
void fl_register_plugins(FlPluginRegistry* registry) {
|
||||
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
|
||||
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
|
||||
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
url_launcher_linux
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
|
|
@ -6,7 +6,9 @@ import FlutterMacOS
|
|||
import Foundation
|
||||
|
||||
import shared_preferences_foundation
|
||||
import url_launcher_macos
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
|
||||
}
|
||||
|
|
64
pubspec.lock
64
pubspec.lock
|
@ -693,6 +693,70 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: url_launcher
|
||||
sha256: e8f2efc804810c0f2f5b485f49e7942179f56eabcfe81dce3387fec4bb55876b
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.9"
|
||||
url_launcher_android:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_android
|
||||
sha256: "3e2f6dfd2c7d9cd123296cab8ef66cfc2c1a13f5845f42c7a0f365690a8a7dd1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.0.23"
|
||||
url_launcher_ios:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_ios
|
||||
sha256: "0a5af0aefdd8cf820dd739886efb1637f1f24489900204f50984634c07a54815"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.1.0"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_linux
|
||||
sha256: "318c42cba924e18180c029be69caf0a1a710191b9ec49bb42b5998fdcccee3cc"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
url_launcher_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_macos
|
||||
sha256: "41988b55570df53b3dd2a7fc90c76756a963de6a8c5f8e113330cb35992e2094"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.2"
|
||||
url_launcher_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_platform_interface
|
||||
sha256: "4eae912628763eb48fc214522e58e942fd16ce195407dbf45638239523c759a6"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
url_launcher_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_web
|
||||
sha256: "44d79408ce9f07052095ef1f9a693c258d6373dc3944249374e30eff7219ccb0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.14"
|
||||
url_launcher_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: url_launcher_windows
|
||||
sha256: b6217370f8eb1fd85c8890c539f5a639a01ab209a36db82c921ebeacefc7a615
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
vector_math:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
@ -22,6 +22,7 @@ dependencies:
|
|||
intl: ^0.18.0
|
||||
csv: ^5.0.1
|
||||
grouped_list: ^5.1.2
|
||||
url_launcher: ^6.1.9
|
||||
|
||||
|
||||
dev_dependencies:
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
|
||||
#include "generated_plugin_registrant.h"
|
||||
|
||||
#include <url_launcher_windows/url_launcher_windows.h>
|
||||
|
||||
void RegisterPlugins(flutter::PluginRegistry* registry) {
|
||||
UrlLauncherWindowsRegisterWithRegistrar(
|
||||
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#
|
||||
|
||||
list(APPEND FLUTTER_PLUGIN_LIST
|
||||
url_launcher_windows
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
|
|
In neuem Issue referenzieren
Einen Benutzer sperren