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

Make projectID and preview API configurable #145

Merged
merged 6 commits into from
Dec 1, 2022

Conversation

Simply007
Copy link
Contributor

Motivation

Internal link: DEVREL-694

Make the project Id and preview API key configurable. Currently using getIntent.getStringExtra().

Checklist

  • Code follows coding conventions held in this repo
  • Automated tests have been added
  • Tests are passing
  • Docs have been updated (if applicable)
  • Temporary settings (e.g. variables used during development and testing) have been reverted to defaults

How to test

If manual testing is required, what are the steps?

@Simply007 Simply007 marked this pull request as ready for review October 31, 2022 13:38
@@ -81,6 +82,14 @@ protected void onCreate(Bundle savedInstanceState) {
// TODO: seems like this is not required after all, verify and remove if possible
//AndroidNetworking.initialize(getApplicationContext());

String customProjectId = getIntent().getStringExtra("KontentProjectId");
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does those come from? I mean are you sending them from some other activity? I think that you wanted to grab those from strings.xml, however then you need to use this: https://developer.android.com/guide/topics/resources/string-resource#String and I think there must be a default value. xml file. Also please add how to use CustomProjectId into readme

Copy link
Contributor Author

@Simply007 Simply007 Nov 23, 2022

Choose a reason for hiding this comment

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

I wanted to use it in combination with appetize: https://docs.appetize.io/core-features/playback-options -> a will add section to README.

Default value is null if nothing is set -> hence condition right under that.

INSTANCE = client;
}
return INSTANCE;
}

private static DeliveryClient resetClient(String previewAPiKey) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't initializeClient be a better name? :) if I am reading it in BaseActivity.java it sounds better to me that: if customprojectId is not null then initializeClient. 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.

renamed

@IvanKiral
Copy link
Contributor

IvanKiral commented Nov 14, 2022

Requested changes:

  • Add how to use customProjectId to readme
  • Consider if current approach of customProjectId is right
  • Considre renaming resetClient

@Simply007
Copy link
Contributor Author

Requested changes:

  • Add how to use customProjectId to readme
  • Consider if current approach of customProjectId is right

I think the code is fine - it is a sample..

  • Considre renaming resetClient

IvanKiral
IvanKiral previously approved these changes Nov 29, 2022
sample-app-android/README.md Outdated Show resolved Hide resolved
sample-app-android/README.md Outdated Show resolved Hide resolved
@Simply007 Simply007 merged commit e2f27a6 into master Dec 1, 2022
@Simply007 Simply007 deleted the configurable-android-project branch December 1, 2022 09:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants