
#import <AppTrackingTransparency/AppTrackingTransparency.h>
#import "UnityInterface.h"

extern "C" {
    void RequestATT()
    {
        if (@available(iOS 14.0, *)) {
            [ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:^(ATTrackingManagerAuthorizationStatus status) {
                if (status == ATTrackingManagerAuthorizationStatusAuthorized) {
                     UnitySendMessage("TYSdkFacade","RequestATTResult", "1");
                } else {

                     UnitySendMessage("TYSdkFacade","RequestATTResult", "0");
                }
            }];
        } else {
             UnitySendMessage("TYSdkFacade","RequestATTResult", "1");
        }
    }
    
    int GetATT()
    {
        if (@available(iOS 14.0, *)) {
            ATTrackingManagerAuthorizationStatus status = [ATTrackingManager trackingAuthorizationStatus];
            if (status == ATTrackingManagerAuthorizationStatusAuthorized)
                return 1;
            else
                return 0;
        } else {
            return 1;
        }
    }
}
