Skip to content

JavaSE - Add SdlFile constructor that takes URI#1470

Merged
RHenigan merged 1 commit intodevelopfrom
feature/issue_1469_sdl_file_uri
Aug 28, 2020
Merged

JavaSE - Add SdlFile constructor that takes URI#1470
RHenigan merged 1 commit intodevelopfrom
feature/issue_1469_sdl_file_uri

Conversation

@bilal-alsharifi
Copy link
Copy Markdown
Contributor

@bilal-alsharifi bilal-alsharifi commented Aug 27, 2020

Fixes #1469

This PR is ready for review.

Risk

This PR makes minor API changes.

Testing Plan

  • I have verified that I have not introduced new warnings in this PR (or explain why below)
  • I have run the unit tests with this PR
  • I have tested this PR against Core and verified behavior (if applicable, if not applicable, explain why below).
  • I have tested Java SE

Core Tests

This code snippet can be used to test uploading a file using URI:

void testSdlFileURI (){
    // Get URI
    File file = new File("<file path>");
    URI uri = file.toURI();

    // Upload file
    final SdlArtwork sdlFile = new SdlArtwork(null, FileType.GRAPHIC_PNG, uri, false);
    sdlFile.setOverwrite(true);
    sdlManager.getFileManager().uploadFile(sdlFile, new CompletionListener() {
        @Override
        public void onComplete(boolean success) {
            if (success) {
                Log.i(TAG,"File Uploaded: " + sdlManager.getFileManager().hasUploadedFile(sdlFile));

                // Send Show
                Show show = new Show();
                show.setMainField1("Hi There");
                Image image = new Image(sdlFile.getName(), ImageType.DYNAMIC);
                show.setGraphic(image);
                show.setOnRPCResponseListener(new OnRPCResponseListener() {
                    @Override
                    public void onResponse(int correlationId, RPCResponse response) {
                        try {
                            Log.i(TAG, "onResponse: " + response.serializeJSON().toString(4));
                        } catch (JSONException e) {
                            e.printStackTrace();
                        }
                    }
                });
                sdlManager.sendRPC(show);
            } else {
                messageLogger.logError(TAG, "Failed to upload file.", true);
            }
        }
    });
}

Core version: Core 6.1.0 / Generic HMI

Summary

This PR Adds SdlFile constructor that takes URI to the JavaSE library to align with Android

CLA

@bilal-alsharifi bilal-alsharifi changed the title [WIP] javaSE - Add SdlFile constructor that takes URI JavaSE - Add SdlFile constructor that takes URI Aug 27, 2020
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 27, 2020

Codecov Report

Merging #1470 into develop will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #1470      +/-   ##
=============================================
+ Coverage      46.95%   46.97%   +0.01%     
  Complexity      4973     4973              
=============================================
  Files            537      537              
  Lines          27360    27360              
  Branches        3376     3376              
=============================================
+ Hits           12848    12851       +3     
+ Misses         13590    13589       -1     
+ Partials         922      920       -2     
Impacted Files Coverage Δ Complexity Δ
...com/smartdevicelink/util/MediaStreamingStatus.java 67.32% <0.00%> (+0.99%) 17.00% <0.00%> (ø%)
...tdevicelink/managers/audio/AudioDecoderCompat.java 73.33% <0.00%> (+3.33%) 3.00% <0.00%> (ø%)

@RHenigan RHenigan merged commit 35e14c2 into develop Aug 28, 2020
@RHenigan RHenigan deleted the feature/issue_1469_sdl_file_uri branch August 28, 2020 20:17
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