| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- //
- // Singleton.m
- // iSales-NPD
- //
- // Created by Jack on 2016/10/12.
- // Copyright © 2016年 United Software Applications, Inc. All rights reserved.
- //
- #import "Singleton.h"
- #import "NotificationNameCenter.h"
- @implementation Singleton
- - (void)dealloc {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- }
- + (instancetype)sharedInstance {
- static Singleton *singleton = nil;
- static dispatch_once_t onceToken;
- dispatch_once(&onceToken, ^{
- singleton = [[Singleton alloc] init];
- [[NSNotificationCenter defaultCenter] addObserver:singleton selector:@selector(handleLogin:) name:User_LoginOK_Notification object:nil];
- });
- return singleton;
- }
- - (void)setGlobal_lock:(BOOL)global_lock {
- _global_lock = global_lock;
- if (global_lock) {
- [[NSNotificationCenter defaultCenter] postNotificationName:Lock_Permission_Notification object:nil];
- } else {
- [[NSNotificationCenter defaultCenter] postNotificationName:unLock_Permission_Notification object:nil];
- }
- }
- - (void)resetGlobalLock {
- _global_lock = NO;
- }
- - (void)handleLogin:(NSNotification *)notification {
- self.currentOrderIsMerged = NO;
- }
- - (NSString *)homeClickedItemName {
- if (!_homeClickedItemName) {
- _homeClickedItemName = @"";
- }
- return _homeClickedItemName;
- }
- - (NSString *)deliveryString {
- if (!_deliveryString) {
- _deliveryString = @"";
- }
- return _deliveryString;
- }
- @end
|