Skip to content

Commit

Permalink
Code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Eeems committed Oct 12, 2024
1 parent f0495ed commit 7ebdbe5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
17 changes: 8 additions & 9 deletions shared/liboxide/devicesettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -324,16 +324,15 @@ namespace Oxide {
}

const QString& DeviceSettings::version(){
static QString version = "";
if(version.isEmpty()){
auto lines = QFile("/usr/share/remarkable/update.conf").readAll().split('\n');
for(const QString& line : lines){
if(line.startsWith("REMARKABLE_RELEASE_VERSION=")){
version = line.mid(27);
break;
}
static QString version;
static std::once_flag flag;
std::call_once(flag, [] {
QSettings settings("/usr/share/remarkable/update.conf", QSettings::IniFormat);
version = settings.value("REMARKABLE_RELEASE_VERSION").toString();
if (version.isEmpty()) {
qWarning() << "Failed to read version from update.conf";
}
}
});
return version;
}
}
2 changes: 1 addition & 1 deletion shared/liboxide/oxide_sentry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ namespace Oxide::Sentry{
sentry_value_set_by_key(user, "id", sentry_value_new_string(machineId()));
sentry_set_user(user);
// Setup context
auto version = deviceSettings.version().toStdString();
const auto version = deviceSettings.version().toStdString();
sentry_set_tag("os.version", version.c_str());
sentry_set_tag("name", name);
sentry_value_t device = sentry_value_new_object();
Expand Down

0 comments on commit 7ebdbe5

Please sign in to comment.