Kaynağa Gözat

fix notification and count badge

alqindiirsyam 6 ay önce
ebeveyn
işleme
740950c690

+ 2 - 2
AppBuilder/AppBuilder.xcodeproj/project.pbxproj

@@ -463,7 +463,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 5.0.3f;
+				MARKETING_VERSION = 5.0.3g;
 				PRODUCT_BUNDLE_IDENTIFIER = io.newuniverse.AppBuilder;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
@@ -499,7 +499,7 @@
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 5.0.3f;
+				MARKETING_VERSION = 5.0.3g;
 				PRODUCT_BUNDLE_IDENTIFIER = io.newuniverse.AppBuilder;
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";

+ 0 - 101
AppBuilder/AppBuilder.xcodeproj/xcshareddata/xcschemes/AppBuilderShare.xcscheme

@@ -1,101 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Scheme
-   LastUpgradeVersion = "1620"
-   wasCreatedForAppExtension = "YES"
-   version = "2.0">
-   <BuildAction
-      parallelizeBuildables = "YES"
-      buildImplicitDependencies = "YES"
-      buildArchitectures = "Automatic">
-      <BuildActionEntries>
-         <BuildActionEntry
-            buildForTesting = "YES"
-            buildForRunning = "YES"
-            buildForProfiling = "YES"
-            buildForArchiving = "YES"
-            buildForAnalyzing = "YES">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "CD2585A22D5486B4002AB416"
-               BuildableName = "AppBuilderShare.appex"
-               BlueprintName = "AppBuilderShare"
-               ReferencedContainer = "container:AppBuilder.xcodeproj">
-            </BuildableReference>
-         </BuildActionEntry>
-         <BuildActionEntry
-            buildForTesting = "YES"
-            buildForRunning = "YES"
-            buildForProfiling = "YES"
-            buildForArchiving = "YES"
-            buildForAnalyzing = "YES">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "2401CE95275490DB00B323BB"
-               BuildableName = "AppBuilder.app"
-               BlueprintName = "AppBuilder"
-               ReferencedContainer = "container:AppBuilder.xcodeproj">
-            </BuildableReference>
-         </BuildActionEntry>
-      </BuildActionEntries>
-   </BuildAction>
-   <TestAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      shouldUseLaunchSchemeArgsEnv = "YES"
-      shouldAutocreateTestPlan = "YES">
-   </TestAction>
-   <LaunchAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = ""
-      selectedLauncherIdentifier = "Xcode.IDEFoundation.Launcher.PosixSpawn"
-      launchStyle = "0"
-      askForAppToLaunch = "Yes"
-      useCustomWorkingDirectory = "NO"
-      ignoresPersistentStateOnLaunch = "NO"
-      debugDocumentVersioning = "YES"
-      debugServiceExtension = "internal"
-      allowLocationSimulation = "YES"
-      launchAutomaticallySubstyle = "2">
-      <RemoteRunnable
-         runnableDebuggingMode = "1"
-         BundleIdentifier = "com.apple.mobileslideshow"
-         RemotePath = "/Applications/MobileSlideShow.app">
-      </RemoteRunnable>
-      <MacroExpansion>
-         <BuildableReference
-            BuildableIdentifier = "primary"
-            BlueprintIdentifier = "2401CE95275490DB00B323BB"
-            BuildableName = "AppBuilder.app"
-            BlueprintName = "AppBuilder"
-            ReferencedContainer = "container:AppBuilder.xcodeproj">
-         </BuildableReference>
-      </MacroExpansion>
-   </LaunchAction>
-   <ProfileAction
-      buildConfiguration = "Release"
-      shouldUseLaunchSchemeArgsEnv = "YES"
-      savedToolIdentifier = ""
-      useCustomWorkingDirectory = "NO"
-      debugDocumentVersioning = "YES"
-      askForAppToLaunch = "Yes"
-      launchAutomaticallySubstyle = "2">
-      <BuildableProductRunnable
-         runnableDebuggingMode = "0">
-         <BuildableReference
-            BuildableIdentifier = "primary"
-            BlueprintIdentifier = "2401CE95275490DB00B323BB"
-            BuildableName = "AppBuilder.app"
-            BlueprintName = "AppBuilder"
-            ReferencedContainer = "container:AppBuilder.xcodeproj">
-         </BuildableReference>
-      </BuildableProductRunnable>
-   </ProfileAction>
-   <AnalyzeAction
-      buildConfiguration = "Debug">
-   </AnalyzeAction>
-   <ArchiveAction
-      buildConfiguration = "Release"
-      revealArchiveInOrganizer = "YES">
-   </ArchiveAction>
-</Scheme>

