File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11library echidna_flutter;
22
3+ import 'dart:convert' ;
4+
35import 'package:dio/dio.dart' ;
46import 'package:echidna_flutter/src/echidna.dart' ;
57import 'package:mcquenji_core/mcquenji_core.dart' ;
@@ -20,7 +22,7 @@ abstract class SignatureService extends Service implements Interceptor {
2022 RequestOptions options,
2123 RequestInterceptorHandler handler,
2224 ) {
23- options.headers['x-signature' ] = sign (options.data. toString ( ));
25+ options.headers['x-signature' ] = sign (jsonEncode ( options.data));
2426 options.headers['client-id' ] = EchidnaConfig .instance.clientId;
2527
2628 handler.next (options);
Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ class HmacSignatureService extends SignatureService {
2424 return false ;
2525 }
2626
27- final body = response.data.toString ();
27+ final body = jsonEncode (response.data);
28+
2829 return signature == sign (body);
2930 }
3031}
Original file line number Diff line number Diff line change @@ -22,13 +22,15 @@ class FeatureGuard extends RouteGuard {
2222 Future <bool > canActivate (String path, ModularRoute route) async {
2323 if (kDebugMode) return true ;
2424
25- final license = Modular .get <LicenseRepository >().state ;
25+ final license = Modular .get <LicenseRepository >();
2626
27- if (! license.hasData) {
27+ await license.ready;
28+
29+ if (! license.state.hasData) {
2830 return false ;
2931 }
3032
31- final unlockedFeatures = license.requireData.featureClaims.map ((c) => c.feature.id);
33+ final unlockedFeatures = license.state. requireData.featureClaims.map ((c) => c.feature.id);
3234
3335 if (! features.every (unlockedFeatures.contains)) {
3436 return false ;
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ class LicenseRepository extends Repository<AsyncValue<LicenseStatus>> {
3535 return ;
3636 }
3737
38- final userId = _userId.state.requireData .userId;
38+ final userId = waitForData ( _userId) .userId;
3939
4040 log ('Getting license status for user $userId ' );
4141
You can’t perform that action at this time.
0 commit comments