Skip to content

Commit

Permalink
Add privacy policy (#41)
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-pratik-k authored Apr 25, 2024
1 parent ad8c771 commit 5b7736a
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 2 deletions.
6 changes: 6 additions & 0 deletions app/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ PODS:
- video_player_avfoundation (0.0.1):
- Flutter
- FlutterMacOS
- webview_flutter_wkwebview (0.0.1):
- Flutter

DEPENDENCIES:
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
Expand All @@ -81,6 +83,7 @@ DEPENDENCIES:
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- video_player_avfoundation (from `.symlinks/plugins/video_player_avfoundation/darwin`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)

SPEC REPOS:
trunk:
Expand Down Expand Up @@ -122,6 +125,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/sqflite/darwin"
video_player_avfoundation:
:path: ".symlinks/plugins/video_player_avfoundation/darwin"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

SPEC CHECKSUMS:
AppAuth: 3bb1d1cd9340bd09f5ed189fb00b1cc28e1e8570
Expand All @@ -147,6 +152,7 @@ SPEC CHECKSUMS:
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
Toast: ec33c32b8688982cecc6348adeae667c1b9938da
video_player_avfoundation: 02011213dab73ae3687df27ce441fbbcc82b5579
webview_flutter_wkwebview: be0f0d33777f1bfd0c9fdcb594786704dbf65f36

PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796

Expand Down
83 changes: 83 additions & 0 deletions app/lib/components/web_view_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:style/buttons/action_button.dart';
import 'package:style/extensions/context_extensions.dart';
import 'package:style/indicators/circular_progress_indicator.dart';
import 'package:webview_flutter/webview_flutter.dart';

import 'app_page.dart';

void showWebView(BuildContext context, String url) {
Navigator.of(context, rootNavigator: true).push(
MaterialPageRoute(
fullscreenDialog: true,
builder: (BuildContext context) => WebViewScreen(url: url),
),
);
}

class WebViewScreen extends StatefulWidget {
final String url;

const WebViewScreen({super.key, required this.url});

@override
State<WebViewScreen> createState() => _WebViewScreenState();
}

class _WebViewScreenState extends State<WebViewScreen> {
late WebViewController _controller;

bool _loading = true;

@override
void initState() {
_controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setNavigationDelegate(
NavigationDelegate(
onNavigationRequest: (request) {
if(request.url.startsWith("https://canopas.github.io/cloud-gallery/")
&& request.url != "https://canopas.github.io/cloud-gallery/"){
return NavigationDecision.navigate;
}
return NavigationDecision.prevent;
},
onPageFinished: (_) => setState(() {
_loading = false;
}),
),
)
..loadRequest(Uri.parse(widget.url));

super.initState();
}

@override
Widget build(BuildContext context) {
return AppPage(
title: '',
automaticallyImplyLeading: false,
leading: ActionButton(
onPressed: () => context.pop(),
icon: Icon(
Icons.close,
color: context.colorScheme.textSecondary,
),
),
body: Builder(
builder: (context) {
return Padding(
padding: context.systemPadding,
child: Stack(
children: [
WebViewWidget(controller: _controller),
if (_loading) const Center(child: AppCircularProgressIndicator()),
],
),
);
}
),
);
}
}
5 changes: 3 additions & 2 deletions app/lib/ui/flow/accounts/components/settings_action_list.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cloud_gallery/components/web_view_screen.dart';
import 'package:cloud_gallery/domain/extensions/context_extensions.dart';
import 'package:data/storage/app_preferences.dart';
import 'package:flutter/cupertino.dart';
Expand Down Expand Up @@ -49,13 +50,13 @@ class SettingsActionList extends ConsumerWidget {
ActionListButton(
title: context.l10n.common_term_and_condition,
onPressed: () {
///TODO: Add term and condition screen
showWebView(context, "https://canopas.github.io/cloud-gallery/terms-and-conditions");
},
),
ActionListButton(
title: context.l10n.common_privacy_policy,
onPressed: () {
///TODO: Add privacy policy screen
showWebView(context, "https://canopas.github.io/cloud-gallery/privacy-policy");
}),
]);
}
Expand Down
32 changes: 32 additions & 0 deletions app/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1336,6 +1336,38 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.4.5"
webview_flutter:
dependency: "direct main"
description:
name: webview_flutter
sha256: "25e1b6e839e8cbfbd708abc6f85ed09d1727e24e08e08c6b8590d7c65c9a8932"
url: "https://pub.dev"
source: hosted
version: "4.7.0"
webview_flutter_android:
dependency: transitive
description:
name: webview_flutter_android
sha256: f038ee2fae73b509dde1bc9d2c5a50ca92054282de17631a9a3d515883740934
url: "https://pub.dev"
source: hosted
version: "3.16.0"
webview_flutter_platform_interface:
dependency: transitive
description:
name: webview_flutter_platform_interface
sha256: d937581d6e558908d7ae3dc1989c4f87b786891ab47bb9df7de548a151779d8d
url: "https://pub.dev"
source: hosted
version: "2.10.0"
webview_flutter_wkwebview:
dependency: transitive
description:
name: webview_flutter_wkwebview
sha256: f12f8d8a99784b863e8b85e4a9a5e3cf1839d6803d2c0c3e0533a8f3c5a992a7
url: "https://pub.dev"
source: hosted
version: "3.13.0"
win32:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dependencies:
dio: ^5.4.3+1
flutter_local_notifications: ^17.0.1
share_plus: ^8.0.3
webview_flutter: ^4.7.0

# storage
shared_preferences: ^2.2.2
Expand Down

0 comments on commit 5b7736a

Please sign in to comment.