{"id":15286856,"url":"https://github.com/irons163/irnotificationreceiver","last_synced_at":"2026-01-05T14:16:23.801Z","repository":{"id":56915178,"uuid":"196354884","full_name":"irons163/IRNotificationReceiver","owner":"irons163","description":"IRNotificationReceiver is a powerful notification receiver/manager for iOS, it can set conditions for eazy to manage the notifications.","archived":false,"fork":false,"pushed_at":"2019-12-23T09:11:45.000Z","size":196,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-02T14:37:32.534Z","etag":null,"topics":["ios","manager","manager-system","network","notification","notification-center","notifications","objective-c","receiver"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/irons163.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-11T08:40:48.000Z","updated_at":"2019-12-31T05:14:37.000Z","dependencies_parsed_at":"2022-08-20T21:20:35.222Z","dependency_job_id":null,"html_url":"https://github.com/irons163/IRNotificationReceiver","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irons163%2FIRNotificationReceiver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irons163%2FIRNotificationReceiver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irons163%2FIRNotificationReceiver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/irons163%2FIRNotificationReceiver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/irons163","download_url":"https://codeload.github.com/irons163/IRNotificationReceiver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245175352,"owners_count":20572781,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ios","manager","manager-system","network","notification","notification-center","notifications","objective-c","receiver"],"created_at":"2024-09-30T15:18:45.889Z","updated_at":"2026-01-05T14:16:23.770Z","avatar_url":"https://github.com/irons163.png","language":"Objective-C","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Build Status](https://img.shields.io/badge/build-%20passing%20-brightgreen.svg)\n![Platform](https://img.shields.io/badge/Platform-%20iOS%20-blue.svg)\n\n# IRNotificationReceiver \n\n- IRNotificationReceiver is a powerful notification receiver/manager for iOS, it can set conditions for eazy to manage the notifications. \n- Notification is base on `Observer Pattern`, it is a good feature to send messages between classes and not break you codes structure, but sometimes you have a lot of notifications and want to manage them, like network relative notifications.\n\n## Features\n- Customize the notifications.\n- Support notifications number control.\n- Support notifications ignore mode.\n- Support shared notifications.\n\n## Install\n### Git\n- Git clone this project.\n- Copy this project into your own project.\n- Add the .xcodeproj into you  project and link it as embed framework.\n#### Options\n- You can remove the `demo` and `ScreenShots` folder.\n\n### Cocoapods\n- Add `pod 'IRNotificationReceiver'`  in the `Podfile`\n- `pod install`\n\n## Usage\n\n- Then `demo` project display a situation for network requests. You want to use notifications to deliver the status of requests, they could be success or failure, and called by sequential  or concurent. Use `IRNotificationReceiver` can be eazy to manage these notifications.\n\n### Basic\n\n#### Setup `NotificationReceiver`\n\n```obj-c\n#import \u003cIRNotificationReceiver/IRNotificationReceiver.h\u003e\n\n#define GetUserProfileSuccessNotification @\"GetUserProfileSuccessNotification\"\n#define GetFriendsSuccessNotification @\"GetFriendsSuccessNotification\"\n#define GetMessagesSuccessNotification @\"GetMessagesSuccessNotification\"\n\nNotificationReceiver *notificationReceiver = [[NotificationReceiver alloc] init];\nnotificationReceiver.repeat = NO;\nnotificationReceiver.delegate = self;\n```\n\n- The default value of `repeat` is `YES`, that means once the conditions are completed, the `NotificationReceiver` will reset and look forward the same conditions again. The situation is use for some the same requests you want to do again, ex: Click a button do 3 requests A, B, C, show the result after the requests are completed, then you can click again.\n\n- The default value of `enable` is `YES`, if set to `NO`,  The `NotificationReceiverDelegate` will not be called, and `checkConditionsWith` not work too.\n    \n#### Set `addObserver`, and set `NotificationConditioner`\n```obj-c\n[notificationReceiver addObserver:self selector:@selector(completionNotifications:) conditioner:[[NotificationConditioner alloc] initWithName:GetUserProfileSuccessNotification minCount:1] ignoreable:YES object:nil];\n```\n\n- `ignoreable`\n    - If set `YES`, while you call `ignoreConditionerWithName` or `ignoreConditioner`, the specific notification would not manage by `checkConditionsWith`. It also triger the ignore delegaet:  `receivedIgnoreConditionerWithName:(NSString*)name` in the `NotificationReceiverDelegate`.\n\n- `minCount`\n    - You can set `minCount` to help you promise the number of specific notification are called if verified by  `checkConditionsWith`.\n\n#### Check verified by `checkConditionsWith` \n\n- Check verified by `checkConditionsWith`, the common way is put the codes in the call back of the requests.\n- Important!!! Do `checkConditionsWith` would consume the `minCount` in the `NotificationConditioner`. That means if you set a  `Login NotificationConditioner` with 3 for `minCount`, after you call `checkConditionsWith:@\"Login\"` three times, the check result would be verified.\n\n```obj-c\n[notificationReceiver checkConditionsWith:name verifity:^(BOOL isVerified) {\n    if(name) {\n        self.statusLabel.text = [self.statusLabel.text stringByAppendingString:[NSString stringWithFormat:@\"%@ %@\\n\", [name stringByReplacingOccurrencesOfString:@\"SuccessNotification\" withString:@\"\"], @\"Success.\"]];\n    }\n    \n    if(isVerified) {\n        [self didUpdate];\n    }\n}];\n```\n\n#### Reset by `resetConditioners` \n\n- You can call `resetConditioners` to make the conditions reset to default. Ex: Click logout button, discard all of the network requests and reset the conditions. \n\n#### Call `removeObserver`\n\n- Don't forgot to remove observer while you not want to observe the notifications.\n\n\n### Advanced settings\n\n- Use `SharedNotificationConditioner`.\n    - The situation for use is when you want to do a common request, like `Login`. You just want to do it once, so if logined, then do something, else do `Login`.\n    - Use  `SharedNotificationConditioner` for `Login` request in the all of the pages that you want to login first. Like Profile page, Friends page, etc....\n    \n```obj-c\n[notificationReceiver addObserver:self selector:@selector(completionNotifications:) conditioner:[[SharedNotificationConditioner sharedInstance] sharedNotificationConditionerWithName:LoginSuccessNotification minCount:1] ignoreable:YES object:nil];\n```\n\n## Screenshots\n| Main Page | Failure |\n|:---:|:---:|\n| ![Main](./ScreenShots/demo1.png) | ![Failure](./ScreenShots/demo6.png) |\n| Sequential Requesting | Sequential Success |\n| ![Sequential](./ScreenShots/demo2.png) | ![Success](./ScreenShots/demo3.png) |\n| Concurent Requesting | Concurent Success |\n| ![Concurent](./ScreenShots/demo4.png) | ![Success](./ScreenShots/demo5.png) |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firons163%2Firnotificationreceiver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Firons163%2Firnotificationreceiver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Firons163%2Firnotificationreceiver/lists"}