+ 1 - 1
AppBuilder/AppBuilder/SceneDelegate.swift

@@ -101,7 +101,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
         // Called as the scene transitions from the foreground to the background.
         // Use this method to save data, release shared resources, and store enough scene-specific state information
         // to restore the scene back to its current state.
-        exit(0)
+        APIS.enterBackground()
     }
 
 

+ 8 - 5
NexilisLite/NexilisLite/Source/APIS.swift

@@ -849,14 +849,16 @@ public class APIS: NSObject {
 //                                    Thread.sleep(forTimeInterval: 1)
 //                                }
 //                            }
+                            while (!API.bnuSDKServiceReady() || API.nGetCLXConnState() == 0) {
+                            }
                             if code == "CL01" {
                                 if let message = data["bodies"] as? [String: String] {
                                     let messageToSave = TMessage()
                                     messageToSave.mBodies = message
-//                                    Nexilis.saveMessage(message: messageToSave, withStatus: false, fromAPNS: true)
-//                                    DispatchQueue.global().async {
-//                                        _ = Nexilis.write(message: CoreMessage_TMessageBank.getAckMessage(messageId: message[CoreMessage_TMessageKey.MESSAGE_ID] ?? ""))
-//                                    }
+                                    Nexilis.saveMessage(message: messageToSave, withStatus: false, fromAPNS: true)
+                                    DispatchQueue.global().async {
+                                        _ = Nexilis.write(message: CoreMessage_TMessageBank.getAckMessage(messageId: message[CoreMessage_TMessageKey.MESSAGE_ID] ?? ""))
+                                    }
                                     addNotificationNexilis(messageToSave)
                                 }
                             } else if code == "CL03" {
@@ -1012,7 +1014,7 @@ public class APIS: NSObject {
                 print("Error scheduling notification: \(error.localizedDescription)")
             }
         }
-        UIApplication.shared.applicationIconBadgeNumber += 1
+        UIApplication.shared.applicationIconBadgeNumber = Int(APIS.getTotalCounter())
     }
     
     private static func copySoundToLocalPath() {
@@ -1206,6 +1208,7 @@ public class APIS: NSObject {
 //            try API.switchCBI(cbiI: Callback(), bLight: true)
 //        } catch {
 //        }
+        exit(0)
     }
     
     public static func enterForeground() {

+ 11 - 11
NexilisLite/NexilisLite/Source/IncomingThread.swift

@@ -1301,17 +1301,17 @@ class IncomingThread {
         } else {
             Nexilis.saveMessage(message: message, withStatus: false)
         }
-//        DispatchQueue.main.async {
-//            if APIS.checkAppStateisBackground() {
-//                UNUserNotificationCenter.current().getDeliveredNotifications { notifications in
-//                    let identifier = message.getBody(key : CoreMessage_TMessageKey.MESSAGE_ID, default_value : "")
-//                    let matchingNotifications = notifications.filter { $0.request.identifier == identifier }
-//                    if !matchingNotifications.isEmpty {
-//                        APIS.addNotificationNexilis(message)
-//                    }
-//                }
-//            }
-//        }
+        DispatchQueue.main.async {
+            if APIS.checkAppStateisBackground() {
+                UNUserNotificationCenter.current().getDeliveredNotifications { notifications in
+                    let identifier = message.getBody(key : CoreMessage_TMessageKey.MESSAGE_ID, default_value : "")
+                    let matchingNotifications = notifications.filter { $0.request.identifier == identifier }
+                    if matchingNotifications.isEmpty {
+                        APIS.addNotificationNexilis(message)
+                    }
+                }
+            }
+        }
         //print("save message incoming")
         if !withoutACK {
             ack(message: message)