Integrate support chat

This commit is contained in:
Vishnu Mohandas 2020-08-29 09:22:12 +05:30
parent fc76a77355
commit 8dc5bad44c
4 changed files with 143 additions and 15 deletions

View file

@ -43,6 +43,13 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
<key>CFBundleURLTypes</key>
<array>
<dict>

View file

@ -1,3 +1,4 @@
import 'package:crisp/crisp.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
@ -144,36 +145,92 @@ class SupportSectionWidget extends StatelessWidget {
child: Column(children: [
Padding(padding: EdgeInsets.all(12)),
SettingsSectionTitle("SUPPORT"),
Padding(padding: EdgeInsets.all(4)),
GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () async {
final Email email = Email(
recipients: ['support@ente.io'],
isHTML: false,
);
await FlutterEmailSender.send(email);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: Column(
children: [
Align(alignment: Alignment.centerLeft, child: Text("Email")),
Icon(Icons.navigate_next),
Padding(padding: EdgeInsets.all(4)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Align(alignment: Alignment.centerLeft, child: Text("Email")),
Icon(Icons.navigate_next),
],
),
Padding(padding: EdgeInsets.all(4)),
],
),
),
Padding(padding: EdgeInsets.all(4)),
Divider(height: 4),
Padding(padding: EdgeInsets.all(4)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Align(alignment: Alignment.centerLeft, child: Text("Chat")),
Icon(Icons.navigate_next),
],
GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () async {
Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
return CrispChatPage();
},
),
);
},
child: Column(
children: [
Padding(padding: EdgeInsets.all(4)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Align(alignment: Alignment.centerLeft, child: Text("Chat")),
Icon(Icons.navigate_next),
],
),
Padding(padding: EdgeInsets.all(4)),
],
),
),
Padding(padding: EdgeInsets.all(4)),
]),
);
}
}
class CrispChatPage extends StatefulWidget {
CrispChatPage({Key key}) : super(key: key);
@override
_CrispChatPageState createState() => _CrispChatPageState();
}
class _CrispChatPageState extends State<CrispChatPage> {
static const websiteID = "86d56ea2-68a2-43f9-8acb-95e06dee42e8";
@override
void initState() {
crisp.initialize(
websiteId: websiteID,
);
crisp.register(
CrispUser(
email: Configuration.instance.getEmail(),
),
);
super.initState();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Support"),
),
body: CrispView(
loadingWidget: loadWidget,
),
);
}
}

View file

@ -134,6 +134,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crisp:
dependency: "direct main"
description:
name: crisp
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
crypto:
dependency: "direct main"
description:
@ -296,6 +303,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_webview_plugin:
dependency: transitive
description:
name: flutter_webview_plugin
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.11"
fluttertoast:
dependency: "direct main"
description:
@ -492,6 +506,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
platform_detect:
dependency: transitive
description:
name: platform_detect
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.0"
plugin_platform_interface:
dependency: transitive
description:
@ -527,6 +548,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.0"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
pull_to_refresh:
dependency: "direct main"
description:
@ -693,6 +721,41 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.0"
url_launcher:
dependency: transitive
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "5.5.1"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+7"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.8"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
usage:
dependency: transitive
description:

View file

@ -63,6 +63,7 @@ dependencies:
flutter_secure_storage: ^3.3.3
uni_links: ^0.4.0
flutter_svg: ^0.18.1
crisp: ^0.1.3
dev_dependencies:
flutter_test: