Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adds 'BW::NetworkIndicator' #349

Merged
merged 9 commits into from
Mar 10, 2014
Merged

adds 'BW::NetworkIndicator' #349

merged 9 commits into from
Mar 10, 2014

Conversation

colinta
Copy link
Contributor

@colinta colinta commented Mar 6, 2014

Regarding #263 and #171, I agree w/ @clayallsopp that UIApplication.sharedApplication.networkActivityIndicatorVisible should be controlled by a centralized module.

I didn't call it BW::HTTP::NetworkIndicator, because I think it could be used as a standalone module (maybe they're not using BW::HTTP).

methods available:

  • BW::NetworkIndicator.show
  • BW::NetworkIndicator.hide
  • BW::NetworkIndicator.visible?
  • BW::NetworkIndicator.reset!

Specs included.

@clayallsopp
Copy link
Contributor

Sweet, and I think it would also make a lot of sense to integrate with BW::HTTP

In this case, thread safety is a realistic consideration - did you check out @bogardon's implementation or other iOS network indicator implementations? (SDNetworkActivityIndicator, AFNetworkingActivityIndicatorManager, etc)

Also the tests failed on Travis?

@colinta
Copy link
Contributor Author

colinta commented Mar 7, 2014

Ah, those failures are from the HTTP integration actually. I'll check it out.

I'll see what needs to be done about thread safety, too. Thanks Clay!

@clayallsopp
Copy link
Contributor

Ah gotcha. Yeah, I think the networking indicator should be included by default w/ bubble-wrap/http (https://github.com/rubymotion/BubbleWrap/blob/master/lib/bubble-wrap/http.rb), instead of making the remember to require it manually

@colinta
Copy link
Contributor Author

colinta commented Mar 7, 2014

Man, turns out all the queries that get created in query_spec kind of throw a wrench in things; they all have to be properly cancel-ed at the end of each test, otherwise the indicator 'counter' is thrown off.

I've added a warning message to query_spec.rb that should detect if a query wasn't canceled, and ask the dev to fix the spec.

@colinta
Copy link
Contributor Author

colinta commented Mar 7, 2014

Dang it. Specs pass locally, I'll see what's up.

@markrickert
Copy link
Collaborator

@colinta It could be that the iOS version is passing and the mac version is not. See @clayallsopp's recommendation for me that helped the specs pass: #335 (comment)

@colinta
Copy link
Contributor Author

colinta commented Mar 7, 2014

Yeah i think you're right; getting 'cancel called on nil' when running on osx. thanks for the heads up! 😃

@colinta
Copy link
Contributor Author

colinta commented Mar 7, 2014

I'm still getting a 'failure' on osx, but it's in the NSIndexPathWrap methods.

NSIndexPathWrap
  - should be able to use an array like accessor
 [ERROR: NoMethodError - undefined method `indexAtPosition' for 826:Fixnum]
  - should support the each iterator
 [ERROR: NoMethodError - undefined method `length' for 826:Fixnum]

@colinta
Copy link
Contributor Author

colinta commented Mar 7, 2014

Strange behavior on my machine, but specs are passing on travis. :-/

@colinta
Copy link
Contributor Author

colinta commented Mar 7, 2014

Can someone run

rake spec osx=1 files=spec/motion/core/ns_index_path_spec.rb

and see what it says?

@clayallsopp
Copy link
Contributor

This is interesting, and broken for me on master. Adding some logging, I see @index: #<ImmediateRef:0x7fcd4bd07560>, self: 0+826i

Travis runs 10.8, which could be making a difference. Sounds like a rubymotion bug @colinta? I've opened #351 and submitted a motion support ticket (#1668)

that aside, I'm down for merging this if it's okay with you @colinta?

@colinta
Copy link
Contributor Author

colinta commented Mar 10, 2014

Yeah, the error isn't related to the NetworkIndicator stuff, so makes sense to me! I'll keep tabs on the NSIndexPath stuff.

clayallsopp added a commit that referenced this pull request Mar 10, 2014
@clayallsopp clayallsopp merged commit bec9c64 into rubymotion-community:master Mar 10, 2014
clayallsopp added a commit that referenced this pull request Apr 16, 2014
- 'bubble-wrap/http' is now deprecated and will be removed in 2.0, see #308

+ `BW::UIActivityViewController` wrapper added, see #335

+ `BW::NetworkIndicator` added, see #349

 + `BW::Location.get_compass` & `BW::Location.get_compass_once`see #348

+ `NSString#to_color` ARGB support, see #350

+ `Object#method` support for `BW::Reactor`, see #359

* Prevented a possible exception when stopping `BW::Location`, see #358

* Fixed a bug when requiring just 'bubble-wrap/ui'
@colinta colinta deleted the network_indicator branch April 18, 2014 17:20
tutuming pushed a commit to tutuming/BubbleWrap that referenced this pull request Apr 21, 2014
- 'bubble-wrap/http' is now deprecated and will be removed in 2.0, see rubymotion-community#308

+ `BW::UIActivityViewController` wrapper added, see rubymotion-community#335

+ `BW::NetworkIndicator` added, see rubymotion-community#349

 + `BW::Location.get_compass` & `BW::Location.get_compass_once`see rubymotion-community#348

+ `NSString#to_color` ARGB support, see rubymotion-community#350

+ `Object#method` support for `BW::Reactor`, see rubymotion-community#359

* Prevented a possible exception when stopping `BW::Location`, see rubymotion-community#358

* Fixed a bug when requiring just 'bubble-wrap/ui'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants