pieroxy / java-user-agent-detection

Some code to deduce an OS/Platform/Browser out of a user-agent string
53 stars 12 forks source link

Braces in brand names #14

Closed mrDoctorWho closed 7 years ago

mrDoctorWho commented 7 years ago

(Windows) (Linux) (Unix-like)

Why?

pieroxy commented 7 years ago

I didn't know what to put in there. I really have no brand to put. I should just leave it empty I guess.

mrDoctorWho commented 7 years ago

Well, let's think about this.

When does this happen?

I mean, what kind of condition makes Windows or Linux a brand?

mrDoctorWho commented 7 years ago
UNKNOWN(""),

I think it should be unknown string too. The point is that the upper level (the program that uses your library) could easily guess that the library has no idea about the browser/brand/etc name.

mrDoctorWho commented 7 years ago
OPENSOURCE("An Open Source Project"),

Is that even a thing?

pieroxy commented 7 years ago

Well, yes and no. I wanted to distinguish the case where a brand is unknow from the case where there is structurally no brand because the project is a collaborative project. Maybe I should add an enum ProjectType { COMMERCIAL, OPEN_SOURCE }

mrDoctorWho commented 7 years ago

@pieroxy enum is a good idea, love it. Although, opensource can be commercial too.

pieroxy commented 7 years ago

Fixed with the last two commits. Let me know if the solution works for you.