Skip to content

Commit f93b745

Browse files
authored
Merge branch 'OneSignal:main' into main
2 parents 373b45e + e3b2964 commit f93b745

175 files changed

Lines changed: 10492 additions & 4237 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../CLAUDE.md

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717
if: |
1818
github.event.pull_request.merged == true &&
1919
contains(github.event.pull_request.title, 'chore: Release')
20-
uses: OneSignal/sdk-actions/.github/workflows/publish-npm-github.yml@main
20+
uses: OneSignal/sdk-shared/.github/workflows/publish-npm-github.yml@main
2121
with:
2222
branch: ${{ github.event.pull_request.base.ref }}

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ concurrency:
1010

1111
jobs:
1212
call:
13-
uses: OneSignal/sdk-actions/.github/workflows/wrapper-js-ci.yml@main
13+
uses: OneSignal/sdk-shared/.github/workflows/wrapper-js-ci.yml@main

.github/workflows/create-release-pr.yml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ on:
4949

5050
jobs:
5151
prep:
52-
uses: OneSignal/sdk-actions/.github/workflows/prep-release.yml@main
52+
uses: OneSignal/sdk-shared/.github/workflows/prep-release.yml@main
5353
secrets:
54-
# Need this cross-repo token (sdk-actions & this repo) to perform changes
54+
# Need this cross-repo token (sdk-shared & this repo) to perform changes
5555

5656
GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
5757
with:
@@ -71,24 +71,21 @@ jobs:
7171
- name: Checkout
7272
uses: actions/checkout@v5
7373
with:
74-
# Need repository otherwise caller would set github.repository to the caller itself (e.g. sdk-actions)
74+
# Need repository otherwise caller would set github.repository to the caller itself (e.g. sdk-shared)
7575
repository: OneSignal/react-native-onesignal
7676
ref: ${{ needs.prep.outputs.release_branch }}
7777
token: ${{ secrets.GH_PUSH_TOKEN || github.token }}
7878

7979
- name: Setup Git User
80-
uses: OneSignal/sdk-actions/.github/actions/setup-git-user@main
80+
uses: OneSignal/sdk-shared/.github/actions/setup-git-user@main
8181

8282
- name: Setup Bun
8383
uses: oven-sh/setup-bun@v2
8484
with:
8585
bun-version: latest
8686

8787
- name: Install
88-
run: |
89-
bun install --frozen-lockfile
90-
cd examples/RNOneSignalTS
91-
bun run setup
88+
run: bun install --frozen-lockfile
9289

9390
- name: Get current native SDK versions from target branch
9491
id: current_versions
@@ -164,12 +161,12 @@ jobs:
164161
165162
create-pr:
166163
needs: [prep, update_version]
167-
uses: OneSignal/sdk-actions/.github/workflows/create-release.yml@main
164+
uses: OneSignal/sdk-shared/.github/workflows/create-release.yml@main
168165
secrets:
169-
# Need this cross-repo token (sdk-actions & this repo) to perform changes
166+
# Need this cross-repo token (sdk-shared & this repo) to perform changes
170167
GH_PUSH_TOKEN: ${{ secrets.GH_PUSH_TOKEN }}
171168
with:
172-
# Need target_repo otherwise caller would set github.repository to the caller itself (e.g. sdk-actions)
169+
# Need target_repo otherwise caller would set github.repository to the caller itself (e.g. sdk-shared)
173170
target_repo: OneSignal/react-native-onesignal
174171
release_branch: ${{ needs.prep.outputs.release_branch }}
175172
target_branch: ${{ inputs.target_branch }}

.github/workflows/lint-pr-title.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ on:
77

88
jobs:
99
call:
10-
uses: OneSignal/sdk-actions/.github/workflows/lint-pr-title.yml@main
10+
uses: OneSignal/sdk-shared/.github/workflows/lint-pr-title.yml@main
1111
secrets: inherit

.gitignore

Lines changed: 13 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -23,38 +23,23 @@ examples/.DS_Store
2323

2424
# examples node_modules
2525
#
26-
examples/CocoapodsDemo/node_modules
27-
examples/RNOneSignal/node_modules
26+
examples/*/node_modules
2827
*.iml
2928
local.properties
3029

31-
# examples android device Data
30+
# examples android data
3231
#
33-
examples/CocoapodsDemo/android/app/build
34-
examples/CocoapodsDemo/android/.gradle
35-
examples/CocoapodsDemo/android/.idea
36-
examples/CocoapodsDemo/android/build
37-
examples/RNOneSignalTS/android/app/build
38-
examples/RNOneSignalTS/android/app/debug.keystore
39-
examples/RNOneSignalTS/android/.gradle
40-
examples/RNOneSignalTS/android/.idea
41-
examples/RNOneSignalTS/android/build
32+
examples/*/android/app/build
33+
examples/*/android/app/debug.keystore
34+
examples/*/android/.gradle
35+
examples/*/android/.idea
36+
examples/*/android/build
4237

