Module: ExpoNotifier

Defined in:
lib/expo_notifier/version.rb,
lib/expo_notifier.rb,
lib/expo_notifier/response.rb,
lib/expo_notifier/mapper/base.rb,
lib/expo_notifier/mapper/error.rb,
lib/expo_notifier/request/base.rb,
lib/expo_notifier/mapper/push_ticket.rb,
lib/expo_notifier/mapper/push_message.rb,
lib/expo_notifier/mapper/push_receipt.rb,
lib/expo_notifier/mapper/push_tickets.rb,
lib/expo_notifier/mapper/rich_content.rb,
lib/expo_notifier/mapper/push_messages.rb,
lib/expo_notifier/mapper/push_receipts.rb,
lib/expo_notifier/mapper/push_receipt_ids.rb,
lib/expo_notifier/request/send_push_notifications.rb,
lib/expo_notifier/mapper/push_ticket_error_details.rb,
lib/expo_notifier/mapper/push_receipt_error_details.rb,
lib/expo_notifier/request/get_push_notification_receipts.rb

Overview

typed: strict frozen_string_literal: true

Defined Under Namespace

Modules: Mapper, Request Classes: Response

Constant Summary collapse

VERSION =
'0.1.0'

Class Method Summary collapse

Class Method Details

.expo_push_token?(token) ⇒ Boolean

: (String) -> bool

Returns:

  • (Boolean)


12
13
14
15
16
17
# File 'lib/expo_notifier.rb', line 12

def expo_push_token?(token)
  return false unless token.is_a?(String)

  ((token.start_with?('ExponentPushToken[') || token.start_with?('ExpoPushToken[')) && token.end_with?(']')) ||
    token.match?(/\A[a-z\d]{8}-[a-z\d]{4}-[a-z\d]{4}-[a-z\d]{4}-[a-z\d]{12}\z/i)
end