react-native-audio-browser 0.2.0-next.26 → 0.2.0-next.28

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.
@@ -19,18 +19,22 @@ internal class ServiceBinding(private val context: Context) {
19
19
  var isBound: Boolean = false
20
20
  private set
21
21
 
22
+ @Volatile private var bindSucceeded: Boolean = false
23
+
22
24
  /**
23
- * Binds if not already bound, and returns whether a binding is held afterwards. A second call
24
- * while bound is a no-op: Android would otherwise count the extra bind and expect a matching
25
+ * Binds if not already bound, and returns whether the service will connect: what
26
+ * [Context.bindService] returned for the binding held. A second call while bound is a no-op that
27
+ * returns the same answer: Android would otherwise count the extra bind and expect a matching
25
28
  * unbind.
26
29
  */
27
30
  fun bind(intent: Intent, connection: ServiceConnection): Boolean {
28
- if (isBound) return true
31
+ if (isBound) return bindSucceeded
29
32
  // Marked bound whatever the result: Android registers the connection before it asks the
30
33
  // ActivityManager, so a false return still leaves one to release — "regardless of the return
31
34
  // value, you should later call unbindService()".
32
35
  isBound = true
33
- return context.bindService(intent, connection, Context.BIND_AUTO_CREATE)
36
+ bindSucceeded = context.bindService(intent, connection, Context.BIND_AUTO_CREATE)
37
+ return bindSucceeded
34
38
  }
35
39
 
36
40
  /**
@@ -74,6 +74,19 @@ class ServiceBindingTest {
74
74
  assertEquals(1, shadowOf(app).unboundServiceConnections.size)
75
75
  }
76
76
 
77
+ /**
78
+ * setupPlayer binds after the auto-bind at construction already has. If that first bind failed,
79
+ * the service never connects, so setup must hear false and reject rather than wait for it.
80
+ */
81
+ @Test
82
+ fun bindingAgainAfterAFailedBindReportsTheFailure() {
83
+ val binding = ServiceBinding(app)
84
+ shadowOf(app).declareActionUnbindable("unbindable")
85
+
86
+ assertFalse(binding.bind(Intent("unbindable"), connection))
87
+ assertFalse(binding.bind(Intent("unbindable"), connection))
88
+ }
89
+
77
90
  @Test
78
91
  fun unbindIsIdempotent() {
79
92
  val binding = ServiceBinding(app)
@@ -62,6 +62,14 @@ namespace margelo::nitro::audiobrowser::bridge::swift {
62
62
  };
63
63
  }
64
64
 
65
+ // pragma MARK: std::function<void(const RequestConfig& /* result */)>
66
+ Func_void_RequestConfig create_Func_void_RequestConfig(void* NON_NULL swiftClosureWrapper) noexcept {
67
+ auto swiftClosure = AudioBrowser::Func_void_RequestConfig::fromUnsafe(swiftClosureWrapper);
68
+ return [swiftClosure = std::move(swiftClosure)](const RequestConfig& result) mutable -> void {
69
+ swiftClosure.call(result);
70
+ };
71
+ }
72
+
65
73
  // pragma MARK: std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<RequestConfig>>>>(const RequestConfig& /* request */, const std::optional<std::unordered_map<std::string, std::string>>& /* routeParams */)>
66
74
  Func_std__shared_ptr_Promise_std__shared_ptr_Promise_RequestConfig_____RequestConfig_std__optional_std__unordered_map_std__string__std__string__ create_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_RequestConfig_____RequestConfig_std__optional_std__unordered_map_std__string__std__string__(void* NON_NULL swiftClosureWrapper) noexcept {
67
75
  auto swiftClosure = AudioBrowser::Func_std__shared_ptr_Promise_std__shared_ptr_Promise_RequestConfig_____RequestConfig_std__optional_std__unordered_map_std__string__std__string__::fromUnsafe(swiftClosureWrapper);
@@ -79,14 +87,6 @@ namespace margelo::nitro::audiobrowser::bridge::swift {
79
87
  };
80
88
  }
81
89
 
82
- // pragma MARK: std::function<void(const RequestConfig& /* result */)>
83
- Func_void_RequestConfig create_Func_void_RequestConfig(void* NON_NULL swiftClosureWrapper) noexcept {
84
- auto swiftClosure = AudioBrowser::Func_void_RequestConfig::fromUnsafe(swiftClosureWrapper);
85
- return [swiftClosure = std::move(swiftClosure)](const RequestConfig& result) mutable -> void {
86
- swiftClosure.call(result);
87
- };
88
- }
89
-
90
90
  // pragma MARK: std::function<std::shared_ptr<Promise<RequestConfig>>(const RequestConfig& /* request */, const std::optional<std::unordered_map<std::string, std::string>>& /* routeParams */)>
91
91
  Func_std__shared_ptr_Promise_RequestConfig___RequestConfig_std__optional_std__unordered_map_std__string__std__string__ create_Func_std__shared_ptr_Promise_RequestConfig___RequestConfig_std__optional_std__unordered_map_std__string__std__string__(void* NON_NULL swiftClosureWrapper) noexcept {
92
92
  auto swiftClosure = AudioBrowser::Func_std__shared_ptr_Promise_RequestConfig___RequestConfig_std__optional_std__unordered_map_std__string__std__string__::fromUnsafe(swiftClosureWrapper);
@@ -96,6 +96,14 @@ namespace margelo::nitro::audiobrowser::bridge::swift {
96
96
  };
97
97
  }
98
98
 
99
+ // pragma MARK: std::function<void(const TransformableRequestConfig& /* result */)>
100
+ Func_void_TransformableRequestConfig create_Func_void_TransformableRequestConfig(void* NON_NULL swiftClosureWrapper) noexcept {
101
+ auto swiftClosure = AudioBrowser::Func_void_TransformableRequestConfig::fromUnsafe(swiftClosureWrapper);
102
+ return [swiftClosure = std::move(swiftClosure)](const TransformableRequestConfig& result) mutable -> void {
103
+ swiftClosure.call(result);
104
+ };
105
+ }
106
+
99
107
  // pragma MARK: std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<TransformableRequestConfig>>>>()>
100
108
  Func_std__shared_ptr_Promise_std__shared_ptr_Promise_TransformableRequestConfig____ create_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_TransformableRequestConfig____(void* NON_NULL swiftClosureWrapper) noexcept {
101
109
  auto swiftClosure = AudioBrowser::Func_std__shared_ptr_Promise_std__shared_ptr_Promise_TransformableRequestConfig____::fromUnsafe(swiftClosureWrapper);
@@ -113,14 +121,6 @@ namespace margelo::nitro::audiobrowser::bridge::swift {
113
121
  };
114
122
  }
115
123
 
116
- // pragma MARK: std::function<void(const TransformableRequestConfig& /* result */)>
117
- Func_void_TransformableRequestConfig create_Func_void_TransformableRequestConfig(void* NON_NULL swiftClosureWrapper) noexcept {
118
- auto swiftClosure = AudioBrowser::Func_void_TransformableRequestConfig::fromUnsafe(swiftClosureWrapper);
119
- return [swiftClosure = std::move(swiftClosure)](const TransformableRequestConfig& result) mutable -> void {
120
- swiftClosure.call(result);
121
- };
122
- }
123
-
124
124
  // pragma MARK: std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<RequestConfig>>>>(const Track& /* track */)>
125
125
  Func_std__shared_ptr_Promise_std__shared_ptr_Promise_RequestConfig_____Track create_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_RequestConfig_____Track(void* NON_NULL swiftClosureWrapper) noexcept {
126
126
  auto swiftClosure = AudioBrowser::Func_std__shared_ptr_Promise_std__shared_ptr_Promise_RequestConfig_____Track::fromUnsafe(swiftClosureWrapper);
@@ -157,6 +157,14 @@ namespace margelo::nitro::audiobrowser::bridge::swift {
157
157
  };
158
158
  }
159
159
 
160
+ // pragma MARK: std::function<void(const std::variant<ResolvedTrack, BrowseError>& /* result */)>
161
+ Func_void_std__variant_ResolvedTrack__BrowseError_ create_Func_void_std__variant_ResolvedTrack__BrowseError_(void* NON_NULL swiftClosureWrapper) noexcept {
162
+ auto swiftClosure = AudioBrowser::Func_void_std__variant_ResolvedTrack__BrowseError_::fromUnsafe(swiftClosureWrapper);
163
+ return [swiftClosure = std::move(swiftClosure)](const std::variant<ResolvedTrack, BrowseError>& result) mutable -> void {
164
+ swiftClosure.call(result);
165
+ };
166
+ }
167
+
160
168
  // pragma MARK: std::function<std::shared_ptr<Promise<std::variant<ResolvedTrack, BrowseError, std::shared_ptr<Promise<std::variant<ResolvedTrack, BrowseError>>>>>>(const BrowserSourceCallbackParam& /* param */)>
161
169
  Func_std__shared_ptr_Promise_std__variant_ResolvedTrack__BrowseError__std__shared_ptr_Promise_std__variant_ResolvedTrack__BrowseError_______BrowserSourceCallbackParam create_Func_std__shared_ptr_Promise_std__variant_ResolvedTrack__BrowseError__std__shared_ptr_Promise_std__variant_ResolvedTrack__BrowseError_______BrowserSourceCallbackParam(void* NON_NULL swiftClosureWrapper) noexcept {
162
170
  auto swiftClosure = AudioBrowser::Func_std__shared_ptr_Promise_std__variant_ResolvedTrack__BrowseError__std__shared_ptr_Promise_std__variant_ResolvedTrack__BrowseError_______BrowserSourceCallbackParam::fromUnsafe(swiftClosureWrapper);
@@ -174,14 +182,6 @@ namespace margelo::nitro::audiobrowser::bridge::swift {
174
182
  };
175
183
  }
176
184
 
177
- // pragma MARK: std::function<void(const std::variant<ResolvedTrack, BrowseError>& /* result */)>
178
- Func_void_std__variant_ResolvedTrack__BrowseError_ create_Func_void_std__variant_ResolvedTrack__BrowseError_(void* NON_NULL swiftClosureWrapper) noexcept {
179
- auto swiftClosure = AudioBrowser::Func_void_std__variant_ResolvedTrack__BrowseError_::fromUnsafe(swiftClosureWrapper);
180
- return [swiftClosure = std::move(swiftClosure)](const std::variant<ResolvedTrack, BrowseError>& result) mutable -> void {
181
- swiftClosure.call(result);
182
- };
183
- }
184
-
185
185
  // pragma MARK: std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<std::vector<Track>>>>>(const SearchParams& /* params */)>
186
186
  Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__vector_Track______SearchParams create_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__vector_Track______SearchParams(void* NON_NULL swiftClosureWrapper) noexcept {
187
187
  auto swiftClosure = AudioBrowser::Func_std__shared_ptr_Promise_std__shared_ptr_Promise_std__vector_Track______SearchParams::fromUnsafe(swiftClosureWrapper);
@@ -199,6 +199,14 @@ namespace margelo::nitro::audiobrowser::bridge::swift {
199
199
  };
200
200
  }
201
201
 
202
+ // pragma MARK: std::function<void()>
203
+ Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
204
+ auto swiftClosure = AudioBrowser::Func_void::fromUnsafe(swiftClosureWrapper);
205
+ return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
206
+ swiftClosure.call();
207
+ };
208
+ }
209
+
202
210
  // pragma MARK: std::function<std::shared_ptr<Promise<std::shared_ptr<Promise<void>>>>(const TrackLoadEvent& /* event */)>
