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

[permission_handler] Support Tizen 4.0 #139

Merged
merged 2 commits into from Jul 5, 2021

Conversation

bbrto21
Copy link
Contributor

@bbrto21 bbrto21 commented Jun 28, 2021

  • Use ppm_request_permission instead of ppm_request_permissions
  • Now the requests are executed sequentially, one by one

Signed-off-by: Boram Bae boram21.bae@samsung.com

@bbrto21 bbrto21 marked this pull request as draft June 28, 2021 11:01
@bbrto21
Copy link
Contributor Author

bbrto21 commented Jun 28, 2021

#61

for (size_t i = 0; i < permissions_to_request.size(); i++) {
const char* permission = permissions_to_request[i];
p.is_done = false;
result = ppm_request_permission(
Copy link
Contributor

Choose a reason for hiding this comment

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

how about extracting this callback 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.

Well... this is close to my personal preference, I like to avoid adding unnecessary functions to class members or exposing them in headers and I generally prefer lambda functions unless they are used forever elsewhere.
However, I respect your opinion and it is possible :) Should I change it?

Copy link
Contributor

Choose a reason for hiding this comment

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

😃 this is also my preference, not a critical. I just found this lambda function too long to read.

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've updated this PR


// Wait until ppm_request_permission is done;
while (!p.is_done) {
ecore_main_loop_iterate();
Copy link
Member

Choose a reason for hiding this comment

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

As we said in our conversation, I don't think this is strange. I'm not sure if timeout is necessary here. I think we should listen to other people's opinions.

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 have other reasonable ideas, please share it :)

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@bbrto21 bbrto21 Jun 29, 2021

Choose a reason for hiding this comment

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

What a funny document! 😆
I'm not God, but there's nothing much the user can do when show pop-up for a permission, so I thought it was OK.

@bwikbs
Copy link
Member

bwikbs commented Jun 29, 2021

It's a little different story...
How about using ppm_request_permissions version maintain too &
Expiring ppm_request_permission version after some time ?
Because it's cleaner to use ppm_request_permissions.

@bbrto21
Copy link
Contributor Author

bbrto21 commented Jun 29, 2021

It's a little different story...
How about using ppm_request_permissions version maintain too &
Expiring ppm_request_permission version after some time ?
Because it's cleaner to use ppm_request_permissions.

I couldn't find any information related to the expiration of ppm_request_permission support in the Tizen document.
and I didn't hear when the Tizen 4.0 support expired on the wearable device, but it's possible when that time comes.
I think we should follow this guide until that time comes

@bbrto21 bbrto21 marked this pull request as ready for review June 30, 2021 01:13
* Use ppm_request_permission instead of ppm_request_permissions
* Now the requests are executed sequentially, one by one

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
Copy link
Contributor

@HakkyuKim HakkyuKim left a comment

Choose a reason for hiding this comment

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

Some minor points

packages/permission_handler/tizen/src/type.h Outdated Show resolved Hide resolved
packages/permission_handler/tizen/src/service_manager.cc Outdated Show resolved Hide resolved
Copy link
Member

@bwikbs bwikbs left a comment

Choose a reason for hiding this comment

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

Thanks for your working!!!

Copy link
Member

@swift-kim swift-kim left a comment

Choose a reason for hiding this comment

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

Overall looks good to me.

packages/permission_handler/tizen/src/type.h Show resolved Hide resolved
const char** privileges, size_t privileges_count, void* user_data) {
if (!user_data) {
LOG_ERROR("Invalid user data");
void OnRequestPermissionsRespon(ppm_call_cause_e cause,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any special reason why you shortened the name of this function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could you please refer to the conversation containing this comment?
When I changed this lambda function back to a named function, I made it a local function and excluded it from the class namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OnRequestPermissionsResponse ->OnRequestPermissionsRespon
Oh!? Are you talking about this? My mistake! I'll fix it later when I get to work.

* Change a long lambda to local function to improve readability
* Apply naming convention
* Use enum class instead of enum
* Use constexpr rather than macro

Signed-off-by: Boram Bae <boram21.bae@samsung.com>
@bwikbs bwikbs merged commit b969b33 into flutter-tizen:master Jul 5, 2021
@bbrto21 bbrto21 deleted the support40 branch August 10, 2021 04:57
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.

None yet

6 participants