This repository was archived by the owner on Feb 22, 2023. It is now read-only.
  
  
  - 
                Notifications
    You must be signed in to change notification settings 
- Fork 9.7k
[webview_flutter] Add download listener to Android webview #4322
          
     Merged
      
      
            fluttergithubbot
  merged 4 commits into
  flutter:master
from
renefloor:feature/setDownloadListener
  
      
      
   
  Sep 10, 2021 
      
    
                
     Merged
            
            [webview_flutter] Add download listener to Android webview #4322
                    fluttergithubbot
  merged 4 commits into
  flutter:master
from
renefloor:feature/setDownloadListener
  
      
      
   
  Sep 10, 2021 
              
            Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    
              
                    renefloor
  
              
              commented
              
                  
                    Sep 8, 2021 
                  
              
              
            
            
      Comment on lines
    
      16
     to 
      18
    
  
  | public void setWebView(WebView webView){ | ||
| this.webView = webView; | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really happy that the webview depends on the downloadlistener and the other way around, but this is also how the FlutterWebChromeClient works. This is less visible as that just uses a property of the parent class.
              
                    mvanbeusekom
  
              
              approved these changes
              
                  
                    Sep 10, 2021 
                  
              
              
            
            
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
    
  engine-flutter-autoroll 
      added a commit
        to engine-flutter-autoroll/flutter
      that referenced
      this pull request
    
      Sep 10, 2021 
    
    
  
    
  engine-flutter-autoroll 
      added a commit
        to engine-flutter-autoroll/flutter
      that referenced
      this pull request
    
      Sep 10, 2021 
    
    
  
    
  engine-flutter-autoroll 
      added a commit
        to engine-flutter-autoroll/flutter
      that referenced
      this pull request
    
      Sep 10, 2021 
    
    
  
    
  NickalasB 
      added a commit
        to NickalasB/plugins
      that referenced
      this pull request
    
      Sep 10, 2021 
    
    
      
  
    
      
    
  
* master: [webview_flutter] Add download listener to Android webview (flutter#4322) [video_player] add support for content-uri based videos (flutter#4330) [webview_flutter] Implementation of the webview_flutter_platform_interface package (flutter#4302) [camera] Bump minimum Flutter version and iOS deployment target (flutter#4327) [video_player] interface: add support for content-uri based videos (android only) (flutter#4307) Ignore unnecessary_import in legacy analysis options (flutter#4129) [ci] Enable the new Windows targets (flutter#4325) # Conflicts: # packages/webview_flutter/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebView.java # packages/webview_flutter/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/WebViewBuilder.java
    
  engine-flutter-autoroll 
      added a commit
        to engine-flutter-autoroll/flutter
      that referenced
      this pull request
    
      Sep 10, 2021 
    
    
  
    
  fotiDim 
      pushed a commit
        to fotiDim/plugins
      that referenced
      this pull request
    
      Sep 13, 2021 
    
    
  
    
  amantoux 
      pushed a commit
        to amantoux/plugins
      that referenced
      this pull request
    
      Sep 27, 2021 
    
    
  
    
  KyleFin 
      pushed a commit
        to KyleFin/plugins
      that referenced
      this pull request
    
      Dec 21, 2021 
    
    
  
  
      Sign up for free
      to subscribe to this conversation on GitHub.
      Already have an account?
      Sign in.
  
      Labels
      
    cla: yes
  
    p: webview_flutter
  Edits files for a webview_flutter plugin 
  
    platform-android
  
    waiting for tree to go green
  (Use "autosubmit") This PR is approved and tested, but waiting for the tree to be green to land. 
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
This PR adds a download listener to the Android webview and sends that url to the navigation delegate. The Dart code can in turn manage the download. By (bad) luck this is already the way it works on iOS, so this PR makes the behaviour between Android and iOS the same.
Fixes flutter/flutter#89657
I also tested these changes in a complete app.
Pre-launch Checklist
dart format.)[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.