Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Hide ref promo banner for non-ente instance

Neeraj Gupta15b02c59cc6b
diff --git a/mobile/lib/core/configuration.dart b/mobile/lib/core/configuration.dart
index 0245e82eae..32a9e6389e 100644
--- a/mobile/lib/core/configuration.dart
+++ b/mobile/lib/core/configuration.dart
@@ -421,6 +421,13 @@ class Configuration {
return _preferences.getString(endPointKey) ?? endpoint;
}
+ // isEnteProduction checks if the current endpoint is the default production
+ // endpoint. This is used to determine if the app is in production mode or
+ // not. The default production endpoint is set in the environment variable
+ bool isEnteProduction() {
+ return getHttpEndpoint() == kDefaultProductionEndpoint;
+ }
+
Future<void> setHttpEndpoint(String endpoint) async {
await _preferences.setString(endPointKey, endpoint);
Bus.instance.fire(EndpointUpdatedEvent());
diff --git a/mobile/lib/ui/settings/developer_settings_widget.dart b/mobile/lib/ui/settings/developer_settings_widget.dart
index b77d647c66..8035fb844d 100644
--- a/mobile/lib/ui/settings/developer_settings_widget.dart
+++ b/mobile/lib/ui/settings/developer_settings_widget.dart
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import "package:photos/core/configuration.dart";
-import "package:photos/core/constants.dart";
import "package:photos/generated/l10n.dart";
class DeveloperSettingsWidget extends StatelessWidget {
@@ -8,8 +7,8 @@ class DeveloperSettingsWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
- final endpoint = Configuration.instance.getHttpEndpoint();
- if (endpoint != kDefaultProductionEndpoint) {
+ if (!Configuration.instance.isEnteProduction()) {
+ final endpoint = Configuration.instance.getHttpEndpoint();
final endpointURI = Uri.parse(endpoint);
return Padding(
padding: const EdgeInsets.only(bottom: 20),
diff --git a/mobile/lib/ui/settings_page.dart b/mobile/lib/ui/settings_page.dart
index 32401fd30f..870b5e71af 100644
--- a/mobile/lib/ui/settings_page.dart
+++ b/mobile/lib/ui/settings_page.dart
@@ -86,8 +86,10 @@ class SettingsPage extends StatelessWidget {
contents.add(const SizedBox(height: 8));
if (hasLoggedIn) {
+ // show banner in debug mode and ente production
final showStorageBonusBanner =
- storageBonusService.shouldShowStorageBonus();
+ storageBonusService.shouldShowStorageBonus() &&
+ (kDebugMode || Configuration.instance.isEnteProduction());
contents.addAll([
const StorageCardWidget(),
(showStorageBonusBanner)
diff --git a/mobile/lib/ui/tabs/home_widget.dart b/mobile/lib/ui/tabs/home_widget.dart
index 839b16c733..47f21733d5 100644
--- a/mobile/lib/ui/tabs/home_widget.dart
+++ b/mobile/lib/ui/tabs/home_widget.dart
@@ -255,8 +255,7 @@ class _HomeWidgetState extends State<HomeWidget> {
if (Platform.isAndroid &&
!localSettings.hasConfiguredInAppLinkPermissions() &&
RemoteSyncService.instance.isFirstRemoteSyncDone() &&
- Configuration.instance.getHttpEndpoint() ==
- kDefaultProductionEndpoint) {
+ Configuration.instance.isEnteProduction()) {
PackageInfo.fromPlatform().then((packageInfo) {
final packageName = packageInfo.packageName;
if (packageName == 'io.ente.photos.independent' ||