Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

temporary fix for maxSdkVersion attribute parsing #194

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions packages/cli/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ const getAndroidDetails = async (
const minSdk = new RegExp(
AaptPrefixes.sdkPrefix + AaptPrefixes.quoteRegex
).exec(stdout);
const permissions = [...stdout.matchAll(/uses-permission: name='(.*)'/g)];
const permissions = [...stdout.matchAll(/uses-permission: name='(.+)?' maxSdkVersion='(\d\d)'|uses-permission: name='(.+)'/g)];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

name='(.+)?'

Won't the ? serve to make the characters between the '' optional? To make this match stingy, I think it should be name='(.+?)'.

const locales = new RegExp(
AaptPrefixes.localePrefix + AaptPrefixes.quoteNonLazyRegex
).exec(stdout);
Expand All @@ -310,7 +310,12 @@ const getAndroidDetails = async (
min_sdk: parseInt(minSdk?.[1] ?? "0", 10),
version_code: parseInt(versionCode?.[1] ?? "0", 10),
version: versionName?.[1] ?? "0",
permissions: permissions.flatMap(permission => permission[1]),
permissions: permissions.flatMap(permission => {
if (permission[1] === undefined)
return permission[3]
else
return permission[1] + " maxSdkVersion=" + permission[2]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd recommend we add a comment here noting that this format will change in the future, with a link to the GitHub issue.

}),
locales: localeArray,
};
};
Expand Down