update one signal
This commit is contained in:
@@ -11,6 +11,7 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:worker/core/constants/api_constants.dart';
|
||||
import 'package:worker/core/network/dio_client.dart';
|
||||
import 'package:worker/core/services/frappe_auth_service.dart';
|
||||
import 'package:worker/core/services/onesignal_service.dart';
|
||||
import 'package:worker/features/auth/data/datasources/auth_local_datasource.dart';
|
||||
import 'package:worker/features/auth/data/datasources/auth_remote_datasource.dart';
|
||||
import 'package:worker/features/auth/domain/entities/user.dart';
|
||||
@@ -100,7 +101,11 @@ class Auth extends _$Auth {
|
||||
final fullName = await secureStorage.read(key: 'frappe_full_name');
|
||||
|
||||
if (sid != null && userId != null && userId != ApiConstants.frappePublicUserId) {
|
||||
// User is logged in and wants to be remembered, create User entity
|
||||
// User is logged in and wants to be remembered
|
||||
// Restore OneSignal external user ID for targeted notifications
|
||||
await OneSignalService.login(userId);
|
||||
|
||||
// Create User entity
|
||||
final now = DateTime.now();
|
||||
return User(
|
||||
userId: userId,
|
||||
@@ -188,6 +193,9 @@ class Auth extends _$Auth {
|
||||
// Log login event
|
||||
await AnalyticsService.logLogin(method: 'phone');
|
||||
|
||||
// Set OneSignal external user ID for targeted notifications
|
||||
await OneSignalService.login(phoneNumber);
|
||||
|
||||
// Create and return User entity
|
||||
final now = DateTime.now();
|
||||
return User(
|
||||
@@ -227,6 +235,9 @@ class Auth extends _$Auth {
|
||||
// Clear user ID from analytics
|
||||
await AnalyticsService.setUserId(null);
|
||||
|
||||
// Clear OneSignal external user ID
|
||||
await OneSignalService.logout();
|
||||
|
||||
// Clear saved session
|
||||
await _localDataSource.clearSession();
|
||||
await frappeService.clearSession();
|
||||
|
||||
@@ -272,7 +272,7 @@ final class AuthProvider extends $AsyncNotifierProvider<Auth, User?> {
|
||||
Auth create() => Auth();
|
||||
}
|
||||
|
||||
String _$authHash() => r'f1d856a9a8fc461da111699e3c7ca2af1f2ce7ca';
|
||||
String _$authHash() => r'2aaad43ba390e824b5aa8d95bc14e514c421c8ef';
|
||||
|
||||
/// Authentication Provider
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user