You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by shawnlinboy <gi...@git.apache.org> on 2018/05/29 12:08:21 UTC

[GitHub] incubator-weex pull request #1221: [android] modify playground app camera ru...

GitHub user shawnlinboy opened a pull request:

    https://github.com/apache/incubator-weex/pull/1221

    [android] modify playground app camera runtime permission request behavior

    For `ActivityCompat.shouldShowRequestPermissionRationale()`, it means your app should display a dialog or something else to explain why you are going to request this permission, and **try again to request the permission**, see https://developer.android.com/training/permissions/requesting and https://github.com/googlesamples/android-RuntimePermissionsBasic/blob/master/Application/src/main/java/com/example/android/basicpermissions/MainActivity.java#L124
    
    For the original code, if the permission was **NOT** granted, the `ContextCompat.checkSelfPermission(mWXSDKInstance.getContext(), Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED` will always returns `true` and `ActivityCompat.shouldShowRequestPermissionRationale((Activity) mWXSDKInstance.getContext(), Manifest.permission.CAMERA)` did the same thing, which means If a user tap `扫描二维码`, the `Weex playground need the camera permission to scan QR code` toast will always show up without prompting a permission request dialog, users have to navigate to system app management and grant permission manually. If one user was not familiar with this mechanism,the Playground app will always be not able to scan code.
    
    This patch fix can show a dialog to tell user that `Weex playground need the camera permission to scan QR code` **and then request this code immediately**, it will make the a system permission dialog alert and the user can now grant permission directly.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/shawnlinboy/incubator-weex android-bugfix-add_camera_scan_permission_check

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-weex/pull/1221.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1221
    
----
commit f3a2bd46ac746faa76016ef2cd8f1704e16441d6
Author: Shen Lin <sh...@...>
Date:   2018-05-29T11:22:35Z

    [android] modify playground app camera runtime permission request behavior

----


---

[GitHub] incubator-weex issue #1221: [android] modify playground app camera runtime p...

Posted by shawnlinboy <gi...@git.apache.org>.
Github user shawnlinboy commented on the issue:

    https://github.com/apache/incubator-weex/pull/1221
  
    @misakuo PTAL :)


---

[GitHub] incubator-weex issue #1221: [WEEX-435][android] modify playground app camera...

Posted by gubaojian <gi...@git.apache.org>.
Github user gubaojian commented on the issue:

    https://github.com/apache/incubator-weex/pull/1221
  
    in your onRequestPermissionsResult you don't handle WRITE_EXTERNAL_STORAGE_PERMISSION_REQUEST_CODE and give an tips. please add this case.
    



---

[GitHub] incubator-weex issue #1221: [WEEX-435][android] modify playground app camera...

Posted by shawnlinboy <gi...@git.apache.org>.
Github user shawnlinboy commented on the issue:

    https://github.com/apache/incubator-weex/pull/1221
  
    @xuyouyang Thanks for reviewing, already created one.
     https://issues.apache.org/jira/browse/WEEX-435


---

[GitHub] incubator-weex issue #1221: [android] modify playground app camera runtime p...

Posted by xuyouyang <gi...@git.apache.org>.
Github user xuyouyang commented on the issue:

    https://github.com/apache/incubator-weex/pull/1221
  
    @shawnlinboy Thank you for your contribution!!As the [development process shows](http://weex.apache.org/development-process.html), we need create a jira issue in [apache](https://issues.apache.org/jira/browse/WEEX), and format your pull request title and commit log. :)
    



---

[GitHub] incubator-weex issue #1221: [android] modify playground app camera runtime p...

Posted by weex-bot <gi...@git.apache.org>.
Github user weex-bot commented on the issue:

    https://github.com/apache/incubator-weex/pull/1221
  
    
    <!--
      0 failure: 
      1 warning:  No Changelog chan...
      1 messages
      
    -->
    
    
    <table>
      <thead>
        <tr>
          <th width="50"></th>
          <th width="100%" data-danger-table="true">Warnings</th>
        </tr>
      </thead>
      <tbody><tr>
          <td>:warning:</td>
          <td>No Changelog changes!</td>
        </tr>
      </tbody>
    </table>
    
    
    <table>
      <thead>
        <tr>
          <th width="50"></th>
          <th width="100%" data-danger-table="true">Messages</th>
        </tr>
      </thead>
      <tbody><tr>
          <td>:book:</td>
          <td>danger test finished.</td>
        </tr>
      </tbody>
    </table>
    
    
    <p align="right">
      Generated by :no_entry_sign: <a href="http://github.com/danger/danger-js/">dangerJS</a>
    </p>



---

[GitHub] incubator-weex issue #1221: [WEEX-435][android] modify playground app camera...

Posted by shawnlinboy <gi...@git.apache.org>.
Github user shawnlinboy commented on the issue:

    https://github.com/apache/incubator-weex/pull/1221
  
    @gubaojian They didn't handle that so I'd like not to add extra code to that.


---