Skip to content

Commit 373b45e

Browse files
authored
Merge branch 'OneSignal:main' into main
2 parents f32c9e5 + 145c7b5 commit 373b45e

12 files changed

Lines changed: 207 additions & 113 deletions

File tree

.github/codeql-config.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
paths:
2+
- src
3+
- android/src/main/java
4+
- .github/actions
5+
6+
paths-ignore:
7+
- "examples/**/android/**"
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Claude Code Review
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, ready_for_review, reopened]
6+
# Optional: Only run on specific file changes
7+
# paths:
8+
# - "src/**/*.ts"
9+
# - "src/**/*.tsx"
10+
# - "src/**/*.js"
11+
# - "src/**/*.jsx"
12+
13+
jobs:
14+
claude-review:
15+
# Optional: Filter by PR author
16+
# if: |
17+
# github.event.pull_request.user.login == 'external-contributor' ||
18+
# github.event.pull_request.user.login == 'new-developer' ||
19+
# github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR'
20+
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
pull-requests: read
25+
issues: read
26+
id-token: write
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 1
33+
34+
- name: Run Claude Code Review
35+
id: claude-review
36+
uses: anthropics/claude-code-action@v1
37+
with:
38+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
39+
plugin_marketplaces: 'https://github.com/anthropics/claude-code.git'
40+
plugins: 'code-review@claude-code-plugins'
41+
prompt: '/code-review:code-review ${{ github.repository }}/pull/${{ github.event.pull_request.number }}'
42+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
43+
# or https://code.claude.com/docs/en/cli-reference for available options
44+

.github/workflows/claude.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Claude Code
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
pull_request_review_comment:
7+
types: [created]
8+
issues:
9+
types: [opened, assigned]
10+
pull_request_review:
11+
types: [submitted]
12+
13+
jobs:
14+
claude:
15+
if: |
16+
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude')) ||
17+
(github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude')) ||
18+
(github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude')) ||
19+
(github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
20+
runs-on: ubuntu-latest
21+
permissions:
22+
contents: read
23+
pull-requests: read
24+
issues: read
25+
id-token: write
26+
actions: read # Required for Claude to read CI results on PRs
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 1
32+
33+
- name: Run Claude Code
34+
id: claude
35+
uses: anthropics/claude-code-action@v1
36+
with:
37+
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
38+
39+
# This is an optional setting that allows Claude to read CI results on PRs
40+
additional_permissions: |
41+
actions: read
42+
43+
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
44+
# prompt: 'Update the pull request description to include a summary of changes.'
45+
46+
# Optional: Add claude_args to customize behavior and configuration
47+
# See https://github.com/anthropics/claude-code-action/blob/main/docs/usage.md
48+
# or https://code.claude.com/docs/en/cli-reference for available options
49+
# claude_args: '--allowed-tools Bash(gh pr:*)'
50+

.github/workflows/codeql.yml

Lines changed: 35 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,14 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
#
12-
name: "CodeQL"
1+
name: 'CodeQL'
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.ref }}
5+
cancel-in-progress: true
136

147
on:
158
push:
16-
branches: [ "main", "major_release_5.0.0" ]
9+
branches: ['main']
1710
pull_request:
18-
# The branches below must be a subset of the branches above
19-
branches: [ "main", "major_release_5.0.0" ]
11+
branches: ['main']
2012
schedule:
2113
- cron: '37 19 * * 4'
2214

@@ -38,45 +30,37 @@ jobs:
3830
strategy:
3931
fail-fast: false
4032
matrix:
41-
language: [ 'javascript-typescript' ]
42-
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
43-
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
44-
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
45-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
33+
include:
34+
- language: actions
35+
build-mode: none
36+
dependency-caching: true
37+
- language: javascript-typescript
38+
build-mode: none
39+
dependency-caching: true
40+
- language: java
41+
build-mode: none
42+
dependency-caching: true
43+
# Not analyzing .m (Objective-C) & .h (Objective-C header) files for now unless CodeQL supports it in the future
4644

4745
steps:
48-
- name: Checkout repository
49-
uses: actions/checkout@v3
50-
51-
# Initializes the CodeQL tools for scanning.
52-
- name: Initialize CodeQL
53-
uses: github/codeql-action/init@v2
54-
with:
55-
languages: ${{ matrix.language }}
56-
# If you wish to specify custom queries, you can do so here or in a config file.
57-
# By default, queries listed here will override any specified in a config file.
58-
# Prefix the list here with "+" to use these queries and those in the config file.
59-
60-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
61-
# queries: security-extended,security-and-quality
62-
63-
64-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
65-
# If this step fails, then you should remove it and run the build manually (see below)
66-
- name: Autobuild
67-
uses: github/codeql-action/autobuild@v2
46+
- name: Checkout repository
47+
uses: actions/checkout@v6
6848

69-
# ℹ️ Command-line programs to run using the OS shell.
70-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
49+
# Initializes the CodeQL tools for scanning.
50+
- name: Initialize CodeQL
51+
uses: github/codeql-action/init@v4
7152

72-
# If the Autobuild fails above, remove it and uncomment the following three lines.
73-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
53+
with:
54+
dependency-caching: ${{ matrix.dependency-caching }}
55+
languages: ${{ matrix.language }}
56+
build-mode: ${{ matrix.build-mode }}
57+
config-file: ./.github/codeql-config.yml
7458

75-
# - run: |
76-
# echo "Run, Build Application using script"
77-
# ./location_of_script_within_repo/buildscript.sh
59+
- name: Autobuild
60+
if: matrix.build-mode == 'autobuild'
61+
uses: github/codeql-action/autobuild@v4
7862

79-
- name: Perform CodeQL Analysis
80-
uses: github/codeql-action/analyze@v2
81-
with:
82-
category: "/language:${{matrix.language}}"
63+
- name: Perform CodeQL Analysis
64+
uses: github/codeql-action/analyze@v4
65+
with:
66+
category: '/language:${{matrix.language}}'

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,15 @@ jobs:
9090
cd examples/RNOneSignalTS
9191
bun run setup
9292
93-
- name: Get current native SDK versions
93+
- name: Get current native SDK versions from target branch
9494
id: current_versions
9595
run: |
96-
# Current React Native version
97-
CURRENT_VERSION=$(jq -r .version package.json)
96+
git fetch origin ${{ inputs.target_branch }}
9897
99-
# Extract current Android SDK version
100-
ANDROID_VERSION=$(grep "api 'com.onesignal:OneSignal:" android/build.gradle | sed -E "s/.*OneSignal:([0-9.]+).*/\1/")
101-
102-
# Extract current iOS SDK version
103-
IOS_VERSION=$(grep "OneSignalXCFramework" react-native-onesignal.podspec | sed -E "s/.*'([0-9.]+)'.*/\1/")
98+
# Get versions from target branch (not the release branch)
99+
CURRENT_VERSION=$(git show origin/${{ inputs.target_branch }}:package.json | jq -r .version)
100+
ANDROID_VERSION=$(git show origin/${{ inputs.target_branch }}:android/build.gradle | grep "api 'com.onesignal:OneSignal:" | sed -E "s/.*OneSignal:([0-9.]+).*/\1/")
101+
IOS_VERSION=$(git show origin/${{ inputs.target_branch }}:react-native-onesignal.podspec | grep "OneSignalXCFramework" | sed -E "s/.*'([0-9.]+)'.*/\1/")
104102
105103
echo "rn_from=$CURRENT_VERSION" >> $GITHUB_OUTPUT
106104
echo "android_from=$ANDROID_VERSION" >> $GITHUB_OUTPUT

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.1.38'
34+
api 'com.onesignal:OneSignal:5.4.2'
3535

3636
testImplementation 'junit:junit:4.12'
3737
}

examples/RNOneSignalTS/OSDemo.tsx

Lines changed: 43 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import { useFocusEffect } from '@react-navigation/native';
22
import React, { useCallback, useEffect, useState } from 'react';
33
import {
4-
Alert,
54
ScrollView,
65
StyleSheet,
76
Text,
87
TextInput,
98
TouchableOpacity,
109
View,
1110
} from 'react-native';
12-
import { LogLevel, OneSignal } from 'react-native-onesignal';
11+
import {
12+
LogLevel,
13+
NotificationClickEvent,
14+
NotificationWillDisplayEvent,
15+
OneSignal,
16+
} from 'react-native-onesignal';
1317
import { SafeAreaView } from 'react-native-safe-area-context';
1418
import OSButtons from './OSButtons';
1519
import OSConsole from './OSConsole';
@@ -37,44 +41,51 @@ const OSDemo: React.FC = () => {
3741
}, []);
3842

3943
const onForegroundWillDisplay = useCallback(
40-
(event: unknown) => {
41-
OSLog('OneSignal: notification will show in foreground:', event);
42-
const notif = (
43-
event as { getNotification: () => { title: string } }
44-
).getNotification();
44+
(event: NotificationWillDisplayEvent) => {
45+
const notif = event.getNotification();
46+
OSLog('OneSignal: notification will show in foreground:', notif.title);
47+
console.log('Will display notification event:', notif);
4548

46-
const cancelButton = {
47-
text: 'Cancel',
48-
onPress: () => {
49-
(event as { preventDefault: () => void }).preventDefault();
50-
},
51-
style: 'cancel' as const,
52-
};
49+
event.preventDefault();
5350

54-
const completeButton = {
55-
text: 'Display',
56-
onPress: () => {
57-
(event as { getNotification: () => { display: () => void } })
58-
.getNotification()
59-
.display();
60-
},
61-
};
51+
setTimeout(() => {
52+
notif.display();
53+
}, 5000);
6254

63-
Alert.alert(
64-
'Display notification?',
65-
notif.title,
66-
[cancelButton, completeButton],
67-
{
68-
cancelable: true,
69-
},
70-
);
55+
// const cancelButton = {
56+
// text: 'Cancel',
57+
// onPress: () => {
58+
// (event as { preventDefault: () => void }).preventDefault();
59+
// },
60+
// style: 'cancel' as const,
61+
// };
62+
63+
// const completeButton = {
64+
// text: 'Display',
65+
// onPress: () => {
66+
// (event as { getNotification: () => { display: () => void } })
67+
// .getNotification()
68+
// .display();
69+
// },
70+
// };
71+
72+
// Alert.alert(
73+
// 'Display notification?',
74+
// notif.title,
75+
// [cancelButton, completeButton],
76+
// {
77+
// cancelable: true,
78+
// },
79+
// );
7180
},
7281
[OSLog],
7382
);
7483

7584
const onNotificationClick = useCallback(
76-
(event: unknown) => {
77-
OSLog('OneSignal: notification clicked:', event);
85+
(event: NotificationClickEvent) => {
86+
const notif = event.notification;
87+
OSLog('OneSignal: notification clicked:', notif.title);
88+
console.log('Notification clicked event:', notif);
7889
},
7990
[OSLog],
8091
);

0 commit comments

Comments
 (0)