From d8125bbbed1da3b21b90660cc2b4fca2b45da07e Mon Sep 17 00:00:00 2001 From: nilsreichardt Date: Thu, 10 Oct 2024 16:49:19 +0200 Subject: [PATCH] Update app imprint from Sharezone GbR to Sharezone UG --- app/lib/main/auth_app.dart | 7 -- app/lib/main/sharezone_bloc_providers.dart | 7 -- .../subpages/imprint/bloc/imprint_bloc.dart | 22 ------- .../imprint/bloc/imprint_bloc_factory.dart | 25 ------- .../imprint/gateway/imprint_gateway.dart | 22 ------- .../src/subpages/imprint/models/imprint.dart | 65 ------------------- .../subpages/imprint/page/imprint_page.dart | 36 ++-------- app/pubspec.lock | 7 ++ app/pubspec.yaml | 2 + lib/legal/lib/legal.dart | 1 + lib/legal/lib/src/imprint/imprint.dart | 29 +++++++++ website/lib/legal/imprint.dart | 64 ------------------ website/lib/legal/imprint_page.dart | 6 +- 13 files changed, 48 insertions(+), 245 deletions(-) delete mode 100644 app/lib/settings/src/subpages/imprint/bloc/imprint_bloc.dart delete mode 100644 app/lib/settings/src/subpages/imprint/bloc/imprint_bloc_factory.dart delete mode 100644 app/lib/settings/src/subpages/imprint/gateway/imprint_gateway.dart delete mode 100644 app/lib/settings/src/subpages/imprint/models/imprint.dart create mode 100644 lib/legal/lib/src/imprint/imprint.dart delete mode 100644 website/lib/legal/imprint.dart diff --git a/app/lib/main/auth_app.dart b/app/lib/main/auth_app.dart index 16e0c782d..594eaf9c8 100644 --- a/app/lib/main/auth_app.dart +++ b/app/lib/main/auth_app.dart @@ -24,8 +24,6 @@ import 'package:sharezone/onboarding/group_onboarding/logic/signed_up_bloc.dart' import 'package:sharezone/onboarding/sign_up/sign_up_page.dart'; import 'package:sharezone/onboarding/welcome_page.dart'; import 'package:sharezone/settings/src/subpages/imprint/analytics/imprint_analytics.dart'; -import 'package:sharezone/settings/src/subpages/imprint/bloc/imprint_bloc_factory.dart'; -import 'package:sharezone/settings/src/subpages/imprint/gateway/imprint_gateway.dart'; import 'package:sharezone/settings/src/subpages/imprint/page/imprint_page.dart'; import 'package:sharezone/support/support_page.dart'; import 'package:sharezone/legal/privacy_policy/privacy_policy_page.dart'; @@ -85,11 +83,6 @@ class _AuthAppState extends State { ), ), BlocProvider(bloc: bloc), - BlocProvider( - bloc: ImprintBlocFactory( - ImprintGateway(widget.blocDependencies.firestore), - ), - ), BlocProvider( bloc: ImprintAnalytics(widget.analytics)), ], diff --git a/app/lib/main/sharezone_bloc_providers.dart b/app/lib/main/sharezone_bloc_providers.dart index 467a5f53a..da9803969 100644 --- a/app/lib/main/sharezone_bloc_providers.dart +++ b/app/lib/main/sharezone_bloc_providers.dart @@ -103,8 +103,6 @@ import 'package:sharezone/report/report_gateway.dart'; import 'package:sharezone/settings/src/bloc/user_settings_bloc.dart'; import 'package:sharezone/settings/src/bloc/user_tips_bloc.dart'; import 'package:sharezone/settings/src/subpages/imprint/analytics/imprint_analytics.dart'; -import 'package:sharezone/settings/src/subpages/imprint/bloc/imprint_bloc_factory.dart'; -import 'package:sharezone/settings/src/subpages/imprint/gateway/imprint_gateway.dart'; import 'package:sharezone/settings/src/subpages/my_profile/change_type_of_user/change_type_of_user_analytics.dart'; import 'package:sharezone/settings/src/subpages/my_profile/change_type_of_user/change_type_of_user_controller.dart'; import 'package:sharezone/settings/src/subpages/my_profile/change_type_of_user/change_type_of_user_service.dart'; @@ -604,11 +602,6 @@ class _SharezoneBlocProvidersState extends State { ), ), BlocProvider(bloc: UserSettingsBloc(api.user)), - BlocProvider( - bloc: ImprintBlocFactory( - ImprintGateway(widget.blocDependencies.firestore), - ), - ), BlocProvider(bloc: ImprintAnalytics(analytics)), BlocProvider(bloc: onboardingNavigator), BlocProvider( diff --git a/app/lib/settings/src/subpages/imprint/bloc/imprint_bloc.dart b/app/lib/settings/src/subpages/imprint/bloc/imprint_bloc.dart deleted file mode 100644 index 6bc461a6c..000000000 --- a/app/lib/settings/src/subpages/imprint/bloc/imprint_bloc.dart +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2022 Sharezone UG (haftungsbeschränkt) -// Licensed under the EUPL-1.2-or-later. -// -// You may obtain a copy of the Licence at: -// https://joinup.ec.europa.eu/software/page/eupl -// -// SPDX-License-Identifier: EUPL-1.2 - -import 'package:bloc_base/bloc_base.dart'; -import 'package:sharezone/settings/src/subpages/imprint/gateway/imprint_gateway.dart'; - -class ImprintBloc extends BlocBase { - final ImprintGateway _gateway; - - ImprintBloc(this._gateway); - - Stream get markdownStream => - _gateway.imprintStream.map((imprint) => imprint.asMarkdown); - - @override - void dispose() {} -} diff --git a/app/lib/settings/src/subpages/imprint/bloc/imprint_bloc_factory.dart b/app/lib/settings/src/subpages/imprint/bloc/imprint_bloc_factory.dart deleted file mode 100644 index 797662d55..000000000 --- a/app/lib/settings/src/subpages/imprint/bloc/imprint_bloc_factory.dart +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) 2022 Sharezone UG (haftungsbeschränkt) -// Licensed under the EUPL-1.2-or-later. -// -// You may obtain a copy of the Licence at: -// https://joinup.ec.europa.eu/software/page/eupl -// -// SPDX-License-Identifier: EUPL-1.2 - -import 'package:bloc_base/bloc_base.dart'; -import 'package:sharezone/settings/src/subpages/imprint/gateway/imprint_gateway.dart'; - -import 'imprint_bloc.dart'; - -class ImprintBlocFactory extends BlocBase { - final ImprintGateway _gateway; - - ImprintBlocFactory(this._gateway); - - ImprintBloc create() { - return ImprintBloc(_gateway); - } - - @override - void dispose() {} -} diff --git a/app/lib/settings/src/subpages/imprint/gateway/imprint_gateway.dart b/app/lib/settings/src/subpages/imprint/gateway/imprint_gateway.dart deleted file mode 100644 index 5ef5e94e0..000000000 --- a/app/lib/settings/src/subpages/imprint/gateway/imprint_gateway.dart +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) 2022 Sharezone UG (haftungsbeschränkt) -// Licensed under the EUPL-1.2-or-later. -// -// You may obtain a copy of the Licence at: -// https://joinup.ec.europa.eu/software/page/eupl -// -// SPDX-License-Identifier: EUPL-1.2 - -import 'package:cloud_firestore/cloud_firestore.dart'; -import 'package:sharezone/settings/src/subpages/imprint/models/imprint.dart'; - -class ImprintGateway { - final FirebaseFirestore _firestore; - - ImprintGateway(this._firestore); - - Stream get imprintStream => _firestore - .collection('Legal') - .doc('imprint') - .snapshots() - .map((doc) => Imprint.fromDocumentSnapshot(doc)); -} diff --git a/app/lib/settings/src/subpages/imprint/models/imprint.dart b/app/lib/settings/src/subpages/imprint/models/imprint.dart deleted file mode 100644 index 8cd261b22..000000000 --- a/app/lib/settings/src/subpages/imprint/models/imprint.dart +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2022 Sharezone UG (haftungsbeschränkt) -// Licensed under the EUPL-1.2-or-later. -// -// You may obtain a copy of the Licence at: -// https://joinup.ec.europa.eu/software/page/eupl -// -// SPDX-License-Identifier: EUPL-1.2 - -import 'package:cloud_firestore/cloud_firestore.dart'; - -class Imprint { - /// Impressum wird als Markdown-String übergeben. Beispiel: - /// - /// **Angaben gemäß § 5 TMG:** - /// - /// Sander, Jonas; Reichardt, Nils u. Weuthen, Felix “Sharezone” GbR - /// Blücherstraße 34 - /// 57072 Siegen - /// - /// **Vertreten durch:** - /// Nils Reichardt - /// - /// **Kontakt:** - /// Telefon: +49 1516 7754541 - /// E-Mail: support@sharezone.net - final String asMarkdown; - - const Imprint._(this.asMarkdown); - - factory Imprint.fromDocumentSnapshot( - DocumentSnapshot> snapshot) { - final markdownData = snapshot.data()?['markdownData'] as String; - return Imprint._(markdownData); - } - - factory Imprint.offline() { - return const Imprint._("""### **Angaben gemäß § 5 TMG:** - -Sander, Jonas; Reichardt, Nils u. Weuthen, Felix “Sharezone” GbR -Blücherstraße 34 -57072 Siegen - -### **Vertreten durch:** - -Nils Reichardt - -### **Kontakt:** - -Telefon: +49 1516 7754541 -E-Mail: support@sharezone.net"""); - } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is Imprint && other.asMarkdown == asMarkdown; - } - - @override - int get hashCode => asMarkdown.hashCode; - - @override - String toString() => 'Imprint(asMarkdown: $asMarkdown)'; -} diff --git a/app/lib/settings/src/subpages/imprint/page/imprint_page.dart b/app/lib/settings/src/subpages/imprint/page/imprint_page.dart index b0bd9dbfe..6ce5f0764 100644 --- a/app/lib/settings/src/subpages/imprint/page/imprint_page.dart +++ b/app/lib/settings/src/subpages/imprint/page/imprint_page.dart @@ -6,52 +6,28 @@ // // SPDX-License-Identifier: EUPL-1.2 -import 'package:bloc_provider/bloc_provider.dart'; import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; +import 'package:legal/legal.dart'; import 'package:sharezone/groups/src/widgets/contact_support.dart'; -import 'package:sharezone/settings/src/subpages/imprint/bloc/imprint_bloc.dart'; -import 'package:sharezone/settings/src/subpages/imprint/bloc/imprint_bloc_factory.dart'; -import 'package:sharezone/settings/src/subpages/imprint/models/imprint.dart'; import 'package:sharezone_utils/launch_link.dart'; -class ImprintPage extends StatefulWidget { +class ImprintPage extends StatelessWidget { static const tag = 'imprint-page'; const ImprintPage({super.key}); - @override - State createState() => _ImprintPageState(); -} - -class _ImprintPageState extends State { - late ImprintBloc bloc; - - @override - void initState() { - super.initState(); - bloc = BlocProvider.of(context).create(); - } - @override Widget build(BuildContext context) { - final offlineData = Imprint.offline().asMarkdown; return Scaffold( appBar: AppBar(title: const Text("Impressum")), body: SingleChildScrollView( padding: const EdgeInsets.all(12), child: SafeArea( - child: StreamBuilder( - initialData: offlineData, - stream: bloc.markdownStream, - builder: (context, snapshot) { - final data = snapshot.data ?? offlineData; - return MarkdownBody( - data: data, - onTapLink: (link, _, __) => launchURL(link), - selectable: true, - ); - }, + child: MarkdownBody( + data: markdownImprint, + onTapLink: (text, href, __) => launchURL(href!), + selectable: true, ), ), ), diff --git a/app/pubspec.lock b/app/pubspec.lock index 46b15a7ad..e9f25bc6d 100644 --- a/app/pubspec.lock +++ b/app/pubspec.lock @@ -1410,6 +1410,13 @@ packages: url: "https://pub.dev" source: hosted version: "3.0.1" + legal: + dependency: "direct main" + description: + path: "../lib/legal" + relative: true + source: path + version: "1.0.0" lints: dependency: transitive description: diff --git a/app/pubspec.yaml b/app/pubspec.yaml index 862738e82..44e654478 100644 --- a/app/pubspec.yaml +++ b/app/pubspec.yaml @@ -128,6 +128,8 @@ dependencies: path: ../lib/key_value_store last_online_reporting: path: ../lib/last_online_reporting + legal: + path: ../lib/legal logging: ^1.1.1 # Can be replaced once Flutter officially supports the new Material Symbols, # see https://github.com/flutter/flutter/issues/102560. diff --git a/lib/legal/lib/legal.dart b/lib/legal/lib/legal.dart index 4ad882bf3..cd8d9a3e0 100644 --- a/lib/legal/lib/legal.dart +++ b/lib/legal/lib/legal.dart @@ -11,5 +11,6 @@ /// More dartdocs go here. library; +export 'src/imprint/imprint.dart'; export 'src/privacy_policy/privacy_policy_page.dart'; export 'src/terms_of_service/terms_of_service_page.dart'; diff --git a/lib/legal/lib/src/imprint/imprint.dart b/lib/legal/lib/src/imprint/imprint.dart new file mode 100644 index 000000000..f6943b504 --- /dev/null +++ b/lib/legal/lib/src/imprint/imprint.dart @@ -0,0 +1,29 @@ +// Copyright (c) 2023 Sharezone UG (haftungsbeschränkt) +// Licensed under the EUPL-1.2-or-later. +// +// You may obtain a copy of the Licence at: +// https://joinup.ec.europa.eu/software/page/eupl +// +// SPDX-License-Identifier: EUPL-1.2 + +const markdownImprint = """### Adresse + +Sharezone UG (haftungsbeschränkt) +Speditionstr. 15A +40221 Düsseldorf + +### Geschäftsführer and redaktionell Verantwortlicher: +Nils Reichardt & Jonas Sander + +### Handelsregister +Registergericht: Amtsgericht Düsseldorf +Registernummer: HRB 91086 + +### Kontakt: +Mobil: +49 1522 9504121 +E-Mail: support@sharezone.net + +### Umsatzsteuer-ID: + +Umsatzsteuer-Identifikationsnummer gemäß §27a Umsatzsteuergesetz: DE338063943 +"""; diff --git a/website/lib/legal/imprint.dart b/website/lib/legal/imprint.dart deleted file mode 100644 index 62a148741..000000000 --- a/website/lib/legal/imprint.dart +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) 2023 Sharezone UG (haftungsbeschränkt) -// Licensed under the EUPL-1.2-or-later. -// -// You may obtain a copy of the Licence at: -// https://joinup.ec.europa.eu/software/page/eupl -// -// SPDX-License-Identifier: EUPL-1.2 - -class Imprint { - /// Impressum wird als Markdown-String übergeben. Beispiel: - /// - /// **Angaben gemäß § 5 TMG:** - /// - /// Sander, Jonas; Reichardt, Nils u. Weuthen, Felix “Sharezone” GbR - /// Blücherstraße 34 - /// 57072 Siegen - /// - /// **Vertreten durch:** - /// Nils Reichardt - /// - /// **Kontakt:** - /// Telefon: +49 15678 612205 - /// E-Mail: support@sharezone.net - final String asMarkdown; - - const Imprint._(this.asMarkdown); - - factory Imprint.offline() { - return const Imprint._("""## Informationen nach § 5 TMG - -Sharezone UG (haftungsbeschränkt) -Speditionstr. 15A -40221 Düsseldorf - -### Geschäftsführer and redaktionell Verantwortlicher: -Nils Reichardt & Jonas Sander - -### Handelsregister -Registergericht: Amtsgericht Düsseldorf -Registernummer: HRB 91086 - -### Kontakt: -Mobil: +49 1522 9504121 -E-Mail: support@sharezone.net - -### Umsatzsteuer-ID: - -Umsatzsteuer-Identifikationsnummer gemäß §27a Umsatzsteuergesetz: DE338063943 -"""); - } - - @override - bool operator ==(Object other) { - if (identical(this, other)) return true; - - return other is Imprint && other.asMarkdown == asMarkdown; - } - - @override - int get hashCode => asMarkdown.hashCode; - - @override - String toString() => 'Imprint(asMarkdown: $asMarkdown)'; -} diff --git a/website/lib/legal/imprint_page.dart b/website/lib/legal/imprint_page.dart index f6b12d764..4143419d7 100644 --- a/website/lib/legal/imprint_page.dart +++ b/website/lib/legal/imprint_page.dart @@ -8,12 +8,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_markdown/flutter_markdown.dart'; +import 'package:legal/legal.dart'; import 'package:sharezone_website/page.dart'; import 'package:sharezone_website/widgets/headline.dart'; import 'package:sharezone_website/widgets/section.dart'; import '../utils.dart'; -import 'imprint.dart'; class ImprintPage extends StatelessWidget { const ImprintPage({super.key}); @@ -40,8 +40,8 @@ class ImprintPage extends StatelessWidget { Theme( data: ThemeData.light(), child: MarkdownBody( - data: Imprint.offline().asMarkdown, - onTapLink: (link, href, title) => launchUrl(link), + data: markdownImprint, + onTapLink: (link, href, title) => launchUrl(href!), selectable: true, softLineBreak: true, ),