merge conflict
This commit is contained in:
commit
60df6aa7e1
13 changed files with 171 additions and 108 deletions
|
|
@ -3790,7 +3790,7 @@
|
|||
}
|
||||
},
|
||||
"freeTrialDesc": "New users recieve a one week free trial of Pangea Chat",
|
||||
"activateTrial": "Activate Trial",
|
||||
"activateTrial": "Activate Free Trial",
|
||||
"inNoSpaces": "You are not a member of any classes or exchanges",
|
||||
"successfullySubscribed": "You have successfully subscribed!",
|
||||
"clickToManageSubscription": "Click here to manage your subscription.",
|
||||
|
|
@ -3949,5 +3949,6 @@
|
|||
}
|
||||
},
|
||||
"kickBotWarning": "Kicking Pangea Bot will remove the conversation bot from this chat.",
|
||||
"joinToView": "Join this room to view details"
|
||||
"joinToView": "Join this room to view details",
|
||||
"refresh": "Refresh"
|
||||
}
|
||||
|
|
@ -4469,7 +4469,6 @@
|
|||
}
|
||||
},
|
||||
"freeTrialDesc": "Los nuevos usuarios reciben una semana de prueba gratuita de Pangea Chat",
|
||||
"activateTrial": "Activar prueba",
|
||||
"successfullySubscribed": "Se ha suscrito correctamente.",
|
||||
"clickToManageSubscription": "Haga clic aquí para gestionar su suscripción.",
|
||||
"emptyInviteWarning": "Añade este chat a una clase o intercambio para invitar a otros usuarios.",
|
||||
|
|
@ -4582,5 +4581,7 @@
|
|||
}
|
||||
},
|
||||
"selectToDefine": "Haga doble clic en una palabra para ver su definición.",
|
||||
"kickBotWarning": "Patear Pangea Bot eliminará el bot de conversación de este chat."
|
||||
"kickBotWarning": "Patear Pangea Bot eliminará el bot de conversación de este chat.",
|
||||
"activateTrial": "Activar prueba gratuita",
|
||||
"refresh": "Actualizar"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pages/chat_details/chat_details.dart';
|
||||
import 'package:fluffychat/pages/chat_details/participant_list_item.dart';
|
||||
|
|
@ -531,18 +532,33 @@ class ChatDetailsView extends StatelessWidget {
|
|||
Icons.archive_outlined,
|
||||
),
|
||||
),
|
||||
onTap: () => showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () async {
|
||||
room.isSpace
|
||||
? await archiveSpace(
|
||||
room,
|
||||
Matrix.of(context).client,
|
||||
)
|
||||
: await room.leave();
|
||||
context.go('/rooms');
|
||||
},
|
||||
),
|
||||
onTap: () async {
|
||||
final confirmed = await showOkCancelAlertDialog(
|
||||
useRootNavigator: false,
|
||||
context: context,
|
||||
title: L10n.of(context)!.areYouSure,
|
||||
okLabel: L10n.of(context)!.ok,
|
||||
cancelLabel: L10n.of(context)!.cancel,
|
||||
message:
|
||||
L10n.of(context)!.archiveRoomDescription,
|
||||
);
|
||||
if (confirmed == OkCancelResult.ok) {
|
||||
final success = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () async {
|
||||
room.isSpace
|
||||
? await archiveSpace(
|
||||
room,
|
||||
Matrix.of(context).client,
|
||||
)
|
||||
: await room.leave();
|
||||
},
|
||||
);
|
||||
if (success.error == null) {
|
||||
context.go('/rooms');
|
||||
}
|
||||
}
|
||||
},
|
||||
),
|
||||
if (room.isRoomAdmin && !room.isDirectChat)
|
||||
SwitchListTile.adaptive(
|
||||
|
|
|
|||
|
|
@ -523,12 +523,25 @@ class _SpaceViewState extends State<SpaceView> {
|
|||
MatrixLocals(L10n.of(context)!),
|
||||
),
|
||||
),
|
||||
trailing: IconButton(
|
||||
icon: loading
|
||||
? const CircularProgressIndicator.adaptive(strokeWidth: 2)
|
||||
: const Icon(Icons.refresh_outlined),
|
||||
onPressed: loading ? null : _refresh,
|
||||
// #Pangea
|
||||
// trailing: IconButton(
|
||||
// icon: loading
|
||||
// ? const CircularProgressIndicator.adaptive(strokeWidth: 2)
|
||||
// : const Icon(Icons.refresh_outlined),
|
||||
// onPressed: loading ? null : _refresh,
|
||||
// ),
|
||||
trailing: Tooltip(
|
||||
message: L10n.of(context)!.refresh,
|
||||
child: IconButton(
|
||||
icon: loading
|
||||
? const CircularProgressIndicator.adaptive(
|
||||
strokeWidth: 2,
|
||||
)
|
||||
: const Icon(Icons.refresh_outlined),
|
||||
onPressed: loading ? null : _refresh,
|
||||
),
|
||||
),
|
||||
// Pangea#
|
||||
),
|
||||
),
|
||||
Builder(
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pangea/config/environment.dart';
|
||||
import 'package:fluffychat/utils/fluffy_share.dart';
|
||||
import 'package:fluffychat/widgets/avatar.dart';
|
||||
import 'package:fluffychat/widgets/matrix.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:future_loading_dialog/future_loading_dialog.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
import 'settings.dart';
|
||||
|
||||
class SettingsView extends StatelessWidget {
|
||||
|
|
@ -208,7 +208,22 @@ class SettingsView extends StatelessWidget {
|
|||
ListTile(
|
||||
leading: const Icon(Icons.help_outline_outlined),
|
||||
title: Text(L10n.of(context)!.help),
|
||||
onTap: () => launchUrlString(AppConfig.supportUrl),
|
||||
// #Pangea
|
||||
// onTap: () => launchUrlString(AppConfig.supportUrl),
|
||||
onTap: () async {
|
||||
await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () async {
|
||||
final String roomId =
|
||||
await Matrix.of(context).client.startDirectChat(
|
||||
Environment.supportUserId,
|
||||
enableEncryption: false,
|
||||
);
|
||||
context.go('/rooms/$roomId');
|
||||
},
|
||||
);
|
||||
},
|
||||
// Pangea#
|
||||
trailing: const Icon(Icons.open_in_new_outlined),
|
||||
),
|
||||
ListTile(
|
||||
|
|
|
|||
|
|
@ -35,12 +35,6 @@ class Environment {
|
|||
'e6fa9fa97031ba0c852efe78457922f278a2fbc109752fe18e465337699e9873';
|
||||
}
|
||||
|
||||
//Question for Jordan - does the client ever pass this to the server?
|
||||
static String get googleAuthKey {
|
||||
return dotenv.env['GOOGLE_AUTH_KEY'] ??
|
||||
'466850640825-qegdiq3mpj3h5e0e79ud5hnnq2c22mi3.apps.googleusercontent.com';
|
||||
}
|
||||
|
||||
static String get sentryDsn {
|
||||
return dotenv.env["SENTRY_DSN"] ??
|
||||
'https://c2fd19ab2cdc4ebb939a32d01c0e9fa1@o225078.ingest.sentry.io/1376295';
|
||||
|
|
@ -74,4 +68,8 @@ class Environment {
|
|||
return dotenv.env["STRIPE_MANAGEMENT_LINK"] ??
|
||||
'https://billing.stripe.com/p/login/dR6dSkf5p6rBc4EcMM';
|
||||
}
|
||||
|
||||
static String get supportUserId {
|
||||
return isStaging ? '@support:staging.pangea.chat' : '@support:pangea.chat';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -260,6 +260,7 @@ class UserController extends BaseController {
|
|||
final PUserModel newUserModel = await PUserRepo.repoCreatePangeaUser(
|
||||
userID: userId!,
|
||||
fullName: fullname,
|
||||
dob: dob,
|
||||
matrixAccessToken: _matrixAccessToken!,
|
||||
);
|
||||
await _savePUserModel(newUserModel);
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class SubscriptionManagementController extends State<SubscriptionManagement> {
|
|||
"";
|
||||
|
||||
bool get showManagementOptions {
|
||||
if (!currentSubscriptionAvailable) {
|
||||
if (!currentSubscriptionAvailable || isNewUserTrial) {
|
||||
return false;
|
||||
}
|
||||
if (subscriptionController.subscription!.purchasedOnWeb) {
|
||||
|
|
@ -102,7 +102,9 @@ class SubscriptionManagementController extends State<SubscriptionManagement> {
|
|||
context,
|
||||
isPromo: isPromo,
|
||||
);
|
||||
setState(() {});
|
||||
setState(() {
|
||||
selectedSubscription = null;
|
||||
});
|
||||
} catch (err) {
|
||||
showOkAlertDialog(
|
||||
context: context,
|
||||
|
|
@ -164,6 +166,11 @@ class SubscriptionManagementController extends State<SubscriptionManagement> {
|
|||
setState(() => selectedSubscription = subscription);
|
||||
}
|
||||
|
||||
bool isCurrentSubscription(SubscriptionDetails subscription) =>
|
||||
subscriptionController.subscription?.currentSubscription ==
|
||||
subscription ||
|
||||
isNewUserTrial && subscription.isTrial;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => SettingsSubscriptionView(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,44 @@ class SettingsSubscriptionView extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final List<Widget> managementButtons = [
|
||||
if (controller.currentSubscriptionAvailable)
|
||||
ListTile(
|
||||
title: Text(L10n.of(context)!.currentSubscription),
|
||||
subtitle: Text(controller.currentSubscriptionTitle),
|
||||
trailing: Text(controller.currentSubscriptionPrice),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(L10n.of(context)!.cancelSubscription),
|
||||
enabled: controller.showManagementOptions,
|
||||
onTap: () => controller.launchMangementUrl(
|
||||
ManagementOption.cancel,
|
||||
),
|
||||
trailing: const Icon(Icons.cancel_outlined),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
title: Text(L10n.of(context)!.paymentMethod),
|
||||
trailing: const Icon(Icons.credit_card),
|
||||
onTap: () => controller.launchMangementUrl(
|
||||
ManagementOption.paymentMethod,
|
||||
),
|
||||
enabled: controller.showManagementOptions,
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10n.of(context)!.paymentHistory),
|
||||
trailing: const Icon(Icons.keyboard_arrow_right_outlined),
|
||||
onTap: () => controller.launchMangementUrl(
|
||||
ManagementOption.history,
|
||||
),
|
||||
enabled: controller.showManagementOptions,
|
||||
),
|
||||
],
|
||||
),
|
||||
];
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
centerTitle: true,
|
||||
|
|
@ -23,53 +61,19 @@ class SettingsSubscriptionView extends StatelessWidget {
|
|||
body: ListTileTheme(
|
||||
iconColor: Theme.of(context).textTheme.bodyLarge!.color,
|
||||
child: MaxWidthBody(
|
||||
child: !(controller.subscriptionController.isSubscribed)
|
||||
? ChangeSubscription(controller: controller)
|
||||
: Column(
|
||||
children: [
|
||||
if (controller.currentSubscriptionAvailable)
|
||||
ListTile(
|
||||
title: Text(L10n.of(context)!.currentSubscription),
|
||||
subtitle: Text(controller.currentSubscriptionTitle),
|
||||
trailing: Text(controller.currentSubscriptionPrice),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(L10n.of(context)!.cancelSubscription),
|
||||
enabled: controller.showManagementOptions,
|
||||
onTap: () => controller.launchMangementUrl(
|
||||
ManagementOption.cancel,
|
||||
),
|
||||
trailing: const Icon(Icons.cancel_outlined),
|
||||
),
|
||||
const Divider(height: 1),
|
||||
ListTile(
|
||||
title: Text(L10n.of(context)!.paymentMethod),
|
||||
trailing: const Icon(Icons.credit_card),
|
||||
onTap: () => controller.launchMangementUrl(
|
||||
ManagementOption.paymentMethod,
|
||||
),
|
||||
enabled: controller.showManagementOptions,
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10n.of(context)!.paymentHistory),
|
||||
trailing:
|
||||
const Icon(Icons.keyboard_arrow_right_outlined),
|
||||
onTap: () => controller.launchMangementUrl(
|
||||
ManagementOption.history,
|
||||
),
|
||||
enabled: controller.showManagementOptions,
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 50),
|
||||
if (!(controller.showManagementOptions))
|
||||
ManagementNotAvailableWarning(
|
||||
controller: controller,
|
||||
),
|
||||
],
|
||||
child: Column(
|
||||
children: [
|
||||
if (controller.subscriptionController.isSubscribed &&
|
||||
!controller.showManagementOptions)
|
||||
ManagementNotAvailableWarning(
|
||||
controller: controller,
|
||||
),
|
||||
if (!(controller.subscriptionController.isSubscribed) ||
|
||||
controller.isNewUserTrial)
|
||||
ChangeSubscription(controller: controller),
|
||||
if (controller.showManagementOptions) ...managementButtons,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import '../network/urls.dart';
|
|||
class PUserRepo {
|
||||
static Future<PUserModel> repoCreatePangeaUser({
|
||||
required String userID,
|
||||
required String dob,
|
||||
required fullName,
|
||||
required String matrixAccessToken,
|
||||
}) async {
|
||||
|
|
@ -24,6 +25,7 @@ class PUserRepo {
|
|||
final Map<String, dynamic> body = {
|
||||
ModelKey.userFullName: fullName,
|
||||
ModelKey.userPangeaUserId: userID,
|
||||
ModelKey.userDateOfBirth: dob,
|
||||
};
|
||||
final Response res = await req.post(
|
||||
url: PApiUrls.createUser,
|
||||
|
|
|
|||
|
|
@ -40,7 +40,8 @@ class SubscriptionButtons extends StatelessWidget {
|
|||
selected: controller.selectedSubscription == subscription,
|
||||
selectedTileColor:
|
||||
Theme.of(context).colorScheme.secondary.withAlpha(16),
|
||||
enabled: !subscription.isTrial || inTrialWindow,
|
||||
enabled: (!subscription.isTrial || inTrialWindow) &&
|
||||
!controller.isCurrentSubscription(subscription),
|
||||
onTap: () {
|
||||
controller.selectSubscription(subscription);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import 'package:fluffychat/pangea/constants/pangea_event_types.dart';
|
|||
import 'package:fluffychat/utils/custom_http_client.dart';
|
||||
import 'package:fluffychat/utils/custom_image_resizer.dart';
|
||||
import 'package:fluffychat/utils/init_with_restore.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/flutter_hive_collections_database.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
|
|
@ -122,7 +121,9 @@ abstract class ClientManager {
|
|||
},
|
||||
logLevel: kReleaseMode ? Level.warning : Level.verbose,
|
||||
databaseBuilder: flutterMatrixSdkDatabaseBuilder,
|
||||
legacyDatabaseBuilder: FlutterHiveCollectionsDatabase.databaseBuilder,
|
||||
// #Pangea
|
||||
// legacyDatabaseBuilder: FlutterHiveCollectionsDatabase.databaseBuilder,
|
||||
// Pangea#
|
||||
supportedLoginTypes: {
|
||||
AuthenticationTypes.password,
|
||||
AuthenticationTypes.sso,
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:fluffychat/pangea/utils/error_handler.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/flutter_hive_collections_database.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
|
|
@ -12,11 +13,6 @@ import 'package:sqflite_common_ffi/sqflite_ffi.dart' as ffi;
|
|||
import 'package:sqflite_sqlcipher/sqflite.dart';
|
||||
import 'package:universal_html/html.dart' as html;
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/utils/client_manager.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/flutter_hive_collections_database.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
|
||||
Future<DatabaseApi> flutterMatrixSdkDatabaseBuilder(Client client) async {
|
||||
MatrixSdkDatabase? database;
|
||||
try {
|
||||
|
|
@ -24,24 +20,31 @@ Future<DatabaseApi> flutterMatrixSdkDatabaseBuilder(Client client) async {
|
|||
await database.open();
|
||||
return database;
|
||||
} catch (e) {
|
||||
// #Pangea
|
||||
ErrorHandler.logError(
|
||||
e: e,
|
||||
m: 'Unable to init database',
|
||||
s: StackTrace.current,
|
||||
);
|
||||
// Try to delete database so that it can created again on next init:
|
||||
database?.delete().catchError(
|
||||
(e, s) => Logs().w(
|
||||
'Unable to delete database, after failed construction',
|
||||
e,
|
||||
s,
|
||||
),
|
||||
);
|
||||
// database?.delete().catchError(
|
||||
// (e, s) => Logs().w(
|
||||
// 'Unable to delete database, after failed construction',
|
||||
// e,
|
||||
// s,
|
||||
// ),
|
||||
// );
|
||||
|
||||
// Send error notification:
|
||||
final l10n = lookupL10n(PlatformDispatcher.instance.locale);
|
||||
ClientManager.sendInitNotification(
|
||||
l10n.initAppError,
|
||||
l10n.databaseBuildErrorBody(
|
||||
AppConfig.newIssueUrl.toString(),
|
||||
e.toString(),
|
||||
),
|
||||
);
|
||||
// final l10n = lookupL10n(PlatformDispatcher.instance.locale);
|
||||
// ClientManager.sendInitNotification(
|
||||
// l10n.initAppError,
|
||||
// l10n.databaseBuildErrorBody(
|
||||
// AppConfig.newIssueUrl.toString(),
|
||||
// e.toString(),
|
||||
// ),
|
||||
// );
|
||||
// Pangea#
|
||||
|
||||
return FlutterHiveCollectionsDatabase.databaseBuilder(client);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue