-
Notifications
You must be signed in to change notification settings - Fork 32
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
add addRadarSDKVerify option #367
base: master
Are you sure you want to change the base?
Changes from all commits
f13dd90
82a2a1c
2a8decc
402e317
e2003ae
727aa63
01950a5
77e9205
789a9d5
148ee24
7b3ba49
da78add
8853da1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,36 @@ export const withRadarIOS: ConfigPlugin<RadarPluginProps> = (config, args) => { | |
}, | ||
]); | ||
} | ||
if (args.addRadarSDKVerify) { | ||
config = withDangerousMod(config, [ | ||
'ios', | ||
async config => { | ||
const filePath = path.join(config.modRequest.platformProjectRoot, 'Podfile'); | ||
const contents = await fs.readFile(filePath, 'utf-8'); | ||
|
||
// Check if the pod declaration already exists | ||
if (contents.indexOf("pod 'RadarSDK/Verify', '3.19.2-beta.9'") === -1) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lmeier @KennyHuRadar Similar to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should probably extract this to a constant in the future. Since we release all the sdks with matching versions (I think, since RadarSDKMotion releases a 3.19 together with a 3.19 main SDK even if there is no change). We can probably just update the version string in the podspec file, and we can read the version from there and use it across the plugin. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea that's exactly correct — easiest to maintain the same version across the the main module and all submodules. |
||
// Find the target block | ||
const targetRegex = /target '(\w+)' do/g; | ||
const match = targetRegex.exec(contents); | ||
if (match) { | ||
const targetStartIndex = match.index; | ||
const targetEndIndex = contents.indexOf('end', targetStartIndex) + 3; | ||
|
||
// Insert the pod declaration within the target block | ||
const targetBlock = contents.substring(targetStartIndex, targetEndIndex); | ||
const updatedTargetBlock = targetBlock.replace(/(target '(\w+)' do)/, `$1\n pod 'RadarSDK/Verify', '3.19.2-beta.9'\n pod 'CocoaAsyncSocket', :modular_headers => true\n pod 'HTTPParserC', :modular_headers => true`); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Telegraph sub-dependencies need |
||
const newContents = contents.replace(targetBlock, updatedTargetBlock); | ||
|
||
// Write the updated contents back to the Podfile | ||
await fs.writeFile(filePath, newContents); | ||
} | ||
} | ||
|
||
return config; | ||
}, | ||
]); | ||
} | ||
|
||
return config; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
localhost
on Android emulator