File tree Expand file tree Collapse file tree 8 files changed +53
-15
lines changed
Expand file tree Collapse file tree 8 files changed +53
-15
lines changed Original file line number Diff line number Diff line change 44 "author" : " Ionic Framework" ,
55 "homepage" : " https://ionicframework.com/" ,
66 "scripts" : {
7- "ng" : " ng" ,
87 "ionic:build" : " ../scripts/build.sh IonicAngular" ,
8+ "ng" : " ng" ,
99 "start" : " ng serve" ,
1010 "build" : " ng build" ,
1111 "watch" : " ng build --watch --configuration development" ,
Original file line number Diff line number Diff line change @@ -16,6 +16,25 @@ export class AppComponent {
1616 const APP_ID = '77e32082-ea27-42e3-a898-c72e141824ef' ; // Use your app ID
1717 OneSignal . Debug . setLogLevel ( LogLevel . Verbose ) ;
1818 OneSignal . initialize ( APP_ID ) ;
19- OneSignal . login ( 'ionic-angular-8' ) ;
19+
20+ OneSignal . InAppMessages . addEventListener ( 'click' , ( event ) => {
21+ console . log ( 'OneSignal IAM clicked:' , event ) ;
22+ } ) ;
23+
24+ OneSignal . InAppMessages . addEventListener ( 'willDisplay' , ( event ) => {
25+ console . log ( 'OneSignal: will display IAM: ' , event ) ;
26+ } ) ;
27+
28+ OneSignal . InAppMessages . addEventListener ( 'didDisplay' , ( event ) => {
29+ console . log ( 'OneSignal: did display IAM: ' , event ) ;
30+ } ) ;
31+
32+ OneSignal . InAppMessages . addEventListener ( 'willDismiss' , ( event ) => {
33+ console . log ( 'OneSignal: will dismiss IAM: ' , event ) ;
34+ } ) ;
35+
36+ OneSignal . InAppMessages . addEventListener ( 'didDismiss' , ( event ) => {
37+ console . log ( 'OneSignal: did dismiss IAM: ' , event ) ;
38+ } ) ;
2039 }
2140}
Original file line number Diff line number Diff line change @@ -17,5 +17,17 @@ <h2>Welcome to OneSignal Ionic Angular Example</h2>
1717 This example demonstrates the OneSignal Cordova SDK integration with Ionic
1818 Angular.
1919 </ p >
20+
21+ < ion-item >
22+ < ion-input
23+ label ="External ID "
24+ labelPlacement ="floating "
25+ placeholder ="Enter external user ID "
26+ [(ngModel)] ="externalId "
27+ > </ ion-input >
28+ </ ion-item >
29+ < ion-button expand ="block " (click) ="login() " [disabled] ="!externalId ">
30+ Login
31+ </ ion-button >
2032 </ div >
2133</ ion-content >
Original file line number Diff line number Diff line change 11import { Component } from '@angular/core' ;
2+ import OneSignal from 'onesignal-cordova-plugin' ;
23
34@Component ( {
45 selector : 'app-home' ,
@@ -7,5 +8,14 @@ import { Component } from '@angular/core';
78 standalone : false ,
89} )
910export class HomePage {
11+ externalId = '' ;
12+
1013 constructor ( ) { }
14+
15+ login ( ) {
16+ if ( this . externalId ) {
17+ OneSignal . login ( this . externalId ) ;
18+ console . log ( 'OneSignal login called with:' , this . externalId ) ;
19+ }
20+ }
1121}
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ dependencies {
1313 implementation " com.onesignal:OneSignal:5.1.38"
1414 implementation " org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10"
1515}
16- apply from : " ../../../.. /build-extras-onesignal.gradle"
16+ apply from : " ../../node_modules/onesignal-cordova-plugin /build-extras-onesignal.gradle"
1717
1818if (hasProperty(' postBuildExtras' )) {
1919 postBuildExtras()
Original file line number Diff line number Diff line change @@ -4,12 +4,4 @@ import { defineConfig } from 'vite';
44// https://vitejs.dev/config/
55export default defineConfig ( {
66 plugins : [ react ( ) ] ,
7- optimizeDeps : {
8- include : [ 'dist' ] ,
9- } ,
10- build : {
11- commonjsOptions : {
12- include : [ / d i s t / , / n o d e _ m o d u l e s / ] ,
13- } ,
14- } ,
157} ) ;
Original file line number Diff line number Diff line change 11#! /bin/bash
2+ # Get example name from argument or environment variable
3+ EXAMPLE_NAME=" ${1:- ${EXAMPLE} } "
4+
5+ echo " Preparing example: ${EXAMPLE_NAME} "
6+
27# Get the directory where this script is located
38SCRIPT_DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd) "
49# Go to the root directory (two levels up from example/scripts/)
510cd " ${SCRIPT_DIR} /../.."
611
7- # Get example name from argument or environment variable
8- EXAMPLE_NAME=" ${1:- ${EXAMPLE} } "
9-
1012bun run build
1113
1214# Pack - remove old tarballs first to ensure fresh build
2527fi
2628
2729# Build example
30+ echo " Building example: ${EXAMPLE_NAME} "
2831if [ " $EXAMPLE_NAME " = " IonicAngular" ]; then
32+ # Clear Angular cache to ensure fresh build
33+ rm -rf .angular/cache
34+
2935 ng build
3036elif [ " $EXAMPLE_NAME " = " IonicCapOneSignal" ]; then
3137 tsc && vite build
Original file line number Diff line number Diff line change 1212 "type" : " git" ,
1313 "url" : " git+https://github.com/OneSignal/OneSignal-Cordova-SDK.git"
1414 },
15- "type" : " module" ,
1615 "main" : " dist/index.js" ,
1716 "types" : " dist/index.d.ts" ,
1817 "scripts" : {
You can’t perform that action at this time.
0 commit comments