LookinAppInfo.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifdef SHOULD_COMPILE_LOOKIN_SERVER
  2. //
  3. // LookinAppInfo.h
  4. // qmuidemo
  5. //
  6. // Created by Li Kai on 2018/11/3.
  7. // Copyright © 2018 QMUI Team. All rights reserved.
  8. //
  9. #import "LookinDefines.h"
  10. typedef NS_ENUM(NSInteger, LookinAppInfoDevice) {
  11. LookinAppInfoDeviceSimulator, // 模拟器
  12. LookinAppInfoDeviceIPad, // iPad 真机
  13. LookinAppInfoDeviceOthers // 应该视为 iPhone 真机
  14. };
  15. @interface LookinAppInfo : NSObject <NSSecureCoding, NSCopying>
  16. /// 每次启动 app 时都会随机生成一个 appInfoIdentifier 直到 app 被 kill 掉
  17. @property(nonatomic, assign) NSUInteger appInfoIdentifier;
  18. /// mac 端应该先读取该属性,如果为 YES 则表示应该使用之前保存的旧 appInfo 对象即可
  19. @property(nonatomic, assign) BOOL shouldUseCache;
  20. /// LookinServer 的版本
  21. @property(nonatomic, assign) int serverVersion;
  22. /// 类似 "1.1.9",只在 1.2.3 以及之后的 LookinServer 版本里有值
  23. @property(nonatomic, assign) NSString *serverReadableVersion;
  24. /// 如果 iOS 侧使用了 SPM 或引入了 Swift Subspec,则该属性为 1
  25. /// 如果 iOS 侧没使用,则该属性为 -1
  26. /// 如果不知道,则该属性为 0
  27. @property(nonatomic, assign) int swiftEnabledInLookinServer;
  28. /// app 的当前截图
  29. @property(nonatomic, strong) LookinImage *screenshot;
  30. /// 可能为 nil,比如新建的 iOS 空项目
  31. @property(nonatomic, strong) LookinImage *appIcon;
  32. /// @"微信读书"
  33. @property(nonatomic, copy) NSString *appName;
  34. /// hughkli.lookin
  35. @property(nonatomic, copy) NSString *appBundleIdentifier;
  36. /// @"iPhone X"
  37. @property(nonatomic, copy) NSString *deviceDescription;
  38. /// @"12.1"
  39. @property(nonatomic, copy) NSString *osDescription;
  40. /// 返回 os 的主版本号,比如 iOS 12.1 的设备将返回 12,iOS 13.2.1 的设备将返回 13
  41. @property(nonatomic, assign) NSUInteger osMainVersion;
  42. /// 设备类型
  43. @property(nonatomic, assign) LookinAppInfoDevice deviceType;
  44. /// 屏幕的宽度
  45. @property(nonatomic, assign) double screenWidth;
  46. /// 屏幕的高度
  47. @property(nonatomic, assign) double screenHeight;
  48. /// 是几倍的屏幕
  49. @property(nonatomic, assign) double screenScale;
  50. - (BOOL)isEqualToAppInfo:(LookinAppInfo *)info;
  51. #if TARGET_OS_IPHONE
  52. + (LookinAppInfo *)currentInfoWithScreenshot:(BOOL)hasScreenshot icon:(BOOL)hasIcon localIdentifiers:(NSArray<NSNumber *> *)localIdentifiers;
  53. #else
  54. @property(nonatomic, assign) NSTimeInterval cachedTimestamp;
  55. #endif
  56. @end
  57. #endif /* SHOULD_COMPILE_LOOKIN_SERVER */