Code Monkey home page Code Monkey logo

Comments (8)

cezarywojcik avatar cezarywojcik commented on August 17, 2024

I can't quite see what's going on with that gif, as the gif itself seems somewhat choppy, but do you experience the same issue with the demo app? If not, the first thing I might try is handling the notification on the main queue in your app.

from cwstatusbarnotification.

mohitathwani avatar mohitathwani commented on August 17, 2024

This is my set up :

    self.statusBarNotification = [CWStatusBarNotification new];
    self.statusBarNotification.notificationLabelBackgroundColor = [UIColor colorWithRed:212.0/255.0 green:212.0/255.0 blue:212.0/255.0 alpha:1.0];
    self.statusBarNotification.notificationLabelTextColor = [UIColor blackColor];
    [self.statusBarNotification displayNotificationWithMessage:@"Fetching stations ..." completion:nil];

    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    [manager GET:@"http://rpi.athwani.net:8843/stations" parameters:nil success:^(AFHTTPRequestOperation *operation, id responseObject) {

        self.stationsDisctionary = (NSDictionary *)responseObject;
        [[NSNotificationCenter defaultCenter] postNotificationName:gotStations object:nil userInfo:nil];

        dispatch_async(dispatch_get_main_queue(), ^{
            [self.statusBarNotification dismissNotification];
        });


    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        NSLog(@"Error: %@", error);
    }];

I've uploaded a video of the problem here :
https://mega.co.nz/#!BUEHEIRA!LXZ4aDk21f32uW7yWf2jkwuMks2NpE8CygTT6c9FQ_M

The sample project seems to be working fine ....

from cwstatusbarnotification.

getaaron avatar getaaron commented on August 17, 2024

This probably isn't your issue, but AFNetworking success blocks are guaranteed to be called on the main thread, so the dispatch to the main queue is unnecessary.

from cwstatusbarnotification.

mohitathwani avatar mohitathwani commented on August 17, 2024

Moved the dismiss call outside the dispatch to main queue, and still no luck. The closing animation is still choppy :(

from cwstatusbarnotification.

getaaron avatar getaaron commented on August 17, 2024

Is the other stuff before the AFNetworking call on the main thread too?

from cwstatusbarnotification.

mohitathwani avatar mohitathwani commented on August 17, 2024

It's actually in a singleton which handles all the downloads. The singleton is called from the main thread for sure.

from cwstatusbarnotification.

cezarywojcik avatar cezarywojcik commented on August 17, 2024

Sorry that I haven't gotten around to this; I've been busy with school.

Anyhow, I tried to recreate your situation like this:

self.notification = [CWStatusBarNotification new];
self.notification.notificationLabelBackgroundColor = [UIColor colorWithRed:212.0/255.0 green:212.0/255.0 blue:212.0/255.0 alpha:1.0];
self.notification.notificationLabelTextColor = [UIColor blackColor];
[self.notification displayNotificationWithMessage:@"Fetching stations ..." completion:nil];

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{  
    [self.notification dismissNotification];
});

However, everything looked fine on my end.

Based on the video you provided, I made a better quality gif.

Here are the exploded frames for the closing:

http://gif-explode.com/?explode=https://www.filepicker.io/api/file/hubwlNIRLmRPPYjx4VkS

It looks like there is another black bar that is covering up the notification as it is being dismissed.

I took another look at the starting animation:

http://gif-explode.com/?explode=https://www.filepicker.io/api/file/sPQ1rT6iSKuo2wI9IMvg

It looks like there is also an issue with the start, as at the beginning, the status bar area is black and the status bar is fading back in. The way the library works is by taking a screenshot of the status bar before displaying the notification, so if this area is black or in some other state of transition before the notification is displayed, this will obviously cause issues.

Are you doing anything else with the status bar before displaying the notification? That would explain why you were having this issue.

from cwstatusbarnotification.

mohitathwani avatar mohitathwani commented on August 17, 2024

I figured out the issue .... I was indirectly calling this from the app delegate ... hence the choppy animation ...

from cwstatusbarnotification.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.