Merge pull request #73 from ente-io/ente_photos_upgrade

Hook for development support
This commit is contained in:
Neeraj Gupta 2023-03-15 18:17:36 +05:30 committed by GitHub
commit 4bf0c5d4bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 94 additions and 3 deletions

View file

@ -55,6 +55,8 @@
"incorrectPassword": "Incorrect password",
"welcomeBackTitle": "Welcome back!",
"madeWithLoveAtPrefix": "made with ❤️ at ",
"supportDevs" : "Subscribe to <bold-green>ente Photos</bold-green> to support this project.",
"supportDiscount" : "Use coupon code \"AUTH\" to get 10% off first year",
"changeEmail": "change email",
"ok": "OK",
"cancel": "Cancel",

View file

@ -28,6 +28,7 @@ class EnteColorScheme {
final Color strokeFaint;
// Fixed Colors
final Color primaryGreen;
final Color primary700;
final Color primary500;
final Color primary400;
@ -53,6 +54,7 @@ class EnteColorScheme {
this.strokeBase,
this.strokeMuted,
this.strokeFaint, {
this.primaryGreen = _primaryGreen,
this.primary700 = _primary700,
this.primary500 = _primary500,
this.primary400 = _primary400,
@ -143,6 +145,8 @@ const Color strokeFaintDark = Color.fromRGBO(255, 255, 255, 0.16);
// Fixed Colors
const Color _primaryGreen = Color.fromRGBO(29, 185, 84, 1);
const Color _primary700 = Color.fromARGB(255, 164, 0, 182);
const Color _primary500 = Color.fromARGB(255, 204, 10, 101);
const Color _primary400 = Color.fromARGB(255, 122, 41, 193);

View file

@ -0,0 +1,68 @@
import 'dart:io';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/models/subscription.dart';
// ignore: import_of_legacy_library_into_null_safe
import 'package:ente_auth/services/billing_service.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:flutter/material.dart';
import 'package:styled_text/styled_text.dart';
import 'package:url_launcher/url_launcher.dart';
class SupportDevWidget extends StatelessWidget {
const SupportDevWidget({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
final l10n = context.l10n;
// fetch
return FutureBuilder<Subscription>(
future: BillingService.instance.fetchSubscription(),
builder: (context, snapshot) {
if (snapshot.hasData) {
final subscription = snapshot.data;
if (subscription != null && subscription.productID != "free") {
return GestureDetector(
onTap: () {
launchUrl(Uri.parse("https://ente.io"));
},
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 12.0, horizontal: 6),
child: Column(
children: [
StyledText(
text: l10n.supportDevs,
tags: {
'bold-green': StyledTextTag(
style: TextStyle(
fontWeight: FontWeight.bold,
color: getEnteColorScheme(context).primaryGreen,
),
),
},
),
const Padding(padding: EdgeInsets.all(6)),
Platform.isAndroid
? Text(
l10n.supportDiscount,
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.grey,
),
)
: const SizedBox.shrink(),
],
),
),
);
}
}
return const SizedBox.shrink();
},
);
}
}

View file

@ -9,9 +9,9 @@ import 'package:ente_auth/ui/settings/account_section_widget.dart';
import 'package:ente_auth/ui/settings/app_version_widget.dart';
import 'package:ente_auth/ui/settings/danger_section_widget.dart';
import 'package:ente_auth/ui/settings/data_section_widget.dart';
import 'package:ente_auth/ui/settings/made_with_love_widget.dart';
import 'package:ente_auth/ui/settings/security_section_widget.dart';
import 'package:ente_auth/ui/settings/social_section_widget.dart';
import 'package:ente_auth/ui/settings/support_dev_widget.dart';
import 'package:ente_auth/ui/settings/support_section_widget.dart';
import 'package:ente_auth/ui/settings/theme_switch_widget.dart';
import 'package:ente_auth/ui/settings/title_bar_widget.dart';
@ -84,7 +84,7 @@ class SettingsPage extends StatelessWidget {
sectionSpacing,
const DangerSectionWidget(),
const AppVersionWidget(),
const MadeWithLoveWidget(),
const SupportDevWidget(),
const Padding(
padding: EdgeInsets.only(bottom: 60),
),

View file

@ -1307,6 +1307,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
styled_text:
dependency: "direct main"
description:
name: styled_text
sha256: f72928d1ebe8cb149e3b34a689cb1ddca696b808187cf40ac3a0bd183dff379c
url: "https://pub.dev"
source: hosted
version: "7.0.0"
synchronized:
dependency: transitive
description:
@ -1515,6 +1523,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.1.0"
xmlstream:
dependency: transitive
description:
name: xmlstream
sha256: "2d10c69a9d5fc46f71798b80ee6db15bc0d5bf560fdbdd264776cbeee0c83631"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
yaml:
dependency: transitive
description:
@ -1525,4 +1541,4 @@ packages:
version: "3.1.1"
sdks:
dart: ">=2.18.0 <3.0.0"
flutter: ">=3.3.0"
flutter: ">=3.7.0"

View file

@ -62,6 +62,7 @@ dependencies:
shared_preferences: ^2.0.5
sqflite: ^2.1.0
step_progress_indicator: ^1.0.2
styled_text: ^7.0.0
url_launcher: ^6.1.5
uuid: ^3.0.4