Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jobs:
if: github.event_name == 'push'
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654
with:
publish-dir: "./docs"
publish-dir: "./docs-gen"
production-branch: master
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "${{ steps.deployment-type.outputs.message }}"
Expand All @@ -71,7 +71,7 @@ jobs:
if: github.event_name == 'pull_request'
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0
with:
publish-dir: "./docs"
publish-dir: "./docs-gen"
production-branch: master
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "${{ steps.deployment-type.outputs.message }}"
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@ android/generated
.env
.xcode.env.local
coverage/
docs/

# Local Netlify folder
.netlify

# Documentation
docs-gen/
.docusaurus/
7 changes: 7 additions & 0 deletions Authenticating.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
group: Guides
category: Guides
---
# Authenticating

TODO: descript the authentification flow
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

## 2.0.4

## Updates
### Updates
- Added API documentation via Netlify([1087275](https://github.com/Iterable/react-native-sdk/commit/1087275))
- Removed dependency on `react-native-vector-icons`, per issues
[#513](https://github.com/Iterable/react-native-sdk/issues/513),
Expand Down
7 changes: 7 additions & 0 deletions In-app Inbox.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
group: Guides
category: Guides
---
# In-app Inbox

TODO: add instructions for the inbox
7 changes: 7 additions & 0 deletions Quick Start.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
group: Guides
category: Guides
---
# Quick Start

TODO: Add quick start instructions
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Iterable logo](./images/Iterable-Logo.png "Iterable Logo")
![Iterable logo](./assets/Iterable-Logo.png "Iterable Logo")

# Iterable's React Native SDK

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import android.net.Uri;
import android.os.Bundle;

import java.time.Duration;
import java.util.Date;

import androidx.annotation.NonNull;
Expand Down Expand Up @@ -596,40 +597,22 @@ public void pauseAuthRetries(boolean pauseRetry) {
IterableApi.getInstance().pauseAuthRetries(pauseRetry);
}

// public void generateJwtForUserId(String secret, double iat, double exp, String userId, String email, Promise promise) {
public void generateJwtForUserId(ReadableMap opts, Promise promise) {
String secret = opts.getString("secret");
double iat = opts.getDouble("iat");
double exp = opts.getDouble("exp");
String userId = opts.hasKey("userId") && !opts.isNull("userId") ? opts.getString("userId") : null;
String email = opts.hasKey("email") && !opts.isNull("email") ? opts.getString("email") : null;

public void generateJwtToken(ReadableMap opts, Promise promise) {
try {
String secret = opts.getString("secret");
long durationMs = (long) opts.getDouble("duration");
String userId = opts.hasKey("userId") && !opts.isNull("userId") ? opts.getString("userId") : null;
String email = opts.hasKey("email") && !opts.isNull("email") ? opts.getString("email") : null;

// Validate that exactly one of userId or email is provided
if ((userId != null && email != null) || (userId == null && email == null)) {
promise.reject("E_INVALID_ARGS", "The token must include a userId or email, but not both.", (Throwable) null);
return;
}

// Build the JSON payload
String payload;
long iatLong = (long) iat;
long expLong = (long) exp;

if (userId != null) {
payload = String.format(
"{ \"userId\": \"%s\", \"iat\": %d, \"exp\": %d }",
userId, iatLong, expLong
);
} else {
payload = String.format(
"{ \"email\": \"%s\", \"iat\": %d, \"exp\": %d }",
email, iatLong, expLong
);
}

// Generate the JWT token
String token = IterableJwtGenerator.generateToken(secret, payload);
// Use the Android SDK's Duration-based JWT generator
Duration duration = Duration.ofMillis(durationMs);
String token = IterableJwtGenerator.generateToken(secret, duration, email, userId);
promise.resolve(token);
} catch (Exception e) {
promise.reject("E_JWT_GENERATION_FAILED", "Failed to generate JWT: " + e.getMessage(), e);
Expand Down
4 changes: 2 additions & 2 deletions android/src/newarch/java/com/RNIterableAPIModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ public void pauseAuthRetries(boolean pauseRetry) {
}

@Override
public void generateJwtForUserId(ReadableMap opts, Promise promise) {
moduleImpl.generateJwtForUserId(opts, promise);
public void generateJwtToken(ReadableMap opts, Promise promise) {
moduleImpl.generateJwtToken(opts, promise);
}

public void sendEvent(@NonNull String eventName, @Nullable Object eventData) {
Expand Down
4 changes: 2 additions & 2 deletions android/src/oldarch/java/com/RNIterableAPIModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ public void pauseAuthRetries(boolean pauseRetry) {
}

@ReactMethod
public void generateJwtForUserId(ReadableMap opts, Promise promise) {
moduleImpl.generateJwtForUserId(opts, promise);
public void generateJwtToken(ReadableMap opts, Promise promise) {
moduleImpl.generateJwtToken(opts, promise);
}

public void sendEvent(@NonNull String eventName, @Nullable Object eventData) {
Expand Down
11 changes: 11 additions & 0 deletions another-md.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
title: External Markdown
group: Documents
category: Guides
children:
- ./most-used-modules.md
---

# HELLO!

I'm an md with some `info`
File renamed without changes
Binary file added assets/favicon.ico
Binary file not shown.
120 changes: 0 additions & 120 deletions docs-deployment.md

This file was deleted.

47 changes: 47 additions & 0 deletions docs/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
sidebar_position: 1
---

# Tutorial Intro

Let's discover **Docusaurus in less than 5 minutes**.

## Getting Started

Get started by **creating a new site**.

Or **try Docusaurus immediately** with **[docusaurus.new](https://docusaurus.new)**.

### What you'll need

- [Node.js](https://nodejs.org/en/download/) version 20.0 or above:
- When installing Node.js, you are recommended to check all checkboxes related to dependencies.

## Generate a new site

Generate a new Docusaurus site using the **classic template**.

The classic template will automatically be added to your project after you run the command:

```bash
npm init docusaurus@latest my-website classic
```

You can type this command into Command Prompt, Powershell, Terminal, or any other integrated terminal of your code editor.

The command also installs all necessary dependencies you need to run Docusaurus.

## Start your site

Run the development server:

```bash
cd my-website
npm run start
```

The `cd` command changes the directory you're working with. In order to work with your newly created Docusaurus site, you'll need to navigate the terminal there.

The `npm run start` command builds your website locally and serves it through a development server, ready for you to view at http://localhost:3000/.

Open `docs/intro.md` (this page) and edit some lines: the site **reloads automatically** and displays your changes.
8 changes: 8 additions & 0 deletions docs/tutorial-basics/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"label": "Tutorial - Basics",
"position": 2,
"link": {
"type": "generated-index",
"description": "5 minutes to learn the most important Docusaurus concepts."
}
}
23 changes: 23 additions & 0 deletions docs/tutorial-basics/congratulations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
sidebar_position: 6
---

# Congratulations!

You have just learned the **basics of Docusaurus** and made some changes to the **initial template**.

Docusaurus has **much more to offer**!

Have **5 more minutes**? Take a look at **[versioning](../tutorial-extras/manage-docs-versions.md)** and **[i18n](../tutorial-extras/translate-your-site.md)**.

Anything **unclear** or **buggy** in this tutorial? [Please report it!](https://github.com/facebook/docusaurus/discussions/4610)

## What's next?

- Read the [official documentation](https://docusaurus.io/)
- Modify your site configuration with [`docusaurus.config.js`](https://docusaurus.io/docs/api/docusaurus-config)
- Add navbar and footer items with [`themeConfig`](https://docusaurus.io/docs/api/themes/configuration)
- Add a custom [Design and Layout](https://docusaurus.io/docs/styling-layout)
- Add a [search bar](https://docusaurus.io/docs/search)
- Find inspirations in the [Docusaurus showcase](https://docusaurus.io/showcase)
- Get involved in the [Docusaurus Community](https://docusaurus.io/community/support)
34 changes: 34 additions & 0 deletions docs/tutorial-basics/create-a-blog-post.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
sidebar_position: 3
---

# Create a Blog Post

Docusaurus creates a **page for each blog post**, but also a **blog index page**, a **tag system**, an **RSS** feed...

## Create your first Post

Create a file at `blog/2021-02-28-greetings.md`:

```md title="blog/2021-02-28-greetings.md"
---
slug: greetings
title: Greetings!
authors:
- name: Joel Marcey
title: Co-creator of Docusaurus 1
url: https://github.com/JoelMarcey
image_url: https://github.com/JoelMarcey.png
- name: Sébastien Lorber
title: Docusaurus maintainer
url: https://sebastienlorber.com
image_url: https://github.com/slorber.png
tags: [greetings]
---

Congratulations, you have made your first post!

Feel free to play around and edit this post as much as you like.
```

A new blog post is now available at [http://localhost:3000/blog/greetings](http://localhost:3000/blog/greetings).
Loading
Loading