react-native-audio-api 0.4.12-beta.2 → 0.4.12-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,10 @@
1
1
  require "json"
2
- require_relative './scripts/audioapi_utils'
3
2
 
4
3
  package_json = JSON.parse(File.read(File.join(__dir__, "package.json")))
5
4
 
6
- $config = find_config()
7
- assert_minimal_react_native_version($config)
8
5
  $new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
9
6
 
10
- folly_flags = "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -DREACT_NATIVE_MINOR_VERSION=#{$config[:react_native_minor_version]}"
7
+ folly_flags = "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32"
11
8
  fabric_flags = $new_arch_enabled ? '-DRCT_NEW_ARCH_ENABLED' : ''
12
9
  version_flag = "-DAUDIOAPI_VERSION=#{package_json['version']}"
13
10
 
@@ -30,38 +27,23 @@ Pod::Spec.new do |s|
30
27
  ss.subspec "ios" do |sss|
31
28
  sss.source_files = "ios/audioapi/**/*.{mm,h,m}"
32
29
  sss.header_dir = "audioapi"
33
- sss.header_mappings_dir = "ios/ausioapi"
30
+ sss.header_mappings_dir = "ios/audioapi"
34
31
  end
35
32
  end
36
33
 
37
34
  s.ios.frameworks = 'CoreFoundation', 'CoreAudio', 'AudioToolbox', 'Accelerate'
38
35
 
39
- s.pod_target_xcconfig = {
36
+ s.compiler_flags = "#{folly_flags}"
37
+
38
+ s.pod_target_xcconfig = {
40
39
  "USE_HEADERMAP" => "YES",
41
- "DEFINES_MODULE" => "YES",
42
- "HEADER_SEARCH_PATHS" => '"$(PODS_TARGET_SRCROOT)/ReactCommon" "$(PODS_TARGET_SRCROOT)" "$(PODS_ROOT)/RCT-Folly" "$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/DoubleConversion" "$(PODS_ROOT)/Headers/Private/React-Core" "$(PODS_ROOT)/Headers/Private/Yoga"',
43
- "FRAMEWORK_SEARCH_PATHS" => '"${PODS_CONFIGURATION_BUILD_DIR}/React-hermes"',
44
40
  "CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
45
41
  "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) HAVE_ACCELERATE=1',
46
- }
47
- s.compiler_flags = "#{folly_flags}"
48
-
49
- s.xcconfig = {
50
- "HEADER_SEARCH_PATHS" => [
51
- '"$(PODS_ROOT)/boost"',
52
- '"$(PODS_ROOT)/boost-for-react-native"',
53
- '"$(PODS_ROOT)/glog"',
54
- '"$(PODS_ROOT)/RCT-Folly"',
55
- '"$(PODS_ROOT)/Headers/Public/React-hermes"',
56
- '"$(PODS_ROOT)/Headers/Public/hermes-engine"',
57
- "\"$(PODS_ROOT)/#{$config[:react_native_common_dir]}\"",
58
- "\"$(PODS_ROOT)/#{$config[:react_native_audioapi_dir_from_pods_root]}/ios\"",
59
- "\"$(PODS_ROOT)/#{$config[:react_native_audioapi_dir_from_pods_root]}/common/cpp\"",
60
- ].join(' '),
42
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/common/cpp\" \"$(PODS_TARGET_SRCROOT)/ios\"",
61
43
  'OTHER_CFLAGS' => "$(inherited) #{folly_flags} #{fabric_flags} #{version_flag}"
62
44
  }
63
45
 
64
46
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
65
47
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
66
- install_modules_dependencies(s, new_arch_enabled: true)
48
+ install_modules_dependencies(s)
67
49
  end
@@ -1,34 +1,41 @@
1
1
  #import "AudioAPIModule.h"
2
2
 
3
- #ifdef RCT_NEW_ARCH_ENABLED
4
3
  #import <React/RCTBridge+Private.h>
4
+
5
+ #ifdef RCT_NEW_ARCH_ENABLED
5
6
  #import <React/RCTCallInvoker.h>
6
7
  #import <ReactCommon/RCTTurboModule.h>
7
8
  #endif // RCT_NEW_ARCH_ENABLED
8
9
 
9
10
  #include <audioapi/AudioAPIModuleInstaller.h>
10
11
 
11
- @implementation AudioAPIModule
12
+ using namespace audioapi;
13
+ using namespace facebook::react;
12
14
 
13
- #if defined(RCT_NEW_ARCH_ENABLED)
15
+ @interface RCTBridge (JSIRuntime)
16
+ - (void *)runtime;
17
+ @end
18
+
19
+ #if defined(RCT_NEW_ARCH_ENABLED) && REACT_NATIVE_MINOR_VERSION >= 75
14
20
  // nothing
15
- #else // defined(RCT_NEW_ARCH_ENABLED)
21
+ #else // defined(RCT_NEW_ARCH_ENABLED) && REACT_NATIVE_MINOR_VERSION >= 75
16
22
  @interface RCTBridge (RCTTurboModule)
17
23
  - (std::shared_ptr<facebook::react::CallInvoker>)jsCallInvoker;
18
24
  - (void)_tryAndHandleError:(dispatch_block_t)block;
19
25
  @end
20
26
  #endif // RCT_NEW_ARCH_ENABLED
21
27
 
28
+ @implementation AudioAPIModule
29
+
22
30
  #if defined(RCT_NEW_ARCH_ENABLED)
23
31
  @synthesize callInvoker = _callInvoker;
24
32
  #endif // defined(RCT_NEW_ARCH_ENABLED)
25
33
 
26
- RCT_EXPORT_MODULE(AudioAPIModule)
34
+ RCT_EXPORT_MODULE(AudioAPIModule);
27
35
 
28
36
  RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install)
29
37
  {
30
- auto *cxxBridge = reinterpret_cast<RCTCxxBridge *>(self.bridge);
31
- auto jsiRuntime = reinterpret_cast<facebook::jsi::Runtime *>(cxxBridge.runtime);
38
+ auto jsiRuntime = reinterpret_cast<facebook::jsi::Runtime *>(self.bridge.runtime);
32
39
 
33
40
  #if defined(RCT_NEW_ARCH_ENABLED)
34
41
  auto jsCallInvoker = _callInvoker.callInvoker;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-audio-api",
3
- "version": "0.4.12-beta.2",
3
+ "version": "0.4.12-beta.4",
4
4
  "description": "react-native-audio-api provides system for controlling audio in React Native environment compatible with Web Audio API specification",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -1,56 +0,0 @@
1
- def try_to_parse_react_native_package_json(node_modules_dir)
2
- react_native_package_json_path = File.join(node_modules_dir, 'react-native/package.json')
3
- if !File.exist?(react_native_package_json_path)
4
- return nil
5
- end
6
- return JSON.parse(File.read(react_native_package_json_path))
7
- end
8
-
9
- def find_config()
10
- result = {
11
- :react_native_version => nil,
12
- :react_native_minor_version => nil,
13
- :react_native_node_modules_dir => nil,
14
- :react_native_common_dir => nil,
15
- :react_native_audioapi_dir_from_pods_root => nil,
16
- }
17
-
18
- react_native_node_modules_dir = File.join(File.dirname(`cd "#{Pod::Config.instance.installation_root.to_s}" && node --print "require.resolve('react-native/package.json')"`), '..')
19
- react_native_json = try_to_parse_react_native_package_json(react_native_node_modules_dir)
20
-
21
- if react_native_json == nil
22
- # user configuration, just in case
23
- node_modules_dir = ENV["REACT_NATIVE_NODE_MODULES_DIR"]
24
- react_native_json = try_to_parse_react_native_package_json(node_modules_dir)
25
- end
26
-
27
- if react_native_json == nil
28
- raise '[Audio API] Unable to recognize your `react-native` version. Please set environmental variable with `react-native` location: `export REACT_NATIVE_NODE_MODULES_DIR="<path to react-native>" && pod install`.'
29
- end
30
-
31
- result[:react_native_version] = react_native_json['version']
32
- result[:react_native_minor_version] = react_native_json['version'].split('.')[1].to_i
33
- if result[:react_native_minor_version] == 0 # nightly
34
- result[:react_native_minor_version] = 1000
35
- end
36
- result[:react_native_node_modules_dir] = File.expand_path(react_native_node_modules_dir)
37
-
38
- pods_root = Pod::Config.instance.project_pods_root
39
- react_native_common_dir_absolute = File.join(react_native_node_modules_dir, 'react-native', 'ReactCommon')
40
- react_native_common_dir_relative = Pathname.new(react_native_common_dir_absolute).relative_path_from(pods_root).to_s
41
- result[:react_native_common_dir] = react_native_common_dir_relative
42
-
43
- react_native_audioapi_dir_absolute = File.join(__dir__, '..')
44
- react_native_audioapi_dir_relative = Pathname.new(react_native_audioapi_dir_absolute).relative_path_from(pods_root).to_s
45
- result[:react_native_audioapi_dir_from_pods_root] = react_native_audioapi_dir_relative
46
-
47
- return result
48
- end
49
-
50
- def assert_minimal_react_native_version(config)
51
- # If you change the minimal React Native version remember to update Compatibility Table in docs
52
- minimalReactNativeVersion = 75
53
- if config[:react_native_minor_version] < minimalReactNativeVersion
54
- raise "[Audio API] Unsupported React Native version. Please use #{minimalReactNativeVersion} or newer."
55
- end
56
- end