MLI-7 Manually restore purchases (#165)

* added `RestorePurchasesListTile`

* added `restorePurchases` to iap stub

* reordered settings

* migrated to iap 0.9.0

* migrated to iap 0.9.1

* use version in release commit

* Revert "use version in release commit"

This reverts commit 513b13eb96.

* migrated to iap 0.9.2

* allow manual restore if Pro features are not unlocked
This commit is contained in:
Vadim 2024-04-10 22:30:35 +02:00 committed by GitHub
parent 2117df2f11
commit 2f8bb983d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 32 additions and 7 deletions

View file

@ -32,6 +32,8 @@ class IAPProductsProviderState extends State<IAPProductsProvider> {
} }
Future<void> buy(IAPProductType type) async {} Future<void> buy(IAPProductType type) async {}
Future<void> restorePurchases() async {}
} }
class IAPProducts extends InheritedModel<IAPProductType> { class IAPProducts extends InheritedModel<IAPProductType> {

View file

@ -82,6 +82,7 @@
"primaryColor": "Primary color", "primaryColor": "Primary color",
"choosePrimaryColor": "Choose primary color", "choosePrimaryColor": "Choose primary color",
"about": "About", "about": "About",
"restorePurchases": "Restore purchases",
"sourceCode": "Source code", "sourceCode": "Source code",
"reportIssue": "Report an issue", "reportIssue": "Report an issue",
"writeEmail": "Write an email", "writeEmail": "Write an email",

View file

@ -82,6 +82,7 @@
"primaryColor": "Couleur primaire", "primaryColor": "Couleur primaire",
"choosePrimaryColor": "Choisir la couleur primaire", "choosePrimaryColor": "Choisir la couleur primaire",
"about": "À propos de l'application", "about": "À propos de l'application",
"restorePurchases": "Restaurer les achats",
"sourceCode": "Code source", "sourceCode": "Code source",
"reportIssue": "Rapporter un problème", "reportIssue": "Rapporter un problème",
"writeEmail": "Écrire un email", "writeEmail": "Écrire un email",

View file

@ -82,6 +82,7 @@
"primaryColor": "Основной цвет", "primaryColor": "Основной цвет",
"choosePrimaryColor": "Выберите основной цвет", "choosePrimaryColor": "Выберите основной цвет",
"about": "О приложении", "about": "О приложении",
"restorePurchases": "Восстановить покупки",
"sourceCode": "Исходный код", "sourceCode": "Исходный код",
"reportIssue": "Сообщить о проблеме", "reportIssue": "Сообщить о проблеме",
"writeEmail": "Написать на почту", "writeEmail": "Написать на почту",

View file

@ -82,6 +82,7 @@
"primaryColor": "主题颜色", "primaryColor": "主题颜色",
"choosePrimaryColor": "选择主题颜色", "choosePrimaryColor": "选择主题颜色",
"about": "关于", "about": "关于",
"restorePurchases": "恢复购买",
"sourceCode": "源代码", "sourceCode": "源代码",
"reportIssue": "报告问题", "reportIssue": "报告问题",
"writeEmail": "Email", "writeEmail": "Email",

View file

@ -0,0 +1,16 @@
import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart';
import 'package:m3_lightmeter_iap/m3_lightmeter_iap.dart';
class RestorePurchasesListTile extends StatelessWidget {
const RestorePurchasesListTile({super.key});
@override
Widget build(BuildContext context) {
return ListTile(
leading: const Icon(Icons.restore),
title: Text(S.of(context).restorePurchases),
onTap: IAPProductsProvider.of(context).restorePurchases,
);
}
}

View file

@ -1,10 +1,12 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:lightmeter/screens/settings/components/about/components/report_issue/widget_list_tile_report_issue.dart'; import 'package:lightmeter/screens/settings/components/about/components/report_issue/widget_list_tile_report_issue.dart';
import 'package:lightmeter/screens/settings/components/about/components/restore_purchases/widget_list_tile_restore_purchases.dart';
import 'package:lightmeter/screens/settings/components/about/components/source_code/widget_list_tile_source_code.dart'; import 'package:lightmeter/screens/settings/components/about/components/source_code/widget_list_tile_source_code.dart';
import 'package:lightmeter/screens/settings/components/about/components/version/widget_list_tile_version.dart'; import 'package:lightmeter/screens/settings/components/about/components/version/widget_list_tile_version.dart';
import 'package:lightmeter/screens/settings/components/about/components/write_email/widget_list_tile_write_email.dart'; import 'package:lightmeter/screens/settings/components/about/components/write_email/widget_list_tile_write_email.dart';
import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart'; import 'package:lightmeter/screens/settings/components/shared/settings_section/widget_settings_section.dart';
import 'package:lightmeter/utils/context_utils.dart';
class AboutSettingsSection extends StatelessWidget { class AboutSettingsSection extends StatelessWidget {
const AboutSettingsSection({super.key}); const AboutSettingsSection({super.key});
@ -13,11 +15,12 @@ class AboutSettingsSection extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SettingsSection( return SettingsSection(
title: S.of(context).about, title: S.of(context).about,
children: const [ children: [
SourceCodeListTile(), const SourceCodeListTile(),
ReportIssueListTile(), if (!context.isPro) const RestorePurchasesListTile(),
WriteEmailListTile(), const ReportIssueListTile(),
VersionListTile(), const WriteEmailListTile(),
const VersionListTile(),
], ],
); );
} }

View file

@ -29,13 +29,13 @@ dependencies:
m3_lightmeter_iap: m3_lightmeter_iap:
git: git:
url: "https://github.com/vodemn/m3_lightmeter_iap" url: "https://github.com/vodemn/m3_lightmeter_iap"
ref: v0.8.1 ref: v0.9.2
m3_lightmeter_resources: m3_lightmeter_resources:
git: git:
url: "https://github.com/vodemn/m3_lightmeter_resources" url: "https://github.com/vodemn/m3_lightmeter_resources"
ref: main ref: main
material_color_utilities: 0.5.0 material_color_utilities: 0.5.0
package_info_plus: 4.0.2 package_info_plus: 4.2.0
permission_handler: 10.4.3 permission_handler: 10.4.3
platform: 3.1.0 platform: 3.1.0
shared_preferences: 2.2.0 shared_preferences: 2.2.0