Skip to content

Commit 2d3b588

Browse files
chore(release): 4.7.7
1 parent fbeafa6 commit 2d3b588

15 files changed

Lines changed: 255 additions & 26 deletions

.env.flutter

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
APP_VERSION=4.7.6
1+
APP_VERSION=4.7.7

lib/l10n/app_en.arb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -954,6 +954,8 @@
954954
"releaseNotes": "Release notes",
955955
"releaseNotesTitle": "What's new",
956956
"version": "Version {version}",
957+
"releaseNotes_4_7_7": "Fixed errors in monthly transit calculations. Subscription badges now display only when appropriate.",
958+
"releaseNotes_4_7_6": "Improved font rendering.",
957959
"releaseNotes_4_7_1": "Connection error messages now translated.",
958960
"releaseNotes_4_5_1": "New app icons. Improved logo quality in the menu. Fixed a validation issue when editing birth charts.",
959961
"releaseNotes_4_0_1": "Fixed an issue where the PDF button did not appear after reading generation. Saved charts now refresh correctly when navigating back with the browser.",
@@ -970,5 +972,7 @@
970972
"releaseNotes_2_0_1": "Initial release with birth chart readings, synastry analysis for couple compatibility, and daily and monthly transit predictions. PDF export. Full support for English and Italian.",
971973
"updateRequired": "Just a moment!",
972974
"updateNow": "Update",
973-
"errorMessageCopied": "Error message copied to clipboard"
975+
"errorMessageCopied": "Error message copied to clipboard",
976+
"portalReturnTitle": "Done",
977+
"portalReturnMessage": "You can close this window and return to the app."
974978
}

lib/l10n/app_it.arb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,6 +933,8 @@
933933
"releaseNotes": "Note di rilascio",
934934
"releaseNotesTitle": "Novità",
935935
"version": "Versione {version}",
936+
"releaseNotes_4_7_7": "Risolti errori nel calcolo dei transiti mensili. I badge degli abbonamenti ora si mostrano solo quando appropriato.",
937+
"releaseNotes_4_7_6": "Migliorato il rendering dei font.",
936938
"releaseNotes_4_7_1": "Messaggi di errore di connessione ora tradotti in italiano.",
937939
"releaseNotes_4_5_1": "Nuove icone dell'app. Migliorata la qualità del logo nel menu. Risolto un problema di validazione nella modifica del tema natale.",
938940
"releaseNotes_4_0_1": "Risolto un problema per cui il pulsante PDF non appariva dopo la generazione della lettura. I grafici salvati ora si aggiornano correttamente tornando indietro con il browser.",
@@ -949,5 +951,7 @@
949951
"releaseNotes_2_0_1": "Rilascio iniziale con letture del tema natale, analisi di sinastria per la compatibilità di coppia, e previsioni dei transiti giornalieri e mensili. Esportazione PDF. Supporto completo per inglese e italiano.",
950952
"updateRequired": "Un attimo!",
951953
"updateNow": "Aggiorna",
952-
"errorMessageCopied": "Messaggio di errore copiato negli appunti"
954+
"errorMessageCopied": "Messaggio di errore copiato negli appunti",
955+
"portalReturnTitle": "Fatto",
956+
"portalReturnMessage": "Puoi chiudere questa finestra e tornare all'app."
953957
}

