gplayapi-ts
Version:
Google Play API wrapper in TypeScript
58 lines • 2.11 kB
JavaScript
import { AndroidCheckinRequest, DeviceConfigurationProto } from "../../gen_proto/googleplay_pb";
const createDeviceFeature = (name, value) => ({ name, value });
class AndroidDevice {
get userAgent() {
return `Android-Finsky/15.8.23-all [0] [PR] 259261889 (api=3,versionCode=81582300,sdk=28,device=${this.build.device},hardware=${this.build.device},product=${this.build.product},platformVersionRelease=${this.versionRelease},model=${this.build.model},buildId=${this.build.id},isWideScreen=0,supportedAbis=${this.platforms.join(";")})`;
}
get authUserAgent() {
return `GoogleAuth/1.4 ${this.build.device} ${this.build.id}`;
}
generateAndroidCheckInRequest() {
this.build.timestamp = BigInt(Math.floor(Date.now() / 1e3));
return new AndroidCheckinRequest({
id: 0n,
checkin: {
build: this.build,
lastCheckinMsec: 0n,
cellOperator: this.cellOperator || "",
simOperator: this.simOperator || "",
roaming: this.roaming || "",
userNumber: 0
},
locale: "en_GB",
timeZone: this.timeZone,
version: 3,
deviceConfiguration: this.getDeviceConfigProto(),
fragment: 0
});
}
getDeviceConfigProto() {
return new DeviceConfigurationProto({
touchScreen: this.touchScreen,
keyboard: this.keyboard,
navigation: this.navigation,
screenLayout: this.screenLayout,
hasHardKeyboard: false,
hasFiveWayNavigation: false,
screenDensity: this.screen.density,
glEsVersion: this.glVersion,
systemSharedLibrary: this.libraries,
systemAvailableFeature: this.deviceFeatures.map((feature) => feature.name),
nativePlatform: this.platforms,
screenWidth: this.screen.width,
screenHeight: this.screen.height,
systemSupportedLocale: this.locales,
glExtension: this.glExtensions,
deviceClass: 0,
lowRamDevice: 0,
totalMemoryBytes: 8589935000n,
maxNumOfCPUCores: 8,
deviceFeature: this.deviceFeatures
});
}
}
export {
AndroidDevice,
createDeviceFeature
};
//# sourceMappingURL=common.mjs.map