Closed ramithks closed 10 months ago
Hi @ramithks,
Thank you for reaching out and reporting this. We will investigate and try to reproduce your issue.
Are you calling OneSignal.login(externalUserId)
and OneSignal.User.pushSubscription.optIn()
immediately? Or is there a wait in between?
Are you calling OneSignal.login(externalUserId) and OneSignal.User.pushSubscription.optIn() immediately? Or is there a wait in between?
@nan-li, Here's what I'm doing to reproduce.
void main() {
runApp(const MyApp());
OneSignal.Debug.setLogLevel(OSLogLevel.verbose);
OneSignal.initialize("REMOVED");
OneSignal.login('iamwillshepherd@kronos.local');
}
Future<void> _toggleOptIn() async {
_isOptedIn
? await OneSignal.User.pushSubscription.optOut()
: await OneSignal.User.pushSubscription.optIn();
print('Opted ${_isOptedIn ? 'Out': 'In'}');
setState(() {
_isOptedIn = !_isOptedIn;
});
}
Here is my log of a repro.
2023-12-27 14:22:45.254 6698-6698 OneSignal com.example.repro D [main] OperationRepo.enqueue(operation: {"name":"update-subscription","appId":"REMOVED","onesignalId":"814621c0-a54b-41d3-ba4b-8a0014c855db","subscriptionId":"affd2425-9291-416b-a83e-89e570a4204a","type":"PUSH","enabled":false,"address":"cDEqVWUIQrWi4ON5tFn6Zd:APA91bFB_ehnMf_pIewmXV5aVoWA63PaKTPQDTOclTMjjyR9HRJDdYY2Fw73wL6VEFw0Nh8ML4QUZ1jPH4QF3Z85dw1_mOMv53Sw-TdQi_aKlKDxc3hb1qhjlt6QO_F5WqDubk_frC8R","status":"UNSUBSCRIBE"}, flush: false)
2023-12-27 14:22:45.260 6698-6748 flutter com.example.repro I Opted In
2023-12-27 14:22:45.277 6698-6749 EGL_emulation com.example.repro D app_time_stats: avg=373.93ms min=11.54ms max=13958.97ms count=39
2023-12-27 14:22:45.461 6698-6768 OneSignal com.example.repro D [OpRepo] SubscriptionOperationExecutor(operations: [{"name":"update-subscription","appId":"REMOVED","onesignalId":"814621c0-a54b-41d3-ba4b-8a0014c855db","subscriptionId":"affd2425-9291-416b-a83e-89e570a4204a","type":"PUSH","enabled":false,"address":"cDEqVWUIQrWi4ON5tFn6Zd:APA91bFB_ehnMf_pIewmXV5aVoWA63PaKTPQDTOclTMjjyR9HRJDdYY2Fw73wL6VEFw0Nh8ML4QUZ1jPH4QF3Z85dw1_mOMv53Sw-TdQi_aKlKDxc3hb1qhjlt6QO_F5WqDubk_frC8R","status":"UNSUBSCRIBE","id":"80e41a8e-e786-406f-8f3d-a557a2445b54"}])
2023-12-27 14:22:45.463 6698-6774 OneSignal com.example.repro D [DefaultDispatcher-worker-4] HttpClient: PATCH apps/b1ae09b2-5311-432e-b69c-65cb354f3472/subscriptions/affd2425-9291-416b-a83e-89e570a4204a - {"subscription":{"type":"AndroidPush","token":"cDEqVWUIQrWi4ON5tFn6Zd:APA91bFB_ehnMf_pIewmXV5aVoWA63PaKTPQDTOclTMjjyR9HRJDdYY2Fw73wL6VEFw0Nh8ML4QUZ1jPH4QF3Z85dw1_mOMv53Sw-TdQi_aKlKDxc3hb1qhjlt6QO_F5WqDubk_frC8R","enabled":false,"notification_types":-2,"sdk":"050004","device_model":"sdk_gphone64_arm64","device_os":"14","rooted":false,"net_type":0,"carrier":"T-Mobile","app_version":"1"}}
2023-12-27 14:22:45.637 6698-6774 OneSignal com.example.repro D [DefaultDispatcher-worker-4] HttpClient: PATCH apps/b1ae09b2-5311-432e-b69c-65cb354f3472/subscriptions/affd2425-9291-416b-a83e-89e570a4204a - STATUS: 200 JSON: {}
2023-12-27 14:22:45.638 6698-6768 OneSignal com.example.repro D [OpRepo] OperationRepo: execute response = SUCCESS
2023-12-27 14:22:48.870 6698-6698 OneSignal com.example.repro D [main] OperationRepo.enqueue(operation: {"name":"update-subscription","appId":"REMOVED","onesignalId":"814621c0-a54b-41d3-ba4b-8a0014c855db","subscriptionId":"affd2425-9291-416b-a83e-89e570a4204a","type":"PUSH","enabled":false,"address":"cDEqVWUIQrWi4ON5tFn6Zd:APA91bFB_ehnMf_pIewmXV5aVoWA63PaKTPQDTOclTMjjyR9HRJDdYY2Fw73wL6VEFw0Nh8ML4QUZ1jPH4QF3Z85dw1_mOMv53Sw-TdQi_aKlKDxc3hb1qhjlt6QO_F5WqDubk_frC8R","status":"UNSUBSCRIBE"}, flush: false)
2023-12-27 14:22:48.876 6698-6748 flutter com.example.repro I Opted Out
2023-12-27 14:22:48.892 6698-6749 EGL_emulation com.example.repro D app_time_stats: avg=92.69ms min=12.63ms max=2990.08ms count=39
2023-12-27 14:22:49.077 6698-6768 OneSignal com.example.repro D [OpRepo] SubscriptionOperationExecutor(operations: [{"name":"update-subscription","appId":"REMOVED","onesignalId":"814621c0-a54b-41d3-ba4b-8a0014c855db","subscriptionId":"affd2425-9291-416b-a83e-89e570a4204a","type":"PUSH","enabled":false,"address":"cDEqVWUIQrWi4ON5tFn6Zd:APA91bFB_ehnMf_pIewmXV5aVoWA63PaKTPQDTOclTMjjyR9HRJDdYY2Fw73wL6VEFw0Nh8ML4QUZ1jPH4QF3Z85dw1_mOMv53Sw-TdQi_aKlKDxc3hb1qhjlt6QO_F5WqDubk_frC8R","status":"UNSUBSCRIBE","id":"939399d6-9c94-4bc2-9647-b59978a582a6"}])
2023-12-27 14:22:49.079 6698-6774 OneSignal com.example.repro D [DefaultDispatcher-worker-4] HttpClient: PATCH apps/b1ae09b2-5311-432e-b69c-65cb354f3472/subscriptions/affd2425-9291-416b-a83e-89e570a4204a - {"subscription":{"type":"AndroidPush","token":"cDEqVWUIQrWi4ON5tFn6Zd:APA91bFB_ehnMf_pIewmXV5aVoWA63PaKTPQDTOclTMjjyR9HRJDdYY2Fw73wL6VEFw0Nh8ML4QUZ1jPH4QF3Z85dw1_mOMv53Sw-TdQi_aKlKDxc3hb1qhjlt6QO_F5WqDubk_frC8R","enabled":false,"notification_types":-2,"sdk":"050004","device_model":"sdk_gphone64_arm64","device_os":"14","rooted":false,"net_type":0,"carrier":"T-Mobile","app_version":"1"}}
2023-12-27 14:22:49.253 6698-6774 OneSignal com.example.repro D [DefaultDispatcher-worker-4] HttpClient: PATCH apps/b1ae09b2-5311-432e-b69c-65cb354f3472/subscriptions/affd2425-9291-416b-a83e-89e570a4204a - STATUS: 200 JSON: {}
2023-12-27 14:22:49.254 6698-6768 OneSignal com.example.repro D [OpRepo] OperationRepo: execute response = SUCCESS
Note that enabled
is always false, and status
is always 'UNSUBSCRIBE`.
Does the SDK re-subscribe users once they've explicitly opted out of push notifications?
Hi @ramithks,
Thank you for reaching out and reporting this. We will investigate and try to reproduce your issue.
Are you calling
OneSignal.login(externalUserId)
andOneSignal.User.pushSubscription.optIn()
immediately? Or is there a wait in between?
Hey @nan-li and @iAmWillShepherd , Ofcourse I'm using await.let me explain this way.
What's working:
What's not working : Status is false ( even the first time ) if we have opt-in or opt-opt method.
But for the first time, atleast we can opt-in which will reflects on the dashboard if not on the debug console .
But from the second time, we can't even toggle ( I mean it will not reflect either on dashboard or on debug console )
Note:
You can recreate by using the example file which is in the pub.dev.
Follow the following steps:
I have tested witn this file as well and the issue is same.
Heyy @iAmWillShepherd and @nan-li , Any update on it or are you working on it? Because I can’t see any progress in the issue at all even when the issue is bigger.
Even some of my developer friends and the people on StackOverflow face this issue.
Having the same issue.
Hi everyone, thank you for the details. We are able to reproduce and are working on the fix.
Hey @nan-li , so glad to hear that ❤️
Hi everyone, thank you for submitting this issue and giving us details,
We have made fixes for this and released in Release 5.1.0.
Please update and reach out if you are still seeing issues.
What happened?
I am currently facing an issue where the functionality of toggling between Opt-In and Opt-Out, along with the login using onesignal_flutter, is not working simultaneously. When both functions are called, only one of them is operational.
Steps to reproduce?
What did you expect to happen?
I want the Opt-In and Opt-Out. function to toggle to true or false when the User is logged in using OneSignal.login.
But only one of this is happening .
OneSignal Flutter SDK version
onesignal_flutter: ^5.0.4
Which platform(s) are affected?
Relevant log output
No response
Code of Conduct