mirror of
https://github.com/ente-io/ente.git
synced 2025-08-13 01:27:17 +00:00
[auth] Delete unused code
This commit is contained in:
@@ -1,3 +0,0 @@
|
|||||||
import 'package:ente_auth/events/event.dart';
|
|
||||||
|
|
||||||
class OpenedSettingsEvent extends Event {}
|
|
@@ -1,17 +0,0 @@
|
|||||||
import 'dart:typed_data';
|
|
||||||
|
|
||||||
import "package:json_annotation/json_annotation.dart";
|
|
||||||
|
|
||||||
class Uint8ListConverter implements JsonConverter<Uint8List, List<int>> {
|
|
||||||
const Uint8ListConverter();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Uint8List fromJson(List<int>? json) {
|
|
||||||
return json == null ? Uint8List(0) : Uint8List.fromList(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
List<int> toJson(Uint8List object) {
|
|
||||||
return object.toList();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,73 +0,0 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
const visibilityVisible = 0;
|
|
||||||
const visibilityArchive = 1;
|
|
||||||
|
|
||||||
const magicKeyVisibility = 'visibility';
|
|
||||||
|
|
||||||
const pubMagicKeyEditedTime = 'editedTime';
|
|
||||||
const pubMagicKeyEditedName = 'editedName';
|
|
||||||
|
|
||||||
class MagicMetadata {
|
|
||||||
// 0 -> visible
|
|
||||||
// 1 -> archived
|
|
||||||
// 2 -> hidden etc?
|
|
||||||
int visibility;
|
|
||||||
|
|
||||||
MagicMetadata({required this.visibility});
|
|
||||||
|
|
||||||
factory MagicMetadata.fromEncodedJson(String encodedJson) =>
|
|
||||||
MagicMetadata.fromJson(jsonDecode(encodedJson));
|
|
||||||
|
|
||||||
factory MagicMetadata.fromJson(dynamic json) => MagicMetadata.fromMap(json);
|
|
||||||
|
|
||||||
static fromMap(Map<String, dynamic>? map) {
|
|
||||||
if (map == null) return null;
|
|
||||||
return MagicMetadata(
|
|
||||||
visibility: map[magicKeyVisibility] ?? visibilityVisible,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class PubMagicMetadata {
|
|
||||||
int? editedTime;
|
|
||||||
String? editedName;
|
|
||||||
|
|
||||||
PubMagicMetadata({this.editedTime, this.editedName});
|
|
||||||
|
|
||||||
factory PubMagicMetadata.fromEncodedJson(String encodedJson) =>
|
|
||||||
PubMagicMetadata.fromJson(jsonDecode(encodedJson));
|
|
||||||
|
|
||||||
factory PubMagicMetadata.fromJson(dynamic json) =>
|
|
||||||
PubMagicMetadata.fromMap(json);
|
|
||||||
|
|
||||||
static fromMap(Map<String, dynamic>? map) {
|
|
||||||
if (map == null) return null;
|
|
||||||
return PubMagicMetadata(
|
|
||||||
editedTime: map[pubMagicKeyEditedTime],
|
|
||||||
editedName: map[pubMagicKeyEditedName],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class CollectionMagicMetadata {
|
|
||||||
// 0 -> visible
|
|
||||||
// 1 -> archived
|
|
||||||
// 2 -> hidden etc?
|
|
||||||
int visibility;
|
|
||||||
|
|
||||||
CollectionMagicMetadata({required this.visibility});
|
|
||||||
|
|
||||||
factory CollectionMagicMetadata.fromEncodedJson(String encodedJson) =>
|
|
||||||
CollectionMagicMetadata.fromJson(jsonDecode(encodedJson));
|
|
||||||
|
|
||||||
factory CollectionMagicMetadata.fromJson(dynamic json) =>
|
|
||||||
CollectionMagicMetadata.fromMap(json);
|
|
||||||
|
|
||||||
static fromMap(Map<String, dynamic>? map) {
|
|
||||||
if (map == null) return null;
|
|
||||||
return CollectionMagicMetadata(
|
|
||||||
visibility: map[magicKeyVisibility] ?? visibilityVisible,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,6 +0,0 @@
|
|||||||
class PublicKey {
|
|
||||||
final String email;
|
|
||||||
final String publicKey;
|
|
||||||
|
|
||||||
PublicKey(this.email, this.publicKey);
|
|
||||||
}
|
|
@@ -1,23 +0,0 @@
|
|||||||
import 'package:ente_auth/core/configuration.dart';
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
|
|
||||||
class FeatureFlagService {
|
|
||||||
FeatureFlagService._privateConstructor();
|
|
||||||
static final FeatureFlagService instance =
|
|
||||||
FeatureFlagService._privateConstructor();
|
|
||||||
|
|
||||||
static final _internalUserIDs = const String.fromEnvironment(
|
|
||||||
"internal_user_ids",
|
|
||||||
defaultValue: "1,2,3,4,191,125,1580559962388044,1580559962392434,10000025",
|
|
||||||
).split(",").map((element) {
|
|
||||||
return int.parse(element);
|
|
||||||
}).toSet();
|
|
||||||
|
|
||||||
bool isInternalUserOrDebugBuild() {
|
|
||||||
final String? email = Configuration.instance.getEmail();
|
|
||||||
final userID = Configuration.instance.getUserID();
|
|
||||||
return (email != null && email.endsWith("@ente.io")) ||
|
|
||||||
_internalUserIDs.contains(userID) ||
|
|
||||||
kDebugMode;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,14 +0,0 @@
|
|||||||
import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
|
|
||||||
class UserStore {
|
|
||||||
UserStore._privateConstructor();
|
|
||||||
|
|
||||||
// ignore: unused_field
|
|
||||||
late SharedPreferences _preferences;
|
|
||||||
|
|
||||||
static final UserStore instance = UserStore._privateConstructor();
|
|
||||||
|
|
||||||
Future<void> init() async {
|
|
||||||
_preferences = await SharedPreferences.getInstance();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,25 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class BottomShadowWidget extends StatelessWidget {
|
|
||||||
final double offsetDy;
|
|
||||||
final Color? shadowColor;
|
|
||||||
const BottomShadowWidget({this.offsetDy = 28, this.shadowColor, super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Container(
|
|
||||||
height: 8,
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: Colors.transparent,
|
|
||||||
boxShadow: [
|
|
||||||
BoxShadow(
|
|
||||||
color: shadowColor ?? Theme.of(context).colorScheme.surface,
|
|
||||||
spreadRadius: 42,
|
|
||||||
blurRadius: 42,
|
|
||||||
offset: Offset(0, offsetDy), // changes position of shadow
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,49 +0,0 @@
|
|||||||
import 'package:ente_auth/ente_theme_data.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class LinearProgressDialog extends StatefulWidget {
|
|
||||||
final String message;
|
|
||||||
|
|
||||||
const LinearProgressDialog(this.message, {super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
LinearProgressDialogState createState() => LinearProgressDialogState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class LinearProgressDialogState extends State<LinearProgressDialog> {
|
|
||||||
double? _progress;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
_progress = 0;
|
|
||||||
super.initState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void setProgress(double progress) {
|
|
||||||
setState(() {
|
|
||||||
_progress = progress;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return PopScope(
|
|
||||||
canPop: false,
|
|
||||||
child: AlertDialog(
|
|
||||||
title: Text(
|
|
||||||
widget.message,
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 16,
|
|
||||||
),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
content: LinearProgressIndicator(
|
|
||||||
value: _progress,
|
|
||||||
valueColor: AlwaysStoppedAnimation<Color>(
|
|
||||||
Theme.of(context).colorScheme.alternativeColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,98 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'package:ente_auth/utils/dialog_util.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class RenameDialog extends StatefulWidget {
|
|
||||||
final String name;
|
|
||||||
final String type;
|
|
||||||
final int maxLength;
|
|
||||||
|
|
||||||
const RenameDialog(this.name, this.type, {super.key, this.maxLength = 100});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<RenameDialog> createState() => _RenameDialogState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _RenameDialogState extends State<RenameDialog> {
|
|
||||||
String? _newName;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
_newName = widget.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: const Text("Enter a new name"),
|
|
||||||
content: SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
TextFormField(
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintText: '${widget.type} name',
|
|
||||||
hintStyle: const TextStyle(
|
|
||||||
color: Colors.white30,
|
|
||||||
),
|
|
||||||
contentPadding: const EdgeInsets.all(12),
|
|
||||||
),
|
|
||||||
onChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
_newName = value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
autocorrect: false,
|
|
||||||
keyboardType: TextInputType.text,
|
|
||||||
initialValue: _newName,
|
|
||||||
autofocus: true,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
child: const Text(
|
|
||||||
"Cancel",
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.redAccent,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop(null);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
child: Text(
|
|
||||||
"Rename",
|
|
||||||
style: TextStyle(
|
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
if (_newName!.trim().isEmpty) {
|
|
||||||
showErrorDialog(
|
|
||||||
context,
|
|
||||||
"Empty name",
|
|
||||||
"${widget.type} name cannot be empty",
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (_newName!.trim().length > widget.maxLength) {
|
|
||||||
showErrorDialog(
|
|
||||||
context,
|
|
||||||
"Name too large",
|
|
||||||
"${widget.type} name should be less than ${widget.maxLength} characters",
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Navigator.of(context).pop(_newName!.trim());
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,41 +0,0 @@
|
|||||||
import 'package:ente_auth/core/event_bus.dart';
|
|
||||||
import 'package:ente_auth/events/opened_settings_event.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class HomeHeaderWidget extends StatefulWidget {
|
|
||||||
final Widget centerWidget;
|
|
||||||
const HomeHeaderWidget({required this.centerWidget, super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
State<HomeHeaderWidget> createState() => _HomeHeaderWidgetState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _HomeHeaderWidgetState extends State<HomeHeaderWidget> {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final hasNotch = View.of(context).viewPadding.top > 65;
|
|
||||||
return Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(4, hasNotch ? 4 : 8, 4, 4),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
IconButton(
|
|
||||||
visualDensity: const VisualDensity(horizontal: -2, vertical: -2),
|
|
||||||
onPressed: () {
|
|
||||||
Scaffold.of(context).openDrawer();
|
|
||||||
Bus.instance.fire(OpenedSettingsEvent());
|
|
||||||
},
|
|
||||||
splashColor: Colors.transparent,
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.menu_outlined,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
AnimatedSwitcher(
|
|
||||||
duration: const Duration(milliseconds: 250),
|
|
||||||
child: widget.centerWidget,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,69 +0,0 @@
|
|||||||
import 'package:ente_auth/l10n/l10n.dart';
|
|
||||||
import 'package:ente_auth/services/user_service.dart';
|
|
||||||
import 'package:ente_auth/theme/ente_theme.dart';
|
|
||||||
import 'package:ente_auth/ui/account/delete_account_page.dart';
|
|
||||||
import 'package:ente_auth/ui/components/captioned_text_widget.dart';
|
|
||||||
import 'package:ente_auth/ui/components/expandable_menu_item_widget.dart';
|
|
||||||
import 'package:ente_auth/ui/components/menu_item_widget.dart';
|
|
||||||
import 'package:ente_auth/ui/settings/common_settings.dart';
|
|
||||||
import 'package:ente_auth/utils/dialog_util.dart';
|
|
||||||
import 'package:ente_auth/utils/navigation_util.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class DangerSectionWidget extends StatelessWidget {
|
|
||||||
const DangerSectionWidget({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return ExpandableMenuItemWidget(
|
|
||||||
title: context.l10n.exit,
|
|
||||||
selectionOptionsWidget: _getSectionOptions(context),
|
|
||||||
leadingIcon: Icons.logout_outlined,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _getSectionOptions(BuildContext context) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
sectionOptionSpacing,
|
|
||||||
MenuItemWidget(
|
|
||||||
captionedTextWidget: CaptionedTextWidget(
|
|
||||||
title: context.l10n.logout,
|
|
||||||
),
|
|
||||||
pressedColor: getEnteColorScheme(context).fillFaint,
|
|
||||||
trailingIcon: Icons.chevron_right_outlined,
|
|
||||||
trailingIconIsMuted: true,
|
|
||||||
onTap: () async {
|
|
||||||
_onLogoutTapped(context);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
sectionOptionSpacing,
|
|
||||||
MenuItemWidget(
|
|
||||||
captionedTextWidget: CaptionedTextWidget(
|
|
||||||
title: context.l10n.deleteAccount,
|
|
||||||
),
|
|
||||||
pressedColor: getEnteColorScheme(context).fillFaint,
|
|
||||||
trailingIcon: Icons.chevron_right_outlined,
|
|
||||||
trailingIconIsMuted: true,
|
|
||||||
onTap: () async {
|
|
||||||
// ignore: unawaited_futures
|
|
||||||
routeToPage(context, const DeleteAccountPage());
|
|
||||||
},
|
|
||||||
),
|
|
||||||
sectionOptionSpacing,
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onLogoutTapped(BuildContext context) {
|
|
||||||
showChoiceActionSheet(
|
|
||||||
context,
|
|
||||||
title: context.l10n.areYouSureYouWantToLogout,
|
|
||||||
firstButtonLabel: context.l10n.yesLogout,
|
|
||||||
isCritical: true,
|
|
||||||
firstButtonOnTap: () async {
|
|
||||||
await UserService.instance.logout(context);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,94 +0,0 @@
|
|||||||
import 'package:ente_auth/core/configuration.dart';
|
|
||||||
import 'package:ente_auth/l10n/l10n.dart';
|
|
||||||
import 'package:ente_auth/ui/settings/common_settings.dart';
|
|
||||||
import 'package:ente_auth/ui/settings/settings_section_title.dart';
|
|
||||||
import 'package:ente_auth/ui/settings/settings_text_item.dart';
|
|
||||||
import 'package:ente_crypto_dart/ente_crypto_dart.dart';
|
|
||||||
import 'package:expandable/expandable.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class DebugSectionWidget extends StatelessWidget {
|
|
||||||
const DebugSectionWidget({super.key});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
// This is a debug only section not shown to end users, so these strings are
|
|
||||||
// not translated.
|
|
||||||
return ExpandablePanel(
|
|
||||||
header: const SettingsSectionTitle("Debug"),
|
|
||||||
collapsed: Container(),
|
|
||||||
expanded: _getSectionOptions(context),
|
|
||||||
theme: getExpandableTheme(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _getSectionOptions(BuildContext context) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
GestureDetector(
|
|
||||||
behavior: HitTestBehavior.translucent,
|
|
||||||
onTap: () async {
|
|
||||||
_showKeyAttributesDialog(context);
|
|
||||||
},
|
|
||||||
child: const SettingsTextItem(
|
|
||||||
text: "Key attributes",
|
|
||||||
icon: Icons.navigate_next,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _showKeyAttributesDialog(BuildContext context) {
|
|
||||||
final l10n = context.l10n;
|
|
||||||
final keyAttributes = Configuration.instance.getKeyAttributes()!;
|
|
||||||
final AlertDialog alert = AlertDialog(
|
|
||||||
title: const Text("key attributes"),
|
|
||||||
content: SingleChildScrollView(
|
|
||||||
child: Column(
|
|
||||||
children: [
|
|
||||||
const Text(
|
|
||||||
"Key",
|
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
Text(CryptoUtil.bin2base64(Configuration.instance.getKey()!)),
|
|
||||||
const Padding(padding: EdgeInsets.all(12)),
|
|
||||||
const Text(
|
|
||||||
"Encrypted Key",
|
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
Text(keyAttributes.encryptedKey),
|
|
||||||
const Padding(padding: EdgeInsets.all(12)),
|
|
||||||
const Text(
|
|
||||||
"Key Decryption Nonce",
|
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
Text(keyAttributes.keyDecryptionNonce),
|
|
||||||
const Padding(padding: EdgeInsets.all(12)),
|
|
||||||
const Text(
|
|
||||||
"KEK Salt",
|
|
||||||
style: TextStyle(fontWeight: FontWeight.bold),
|
|
||||||
),
|
|
||||||
Text(keyAttributes.kekSalt),
|
|
||||||
const Padding(padding: EdgeInsets.all(12)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
actions: [
|
|
||||||
TextButton(
|
|
||||||
child: Text(l10n.ok),
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context, rootNavigator: true).pop('dialog');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return alert;
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,34 +0,0 @@
|
|||||||
import 'package:ente_auth/l10n/l10n.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
|
||||||
|
|
||||||
class MadeWithLoveWidget extends StatelessWidget {
|
|
||||||
const MadeWithLoveWidget({
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final l10n = context.l10n;
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
launchUrl(Uri.parse("https://ente.io"));
|
|
||||||
},
|
|
||||||
child: RichText(
|
|
||||||
text: TextSpan(
|
|
||||||
text: l10n.madeWithLoveAtPrefix,
|
|
||||||
style: DefaultTextStyle.of(context).style,
|
|
||||||
children: const <TextSpan>[
|
|
||||||
TextSpan(
|
|
||||||
text: 'ente.io',
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: Colors.green,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,35 +0,0 @@
|
|||||||
|
|
||||||
|
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
|
|
||||||
class SettingsTextItem extends StatelessWidget {
|
|
||||||
final String text;
|
|
||||||
final IconData icon;
|
|
||||||
const SettingsTextItem({
|
|
||||||
super.key,
|
|
||||||
required this.text,
|
|
||||||
required this.icon,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Padding(padding: EdgeInsets.all(Platform.isIOS ? 4 : 6)),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: [
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.centerLeft,
|
|
||||||
child: Text(text, style: Theme.of(context).textTheme.titleMedium),
|
|
||||||
),
|
|
||||||
Icon(icon),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Padding(padding: EdgeInsets.all(Platform.isIOS ? 4 : 6)),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,83 +0,0 @@
|
|||||||
import 'package:dotted_border/dotted_border.dart';
|
|
||||||
import 'package:ente_auth/core/configuration.dart';
|
|
||||||
import 'package:ente_auth/l10n/l10n.dart';
|
|
||||||
import 'package:ente_auth/models/subscription.dart';
|
|
||||||
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({
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
final l10n = context.l10n;
|
|
||||||
|
|
||||||
// fetch
|
|
||||||
if (Configuration.instance.hasConfiguredAccount()) {
|
|
||||||
return FutureBuilder<Subscription>(
|
|
||||||
future: BillingService.instance.getSubscription(),
|
|
||||||
builder: (context, snapshot) {
|
|
||||||
if (snapshot.hasData) {
|
|
||||||
final subscription = snapshot.data;
|
|
||||||
if (subscription != null && subscription.productID == "free") {
|
|
||||||
return buildWidget(l10n, context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return const SizedBox.shrink();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return buildWidget(l10n, context);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget buildWidget(AppLocalizations l10n, BuildContext context) {
|
|
||||||
return GestureDetector(
|
|
||||||
onTap: () {
|
|
||||||
launchUrl(Uri.parse("https://ente.io"));
|
|
||||||
},
|
|
||||||
child: DottedBorder(
|
|
||||||
borderType: BorderType.RRect,
|
|
||||||
radius: const Radius.circular(12),
|
|
||||||
padding: const EdgeInsets.all(6),
|
|
||||||
dashPattern: const <double>[3, 3],
|
|
||||||
color: getEnteColorScheme(context).primaryGreen,
|
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(12)),
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 6),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
StyledText(
|
|
||||||
text: l10n.supportDevs,
|
|
||||||
style: getEnteTextTheme(context).large,
|
|
||||||
tags: {
|
|
||||||
'bold-green': StyledTextTag(
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: getEnteColorScheme(context).primaryGreen,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
),
|
|
||||||
const Padding(padding: EdgeInsets.all(6)),
|
|
||||||
Text(
|
|
||||||
l10n.supportDiscount,
|
|
||||||
style: const TextStyle(
|
|
||||||
color: Colors.grey,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1 +0,0 @@
|
|||||||
// TODO Implement this library.
|
|
Reference in New Issue
Block a user