示例#1
0
def isDisplayingHUD() -> bool:
    if not HM.existClass(gClassName):
        return False

    command_script = f'''
        BOOL isDisplaying = NO;
        UIView *keyWindow = [UIApplication sharedApplication].keyWindow;
        UIView *HUD = nil;
        Class HUDClass = (Class)objc_lookUpClass("{gClassName}");
        for (UIView *subView in keyWindow.subviews) {{
            if ([subView isKindOfClass:HUDClass]) {{
                isDisplaying = YES;
                HUD = subView;
                break;
            }}
        }}
        if (HUD) {{
            [keyWindow bringSubviewToFront:HUD];
        }}
        isDisplaying;
    '''

    val = HM.evaluateExpressionValue(command_script)
    return HM.boolOfSBValue(val)
示例#2
0
def verifyObjIsKindOfClass(objAddress: str, className: str) -> bool:
    if objAddress is None or len(objAddress) == 0:
        return False
    
    resultValue = HM.evaluateExpressionValue(f"(BOOL)[(id){objAddress} isKindOfClass:[{className} class]]")
    return HM.boolOfSBValue(resultValue)