-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs(notification_service): draft #9
Conversation
что за draft? |
@yart просил уже миллион раз - отруби чёртовы экшены |
let notificationService = NotificationService(sdkInstance: personalizationSDK) | ||
|
||
// Request permission for remote notifications | ||
UIApplication.shared.registerForRemoteNotifications() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
метод registerForRemoteNotifications
наш класс NotificationService
вызовет самостоятельно во время своей инициализации. Клиенту(разработчику) не нужно самостоятельно подписываться под уведомления и просить авторизиции (разрешение на отправку уведомлений)
@@ -0,0 +1,37 @@ | |||
// Example of SimplePersonalizationSDK initialization with autoSendPushToken flag set to true | |||
|
|||
let personalizationSDK = SimplePersonalizationSDK(autoSendPushToken: true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
по дефолту токен будет отправляться автоматически - поэтому не обязательно прописывать явно параметр autoSendPushToken
- не знаю необходимо ли это в документации но инфу доношу.
лучше написать так let personalizationSDK = SimplePersonalizationSDK(shopId: "SHOP_ID", autoSendPushToken: true)
тк параметр shopId
обязателен для инициализации.
let personalizationSDK = SimplePersonalizationSDK(autoSendPushToken: true) | ||
|
||
// Example of initializing NotificationService | ||
let notificationService = NotificationService(sdkInstance: personalizationSDK) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NotificationService(sdk: personalizationSDK)
- не sdkInstance
let notificationService = NotificationService(sdkInstance: personalizationSDK) | ||
|
||
// Request permission for remote notifications | ||
UIApplication.shared.registerForRemoteNotifications() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NotificationService
самостоятельно запросит регистрацию
UIApplication.shared.registerForRemoteNotifications()
не нужно вызывать самостоятельно
|
||
// Example of integrating NotificationService in AppDelegate | ||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | ||
// Initialize NotificationService |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Initialize iOS SDK first
var personalizationSDK = createPersonalizationSDK(shopId: "SHOP_ID", autoSendPushToken: true)
// Initialize NotificationService with pre-created instance of iOS SDK
let notificationService = NotificationService(sdk: personalizationSDK)
// Implement method for receiving device token | ||
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { | ||
// Pass device token to NotificationService | ||
notificationService.didRegisterForRemoteNotifications(with: deviceToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
notificationService.didRegisterForRemoteNotificationsWithDeviceToken(deviceToken: deviceToken)
2bcea05
to
abc42dc
Compare
No description provided.