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

Sparrow SDK #1282

Merged
merged 21 commits into from
Jan 28, 2025
Merged

Sparrow SDK #1282

merged 21 commits into from
Jan 28, 2025

Conversation

jigar-f
Copy link
Contributor

@jigar-f jigar-f commented Jan 7, 2025

No description provided.

@jigar-f jigar-f added the enhancement New feature or request label Jan 7, 2025
@jigar-f jigar-f self-assigned this Jan 7, 2025
@jigar-f jigar-f marked this pull request as ready for review January 16, 2025 08:22
@jigar-f jigar-f requested a review from atavism January 16, 2025 08:22
domainName: "lantern.surveysparrow.com",
targetToken: AppSecret.myanmarSpotCheckTargetToken,
// Should Not Pass userDetails as const
userDetails: {});
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe create a method to create SpotCheck instances dynamically based on country code to remove the need for all these separate variables?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you are taking about AppSecret.myanmarSpotCheckTargetToken then that is not possible, this is a token needed need for each country.

default:
_testingSpotCheck.trackScreen(screen.name);
break;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here.. you could add a utility method to fetch a SpotCheck for a given country code., and then call trackScreen on it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


void trackScreen(SurveyScreens screen) {
switch (sessionModel.country.value?.toLowerCase()) {
case 'ru':
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to use enums for country codes to avoid hardcoding them in multiple places?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea, thanks

final filePath = await _surveyConfigPath;
final file = File(filePath);
if (await file.exists()) {
final content = await file.readAsString();
Copy link
Contributor

Choose a reason for hiding this comment

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

The logic for reading the config here could also be extracted into a reusable method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, but I think if we just use shared_pref here, there might be less overhead for this, What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@atavism
Copy link
Contributor

atavism commented Jan 26, 2025

Just a few comments on this one as well..

@jigar-f
Copy link
Contributor Author

jigar-f commented Jan 27, 2025

Changes are done, Do you mind taking a look again?

@jigar-f jigar-f merged commit 6b2b9a6 into main Jan 28, 2025
2 checks passed
@jigar-f jigar-f deleted the jigar/sparrow-sdk branch January 28, 2025 11:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants