Browse Source

Merge pull request #566 from ente-io/clean_up_2

Vishnu Mohandas 2 năm trước cách đây
mục cha
commit
5b9be9202c

+ 0 - 13
lib/core/cache/thumbnail_cache_manager.dart

@@ -1,13 +0,0 @@
-
-
-import 'package:flutter_cache_manager/flutter_cache_manager.dart';
-
-class ThumbnailCacheManager {
-  static const key = 'cached-thumbnail-data';
-  static CacheManager instance = CacheManager(
-    Config(
-      key,
-      maxNrOfCacheObjects: 2500,
-    ),
-  );
-}

+ 0 - 1
lib/models/ignored_file.dart

@@ -1,7 +1,6 @@
 import 'package:photos/models/trash_file.dart';
 import 'package:photos/models/trash_file.dart';
 
 
 const kIgnoreReasonTrash = "trash";
 const kIgnoreReasonTrash = "trash";
-const kIgnoreReasonInvalidFile = "invalidFile";
 
 
 class IgnoredFile {
 class IgnoredFile {
   final String? localID;
   final String? localID;

+ 0 - 137
lib/ui/account/email_entry_page.dart

@@ -1,7 +1,5 @@
 // @dart=2.9
 // @dart=2.9
 
 
-import 'dart:io';
-
 import 'package:email_validator/email_validator.dart';
 import 'package:email_validator/email_validator.dart';
 import 'package:flutter/gestures.dart';
 import 'package:flutter/gestures.dart';
 import 'package:flutter/material.dart';
 import 'package:flutter/material.dart';
@@ -9,13 +7,9 @@ import 'package:flutter/services.dart';
 import 'package:password_strength/password_strength.dart';
 import 'package:password_strength/password_strength.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/core/configuration.dart';
 import 'package:photos/ente_theme_data.dart';
 import 'package:photos/ente_theme_data.dart';
-import 'package:photos/models/billing_plan.dart';
-import 'package:photos/services/billing_service.dart';
 import 'package:photos/services/user_service.dart';
 import 'package:photos/services/user_service.dart';
 import 'package:photos/ui/common/dynamic_fab.dart';
 import 'package:photos/ui/common/dynamic_fab.dart';
-import 'package:photos/ui/common/loading_widget.dart';
 import 'package:photos/ui/common/web_page.dart';
 import 'package:photos/ui/common/web_page.dart';
-import 'package:photos/utils/data_util.dart';
 import 'package:step_progress_indicator/step_progress_indicator.dart';
 import 'package:step_progress_indicator/step_progress_indicator.dart';
 
 
 class EmailEntryPage extends StatefulWidget {
 class EmailEntryPage extends StatefulWidget {
@@ -502,134 +496,3 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
         _passwordIsValid;
         _passwordIsValid;
   }
   }
 }
 }
