File tree Expand file tree Collapse file tree 1 file changed +22
-16
lines changed Expand file tree Collapse file tree 1 file changed +22
-16
lines changed Original file line number Diff line number Diff line change @@ -291,22 +291,7 @@ export default class LeanplumInternal {
291291 } else if ( state === MigrationState . CLEVERTAP ) {
292292 this . _ct = this . _migration . initCleverTap ( )
293293
294- // move subscription in CT
295- this . isWebPushSubscribed ( ) . then ( ( isSubscribed ) => {
296- if ( isSubscribed ) {
297- this . _pushManager . unsubscribeUser ( )
298-
299- const serviceWorkerPath = this . _webPushOptions ?. serviceWorkerUrl
300- const path = serviceWorkerPath ? { serviceWorkerPath } : { }
301- this . _ct && this . _ct . notifications . push ( {
302- titleText : '' ,
303- bodyText : '' ,
304- okButtonText : '' ,
305- rejectButtonText : '' ,
306- ...path ,
307- } )
308- }
309- } )
294+ this . migratePushToken ( )
310295
311296 Object . values ( Constants . DEFAULT_KEYS )
312297 . filter ( key => ! [
@@ -702,4 +687,25 @@ export default class LeanplumInternal {
702687 private updateSession ( ) : void {
703688 StorageManager . save ( SESSION_KEY , String ( Date . now ( ) ) )
704689 }
690+
691+ private migratePushToken ( ) : void {
692+ if ( StorageManager . get ( Constants . DEFAULT_KEYS . PUSH_SUBSCRIPTION ) ) {
693+ // move subscription in CT
694+ this . isWebPushSubscribed ( ) . then ( ( isSubscribed : boolean ) => {
695+ if ( isSubscribed ) {
696+ this . _pushManager . unsubscribeUser ( )
697+
698+ const serviceWorkerPath = this . _webPushOptions ?. serviceWorkerUrl
699+ const path = serviceWorkerPath ? { serviceWorkerPath } : { }
700+ this . _ct && this . _ct . notifications . push ( {
701+ titleText : '' ,
702+ bodyText : '' ,
703+ okButtonText : '' ,
704+ rejectButtonText : '' ,
705+ ...path ,
706+ } )
707+ }
708+ } )
709+ }
710+ }
705711}
You can’t perform that action at this time.
0 commit comments