refresh button tooltip + message explaining archive, direct chat with support on help button click, ability to purchase subscription if in trial
This commit is contained in:
parent
bc3a942517
commit
1623bdf005
11 changed files with 143 additions and 78 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.",
|
||||
|
|
@ -3948,5 +3948,6 @@
|
|||
"age": {}
|
||||
}
|
||||
},
|
||||
"kickBotWarning": "Kicking Pangea Bot will remove the conversation bot from this chat."
|
||||
"kickBotWarning": "Kicking Pangea Bot will remove the conversation bot from this chat.",
|
||||
"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(
|
||||
|
|
|
|||
|
|
@ -68,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);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue