Skip to content

armgit / ente

Public Imported from GitHub
0

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

[mob] Remove hardcoded url for accounts/passkey

Neeraj Gupta3ca78cac35dc
diff --git a/mobile/lib/services/billing_service.dart b/mobile/lib/services/billing_service.dart
index 2037cb8ad0..b26d4507a3 100644
--- a/mobile/lib/services/billing_service.dart
+++ b/mobile/lib/services/billing_service.dart
@@ -25,11 +25,6 @@ const kWebPaymentBaseEndpoint = String.fromEnvironment(
defaultValue: "https://payments.ente.io",
);
-const kFamilyPlanManagementUrl = String.fromEnvironment(
- "web-family",
- defaultValue: "https://family.ente.io",
-);
-
class BillingService {
late final _logger = Logger("BillingService");
final Dio _enteDio;
@@ -185,16 +180,15 @@ class BillingService {
);
await dialog.show();
try {
- final String jwtToken = await UserService.instance.getFamiliesToken();
final bool familyExist = userDetails.isPartOfFamily();
+ final String url =
+ await UserService.instance.getFamilyPortalUrl(familyExist);
+
await dialog.hide();
await Navigator.of(context).push(
MaterialPageRoute(
builder: (BuildContext context) {
- return WebPage(
- S.of(context).familyPlanPortalTitle,
- '$kFamilyPlanManagementUrl?token=$jwtToken&isFamilyCreated=$familyExist',
- );
+ return WebPage(S.of(context).familyPlanPortalTitle, url);
},
),
);
diff --git a/mobile/lib/services/passkey_service.dart b/mobile/lib/services/passkey_service.dart
index 0faa7b5416..f0dfc7b767 100644
--- a/mobile/lib/services/passkey_service.dart
+++ b/mobile/lib/services/passkey_service.dart
@@ -27,10 +27,6 @@ class PasskeyService {
return response.data!["isPasskeyRecoveryEnabled"] as bool;
}
- String get accountsUrl {
- return kDebugMode ? "http://localhost:3001" : "https://accounts.ente.io";
- }
-
Future<void> configurePasskeyRecovery(
String secret,
String userEncryptedSecret,
diff --git a/mobile/lib/services/user_service.dart b/mobile/lib/services/user_service.dart
index 3ec22674a4..e13cc3e58a 100644
--- a/mobile/lib/services/user_service.dart
+++ b/mobile/lib/services/user_service.dart
@@ -1194,11 +1194,13 @@ class UserService {
}
}
- Future<String> getFamiliesToken() async {
+ Future<String> getFamilyPortalUrl(bool familyExist) async {
try {
final response = await _enteDio.get("/users/families-token");
if (response.statusCode == 200) {
- return response.data["familiesToken"];
+ final String url = response.data["familyUrl"] ?? kFamilyUrl;
+ final String jwtToken = response.data["familiesToken"];
+ return '$url?token=$jwtToken&isFamilyCreated=$familyExist';
} else {
throw Exception("non 200 ok response");
}