presentCustomerCenter static method

Future<void> presentCustomerCenter({
  1. CustomerCenterRestoreStarted? onRestoreStarted,
  2. CustomerCenterRestoreCompleted? onRestoreCompleted,
  3. CustomerCenterRestoreFailed? onRestoreFailed,
  4. CustomerCenterManageSubscriptions? onShowingManageSubscriptions,
  5. CustomerCenterRefundRequestStarted? onRefundRequestStarted,
  6. CustomerCenterRefundRequestCompleted? onRefundRequestCompleted,
  7. CustomerCenterFeedbackSurveyCompleted? onFeedbackSurveyCompleted,
  8. CustomerCenterManagementOptionSelected? onManagementOptionSelected,
  9. CustomerCenterCustomActionSelected? onCustomActionSelected,
})

Presents the customer center modally using the native SDKs.

Provide callback handlers to receive customer center lifecycle events. All handlers are optional.

Implementation

static Future<void> presentCustomerCenter({
  CustomerCenterRestoreStarted? onRestoreStarted,
  CustomerCenterRestoreCompleted? onRestoreCompleted,
  CustomerCenterRestoreFailed? onRestoreFailed,
  CustomerCenterManageSubscriptions? onShowingManageSubscriptions,
  CustomerCenterRefundRequestStarted? onRefundRequestStarted,
  CustomerCenterRefundRequestCompleted? onRefundRequestCompleted,
  CustomerCenterFeedbackSurveyCompleted? onFeedbackSurveyCompleted,
  CustomerCenterManagementOptionSelected? onManagementOptionSelected,
  CustomerCenterCustomActionSelected? onCustomActionSelected,
}) async {
  _setMethodChannelHandlerIfNeeded();
  final hasCallbacks = onRestoreStarted != null ||
      onRestoreCompleted != null ||
      onRestoreFailed != null ||
      onShowingManageSubscriptions != null ||
      onRefundRequestStarted != null ||
      onRefundRequestCompleted != null ||
      onFeedbackSurveyCompleted != null ||
      onManagementOptionSelected != null ||
      onCustomActionSelected != null;

  await _clearCustomerCenterCallbacks();

  if (hasCallbacks) {
    await _registerCustomerCenterCallbacks(
      onRestoreStarted: onRestoreStarted,
      onRestoreCompleted: onRestoreCompleted,
      onRestoreFailed: onRestoreFailed,
      onShowingManageSubscriptions: onShowingManageSubscriptions,
      onRefundRequestStarted: onRefundRequestStarted,
      onRefundRequestCompleted: onRefundRequestCompleted,
      onFeedbackSurveyCompleted: onFeedbackSurveyCompleted,
      onManagementOptionSelected: onManagementOptionSelected,
      onCustomActionSelected: onCustomActionSelected,
    );
  }
  await _methodChannel.invokeMethod('presentCustomerCenter');
}