浏览代码

Remove disableUrl sharing feature flag

Neeraj Gupta 2 年之前
父节点
当前提交
5f5caeb887
共有 3 个文件被更改,包括 60 次插入79 次删除
  1. 0 1
      lib/core/constants.dart
  2. 0 15
      lib/services/feature_flag_service.dart
  3. 60 63
      lib/ui/sharing/share_collection_widget.dart

+ 0 - 1
lib/core/constants.dart

@@ -39,7 +39,6 @@ const kSupportEmail = 'support@ente.io';
 // Default values for various feature flags
 // Default values for various feature flags
 class FFDefault {
 class FFDefault {
   static const bool enableStripe = true;
   static const bool enableStripe = true;
-  static const bool disableUrlSharing = false;
   static const bool disableCFWorker = false;
   static const bool disableCFWorker = false;
   static const bool enableMissingLocationMigration = false;
   static const bool enableMissingLocationMigration = false;
 }
 }

+ 0 - 15
lib/services/feature_flag_service.dart

@@ -52,15 +52,6 @@ class FeatureFlagService {
     }
     }
   }
   }
 
 
-  bool disableUrlSharing() {
-    try {
-      return _getFeatureFlags().disableUrlSharing;
-    } catch (e) {
-      _logger.severe(e);
-      return FFDefault.disableUrlSharing;
-    }
-  }
-
   bool enableMissingLocationMigration() {
   bool enableMissingLocationMigration() {
     // only needs to be enabled for android
     // only needs to be enabled for android
     if (!Platform.isAndroid) {
     if (!Platform.isAndroid) {
@@ -110,19 +101,16 @@ class FeatureFlagService {
 class FeatureFlags {
 class FeatureFlags {
   static FeatureFlags defaultFlags = FeatureFlags(
   static FeatureFlags defaultFlags = FeatureFlags(
     disableCFWorker: FFDefault.disableCFWorker,
     disableCFWorker: FFDefault.disableCFWorker,
-    disableUrlSharing: FFDefault.disableUrlSharing,
     enableStripe: FFDefault.enableStripe,
     enableStripe: FFDefault.enableStripe,
     enableMissingLocationMigration: FFDefault.enableMissingLocationMigration,
     enableMissingLocationMigration: FFDefault.enableMissingLocationMigration,
   );
   );
 
 
   final bool disableCFWorker;
   final bool disableCFWorker;
-  final bool disableUrlSharing;
   final bool enableStripe;
   final bool enableStripe;
   final bool enableMissingLocationMigration;
   final bool enableMissingLocationMigration;
 
 
   FeatureFlags({
   FeatureFlags({
     @required this.disableCFWorker,
     @required this.disableCFWorker,
-    @required this.disableUrlSharing,
     @required this.enableStripe,
     @required this.enableStripe,
     @required this.enableMissingLocationMigration,
     @required this.enableMissingLocationMigration,
   });
   });
@@ -130,7 +118,6 @@ class FeatureFlags {
   Map<String, dynamic> toMap() {
   Map<String, dynamic> toMap() {
     return {
     return {
       "disableCFWorker": disableCFWorker,
       "disableCFWorker": disableCFWorker,
-      "disableUrlSharing": disableUrlSharing,
       "enableStripe": enableStripe,
       "enableStripe": enableStripe,
       "enableMissingLocationMigration": enableMissingLocationMigration,
       "enableMissingLocationMigration": enableMissingLocationMigration,
     };
     };
@@ -144,8 +131,6 @@ class FeatureFlags {
   factory FeatureFlags.fromMap(Map<String, dynamic> json) {
   factory FeatureFlags.fromMap(Map<String, dynamic> json) {
     return FeatureFlags(
     return FeatureFlags(
       disableCFWorker: json["disableCFWorker"] ?? FFDefault.disableCFWorker,
       disableCFWorker: json["disableCFWorker"] ?? FFDefault.disableCFWorker,
-      disableUrlSharing:
-          json["disableUrlSharing"] ?? FFDefault.disableUrlSharing,
       enableStripe: json["enableStripe"] ?? FFDefault.enableStripe,
       enableStripe: json["enableStripe"] ?? FFDefault.enableStripe,
       enableMissingLocationMigration: json["enableMissingLocationMigration"] ??
       enableMissingLocationMigration: json["enableMissingLocationMigration"] ??
           FFDefault.enableMissingLocationMigration,
           FFDefault.enableMissingLocationMigration,

+ 60 - 63
lib/ui/sharing/share_collection_widget.dart

@@ -14,7 +14,6 @@ import 'package:photos/ente_theme_data.dart';
 import 'package:photos/models/collection.dart';
 import 'package:photos/models/collection.dart';
 import 'package:photos/models/public_key.dart';
 import 'package:photos/models/public_key.dart';
 import 'package:photos/services/collections_service.dart';
 import 'package:photos/services/collections_service.dart';
-import 'package:photos/services/feature_flag_service.dart';
 import 'package:photos/services/user_service.dart';
 import 'package:photos/services/user_service.dart';
 import 'package:photos/ui/common/dialogs.dart';
 import 'package:photos/ui/common/dialogs.dart';
 import 'package:photos/ui/common/gradient_button.dart';
 import 'package:photos/ui/common/gradient_button.dart';
@@ -90,72 +89,70 @@ class _SharingDialogState extends State<SharingDialog> {
       );
       );
     }
     }
 
 
-    if (!FeatureFlagService.instance.disableUrlSharing()) {
-      final bool hasUrl = widget.collection.publicURLs?.isNotEmpty ?? false;
-      children.addAll([
-        const Padding(padding: EdgeInsets.all(16)),
-        const Divider(height: 1),
-        const Padding(padding: EdgeInsets.all(12)),
-        SizedBox(
-          height: 36,
-          child: Row(
-            mainAxisAlignment: MainAxisAlignment.center,
-            children: [
-              const Text("Public link"),
-              Switch(
-                value: hasUrl,
-                onChanged: (enable) async {
-                  // confirm if user wants to disable the url
-                  if (!enable) {
-                    final choice = await showChoiceDialog(
-                      context,
-                      'Disable link',
-                      'Are you sure that you want to disable the album link?',
-                      firstAction: 'Yes, disable',
-                      secondAction: 'No',
-                      actionType: ActionType.critical,
-                    );
-                    if (choice != DialogUserChoice.firstChoice) {
-                      return;
-                    }
-                  }
-                  final dialog = createProgressDialog(
+    final bool hasUrl = widget.collection.publicURLs?.isNotEmpty ?? false;
+    children.addAll([
+      const Padding(padding: EdgeInsets.all(16)),
+      const Divider(height: 1),
+      const Padding(padding: EdgeInsets.all(12)),
+      SizedBox(
+        height: 36,
+        child: Row(
+          mainAxisAlignment: MainAxisAlignment.center,
+          children: [
+            const Text("Public link"),
+            Switch(
+              value: hasUrl,
+              onChanged: (enable) async {
+                // confirm if user wants to disable the url
+                if (!enable) {
+                  final choice = await showChoiceDialog(
                     context,
                     context,
-                    enable ? "Creating link..." : "Disabling link...",
+                    'Disable link',
+                    'Are you sure that you want to disable the album link?',
+                    firstAction: 'Yes, disable',
+                    secondAction: 'No',
+                    actionType: ActionType.critical,
                   );
                   );
-                  try {
-                    await dialog.show();
-                    enable
-                        ? await CollectionsService.instance
-                            .createShareUrl(widget.collection)
-                        : await CollectionsService.instance
-                            .disableShareUrl(widget.collection);
-                    dialog.hide();
-                    setState(() {});
-                  } catch (e) {
-                    dialog.hide();
-                    if (e is SharingNotPermittedForFreeAccountsError) {
-                      _showUnSupportedAlert();
-                    } else {
-                      _logger.severe("failed to share collection", e);
-                      showGenericErrorDialog(context);
-                    }
+                  if (choice != DialogUserChoice.firstChoice) {
+                    return;
                   }
                   }
-                },
-              ),
-            ],
-          ),
+                }
+                final dialog = createProgressDialog(
+                  context,
+                  enable ? "Creating link..." : "Disabling link...",
+                );
+                try {
+                  await dialog.show();
+                  enable
+                      ? await CollectionsService.instance
+                          .createShareUrl(widget.collection)
+                      : await CollectionsService.instance
+                          .disableShareUrl(widget.collection);
+                  dialog.hide();
+                  setState(() {});
+                } catch (e) {
+                  dialog.hide();
+                  if (e is SharingNotPermittedForFreeAccountsError) {
+                    _showUnSupportedAlert();
+                  } else {
+                    _logger.severe("failed to share collection", e);
+                    showGenericErrorDialog(context);
+                  }
+                }
+              },
+            ),
+          ],
         ),
         ),
-        const Padding(padding: EdgeInsets.all(8)),
-      ]);
-      if (widget.collection.publicURLs?.isNotEmpty ?? false) {
-        children.add(
-          const Padding(
-            padding: EdgeInsets.all(2),
-          ),
-        );
-        children.add(_getShareableUrlWidget(context));
-      }
+      ),
+      const Padding(padding: EdgeInsets.all(8)),
+    ]);
+    if (widget.collection.publicURLs?.isNotEmpty ?? false) {
+      children.add(
+        const Padding(
+          padding: EdgeInsets.all(2),
+        ),
+      );
+      children.add(_getShareableUrlWidget(context));
     }
     }
 
 
     return AlertDialog(
     return AlertDialog(