//
//  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

+ (instancetype)sharedInstance {
    static Singleton *singleton = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        singleton = [[Singleton alloc] init];
    });
    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 = YES;
}

@end