4338
# examples iOS data
4439
#
45-
examples/CocoapodsDemo/ios/CocoapodsDemo.xcodeproj/project.xcworkspace/xcshareddata
46-
examples/CocoapodsDemo/ios/CocoapodsDemo.xcodeproj/project.xcworkspace/xcuserdata
47-
examples/CocoapodsDemo/ios/CocoapodsDemo.xcodeproj/xcuserdata
48-
examples/CocoapodsDemo/ios/CocoapodsDemo.xcworkspace/xcshareddata
49-
examples/CocoapodsDemo/ios/CocoapodsDemo.xcworkspace/xcuserdata
50-
examples/CocoapodsDemo/ios/Pods/Pods.xcodeproj/xcuserdata
51-
examples/RNOneSignalTS/ios/RNOneSignal.xcodeproj/project.xcworkspace/xcshareddata
52-
examples/RNOneSignalTS/ios/RNOneSignal.xcodeproj/project.xcworkspace/xcuserdata
53-
examples/RNOneSignalTS/ios/RNOneSignal.xcodeproj/xcuserdata
54-
examples/RNOneSignalTS/ios/RNOneSignal.xcworkspace/xcshareddata
55-
examples/RNOneSignalTS/ios/RNOneSignal.xcworkspace/xcuserdata
56-
examples/RNOneSignal/ios/Pods/Pods.xcodeproj/xcuserdata
57-
58-
59-
60-
40+
examples/*/ios/*.xcodeproj/project.xcworkspace/xcshareddata
41+
examples/*/ios/*.xcodeproj/project.xcworkspace/xcuserdata
42+
examples/*/ios/*.xcodeproj/xcuserdata
43+
examples/*/ios/*.xcworkspace/xcshareddata
44+
examples/*/ios/*.xcworkspace/xcuserdata
45+
examples/*/ios/Pods/Pods.xcodeproj/xcuserdata

.prettierignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
examples/RNOneSignalTS/vendor
2-
examples/RNOneSignalTS/ios
3-
examples/RNOneSignalTS/android
1+
examples/*/vendor
2+
examples/*/ios
3+
examples/*/android

CLAUDE.md

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
---
2+
description: Use Bun instead of Node.js, npm, pnpm, or vite.
3+
globs: "*.ts, *.tsx, *.html, *.css, *.js, *.jsx, package.json"
4+
alwaysApply: false
5+
---
6+
7+
Default to using Bun instead of Node.js.
8+
9+
- Use `bun <file>` instead of `node <file>` or `ts-node <file>`
10+
- Use `bun test` instead of `jest` or `vitest`
11+
- Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
12+
- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
13+
- Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
14+
- Use `bunx <package> <command>` instead of `npx <package> <command>`
15+
- Bun automatically loads .env, so don't use dotenv.
16+
17+
## APIs
18+
19+
- `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
20+
- `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
21+
- `Bun.redis` for Redis. Don't use `ioredis`.
22+
- `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
23+
- `WebSocket` is built-in. Don't use `ws`.
24+
- Prefer `Bun.file` over `node:fs`'s readFile/writeFile
25+
- Bun.$`ls` instead of execa.
26+
27+
## Testing
28+
29+
Use `bun test` to run tests.
30+
31+
```ts#index.test.ts
32+
import { test, expect } from "bun:test";
33+
34+
test("hello world", () => {
35+
expect(1).toBe(1);
36+
});
37+
```
38+
39+
## Frontend
40+
41+
Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
42+
43+
Server:
44+
45+
```ts#index.ts
46+
import index from "./index.html"
47+
48+
Bun.serve({
49+
routes: {
50+
"/": index,
51+
"/api/users/:id": {
52+
GET: (req) => {
53+
return new Response(JSON.stringify({ id: req.params.id }));
54+
},
55+
},
56+
},
57+
// optional websocket support
58+
websocket: {
59+
open: (ws) => {
60+
ws.send("Hello, world!");
61+
},
62+
message: (ws, message) => {
63+
ws.send(message);
64+
},
65+
close: (ws) => {
66+
// handle close
67+
}
68+
},
69+
development: {
70+
hmr: true,
71+
console: true,
72+
}
73+
})
74+
```
75+
76+
HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.
77+
78+
```html#index.html
79+
<html>
80+
<body>
81+
<h1>Hello, world!</h1>
82+
<script type="module" src="./frontend.tsx"></script>
83+
</body>
84+
</html>
85+
```
86+
87+
With the following `frontend.tsx`:
88+
89+
```tsx#frontend.tsx
90+
import React from "react";
91+
import { createRoot } from "react-dom/client";
92+
93+
// import .css files directly and it works
94+
import './index.css';
95+
96+
const root = createRoot(document.body);
97+
98+
export default function Frontend() {
99+
return <h1>Hello, world!</h1>;
100+
}
101+
102+
root.render(<Frontend />);
103+
```
104+
105+
Then, run index.ts
106+
107+
```sh
108+
bun --hot ./index.ts
109+
```
110+
111+
For more information, read the Bun API docs in `node_modules/bun-types/docs/**.mdx`.

__mocks__/react-native.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ const mockRNOneSignal = {
8686
addOutcomeWithValue: vi.fn(),
8787
displayNotification: vi.fn(),
8888
preventDefault: vi.fn(),
89+
trackEvent: vi.fn(),
8990
};
9091

9192
const mockPlatform = {

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ dependencies {
3131

3232
// api is used instead of implementation so the parent :app project can access any of the OneSignal Java
3333
// classes if needed. Such as com.onesignal.NotificationExtenderService
34-
api 'com.onesignal:OneSignal:5.4.2'
34+
api 'com.onesignal:OneSignal:5.6.1'
3535

3636
testImplementation 'junit:junit:4.12'
3737
}

0 commit comments

Comments
 (0)