Sfoglia il codice sorgente

fix: 接入腾讯 IM 离线推送

陈文艺 2 mesi fa
parent
commit
c20a503b2c
6 ha cambiato i file con 26 aggiunte e 1 eliminazioni
  1. 10 0
      Lanu/AppDelegate.swift
  2. 4 0
      Lanu/Info.plist
  3. 2 0
      Lanu/Lanu-Bridging-Header.h
  4. 3 0
      Lanu/Manager/IM/LNIMManager.swift
  5. 1 0
      Podfile
  6. 6 1
      Podfile.lock

+ 10 - 0
Lanu/AppDelegate.swift

@@ -55,6 +55,16 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
     }
 }
 
+extension AppDelegate {
+    @objc func businessID() -> Int32 {
+        LNIMManager.shared.offlinePushAppId
+    }
+    
+    @objc func onRemoteNotificationReceived(_ notice: String?) -> Bool {
+        false
+    }
+}
+
 extension AppDelegate {
     private func reportLanguage() {
         LNProfileManager.shared.reportCurrentLanguage(code: LNAppConfig.shared.curLang.languageCode) { _ in }

+ 4 - 0
Lanu/Info.plist

@@ -62,6 +62,10 @@
 			</array>
 		</dict>
 	</dict>
+	<key>UIBackgroundModes</key>
+	<array>
+		<string>remote-notification</string>
+	</array>
 	<key>UIDesignRequiresCompatibility</key>
 	<true/>
 </dict>

+ 2 - 0
Lanu/Lanu-Bridging-Header.h

@@ -4,4 +4,6 @@
 
 #import <SDWebImage/SDWebImage.h>
 
+#import "TIMPush/TIMPush.h"
+
 @import ImSDK_Plus;

+ 3 - 0
Lanu/Manager/IM/LNIMManager.swift

@@ -44,6 +44,7 @@ class LNIMManager: NSObject {
             80000456
         }
     }
+    let offlinePushAppId: Int32 = 17229
     
     static var shared = LNIMManager()
     
@@ -203,6 +204,7 @@ extension LNIMManager: LNAccountManagerNotify {
         let loginSuccessBlock = { [weak self] in
             guard let self else { return }
             reloadConversationList()
+            TIMPushManager.registerPush(Self.appId, appKey: "") { _ in } fail: { _, _ in }
         }
         if V2TIMManager.sharedInstance().getLoginUser()?.isMyUid == true {
             loginSuccessBlock()
@@ -217,6 +219,7 @@ extension LNIMManager: LNAccountManagerNotify {
     
     func onUserLogout() {
         V2TIMManager.sharedInstance().logout(succ: nil)
+        TIMPushManager.unRegisterPush { } fail: { _, _ in }
         
         Self.shared = LNIMManager()
     }

+ 1 - 0
Podfile

@@ -10,6 +10,7 @@ target 'Gami' do
   # # 腾讯IM
   pod 'TIMCommon', :path => "./ThirdParty/TUIKit/TIMCommon"
   pod 'TUIChat', :path => "./ThirdParty/TUIKit/TUIChat"
+  pod 'TIMPush'
   
   pod 'DoraemonKit', :configurations => ['Debug']
 

+ 6 - 1
Podfile.lock

@@ -22,6 +22,8 @@ PODS:
     - TIMCommon/ImSDK_Plus (= 1.0.0)
   - TIMCommon/ImSDK_Plus (1.0.0):
     - TXIMSDK_Plus_iOS_XCFramework
+  - TIMPush (8.7.7201):
+    - TXIMSDK_Plus_iOS_XCFramework (>= 8.7.7201)
   - TUIChat (1.0.0):
     - TIMCommon
   - TXIMSDK_Plus_iOS_XCFramework (8.7.7201)
@@ -29,6 +31,7 @@ PODS:
 DEPENDENCIES:
   - DoraemonKit
   - TIMCommon (from `./ThirdParty/TUIKit/TIMCommon`)
+  - TIMPush
   - TUIChat (from `./ThirdParty/TUIKit/TUIChat`)
 
 SPEC REPOS:
@@ -36,6 +39,7 @@ SPEC REPOS:
     - DoraemonKit
     - FMDB
     - GCDWebServer
+    - TIMPush
     - TXIMSDK_Plus_iOS_XCFramework
 
 EXTERNAL SOURCES:
@@ -49,9 +53,10 @@ SPEC CHECKSUMS:
   FMDB: 728731dd336af3936ce00f91d9d8495f5718a0e6
   GCDWebServer: 2c156a56c8226e2d5c0c3f208a3621ccffbe3ce4
   TIMCommon: 36dad82b29c87b6cfd7eb5251c44db7d03598267
+  TIMPush: 4f4fa655697c4106309054d0b50a485e642b4f80
   TUIChat: 696bca6e2a6cfd2bc22f624425b425b68bd9506c
   TXIMSDK_Plus_iOS_XCFramework: 3b435eae84c639f35ae8dc9c8b92c399a8b0a67f
 
-PODFILE CHECKSUM: 55268eb8555e2ec448595c4dc09fe7a249108722
+PODFILE CHECKSUM: e9bc1dfb5b6d55f23b3b68b79739f5a8b74c1f05
 
 COCOAPODS: 1.16.2