Ver Fonte

Fixed check for internal user (#1739)

Neeraj Gupta há 1 ano atrás
pai
commit
21c733b812

+ 0 - 2
lib/core/constants.dart

@@ -67,8 +67,6 @@ const galleryGridSpacing = 2.0;
 
 const searchSectionLimit = 7;
 
-bool isInternalUser = false;
-
 const blackThumbnailBase64 = '/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAEBAQEBAQEB' +
     'AQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/2wBDAQEBAQEBAQ' +
     'EBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/wAARC' +

+ 1 - 2
lib/services/feature_flag_service.dart

@@ -71,10 +71,9 @@ class FeatureFlagService {
   bool isInternalUserOrDebugBuild() {
     final String? email = Configuration.instance.getEmail();
     final userID = Configuration.instance.getUserID();
-    isInternalUser = (email != null && email.endsWith("@ente.io")) ||
+    return (email != null && email.endsWith("@ente.io")) ||
         _internalUserIDs.contains(userID) ||
         kDebugMode;
-    return isInternalUser;
   }
 
   Future<void> fetchFeatureFlags() async {

+ 3 - 2
lib/utils/dialog_util.dart

@@ -2,10 +2,10 @@ import "package:dio/dio.dart";
 import "package:flutter/foundation.dart";
 import 'package:flutter/material.dart';
 import "package:flutter/services.dart";
-import "package:photos/core/constants.dart";
 import "package:photos/generated/l10n.dart";
 import 'package:photos/models/button_result.dart';
 import 'package:photos/models/typedefs.dart';
+import "package:photos/services/feature_flag_service.dart";
 import 'package:photos/theme/colors.dart';
 import 'package:photos/ui/common/loading_widget.dart';
 import 'package:photos/ui/common/progress_dialog.dart';
@@ -91,7 +91,8 @@ String parseErrorForUI(
     }
   }
   // return generic error if the user is not internal and the error is not in debug mode
-  if (!(isInternalUser && kDebugMode)) {
+  if (!(FeatureFlagService.instance.isInternalUserOrDebugBuild() &&
+      kDebugMode)) {
     return genericError;
   }
   String errorInfo = "";