import WaLog from "@normalized:N&&&analytics/src/main/ets/g/h&2.3.1";
import bundleManager from "@ohos:bundle.bundleManager";
import Model from "@normalized:N&&&analytics/src/main/ets/d/e&2.3.1";
export default class AppInfo extends Model {
    constructor() {
        super();
        this.app_bundle_id = "";
        this.app_version = "";
        this.getAppInfo();
    }
    getAppInfo() {
        let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION |
            bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA;
        try {
            let data = bundleManager.getBundleInfoForSelfSync(bundleFlags);
            WaLog.i('getBundleInfoForSelf successfully. Data: %{public}s', JSON.stringify(data));
            this.app_bundle_id = data.name;
            this.app_version = data.versionName;
        }
        catch (err) {
            let message = err.message;
            WaLog.e('getBundleInfoForSelf failed: %{public}s', message);
        }
    }
}
AppInfo.instance = null;
