Skip to content

Commit

Permalink
Generated docs for 967f668
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Mar 8, 2024
1 parent 4337fd2 commit 300f12f
Show file tree
Hide file tree
Showing 11 changed files with 70 additions and 70 deletions.
10 changes: 5 additions & 5 deletions docs/enums/EventName.html

Large diffs are not rendered by default.

40 changes: 20 additions & 20 deletions docs/enums/ProfileProperty.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@
</code><button>Copy</button></pre>
</li>
<li><p>Finally, in your React Native code, you can collect &amp; set the push token as follows:</p>
<pre><code class="language-typescript"><span class="hl-4">import</span><span class="hl-2"> </span><span class="hl-5">messaging</span><span class="hl-2"> </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;@react-native-firebase/messaging&#39;</span><span class="hl-2">;</span><br/><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">Klaviyo</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;klaviyo-react-native-sdk&#39;</span><span class="hl-2">;</span><br/><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">Platform</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;react-native&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-1">fetchAndSetPushToken</span><span class="hl-2"> = </span><span class="hl-6">async</span><span class="hl-2"> () </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">try</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-6">let</span><span class="hl-2"> </span><span class="hl-5">deviceToken</span><span class="hl-2">: </span><span class="hl-8">string</span><span class="hl-2"> | </span><span class="hl-8">null</span><span class="hl-2"> = </span><span class="hl-6">null</span><span class="hl-2">;</span><br/><span class="hl-2"> </span><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">Platform</span><span class="hl-2">.</span><span class="hl-7">OS</span><span class="hl-2"> === </span><span class="hl-3">&#39;android&#39;</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">deviceToken</span><span class="hl-2"> = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">messaging</span><span class="hl-2">().</span><span class="hl-1">getToken</span><span class="hl-2">();</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;FCM Token:&#39;</span><span class="hl-2">, </span><span class="hl-5">deviceToken</span><span class="hl-2">);</span><br/><span class="hl-2"> } </span><span class="hl-4">else</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-5">deviceToken</span><span class="hl-2"> = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">messaging</span><span class="hl-2">().</span><span class="hl-1">getAPNSToken</span><span class="hl-2">();</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;APNs Token:&#39;</span><span class="hl-2">, </span><span class="hl-5">deviceToken</span><span class="hl-2">);</span><br/><span class="hl-2"> }</span><br/><br/><span class="hl-2"> </span><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">deviceToken</span><span class="hl-2"> != </span><span class="hl-6">null</span><span class="hl-2"> &amp;&amp; </span><span class="hl-5">deviceToken</span><span class="hl-2">.</span><span class="hl-5">length</span><span class="hl-2"> &gt; </span><span class="hl-9">0</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">Klaviyo</span><span class="hl-2">.</span><span class="hl-1">setPushToken</span><span class="hl-2">(</span><span class="hl-5">deviceToken</span><span class="hl-2">!);</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> } </span><span class="hl-4">catch</span><span class="hl-2"> (</span><span class="hl-5">error</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-3">&#39;Error in fetchAndSetPushToken:&#39;</span><span class="hl-2">, </span><span class="hl-5">error</span><span class="hl-2">);</span><br/><span class="hl-2"> }</span><br/><span class="hl-2">};</span>
<pre><code class="language-typescript"><span class="hl-4">import</span><span class="hl-2"> </span><span class="hl-5">messaging</span><span class="hl-2"> </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;@react-native-firebase/messaging&#39;</span><span class="hl-2">;</span><br/><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">Klaviyo</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;klaviyo-react-native-sdk&#39;</span><span class="hl-2">;</span><br/><span class="hl-4">import</span><span class="hl-2"> { </span><span class="hl-5">Platform</span><span class="hl-2"> } </span><span class="hl-4">from</span><span class="hl-2"> </span><span class="hl-3">&#39;react-native&#39;</span><span class="hl-2">;</span><br/><br/><span class="hl-6">const</span><span class="hl-2"> </span><span class="hl-1">fetchAndSetPushToken</span><span class="hl-2"> = </span><span class="hl-6">async</span><span class="hl-2"> () </span><span class="hl-6">=&gt;</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-4">try</span><span class="hl-2"> {</span><br/><span class="hl-2"> </span><span class="hl-6">let</span><span class="hl-2"> </span><span class="hl-5">deviceToken</span><span class="hl-2">: </span><span class="hl-8">string</span><span class="hl-2"> | </span><span class="hl-8">null</span><span class="hl-2"> = </span><span class="hl-6">null</span><span class="hl-2">;</span><br/><span class="hl-2"> </span><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">Platform</span><span class="hl-2">.</span><span class="hl-7">OS</span><span class="hl-2"> === </span><span class="hl-3">&#39;android&#39;</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-0">// For Android, Klaviyo requires the FCM token</span><br/><span class="hl-2"> </span><span class="hl-5">deviceToken</span><span class="hl-2"> = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">messaging</span><span class="hl-2">().</span><span class="hl-1">getToken</span><span class="hl-2">();</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;FCM Token:&#39;</span><span class="hl-2">, </span><span class="hl-5">deviceToken</span><span class="hl-2">);</span><br/><span class="hl-2"> } </span><span class="hl-4">else</span><span class="hl-2"> </span><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">Platform</span><span class="hl-2">.</span><span class="hl-7">OS</span><span class="hl-2"> === </span><span class="hl-3">&#39;ios&#39;</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-0">// For iOS, Klaviyo requires the APNs token</span><br/><span class="hl-2"> </span><span class="hl-5">deviceToken</span><span class="hl-2"> = </span><span class="hl-4">await</span><span class="hl-2"> </span><span class="hl-1">messaging</span><span class="hl-2">().</span><span class="hl-1">getAPNSToken</span><span class="hl-2">();</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">log</span><span class="hl-2">(</span><span class="hl-3">&#39;APNs Token:&#39;</span><span class="hl-2">, </span><span class="hl-5">deviceToken</span><span class="hl-2">);</span><br/><span class="hl-2"> }</span><br/><br/><span class="hl-2"> </span><span class="hl-4">if</span><span class="hl-2"> (</span><span class="hl-5">deviceToken</span><span class="hl-2"> != </span><span class="hl-6">null</span><span class="hl-2"> &amp;&amp; </span><span class="hl-5">deviceToken</span><span class="hl-2">.</span><span class="hl-5">length</span><span class="hl-2"> &gt; </span><span class="hl-9">0</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">Klaviyo</span><span class="hl-2">.</span><span class="hl-1">setPushToken</span><span class="hl-2">(</span><span class="hl-5">deviceToken</span><span class="hl-2">!);</span><br/><span class="hl-2"> }</span><br/><span class="hl-2"> } </span><span class="hl-4">catch</span><span class="hl-2"> (</span><span class="hl-5">error</span><span class="hl-2">) {</span><br/><span class="hl-2"> </span><span class="hl-5">console</span><span class="hl-2">.</span><span class="hl-1">error</span><span class="hl-2">(</span><span class="hl-3">&#39;Error in fetchAndSetPushToken:&#39;</span><span class="hl-2">, </span><span class="hl-5">error</span><span class="hl-2">);</span><br/><span class="hl-2"> }</span><br/><span class="hl-2">};</span>
</code><button>Copy</button></pre>
</li>
</ol>
Expand Down
Loading

0 comments on commit 300f12f

Please sign in to comment.