-
-class PricingWidget extends StatelessWidget {
-  const PricingWidget({
-    Key key,
-  }) : super(key: key);
-
-  @override
-  Widget build(BuildContext context) {
-    return FutureBuilder<BillingPlans>(
-      future: BillingService.instance.getBillingPlans(),
-      builder: (BuildContext context, AsyncSnapshot snapshot) {
-        if (snapshot.hasData) {
-          return _buildPlans(context, snapshot.data);
-        } else if (snapshot.hasError) {
-          return const Text("Oops, Something went wrong.");
-        }
-        return const EnteLoadingWidget();
-      },
-    );
-  }
-
-  Container _buildPlans(BuildContext context, BillingPlans plans) {
-    final planWidgets = <BillingPlanWidget>[];
-    for (final plan in plans.plans) {
-      final productID = Platform.isAndroid ? plan.androidID : plan.iosID;
-      if (productID != null && productID.isNotEmpty) {
-        planWidgets.add(BillingPlanWidget(plan));
-      }
-    }
-    final freePlan = plans.freePlan;
-    return Container(
-      height: 280,
-      color: Theme.of(context).cardColor,
-      child: Column(
-        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
-        children: <Widget>[
-          const Text(
-            "Pricing",
-            style: TextStyle(
-              fontWeight: FontWeight.bold,
-              fontSize: 18,
-            ),
-          ),
-          SingleChildScrollView(
-            scrollDirection: Axis.horizontal,
-            child: Row(
-              mainAxisAlignment: MainAxisAlignment.center,
-              children: planWidgets,
-            ),
-          ),
-          Text(
-            "We offer a free trial of " +
-                convertBytesToReadableFormat(freePlan.storage) +
-                " for " +
-                freePlan.duration.toString() +
-                " " +
-                freePlan.period,
-          ),
-          GestureDetector(
-            child: Row(
-              mainAxisAlignment: MainAxisAlignment.center,
-              crossAxisAlignment: CrossAxisAlignment.center,
-              children: const [
-                Icon(
-                  Icons.close,
-                  size: 12,
-                  color: Colors.white38,
-                ),
-                Padding(padding: EdgeInsets.all(1)),
-                Text(
-                  "Close",
-                  style: TextStyle(
-                    color: Colors.white38,
-                  ),
-                ),
-              ],
-            ),
-            onTap: () => Navigator.pop(context),
-          )
-        ],
-      ),
-    );
-  }
-}
-
-class BillingPlanWidget extends StatelessWidget {
-  final BillingPlan plan;
-
-  const BillingPlanWidget(
-    this.plan, {
-    Key key,
-  }) : super(key: key);
-
-  @override
-  Widget build(BuildContext context) {
-    return Padding(
-      padding: const EdgeInsets.all(2.0),
-      child: Card(
-        shape: RoundedRectangleBorder(
-          borderRadius: BorderRadius.circular(12.0),
-        ),
-        color: Colors.black.withOpacity(0.2),
-        child: Container(
-          padding: const EdgeInsets.fromLTRB(12, 20, 12, 20),
-          child: Column(
-            children: [
-              Text(
-                convertBytesToGBs(plan.storage, precision: 0).toString() +
-                    " GB",
-                style: const TextStyle(
-                  fontWeight: FontWeight.bold,
-                  fontSize: 16,
-                ),
-              ),
-              const Padding(
-                padding: EdgeInsets.all(4),
-              ),
-              Text(
-                plan.price + " / " + plan.period,
-                style: const TextStyle(
-                  fontSize: 12,
-                  color: Colors.white70,
-                ),
-              ),
-            ],
-          ),
-        ),
-      ),
-    );
-  }
-}

+ 0 - 33
lib/ui/common/report_bug_popup.dart

@@ -1,33 +0,0 @@
-// @dart=2.9
-
-import 'package:flutter/material.dart';
-import 'package:photos/utils/email_util.dart';
-
-PopupMenuButton<dynamic> reportBugPopupMenu(BuildContext context) {
-  return PopupMenuButton(
-    itemBuilder: (context) {
-      final List<PopupMenuItem> items = [];
-      items.add(
-        PopupMenuItem(
-          value: 1,
-          child: Row(
-            children: const [
-              Text("Contact support"),
-            ],
-          ),
-        ),
-      );
-      return items;
-    },
-    onSelected: (value) async {
-      if (value == 1) {
-        await sendLogs(
-          context,
-          "Contact support",
-          "support@ente.io",
-          postShare: () {},
-        );
-      }
-    },
-  );
-}

+ 0 - 36
lib/ui/settings/settings_section_title.dart

@@ -1,36 +0,0 @@
-// @dart=2.9
-
-import 'package:flutter/material.dart';
-
-class SettingsSectionTitle extends StatelessWidget {
-  final String title;
-  final Color color;
-
-  const SettingsSectionTitle(
-    this.title, {
-    Key key,
-    this.color,
-  }) : super(key: key);
-
-  @override
-  Widget build(BuildContext context) {
-    return Column(
-      children: [
-        const Padding(padding: EdgeInsets.all(4)),
-        Align(
-          alignment: Alignment.centerLeft,
-          child: Text(
-            title,
-            style: color != null
-                ? Theme.of(context)
-                    .textTheme
-                    .headline6
-                    .merge(TextStyle(color: color))
-                : Theme.of(context).textTheme.headline6,
-          ),
-        ),
-        const Padding(padding: EdgeInsets.all(4)),
-      ],
-    );
-  }
-}

+ 0 - 93
lib/ui/tools/set_wallpaper_dialog.dart

