vbea 2 vuotta sitten
vanhempi
sitoutus
ec1a5f9ff1

+ 35 - 39
Strides-APP/ios/Podfile

@@ -71,16 +71,12 @@ target 'Strides' do
   # pod 'GoogleMaps', '3.5.0'
   # pod 'Google-Maps-iOS-Utils', '2.1.0'
 
-  #谷歌通知启用
-  pod 'Firebase/Core', '9.4.0', :modular_headers => true
-  pod 'Firebase/Analytics', '9.4.0', :modular_headers => true
-  pod 'Firebase/Messaging', '9.4.0', :modular_headers => true
-  pod 'FirebaseCoreInternal', '9.4.0', :modular_headers => true
-  pod 'GoogleUtilities', :modular_headers => true
-  #微软热更新
-  #pod 'CodePush', :path => '../node_modules/react-native-code-push'
-  #国际化
-  #pod 'RNI18n', :path => '../node_modules/react-native-i18n'
+  # 谷歌通知启用
+  # pod 'FirebaseAuth'
+  pod 'FirebaseCore'
+  pod 'FirebaseAnalytics'
+  pod 'FirebaseMessaging'
+  # pod 'FirebaseFirestore'
 
   use_react_native!(
     :path => config[:reactNativePath],
@@ -137,36 +133,36 @@ target 'Strides' do
 end
 
 def fix_library_search_paths(installer)
-  def fix_config(config)
-    lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
-    if lib_search_paths
-      if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
-        # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
-        # since the libraries there are only built for x86_64 and i386.
-        lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
-        lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
-        if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
-          # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
-          lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
-        end
+  #def fix_config(config)
+  lib_search_paths = config.build_settings["LIBRARY_SEARCH_PATHS"]
+  if lib_search_paths
+    if lib_search_paths.include?("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)") || lib_search_paths.include?("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
+      # $(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME) causes problem with Xcode 12.5 + arm64 (Apple M1)
+      # since the libraries there are only built for x86_64 and i386.
+      lib_search_paths.delete("$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)")
+      lib_search_paths.delete("\"$(TOOLCHAIN_DIR)/usr/lib/swift-5.0/$(PLATFORM_NAME)\"")
+      if !(lib_search_paths.include?("$(SDKROOT)/usr/lib/swift") || lib_search_paths.include?("\"$(SDKROOT)/usr/lib/swift\""))
+        # however, $(SDKROOT)/usr/lib/swift is required, at least if user is not running CocoaPods 1.11
+        lib_search_paths.insert(0, "$(SDKROOT)/usr/lib/swift")
       end
     end
   end
-
-  projects = installer.aggregate_targets
-    .map{ |t| t.user_project }
-    .uniq{ |p| p.path }
-    .push(installer.pods_project)
-
-  projects.each do |project|
-    project.build_configurations.each do |config|
-      fix_config(config)
-    end
-    project.native_targets.each do |target|
-      target.build_configurations.each do |config|
-        fix_config(config)
-      end
-    end
-    project.save()
-  end
 end
+
+# projects = installer.aggregate_targets
+#   .map{ |t| t.user_project }
+#   .uniq{ |p| p.path }
+#   .push(installer.pods_project)
+
+#   projects.each do |project|
+#     project.build_configurations.each do |config|
+#       fix_config(config)
+#     end
+#     project.native_targets.each do |target|
+#       target.build_configurations.each do |config|
+#         fix_config(config)
+#       end
+#     end
+#     project.save()
+#   end
+# end

+ 3 - 1
Strides-APP/ios/Strides/AppDelegate.h

@@ -2,6 +2,8 @@
 #import <UIKit/UIKit.h>
 #import <UserNotifications/UNUserNotificationCenter.h>
 
-@interface AppDelegate : RCTAppDelegate <UNUserNotificationCenterDelegate>
+@protocol FIRMessagingDelegate;
+
+@interface AppDelegate : RCTAppDelegate <UNUserNotificationCenterDelegate, FIRMessagingDelegate>
 
 @end

+ 11 - 9
Strides-APP/ios/Strides/AppDelegate.mm

@@ -27,9 +27,11 @@ static void InitializeFlipper(UIApplication *application) {
 }
 #endif
 
-@import Firebase;
+@import UserNotifications;
+@import FirebaseCore;
+@import FirebaseMessaging;
 
-@interface AppDelegate () <FIRMessagingDelegate>
+@interface AppDelegate () <UNUserNotificationCenterDelegate>
 
 @end
 
@@ -51,15 +53,15 @@ static void InitializeFlipper(UIApplication *application) {
 
   //远程推送配置
   // Define UNUserNotificationCenter
-  UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
-  center.delegate = self;
+  [UNUserNotificationCenter currentNotificationCenter].delegate = self;
   UNAuthorizationOptions authOptions = UNAuthorizationOptionAlert |
-        UNAuthorizationOptionSound | UNAuthorizationOptionBadge;
+      UNAuthorizationOptionSound | UNAuthorizationOptionBadge;
   [[UNUserNotificationCenter currentNotificationCenter]
-        requestAuthorizationWithOptions:authOptions
-        completionHandler:^(BOOL granted, NSError * _Nullable error) {
-          // ...
-        }];
+      requestAuthorizationWithOptions:authOptions
+      completionHandler:^(BOOL granted, NSError * _Nullable error) {
+        // ...
+      }];
+
   [application registerForRemoteNotifications];
   //return YES;
   return [super application:application didFinishLaunchingWithOptions:launchOptions];