Skip to content

Commit

Permalink
Merge branch 'dev' into feature-discord-logic-bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
VincePaulin committed Jul 31, 2024
2 parents 3553304 + 72b38b0 commit 8e5935d
Show file tree
Hide file tree
Showing 22 changed files with 1,046 additions and 379 deletions.
31 changes: 26 additions & 5 deletions assets/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -2594,9 +2594,9 @@
"whatsAppQrTitle": "Pairing with WhatsApp",
"whatsAppQrExplainOne": "On your main phone",
"whatsAppQrExplainTwo": "From WhatsApp, tap on the Enter code notification.",
"whatsAppQrExplainTree": "Unlock your main phone with your pin code or biometric authentication",
"whatsAppQrExplainFour": "The location and name of our server will be displayed, press Confirm.",
"whatsAppQrExplainFive": "Enter the 8-character code below to link your WhatsApp to Tawkie",
"whatsAppQrExplainTree": "Or else:",
"whatsAppQrExplainFour": "1. Press the settings icon at top right and select Connected devices",
"whatsAppQrExplainFive": "2. Press the Connect a device button",
"whatsAppQrExplainSix": "Or by QR Code",
"whatsAppQrExplainSeven": "On your WhatsApp click on",
"whatsAppQrExplainEight": "> Connected devices > Connect a device.",
Expand Down Expand Up @@ -2695,5 +2695,26 @@
"discordQrExplainSix": "We advise you to open this QR code on a computer and scan it with your cell phone.",
"discordQrExplainSeven": "WARNING",
"discordQrExplainEight": "This QR code expires quickly.",
"discordQrExplainNine": "Scan this QR Code"
}
"discordQrExplainNine": "Scan this QR Code",
"joinBetaTitle": "Join the Beta",
"betaJoinExplanation": "## How to test the Beta version and access new features in advance?",
"betaJoinBenefit": "Participating in the Beta allows you to access application updates in advance and be the first to test new features!",
"iosInstructionsTitle": "On iOS:",
"installTestflight": "- Install Apple Testflight",
"downloadTestflightButton": "Download Apple Testflight",
"downloadBetaIOSButton": "Download the iOS Beta",
"joinBetaGroup": "- Join the Tawkie Beta group: #beta",
"androidInstructionsTitle": "On Android:",
"joinBetaPlayStore": "- Join the Beta from the Play Store or online",
"downloadBetaAndroidButton": "Download the Android Beta",
"joinBetaButtonLabel": "Join the Beta group",
"joinBetaError": "Something went wrong: ",
"failedToJoinRoom": "Failed to join room: ",
"roomIdNullError": "Room ID is null for alias: ",
"roomNotFoundError": "Room not found after joining",
"seeBotsRoom":"See bots",
"leaveTheConvDesc": "Do you really want to leave this conversation?",
"leaveTheConvSuccess": "You have left the conversation.",
"chatBotRoomsTitle": "Bots conversations",
"chatBotRoomsNotFound": "No conversation with bots."
}
31 changes: 26 additions & 5 deletions assets/l10n/intl_fr.arb
Original file line number Diff line number Diff line change
Expand Up @@ -2414,9 +2414,9 @@
"whatsAppQrTitle": "Appariement avec WhatsApp",
"whatsAppQrExplainOne": "Sur votre téléphone principal",
"whatsAppQrExplainTwo": "Dans WhatsApp, appuyez sur la notification Entrer le code.",
"whatsAppQrExplainTree": "Déverrouillez votre téléphone principal avec votre code PIN ou votre authentification biométrique",
"whatsAppQrExplainFour": "L'emplacement et le nom de notre serveur seront affichés, appuyez sur Confirmer.",
"whatsAppQrExplainFive": "Saisissez le code à 8 caractères ci-dessous pour lier votre WhatsApp à Tawkie",
"whatsAppQrExplainTree": "Ou bien:",
"whatsAppQrExplainFour": "1. Appuyer sur l'icône des paramètres, en haut à droite et sélectionnez Appareils connectés",
"whatsAppQrExplainFive": "2. Appuyez sur le bouton Connecter un appareil",
"whatsAppQrExplainSix": "Ou par code QR",
"whatsAppQrExplainSeven": "Sur votre WhatsApp, cliquez sur",
"whatsAppQrExplainEight": "> Appareils connectés > Connecter un appareil.",
Expand Down Expand Up @@ -2511,5 +2511,26 @@
"discordQrExplainSix": "Nous vous conseillons d'ouvrir ce QR code sur un ordinateur et de le scanner avec votre téléphone.",
"discordQrExplainSeven": "ATTENTION",
"discordQrExplainEight": "Ce QR code expire rapidement.",
"discordQrExplainNine": "Scannez ce QR Code"
}
"discordQrExplainNine": "Scannez ce QR Code",
"joinBetaTitle": "Rejoindre la Beta",
"betaJoinExplanation": "## Comment tester la version Beta et accéder aux nouvelles fonctionnalités en avance ?",
"betaJoinBenefit": "Participer à la Beta permet d'avoir accès aux mises à jour de l'application en avance et tester en premier.ère les nouvelles fonctionnalités !",
"iosInstructionsTitle": "Sous iOS :",
"installTestflight": "- Installer Apple Testflight",
"downloadTestflightButton": "Télécharger Apple Testflight",
"downloadBetaIOSButton": "Télécharger la Beta iOS",
"joinBetaGroup": "- Rejoindre le groupe Tawkie de la Beta : #beta",
"androidInstructionsTitle": "Sous Android :",
"joinBetaPlayStore": "- Rejoindre la Beta depuis le Play Store ou en ligne",
"downloadBetaAndroidButton": "Télécharger la Beta Android",
"joinBetaButtonLabel": "Rejoindre le groupe Beta",
"joinBetaError": "Une erreur s'est produite : ",
"failedToJoinRoom": "Échec de la connexion à la salle : ",
"roomIdNullError": "L'ID de la salle est nul pour l'alias : ",
"roomNotFoundError": "Salle introuvable après la connexion",
"seeBotsRoom":"Voir les bots",
"leaveTheConvDesc": "Voulez-vous vraiment quitter cette conversation ?",
"leaveTheConvSuccess": "Vous avez quitté la conversation.",
"chatBotRoomsTitle": "Conversations des bots",
"chatBotRoomsNotFound": "Aucune conversation avec les bots."
}
Binary file added assets/tawkie.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions lib/config/app_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,23 @@ abstract class AppConfig {
static const String baseUrl = kDebugMode ? stagingUrl : productionUrl;
static String tawkieSubscriptionIdentifier = 'Tawkie subscription';

// URLs for Beta Join
static const String testflightAppUrl = 'https://apps.apple.com/us/app/testflight/id899247664';
static const String appleBetaUrl = 'https://testflight.apple.com/join/daXe0NfW';
static const String playStoreUrl = 'https://play.google.com/store/apps/details?id=fr.tawkie.app';
static const String androidBetaUrl = 'https://play.google.com/apps/testing/fr.tawkie.app';

static const String iosUrl = 'itms-apps://itunes.apple.com/app/id899247664';
static const String androidUrl = 'market://details?id=fr.tawkie.app';

static const String prodBetaAlias = 'beta';
static const String testBetaAlias = 'testbeta';
static const String betaAlias = kDebugMode ? testBetaAlias : prodBetaAlias;
static const String serverStagingUrl = ':staging.tawkie.fr';
static const String serverProductionUrl = ':alpha.tawkie.fr';
static const String server = kDebugMode ? serverStagingUrl : serverProductionUrl;
static const String roomAlias = '#$betaAlias$server';

static void loadFromJson(Map<String, dynamic> json) {
if (json['chat_color'] != null) {
try {
Expand Down
16 changes: 12 additions & 4 deletions lib/config/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';

import 'package:go_router/go_router.dart';

import 'package:tawkie/config/themes.dart';
import 'package:tawkie/pages/add_bridge/add_bridge.dart';
import 'package:tawkie/pages/add_bridge/add_bridge_body.dart';
import 'package:tawkie/pages/archive/archive.dart';
import 'package:tawkie/pages/auth/auth.dart';
import 'package:tawkie/pages/beta/beta.dart';
import 'package:tawkie/pages/chat/chat.dart';
import 'package:tawkie/pages/chat_access_settings/chat_access_settings_controller.dart';
import 'package:tawkie/pages/chat_details/chat_details.dart';
Expand Down Expand Up @@ -49,7 +47,8 @@ abstract class AppRoutes {
final FlutterSecureStorage _secureStorage = const FlutterSecureStorage();
final sessionToken = await _secureStorage.read(key: 'sessionToken');

final bool isLoggedKratos = sessionToken is String && sessionToken.isNotEmpty;
final bool isLoggedKratos =
sessionToken is String && sessionToken.isNotEmpty;
final bool isLoggedMatrix = Matrix.of(context).client.isLogged();
final bool preAuth = state.fullPath!.startsWith('/home');

Expand Down Expand Up @@ -306,6 +305,15 @@ abstract class AppRoutes {
),
],
),
GoRoute(
path: 'joinBeta',
pageBuilder: (context, state) => defaultPageBuilder(
context,
state,
const BetaJoinPage(),
),
redirect: loggedOutRedirect,
),
// Route to social networking page via chat bot
// The entire path is: /rooms/settings/addbridgebot
GoRoute(
Expand Down
1 change: 1 addition & 0 deletions lib/config/themes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ abstract class FluffyThemes {
static const Color linkedinColor = Color(0xFF0077B5);
static const Color dicordColor = Color(0xFF7289DA);
static const Color signalColor = Color(0xFF3A76F0);
static const Color tawkieColor = Color(0xFFA13EAE);

static var fallbackTextTheme = const TextTheme(
bodyLarge: fallbackTextStyle,
Expand Down
32 changes: 31 additions & 1 deletion lib/pages/add_bridge/add_bridge.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import 'package:tawkie/widgets/matrix.dart';
import 'package:tawkie/widgets/notifier_state.dart';
import 'package:webview_cookie_manager/webview_cookie_manager.dart';

import 'bot_chat_list.dart';
import 'connection_bridge_dialog.dart';
import 'delete_conversation_dialog.dart';
import 'error_message_dialog.dart';
Expand Down Expand Up @@ -93,7 +94,36 @@ class BotController extends State<AddBridge> {
continueProcess = false;
}

/// Get or create a direct chat with the bot
List<String> getBotIds() {
return SocialNetworkManager.socialNetworks
.map((sn) => sn.chatBot + hostname)
.toList();
}

List<String> get botIds => getBotIds();

void showPopupMenu(BuildContext context) async {
await showMenu(
context: context,
position: const RelativeRect.fromLTRB(100, 80, 0, 100),
items: [
PopupMenuItem(
value: 'see_bots',
child: Text(L10n.of(context)!.seeBotsRoom),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BotChatListPage(botUserIds: botIds),
),
);
},
),
],
elevation: 8.0,
);
}

Future<String?> _getOrCreateDirectChat(String botUserId) async {
try {
await waitForMatrixSync(); // Make sure all conversations are loaded
Expand Down
59 changes: 39 additions & 20 deletions lib/pages/add_bridge/add_bridge_body.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ import 'package:tawkie/pages/add_bridge/add_bridge.dart';
import 'package:tawkie/pages/add_bridge/social_network_item.dart';
import 'package:tawkie/utils/platform_infos.dart';
import 'package:tawkie/utils/platform_size.dart';

import 'add_bridge_header.dart';
import 'model/social_network.dart';

// Page offering brigde bot connections to social network chats
class AddBridgeBody extends StatelessWidget {
final BotController controller;

const AddBridgeBody({
super.key,
required this.controller,
Expand All @@ -19,23 +21,32 @@ class AddBridgeBody extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
appBar: AppBar(
actions: <Widget>[
IconButton(
icon: const Icon(Icons.settings),
onPressed: () {
controller.showPopupMenu(context);
},
),
],
),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
buildHeaderBridgeText(context),
buildHeaderBridgeSubText(context),
PlatformInfos.isWeb ||
PlatformInfos.isDesktop ||
PlatformInfos.isWindows ||
PlatformInfos.isMacOS
PlatformInfos.isDesktop ||
PlatformInfos.isWindows ||
PlatformInfos.isMacOS
? ElevatedButton(
onPressed: () {
// controller.handleRefresh();
},
child: Text(L10n.of(context)!.refreshList),
)
onPressed: () {
// controller.handleRefresh();
},
child: Text(L10n.of(context)!.refreshList),
)
: Container(),
const SizedBox(
height: 10,
Expand All @@ -50,22 +61,30 @@ class AddBridgeBody extends StatelessWidget {
physics: const AlwaysScrollableScrollPhysics(),
itemCount: SocialNetworkManager.socialNetworks.length,
itemBuilder: (BuildContext context, int index) {
final network =
SocialNetworkManager.socialNetworks[index];
if (!network.available) {
return const SizedBox();
}
return ListTile(
leading: controller.socialNetworks[index].logo,
leading: network.logo,
title: Text(
controller.socialNetworks[index].name,
network.name,
),
// Different build of subtle depending on the social network, for now only Instagram
subtitle: buildSubtitle(context, controller.socialNetworks[index]),
trailing: controller.socialNetworks[index].error == false
? const Icon(
CupertinoIcons.right_chevron,
)
: const Icon(
CupertinoIcons.refresh_bold,
),
subtitle: buildSubtitle(
context, controller.socialNetworks[index]),
trailing:
controller.socialNetworks[index].error == false
? const Icon(
CupertinoIcons.right_chevron,
)
: const Icon(
CupertinoIcons.refresh_bold,
),
// Different ways of connecting and disconnecting depending on the social network
onTap: () => controller.handleSocialNetworkAction(controller.socialNetworks[index]),
onTap: () => controller.handleSocialNetworkAction(
controller.socialNetworks[index]),
);
},
),
Expand Down
Loading

0 comments on commit 8e5935d

Please sign in to comment.