@@ -1,93 +0,0 @@
-// @dart=2.9
-
-import 'package:flutter/material.dart';
-import 'package:logging/logging.dart';
-import 'package:photos/models/file.dart';
-import 'package:photos/utils/dialog_util.dart';
-import 'package:photos/utils/file_util.dart';
-import 'package:photos/utils/toast_util.dart';
-import 'package:wallpaper_manager_flutter/wallpaper_manager_flutter.dart';
-
-class SetWallpaperDialog extends StatefulWidget {
-  final File file;
-
-  const SetWallpaperDialog(this.file, {Key key}) : super(key: key);
-
-  @override
-  State<SetWallpaperDialog> createState() => _SetWallpaperDialogState();
-}
-
-class _SetWallpaperDialogState extends State<SetWallpaperDialog> {
-  int _lockscreenValue = WallpaperManagerFlutter.HOME_SCREEN;
-
-  @override
-  Widget build(BuildContext context) {
-    final alert = AlertDialog(
-      title: const Text("Set wallpaper"),
-      content: Column(
-        mainAxisSize: MainAxisSize.min,
-        children: [
-          RadioListTile(
-            title: const Text("Homescreen"),
-            value: WallpaperManagerFlutter.HOME_SCREEN,
-            groupValue: _lockscreenValue,
-            onChanged: (v) {
-              setState(() {
-                _lockscreenValue = v;
-              });
-            },
-          ),
-          RadioListTile(
-            title: const Text("Lockscreen"),
-            value: WallpaperManagerFlutter.LOCK_SCREEN,
-            groupValue: _lockscreenValue,
-            onChanged: (v) {
-              setState(() {
-                _lockscreenValue = v;
-              });
-            },
-          ),
-          RadioListTile(
-            title: const Text("Both"),
-            value: WallpaperManagerFlutter.BOTH_SCREENS,
-            groupValue: _lockscreenValue,
-            onChanged: (v) {
-              setState(() {
-                _lockscreenValue = v;
-              });
-            },
-          ),
-        ],
-      ),
-      actions: [
-        TextButton(
-          child: const Text(
-            "Ok",
-            style: TextStyle(
-              color: Colors.white,
-            ),
-          ),
-          onPressed: () async {
-            Navigator.of(context, rootNavigator: true).pop('dialog');
-            final dialog = createProgressDialog(context, "Setting wallpaper");
-            await dialog.show();
-            try {
-              await WallpaperManagerFlutter().setwallpaperfromFile(
-                await getFile(widget.file),
-                _lockscreenValue,
-              );
-              await dialog.hide();
-              showToast(context, "Wallpaper set successfully");
-            } catch (e, s) {
-              await dialog.hide();
-              Logger("SetWallpaperDialog").severe(e, s);
-              showToast(context, "Something went wrong");
-              return;
-            }
-          },
-        ),
-      ],
-    );
-    return alert;
-  }
-}

+ 0 - 67
lib/utils/hex.dart

@@ -1,67 +0,0 @@
-import "dart:convert";
-import "dart:typed_data";
-
-const String _alphabet = "0123456789abcdef";
-
-/// An instance of the default implementation of the [HexCodec].
-const hex = HexCodec();
-
-/// A codec for encoding and decoding byte arrays to and from
-/// hexadecimal strings.
-class HexCodec extends Codec<List<int>, String> {
-  const HexCodec();
-
-  @override
-  Converter<List<int>, String> get encoder => const HexEncoder();
-
-  @override
-  Converter<String, List<int>> get decoder => const HexDecoder();
-}
-
-/// A converter to encode byte arrays into hexadecimal strings.
-class HexEncoder extends Converter<List<int>, String> {
-  /// If true, the encoder will encode into uppercase hexadecimal strings.
-  final bool upperCase;
-
-  const HexEncoder({this.upperCase = false});
-
-  @override
-  String convert(List<int> bytes) {
-    final StringBuffer buffer = StringBuffer();
-    for (int part in bytes) {
-      if (part & 0xff != part) {
-        throw const FormatException("Non-byte integer detected");
-      }
-      buffer.write('${part < 16 ? '0' : ''}${part.toRadixString(16)}');
-    }
-    if (upperCase) {
-      return buffer.toString().toUpperCase();
-    } else {
-      return buffer.toString();
-    }
-  }
-}
-
-/// A converter to decode hexadecimal strings into byte arrays.
-class HexDecoder extends Converter<String, List<int>> {
-  const HexDecoder();
-
-  @override
-  List<int> convert(String hex) {
-    String str = hex.replaceAll(" ", "");
-    str = str.toLowerCase();
-    if (str.length % 2 != 0) {
-      str = "0" + str;
-    }
-    final Uint8List result = Uint8List(str.length ~/ 2);
-    for (int i = 0; i < result.length; i++) {
-      final int firstDigit = _alphabet.indexOf(str[i * 2]);
-      final int secondDigit = _alphabet.indexOf(str[i * 2 + 1]);
-      if (firstDigit == -1 || secondDigit == -1) {
-        throw FormatException("Non-hex character detected in $hex");
-      }
-      result[i] = (firstDigit << 4) + secondDigit;
-    }
-    return result;
-  }
-}