Skip to content

Commit

Permalink
fix: add branch keys in ensemble.properties for deeplink
Browse files Browse the repository at this point in the history
  • Loading branch information
sharjeelyunus committed Oct 10, 2024
1 parent 7bbee6c commit 7a571f2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion starter/dart_runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const modules = [
path: 'scripts/modules/enable_deeplink.dart',
parameters: [
{ key: 'branch_live_key', question: 'Please provide the live Branch.io key: ', required: true },
{ key: 'branch_test_key', question: 'Please provide the test Branch.io key: ', required: false },
{ key: 'branch_test_key', question: 'Please provide the test Branch.io key: ', required: true },
{ key: 'use_test_key', question: 'Are you using the test key? (yes/no): ', type: 'list', choices: ['yes', 'no'], required: true },
{ key: 'scheme', question: 'Please provide the URI scheme for deeplinking: ', required: true },
{ key: 'links', question: 'Please provide a comma-separated list of deeplink URLs: ', required: true }
Expand Down
15 changes: 12 additions & 3 deletions starter/scripts/modules/enable_deeplink.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,17 @@ void main(List<String> arguments) {

String? branchIOLiveKey =
getArgumentValue(arguments, 'branch_live_key', required: true);
String? branchIOTestKey = getArgumentValue(arguments, 'branch_test_key');
String? branchIOTestKey =
getArgumentValue(arguments, 'branch_test_key', required: true);
bool useTestKey =
getArgumentValue(arguments, 'use_test_key')?.toLowerCase() == 'true';
String? scheme = getArgumentValue(arguments, 'scheme', required: true);
List<String> links = getArgumentValue(arguments, 'links')?.split(',') ?? [];

if (branchIOLiveKey == null || branchIOLiveKey.isEmpty) {
if (branchIOLiveKey == null ||
branchIOLiveKey.isEmpty ||
branchIOTestKey == null ||
branchIOTestKey.isEmpty) {
print(
'Error: Missing branch_live_key argument. Usage: npm run useDeeplink branch_live_key=<branch_live_key> branch_test_key=<branch_test_key> use_test_key=<true|false> scheme=<scheme> links=<link1,link2>');
exit(1);
Expand Down Expand Up @@ -86,6 +90,11 @@ ensemble_deeplink:
);
}

updatePropertiesFile(
ensemblePropertiesFilePath, 'branchTestKey', branchIOTestKey);
updatePropertiesFile(
ensemblePropertiesFilePath, 'branchLiveKey', branchIOLiveKey);

// Modify AndroidManifest.xml for deep linking
if (platforms.contains('android')) {
updateAndroidManifestWithDeeplink(
Expand All @@ -112,7 +121,7 @@ ensemble_deeplink:
'branch_key',
{
'live': branchIOLiveKey,
'test': branchIOTestKey ?? '',
'test': branchIOTestKey,
},
isDict: true,
);
Expand Down

0 comments on commit 7a571f2

Please sign in to comment.