lib/l10n/app_localizations.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5696,6 +5696,18 @@ abstract class AppLocalizations {
56965696
/// **'Version {version}'**
56975697
String version(Object version);
56985698

5699+
/// No description provided for @releaseNotes_4_7_7.
5700+
///
5701+
/// In en, this message translates to:
5702+
/// **'Fixed errors in monthly transit calculations. Subscription badges now display only when appropriate.'**
5703+
String get releaseNotes_4_7_7;
5704+
5705+
/// No description provided for @releaseNotes_4_7_6.
5706+
///
5707+
/// In en, this message translates to:
5708+
/// **'Improved font rendering.'**
5709+
String get releaseNotes_4_7_6;
5710+
56995711
/// No description provided for @releaseNotes_4_7_1.
57005712
///
57015713
/// In en, this message translates to:
@@ -5797,6 +5809,18 @@ abstract class AppLocalizations {
57975809
/// In en, this message translates to:
57985810
/// **'Error message copied to clipboard'**
57995811
String get errorMessageCopied;
5812+
5813+
/// No description provided for @portalReturnTitle.
5814+
///
5815+
/// In en, this message translates to:
5816+
/// **'Done'**
5817+
String get portalReturnTitle;
5818+
5819+
/// No description provided for @portalReturnMessage.
5820+
///
5821+
/// In en, this message translates to:
5822+
/// **'You can close this window and return to the app.'**
5823+
String get portalReturnMessage;
58005824
}
58015825

58025826
class _AppLocalizationsDelegate

lib/l10n/app_localizations_en.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3210,6 +3210,13 @@ class AppLocalizationsEn extends AppLocalizations {
32103210
return 'Version $version';
32113211
}
32123212

3213+
@override
3214+
String get releaseNotes_4_7_7 =>
3215+
'Fixed errors in monthly transit calculations. Subscription badges now display only when appropriate.';
3216+
3217+
@override
3218+
String get releaseNotes_4_7_6 => 'Improved font rendering.';
3219+
32133220
@override
32143221
String get releaseNotes_4_7_1 => 'Connection error messages now translated.';
32153222

@@ -3269,4 +3276,11 @@ class AppLocalizationsEn extends AppLocalizations {
32693276

32703277
@override
32713278
String get errorMessageCopied => 'Error message copied to clipboard';
3279+
3280+
@override
3281+
String get portalReturnTitle => 'Done';
3282+
3283+
@override
3284+
String get portalReturnMessage =>
3285+
'You can close this window and return to the app.';
32723286
}

lib/l10n/app_localizations_it.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,6 +3239,13 @@ class AppLocalizationsIt extends AppLocalizations {
32393239
return 'Versione $version';
32403240
}
32413241

3242+
@override
3243+
String get releaseNotes_4_7_7 =>
3244+
'Risolti errori nel calcolo dei transiti mensili. I badge degli abbonamenti ora si mostrano solo quando appropriato.';
3245+
3246+
@override
3247+
String get releaseNotes_4_7_6 => 'Migliorato il rendering dei font.';
3248+
32423249
@override
32433250
String get releaseNotes_4_7_1 =>
32443251
'Messaggi di errore di connessione ora tradotti in italiano.';
@@ -3302,4 +3309,11 @@ class AppLocalizationsIt extends AppLocalizations {
33023309

33033310
@override
33043311
String get errorMessageCopied => 'Messaggio di errore copiato negli appunti';
3312+
3313+
@override
3314+
String get portalReturnTitle => 'Fatto';
3315+
3316+
@override
3317+
String get portalReturnMessage =>
3318+
'Puoi chiudere questa finestra e tornare all\'app.';
33053319
}

lib/models/subscription_plan.dart

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,7 @@ enum PlanTier { standard, premium }
77

88
enum CardStyle { normal, alternative, main }
99

10-
enum PlanBadge {
11-
currentPlan,
12-
upgrade,
13-
downgrade,
14-
none,
15-
}
10+
enum PlanBadge { currentPlan, upgrade, downgrade, none }
1611

1712
class SubscriptionPlan {
1813
final String title;
@@ -122,6 +117,13 @@ class SubscriptionPlan {
122117
return plans;
123118
}
124119

120+
final isActiveSubscription =
121+
currentSubscription.status == 'active' ||
122+
currentSubscription.status == 'trialing';
123+
if (!isActiveSubscription) {
124+
return plans;
125+
}
126+
125127
final currentPriceId = _extractPriceIdFromSubscription(currentSubscription);
126128
if (currentPriceId == null) {
127129
return plans;
@@ -183,10 +185,7 @@ class SubscriptionPlan {
183185
}
184186

185187
static int _compareTiers(PlanTier tier1, PlanTier tier2) {
186-
const tierOrder = {
187-
PlanTier.standard: 0,
188-
PlanTier.premium: 1,
189-
};
188+
const tierOrder = {PlanTier.standard: 0, PlanTier.premium: 1};
190189
return (tierOrder[tier1] ?? 0) - (tierOrder[tier2] ?? 0);
191190
}
192191

@@ -199,20 +198,26 @@ class SubscriptionPlan {
199198
return (durationOrder[type1] ?? 0) - (durationOrder[type2] ?? 0);
200199
}
201200

202-
static List<SubscriptionPlan> sortByPriority(
203-
List<SubscriptionPlan> plans,
204-
) {
201+
static List<SubscriptionPlan> sortByPriority(List<SubscriptionPlan> plans) {
205202
final sortedPlans = List<SubscriptionPlan>.from(plans);
206203

207204
sortedPlans.sort((a, b) {
208205
if (a.isCurrentPlan && !b.isCurrentPlan) return -1;
209206
if (!a.isCurrentPlan && b.isCurrentPlan) return 1;
210207

211-
if (a.badge == PlanBadge.upgrade && b.badge != PlanBadge.upgrade) return -1;
212-
if (a.badge != PlanBadge.upgrade && b.badge == PlanBadge.upgrade) return 1;
208+
if (a.badge == PlanBadge.upgrade && b.badge != PlanBadge.upgrade) {
209+
return -1;
210+
}
211+
if (a.badge != PlanBadge.upgrade && b.badge == PlanBadge.upgrade) {
212+
return 1;
213+
}
213214

214-
if (a.badge == PlanBadge.downgrade && b.badge != PlanBadge.downgrade) return 1;
215-
if (a.badge != PlanBadge.downgrade && b.badge == PlanBadge.downgrade) return -1;
215+
if (a.badge == PlanBadge.downgrade && b.badge != PlanBadge.downgrade) {
216+
return 1;
217+
}
218+
if (a.badge != PlanBadge.downgrade && b.badge == PlanBadge.downgrade) {
219+
return -1;
220+
}
216221

217222
final tierComp = _compareTiers(b.tier, a.tier);
218223
if (tierComp != 0) return tierComp;

lib/screens/release_notes_screen.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ class ReleaseNotesScreen extends StatelessWidget {
1313
final l10n = AppLocalizations.of(context)!;
1414

1515
final releases = [
16+
_ReleaseInfo('4.7.7', l10n.releaseNotes_4_7_7),
17+
_ReleaseInfo('4.7.6', l10n.releaseNotes_4_7_6),
1618
_ReleaseInfo('4.7.1', l10n.releaseNotes_4_7_1),
1719
_ReleaseInfo('4.5.1', l10n.releaseNotes_4_5_1),
1820
_ReleaseInfo('4.0.1', l10n.releaseNotes_4_0_1),

lib/services/api_client.dart

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,11 +457,17 @@ class ApiClient {
457457
return await get('/subscription-status');
458458
}
459459

460-
Future<Map<String, dynamic>> createPortalSession({String? priceId}) async {
460+
Future<Map<String, dynamic>> createPortalSession({
461+
String? priceId,
462+
String? returnUrl,
463+
}) async {
461464
final body = <String, dynamic>{};
462465
if (priceId != null) {
463466
body['price_id'] = priceId;
464467
}
468+
if (returnUrl != null) {
469+
body['return_url'] = returnUrl;
470+
}
465471
return await post('/create-portal-session', body: body);
466472
}
467473

lib/services/loopback_server.dart

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import 'dart:async';
2+
import 'dart:io';
3+
4+
class LoopbackServer {
5+
HttpServer? _server;
6+
final String title;
7+
final String message;
8+
9+
LoopbackServer({
10+
required this.title,
11+
required this.message,
12+
});
13+
14+
Future<String> start() async {
15+
_server = await HttpServer.bind(InternetAddress.loopbackIPv4, 0);
16+
return 'http://localhost:${_server!.port}/callback';
17+
}
18+
19+
Future<void> waitForCallback() async {
20+
if (_server == null) {
21+
throw StateError('Server not started. Call start() first.');
22+
}
23+
24+
final completer = Completer<void>();
25+
26+
_server!.listen((request) async {
27+
if (request.uri.path == '/callback') {
28+
request.response
29+
..statusCode = HttpStatus.ok
30+
..headers.contentType = ContentType.html
31+
..write(_getSuccessPage());
32+
await request.response.close();
33+
34+
await _server?.close();
35+
_server = null;
36+
37+
if (!completer.isCompleted) {
38+
completer.complete();
39+
}
40+
}
41+
});
42+
43+
await completer.future;
44+
}
45+
46+
Future<void> close() async {
47+
await _server?.close();
48+
_server = null;
49+
}
50+
51+
String _getSuccessPage() {
52+
return '''
53+
<!DOCTYPE html>
54+
<html>
55+
<head>
56+
<meta charset="utf-8">
57+
<title>AstroGods</title>
58+
<style>
59+
body {
60+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
61+
display: flex;
62+
justify-content: center;
63+
align-items: center;
64+
height: 100vh;
65+
margin: 0;
66+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
67+
color: white;
68+
}
69+
.container {
70+
text-align: center;
71+
padding: 40px;
72+
}
73+
h1 { margin-bottom: 16px; }
74+
p { opacity: 0.8; }
75+
</style>
76+
</head>
77+
<body>
78+
<div class="container">
79+
<h1>$title</h1>
80+
<p>$message</p>
81+
</div>
82+
</body>
83+
</html>
84+
''';
85+
}
86+
}

0 commit comments

Comments
 (0)