Skip to content

Commit

Permalink
isPurchaseAllowed should be an answer
Browse files Browse the repository at this point in the history
... instead of a question.
  • Loading branch information
CarlosNihelton committed Oct 17, 2023
1 parent 0a70e5a commit b4bf3f7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class SubscribeNowPage extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
children: [
Tooltip(
message: model.isPurchaseAllowed()
message: model.purchaseAllowed()
? ''
: lang.subscribeNowTooltipDisabled,
child: ElevatedButton(
onPressed: model.isPurchaseAllowed()
onPressed: model.purchaseAllowed()
? () async {
final subs = await model.purchaseSubscription();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class SubscribeNowModel extends SubscriptionStatusModel {
/// Returns true if the environment variable 'UP4W_ALLOW_STORE_PURCHASE' has been set.
/// Since this reading won't change during the app lifetime, even if the user changes
/// it's value from outside, the value is cached so we don't check the environment more than once.
bool isPurchaseAllowed() {
bool purchaseAllowed() {
return _isPurchaseAllowed ??= ['true', '1', 'on']
.contains(Environment()['UP4W_ALLOW_STORE_PURCHASE']?.toLowerCase());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ void main() {

test('disabled by default', () {
final model = SubscribeNowModel(client);
expect(model.isPurchaseAllowed(), isFalse);
expect(model.purchaseAllowed(), isFalse);
});

test('expected failure', () async {
Expand Down

0 comments on commit b4bf3f7

Please sign in to comment.