- 
                Notifications
    You must be signed in to change notification settings 
- Fork 3.5k
[gis_web] Improves renderButton API exports. #3432
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
          
     Merged
      
      
            auto-submit
  merged 6 commits into
  flutter:main
from
ditman:gis-web-fix-render-button-api
  
      
      
   
  Mar 31, 2023 
      
    
  
     Merged
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            6 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      207fa35
              
                [gis_web] renderButton now accepts any js-interop target.
              
              
                ditman 7151103
              
                dart format .
              
              
                ditman 639e119
              
                Expose Button configuration API
              
              
                ditman 5ef94ab
              
                [gis_web] Remove jwt_decoder dep.
              
              
                ditman 6e9ccd7
              
                [gis_web] Bump version more after exposing enums.
              
              
                ditman d3c4924
              
                [ci] Disallow jwt_decoder dep.
              
              
                ditman File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
        
          
  
    
      
          
            31 changes: 31 additions & 0 deletions
          
          31 
        
  packages/google_identity_services_web/example/integration_test/src/dom.dart
  
  
      
      
   
        
      
      
    
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|  | ||
| // ignore_for_file: public_member_api_docs | ||
|  | ||
| import 'package:js/js.dart'; | ||
| import 'package:js/js_util.dart' as js_util; | ||
|  | ||
| @JS() | ||
| @staticInterop | ||
| class DomDocument {} | ||
|  | ||
| extension DomDocumentExtension on DomDocument { | ||
| DomElement createElement(String name, [Object? options]) => | ||
| js_util.callMethod(this, 'createElement', | ||
| <Object>[name, if (options != null) options]) as DomElement; | ||
| } | ||
|  | ||
| @JS() | ||
| @staticInterop | ||
| class DomElement {} | ||
|  | ||
| extension DomElementExtension on DomElement { | ||
| external DomElement? querySelector(String selector); | ||
| } | ||
|  | ||
| @JS('document') | ||
| external DomDocument get domDocument; | ||
|  | ||
| DomElement createDomElement(String tag) => domDocument.createElement(tag); | ||
  
    
      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
    
  
  
    
              
        
          
  
    
      
          
            50 changes: 50 additions & 0 deletions
          
          50 
        
  packages/google_identity_services_web/example/lib/src/jwt.dart
  
  
      
      
   
        
      
      
    
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|  | ||
| import 'dart:convert'; | ||
|  | ||
| /// A codec that can encode/decode JWT payloads. | ||
| /// | ||
| /// See https://www.rfc-editor.org/rfc/rfc7519#section-3 | ||
| final Codec<Object?, String> _jwtCodec = json.fuse(utf8).fuse(base64); | ||
|  | ||
| /// A RegExp that can match, and extract parts from a JWT Token. | ||
| /// | ||
| /// A JWT token consists of 3 base-64 encoded parts of data separated by periods: | ||
| /// | ||
| /// header.payload.signature | ||
| /// | ||
| /// More info: https://regexr.com/789qc | ||
| final RegExp _jwtTokenRegexp = RegExp( | ||
| r'^(?<header>[^\.\s]+)\.(?<payload>[^\.\s]+)\.(?<signature>[^\.\s]+)$'); | ||
|  | ||
| /// Decodes the `claims` of a JWT token and returns them as a Map. | ||
| /// | ||
| /// JWT `claims` are stored as a JSON object in the `payload` part of the token. | ||
| /// | ||
| /// (This method does not validate the signature of the token.) | ||
| /// | ||
| /// See https://www.rfc-editor.org/rfc/rfc7519#section-3 | ||
| Map<String, Object?>? decodePayload(String? token) { | ||
| if (token != null) { | ||
| final RegExpMatch? match = _jwtTokenRegexp.firstMatch(token); | ||
| if (match != null) { | ||
| return _decodeJwtPayload(match.namedGroup('payload')); | ||
| } | ||
| } | ||
|  | ||
| return null; | ||
| } | ||
|  | ||
| /// Decodes a JWT payload using the [_jwtCodec]. | ||
| Map<String, Object?>? _decodeJwtPayload(String? payload) { | ||
| try { | ||
| // Payload must be normalized before passing it to the codec | ||
| return _jwtCodec.decode(base64.normalize(payload!)) | ||
| as Map<String, Object?>?; | ||
| } catch (_) { | ||
| // Do nothing, we always return null for any failure. | ||
| } | ||
| return null; | ||
| } | 
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  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.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.