TF-3985 Navigate Paywall url when click Increase your space button
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import 'package:get/get.dart';
|
||||
import 'package:tmail_ui_user/features/base/interactors_bindings.dart';
|
||||
import 'package:tmail_ui_user/features/mailbox_dashboard/data/network/linagora_ecosystem_api.dart';
|
||||
import 'package:tmail_ui_user/features/paywall/data/datasource/paywall_datasource.dart';
|
||||
import 'package:tmail_ui_user/features/paywall/data/datasource_impl/paywall_datasource_impl.dart';
|
||||
import 'package:tmail_ui_user/features/paywall/data/repository/paywall_repository_impl.dart';
|
||||
import 'package:tmail_ui_user/features/paywall/domain/repository/paywall_repository.dart';
|
||||
import 'package:tmail_ui_user/features/paywall/domain/usecases/get_paywall_url_interactor.dart';
|
||||
import 'package:tmail_ui_user/main/exceptions/remote_exception_thrower.dart';
|
||||
|
||||
class PaywallBindings extends InteractorsBindings {
|
||||
@override
|
||||
void bindingsDataSource() {
|
||||
Get.lazyPut<PaywallDatasource>(() => Get.find<PaywallDatasourceImpl>());
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsDataSourceImpl() {
|
||||
Get.lazyPut(
|
||||
() => PaywallDatasourceImpl(
|
||||
Get.find<LinagoraEcosystemApi>(),
|
||||
Get.find<RemoteExceptionThrower>(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsInteractor() {
|
||||
Get.lazyPut(() => GetPaywallUrlInteractor(Get.find<PaywallRepository>()));
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsRepository() {
|
||||
Get.lazyPut<PaywallRepository>(() => Get.find<PaywallRepositoryImpl>());
|
||||
}
|
||||
|
||||
@override
|
||||
void bindingsRepositoryImpl() {
|
||||
Get.lazyPut(() => PaywallRepositoryImpl(Get.find<PaywallDatasource>()));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
class PaywallUtils {
|
||||
const PaywallUtils._();
|
||||
|
||||
/// Builds a paywall URL from a template.
|
||||
///
|
||||
/// - Supports both raw placeholders (`{localPart}`, `{domainName}`)
|
||||
/// and URL-encoded placeholders (`%7BlocalPart%7D`, `%7BdomainName%7D`).
|
||||
/// - If [localPart] or [domainName] is not provided, the placeholder
|
||||
/// is removed.
|
||||
static String buildPaywallUrlFromTemplate({
|
||||
required String template,
|
||||
String? localPart,
|
||||
String? domainName,
|
||||
}) {
|
||||
final replacements = {
|
||||
'{localPart}': localPart ?? '',
|
||||
'{domainName}': domainName ?? '',
|
||||
Uri.encodeComponent('{localPart}'): localPart ?? '',
|
||||
Uri.encodeComponent('{domainName}'): domainName ?? '',
|
||||
};
|
||||
|
||||
var result = template;
|
||||
replacements.forEach((placeholder, value) {
|
||||
result = result.replaceAll(placeholder, value);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user