203
211
  Func_std__shared_ptr_Promise_std__shared_ptr_Promise_void_____TrackLoadEvent create_Func_std__shared_ptr_Promise_std__shared_ptr_Promise_void_____TrackLoadEvent(void* NON_NULL swiftClosureWrapper) noexcept {
204
212
  auto swiftClosure = AudioBrowser::Func_std__shared_ptr_Promise_std__shared_ptr_Promise_void_____TrackLoadEvent::fromUnsafe(swiftClosureWrapper);
@@ -216,14 +224,6 @@ namespace margelo::nitro::audiobrowser::bridge::swift {
216
224
  };
217
225
  }
218
226
 
219
- // pragma MARK: std::function<void()>
220
- Func_void create_Func_void(void* NON_NULL swiftClosureWrapper) noexcept {
221
- auto swiftClosure = AudioBrowser::Func_void::fromUnsafe(swiftClosureWrapper);
222
- return [swiftClosure = std::move(swiftClosure)]() mutable -> void {
223
- swiftClosure.call();
224
- };
225
- }
226
-
227
227
  // pragma MARK: std::function<std::shared_ptr<Promise<std::string>>()>
228
228
  Func_std__shared_ptr_Promise_std__string__ create_Func_std__shared_ptr_Promise_std__string__(void* NON_NULL swiftClosureWrapper) noexcept {
229
229
  auto swiftClosure = AudioBrowser::Func_std__shared_ptr_Promise_std__string__::fromUnsafe(swiftClosureWrapper);