-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4901b42
commit b250034
Showing
8 changed files
with
104 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
Examples/Swift/NYSExampleSwift/Supporting Files/AppDelegate+Extension.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// AppDelegate+Extension.swift | ||
// NYSExampleSwift | ||
// | ||
// Created by niyongsheng on 2024/2/7. | ||
// Copyright © 2024 niyongsheng. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
extension AppDelegate: JPUSHRegisterDelegate, JPUSHInAppMessageDelegate { | ||
|
||
func initJPush(_ launchOptions: [UIApplication.LaunchOptionsKey: Any]?) { | ||
let entity = JPUSHRegisterEntity() | ||
entity.types = NSInteger(UNAuthorizationOptions.alert.rawValue) | | ||
NSInteger(UNAuthorizationOptions.sound.rawValue) | | ||
NSInteger(UNAuthorizationOptions.badge.rawValue) | | ||
NSInteger(UNAuthorizationOptions.provisional.rawValue) | ||
|
||
JPUSHService.register(forRemoteNotificationConfig: entity, delegate: self) | ||
JPUSHService.setInAppMessageDelegate(self) | ||
JPUSHService.setup(withOption: launchOptions, appKey: JPUSH_APPKEY, channel: JPUSH_CHANNEl, apsForProduction: IS_Prod, advertisingIdentifier: nil) | ||
JPUSHService.registrationIDCompletionHandler { resCode, registrationID in | ||
if resCode == 0 { | ||
self.print("registrationID获取成功:\(String(describing: registrationID))") | ||
} else { | ||
self.print("registrationID获取失败,code:\(String(describing: registrationID))") | ||
} | ||
} | ||
} | ||
|
||
// MARK - JPUSHRegisterDelegate | ||
func jpushNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: (() -> Void)) { | ||
let userInfo = response.notification.request.content.userInfo | ||
let request = response.notification.request | ||
if (response.notification.request.trigger?.isKind(of: UNPushNotificationTrigger.self) == true) { | ||
JPUSHService.handleRemoteNotification(userInfo) | ||
} | ||
print(request) | ||
completionHandler() | ||
} | ||
|
||
// 前台得到的的通知 | ||
func jpushNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: ((Int) -> Void)) { | ||
let userInfo = notification.request.content.userInfo | ||
let request = notification.request | ||
if (notification.request.trigger?.isKind(of: UNPushNotificationTrigger.self) == true) { | ||
JPUSHService.handleRemoteNotification(userInfo) | ||
} | ||
print(request) | ||
completionHandler(Int(UNNotificationPresentationOptions.badge.rawValue | UNNotificationPresentationOptions.sound.rawValue | UNNotificationPresentationOptions.alert.rawValue)) | ||
} | ||
|
||
func jpushNotificationCenter(_ center: UNUserNotificationCenter, openSettingsFor notification: UNNotification) { | ||
|
||
} | ||
|
||
func jpushNotificationAuthorization(_ status: JPAuthorizationStatus, withInfo info: [AnyHashable : Any]?) { | ||
print("receive notification authorization status:\(status), info:\(String(describing: info))") | ||
} | ||
|
||
// MARK - JPushInMessageDelegate | ||
func jPush(inAppMessageDidShow inAppMessage: JPushInAppMessage) { | ||
|
||
} | ||
|
||
func jPush(inAppMessageDidClick inAppMessage: JPushInAppMessage) { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
NYSUIKit/Resources/NYSUIKit.bundle/es.lproj/Localizable.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
NoMore="No más"; | ||
NoData="No Data"; | ||
NetErr="Error de red"; | ||
Retry="reintentar"; | ||
Loading="Carga..."; | ||
|
||
TipsAppUpdate="Nueva versión de prueba"; | ||
AppUpdate="actualización"; |
8 changes: 8 additions & 0 deletions
8
NYSUIKit/Resources/NYSUIKit.bundle/ja.lproj/Localizable.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
NoMore="もう"; | ||
NoData="データがない"; | ||
NetErr="ネットワーク誤差"; | ||
Retry="再審"; | ||
Loading="装着…"; | ||
|
||
TipsAppUpdate="新テスト版"; | ||
AppUpdate="更新"; |
8 changes: 8 additions & 0 deletions
8
NYSUIKit/Resources/NYSUIKit.bundle/ko.lproj/Localizable.strings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
NoMore="더 이상"; | ||
NoData="데이터 가 없"; | ||
NetErr="네트워크 오류 가"; | ||
Retry="재시도"; | ||
Loading="로드 …"; | ||
|
||
TipsAppUpdate="New 테스트 버전"; | ||
AppUpdate="업 데이트"; |