hsanjuan / go-ndef

A Go implementation of the NFC Data Exchange Format (NDEF) specification
GNU Lesser General Public License v3.0
10 stars 5 forks source link

Fix/multi records and smart posters #3

Closed hsanjuan closed 5 years ago

hsanjuan commented 5 years ago

cc @taglme

This should fix a bunch of issues and adds SmartPoster support (with helpers). From example:

func ExampleSmartPoster() {
    // Here we create a SmartPoster Message with a title and a URL.
    // A SmartPoster wraps an NDEF Message with several records.
    title := NewTextRecord("The title", "en")
    url := NewURIRecord("https://github.com/hsanjuan/go-ndef")
    posterPayload := NewMessageFromRecords(title, url)
    poster := NewSmartPosterMessage(posterPayload)
    fmt.Println(poster)
    // Output:
    // urn:nfc:wkt:Sp:
    // urn:nfc:wkt:T:The title
    // urn:nfc:wkt:U:https://github.com/hsanjuan/go-ndef
}

Seems to work on my phone.

codecov-io commented 5 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@dba592a). Click here to learn what that means. The diff coverage is 73.52%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master       #3   +/-   ##
=========================================
  Coverage          ?   85.49%           
=========================================
  Files             ?        6           
  Lines             ?      448           
  Branches          ?        0           
=========================================
  Hits              ?      383           
  Misses            ?       33           
  Partials          ?       32
Impacted Files Coverage Δ
sp.go 100% <100%> (ø)
record_payload.go 100% <100%> (ø)
byte_utils.go 87.5% <50%> (ø)
message.go 78.49% <60%> (ø)
record.go 78.37% <69.23%> (ø)
record_chunk.go 93.28% <90.9%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update dba592a...80c8f81. Read the comment docs.

taglme commented 5 years ago

@hsanjuan, well done, new helpers are awesome. Could I ask you to add also NewEmptyRecord helper? Think it be useful too.