question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ideas for version 3

See original GitHub issue

At some point, we are going to have to release a BC breaking version in order to fix some inconsistencies in this library. While we’re at it, we might want to rethink the implementation a bit.

Here are some of my findings after having spending some time triaging issues, reviewing pull requests and reading the source code:

Return type inconsistency

Findings:

  • getBuildNumber() returns a string on iOS, and a number on Android (#214). Should be a number IMHO
  • The windows implementation sometimes returns “not available” when a feature is missing
  • Some methods are not implemented at all on a target and causes exceptions when called. Example: getIPAddress()

Proposal:

  • No method should throw an exception if not implemented.
  • Exception should only be thrown for Android when a permission is missing
  • Unimplemented methods should always return undefined.

Namespacing

Findings: The API is getting bigger and deals with a lot of mixed stuff (networking, telephony, calendar, …).

Proposal: I think that introducing some king of namespacing could help keeping it tidy:

DeviceInfo.telephony.getPhoneNumber();
DeviceInfo.network.getMacAddress();
DeviceInfo.network.getIPAddress();
// ...

We would also split the native code files by namespace

Naming

Naming is inconsistent: getDeviceName() vs getBrand().

We should take advantage of namespaces introduction to tidy up names.

Multi SIM

Currently, telephony related functions returns data for the first SIM card. Might be good to introduce multi SIM card support.

Same goes for network informations (#259)


Feel free to join the conversation and suggest other or better ideas!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:33 (1 by maintainers)

github_iconTop GitHub Comments

8reactions
machourcommented, Feb 8, 2018

Ok so here’s a first part of the namespacing/renaming I had in mind. I’m pretty sure it can be perfected:

var DeviceInfo = {
  app: {
    getName: function() {}, // ex getApplicationName()
    getInstallTime: function() {}, // ex getFirstInstallTime()
    getUpdateTime: function() {}, // ex getLastUpdateTime()
    getInstanceId: function() {},
    getBundleId: function() {},
    getBuildNumber: function() {},
    getVersion: function() {},
    getReadableVersion: function() {},
  },
  os: {
    getApiLevel: function() {}, // android only?
    getName: function() {}, // ex getSystemName()
    getVersion: function() {}, // ex getSystemVersion()
  },
  sim: {
    getCarrier: function() {},
  },
  network: {
    getIpAddress: function() {}, // ex getIPAddress
    getMacAddress: function() {}, // ex getMACAddress
  },
  device: {
    getBrand: function() {},
    getId: function() {}, // ex getDeviceId
    getName: function() {}, // ex getDeviceName
    getManufacturer: function() {},
    getMaxMemory: function() {},
    getTotalMemory: function() {},
    getModel: function() {},
    getSerialNumber: function() {},
    getTimezone: function() {},
    getUniqueId: function() {},
    getUserAgent: function() {},
    is24Hour: function() {},
    isEmulator: function() {},
    isTablet: function() {},
    isPinOrFingerprintSet: function() {},
  },
  storage: {
    getFreeSpace: function() {},
    getTotalSpace: function() {},
  }
  screen: {
    getFontScale: function() {},
  },
  dunnoYet: {
    getDeviceCountry: function() {},
    getDeviceLocale: function() {},
  }
};

2reactions
mikehardycommented, Aug 29, 2019

implementation will begin in earnest shortly

  • basic source formatting to community standards
  • e2e / detox testing in CI with the current code
  • namespacing / typing / reorg etc (probably move fully to typescript)
  • conversion to promise returns everywhere
  • mopup various dependent issues that alter implementation

That’s the general idea anyway

Read more comments on GitHub >

github_iconTop Results From Across the Web

In This House Stairs Version 3 Decor Decal Sticker Wall ...
In This House The latest in home decorating. Beautiful wall vinyl decals, that are simple to apply, are a great accent piece for...
Read more >
IDEAS For Us | Environmental Solutions Incubator ...
IDEAS connects communities with a sustainability professional in an engaging, educational workshop centered around one of our focus areas: energy, water, food, ...
Read more >
Symphony 3 versioning ideas - gists · GitHub
Symphony 3 versioning ideas. GitHub Gist: instantly share code, notes, and snippets.
Read more >
IDeaS | Revenue Management Software & Solutions
IDeaS revenue management solutions enhance your profitability using revenue science. See how we help hotels, event spaces and car parks thrive.
Read more >
What "version naming convention" do you use? [closed]
I tend to follow Jeff Atwood's opinion of the .NET convention of version numbering. (Major version).(Minor version).(Revision number).(Build number).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found