apphud / ApphudSDK-Flutter

MIT License
5 stars 5 forks source link

[BUG] Doesn't work after hot restart. #55

Closed darkstarx closed 11 months ago

darkstarx commented 1 year ago

All async methods for loading something don't work, they just freeze. Also ApphudListener doesn't work after hot restart, paywallsDidFullyLoad and userDidLoad return empty lists.

class ApphudService implements ApphudListener
{
  Future<void> init() async
  {
    await Apphud.enableDebugLogs(level: ApphudDebugLevel.high);
    await Apphud.setListener(listener: this);
    await Apphud.start(
      apiKey: Global.config.apphud.apiKey,
      observerMode: false,
    );
    // await Apphud.products();  // Freezes after hotrestart (after repeated execution of the init method)
  }

  Future<void> dismiss() async
  {
    await Apphud.setListener(listener: null);
    await Apphud.logout();
  }

  @override
  Future<void> apphudDidChangeUserID(final String userId) async
  {
    _log.fine('Apphud user: $userId');
  }

  @override
  Future<void> apphudDidFecthProducts(
    final List<ApphudProductComposite> products,
  ) async
  {
    _log.fine('Apphud products: $products');
  }

  @override
  Future<void> apphudNonRenewingPurchasesUpdated(
    final List<ApphudNonRenewingPurchase> purchases,
  ) async
  {
    _log.fine('Apphud purchases: $purchases');
  }

  @override
  Future<void> apphudSubscriptionsUpdated(
    final List<ApphudSubscriptionWrapper> subscriptions,
  ) async
  {
    _log.fine('Apphud subscriptions: $subscriptions');
  }

  @override
  Future<void> paywallsDidFullyLoad(final ApphudPaywalls paywalls) async
  {
    _log.fine('Apphud paywalls: $paywalls');
  }

  @override
  Future<void> userDidLoad(final ApphudPaywalls paywalls) async
  {
    _log.fine('Apphud user paywalls: $paywalls');
  }
}
ren6 commented 11 months ago

@darkstarx I guess you fixed your issue? I will reopen if it's still not fixed. Closing for now.