Skip to content

Commit

Permalink
Merge pull request #1583 from ruuvi/beta
Browse files Browse the repository at this point in the history
v2.2.1
  • Loading branch information
priyonto authored Aug 1, 2023
2 parents 3943bd5 + ce00e0f commit 069fe03
Show file tree
Hide file tree
Showing 12 changed files with 148 additions and 93 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public enum RuuviCloudAlertType: String, Codable {
case pressure
case signal
case movement
case offline
}

public enum RuuviCloudAlertSettingType: String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,9 @@ public final class RuuviServiceAlertImpl: RuuviServiceAlert {
type = .signal(lower: cloudAlert.min,
upper: cloudAlert.max)
setSignal(description: cloudAlert.description, for: physicalSensor)
case .offline:
// Not supported on app yet.
break
}
if let type = type {
if cloudAlert.enabled {
Expand Down
43 changes: 26 additions & 17 deletions pnservice/NotificationService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class NotificationService: UNNotificationServiceExtension {
case pressure = "pressure"
case signal = "signal"
case movement = "movement"
case offline = "offline"
}

private enum TriggerType: String {
Expand Down Expand Up @@ -41,20 +42,25 @@ class NotificationService: UNNotificationServiceExtension {

if let contentHandler = contentHandler,
let userInfo = currentRequest?.content.userInfo,
let sensorName = userInfo["name"] as? String,
let alertType = userInfo["alertType"] as? String,
let triggerType = userInfo["triggerType"] as? String,
let threshold = userInfo["thresholdValue"] as? String,
let alertUnit = userInfo["alertUnit"] as? String,
let alertMessage = userInfo["alertData"] as? String,
let bestAttemptContent = bestAttemptContent {
let title = titleForAlert(from: triggerType,
alertType: alertType,
threshold: threshold,
alertUnit: alertUnit)
bestAttemptContent.title = title
bestAttemptContent.subtitle = alertMessage
bestAttemptContent.body = sensorName
let bestAttemptContent = bestAttemptContent {
// If this value is not available on data, show formatted message.
// Otherwise don't do anything.
let showLocallyFormattedMessage = userInfo["showLocallyFormatted"] as? Bool ?? true
if showLocallyFormattedMessage {
if let sensorName = userInfo["name"] as? String,
let alertType = userInfo["alertType"] as? String,
let triggerType = userInfo["triggerType"] as? String,
let threshold = userInfo["thresholdValue"] as? String,
let alertMessage = userInfo["alertData"] as? String {
let title = titleForAlert(from: triggerType,
alertType: alertType,
threshold: threshold)
bestAttemptContent.subtitle = alertMessage
bestAttemptContent.title = title
bestAttemptContent.body = sensorName
}
}

contentHandler(bestAttemptContent)
}
}
Expand Down Expand Up @@ -92,8 +98,7 @@ extension NotificationService {
// swiftlint:disable:next cyclomatic_complexity
private func titleForAlert(from triggerType: String,
alertType: String,
threshold: String,
alertUnit: String) -> String {
threshold: String) -> String {
guard let triggerType = getTriggerType(from: triggerType),
let alertType = getAlertType(from: alertType) else {
return ""
Expand All @@ -114,6 +119,8 @@ extension NotificationService {
case .movement:
let format = "LocalNotificationsManager.DidMove.title"
return localized(value: format)
default:
break
}
case .over:
switch alertType {
Expand All @@ -128,10 +135,12 @@ extension NotificationService {
case .movement:
let format = "LocalNotificationsManager.DidMove.title"
return localized(value: format)
default:
break
}
}

return String(format: localized(value: format), threshold) + alertUnit
return String(format: localized(value: format), threshold)
}

private func localized(value: String) -> String {
Expand Down
40 changes: 20 additions & 20 deletions station.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6363,7 +6363,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 386;
CURRENT_PROJECT_VERSION = 391;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
Expand All @@ -6373,7 +6373,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS -D DEVELOPMENT";
PRODUCT_BUNDLE_IDENTIFIER = com.ruuvi.station;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -6395,7 +6395,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 386;
CURRENT_PROJECT_VERSION = 391;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
Expand All @@ -6405,7 +6405,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.ruuvi.station;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -6427,7 +6427,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 386;
CURRENT_PROJECT_VERSION = 391;
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -6440,7 +6440,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.ruuvi.station.widgets;
Expand All @@ -6464,7 +6464,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 386;
CURRENT_PROJECT_VERSION = 391;
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -6477,7 +6477,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.ruuvi.station.widgets;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -6499,7 +6499,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 386;
CURRENT_PROJECT_VERSION = 391;
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -6512,7 +6512,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.ruuvi.station.intents;
Expand All @@ -6535,7 +6535,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 386;
CURRENT_PROJECT_VERSION = 391;
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -6548,7 +6548,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.ruuvi.station.intents;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -6687,7 +6687,7 @@
CODE_SIGN_ENTITLEMENTS = station/station.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 386;
CURRENT_PROJECT_VERSION = 391;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
Expand Down Expand Up @@ -6729,7 +6729,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.ruuvi.station;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -6749,7 +6749,7 @@
CODE_SIGN_ENTITLEMENTS = station/station.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 386;
CURRENT_PROJECT_VERSION = 391;
DEVELOPMENT_TEAM = 4MUYJ4YYH4;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
INFOPLIST_FILE = "$(SRCROOT)/station/Resources/Plists/Info.plist";
Expand All @@ -6758,7 +6758,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
OTHER_SWIFT_FLAGS = "$(inherited) -D COCOAPODS";
PRODUCT_BUNDLE_IDENTIFIER = com.ruuvi.station;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -6863,7 +6863,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 386;
CURRENT_PROJECT_VERSION = 391;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -6876,7 +6876,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.ruuvi.station.pnservice;
Expand All @@ -6898,7 +6898,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 386;
CURRENT_PROJECT_VERSION = 391;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = 4MUYJ4YYH4;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -6911,7 +6911,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 2.2.0;
MARKETING_VERSION = 2.2.1;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.ruuvi.station.pnservice;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
2 changes: 1 addition & 1 deletion station/Resources/Plists/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>384</string>
<string>389</string>
<key>FirebaseMessagingAutoInitEnabled</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
29 changes: 18 additions & 11 deletions station/Resources/Strings/de.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -703,16 +703,23 @@ Wenn die Beanspruchung nicht erfolgreich war oder NFC auf Ihrem Gerät nicht ver
"Defaults.HideNFC.title" = "Verstecken Sie die NFC-Option vor einem erzwungenen Eigentümerwechsel";
"settings_alert_sound_default" = "Systemfehler";
"settings_alert_sound_ruuvi_speak" = "Ruuvi Alarm";
"add_with_nfc" = "Add with NFC";
"sensor_details" = "Sensor Details";
"add_sensor" = "Add Sensor";
"copy_details" = "Copy Details";
"add_with_nfc" = "Mit NFC hinzufügen";
"sensor_details" = "Sensordetails";
"add_sensor" = "Sensor hinzufügen";
"copy_details" = "Details kopieren";
"name" = "Name:";
"mac_address" = "Mac Address:";
"unique_id" = "Unique ID:";
"mac_address" = "MAC-Adresse:";
"go_to_sensor" = "Gehen Sie zur Sensorkarte";
"unique_id" = "Eindeutige ID:";
"firmware_version" = "Firmware Version:";
"close" = "Close";
"add_sensor_nfc_df3_error" = "This tag cannot be added with NFC due to old firmware. Please add the tag with Bluetooth and update firmware.";
"unclaim_sensor" = "Unclaim sensor";
"unclaim" = "Unclaim";
"unclaim_sensor_description" = "Ownership of this sensor has been claimed to your Ruuvi account. Press Unclaim to remove this sensor's settings and related data from your Ruuvi account.";
"Close" = "Schließen";
"add_sensor_nfc_df3_error" = "Dieser Sensor kann aufgrund der alten Firmware nicht mit NFC hinzugefügt werden. Bitte fügen Sie den Sensor über Bluetooth hinzu und aktualisieren Sie die Firmware.";
"add_sensor_description" = "Auf dieser Seite werden Ruuvi-Sensoren in der Nähe angezeigt, die der App noch nicht hinzugefügt wurden. Tippen Sie auf einen Sensor, um ihn hinzuzufügen.";
"add_sensor_via_nfc" = "Alternatively, you can add a sensor using NFC by selecting Add with NFC and touching it with your phone.";
"unclaim_sensor" = "Anspruch auf Eigentum zurückziehen";
"unclaim" = "Anspruch aufheben";
"unclaim_sensor_description" = "Das Eigentum an diesem Sensor wurde Ihrem Ruuvi-Konto zugeordnet. Klicken Sie auf „Anspruch aufheben“, um die Einstellungen dieses Sensors und die zugehörigen Daten aus Ihrem Ruuvi-Konto zu entfernen.";
"claim_sensor_ownership" = "Beanspruchen Sie den Besitz des Sensors";
"do_you_own_sensor" = "Besitzen Sie diesen Sensor?";
"owners_plan" = "Ruuvi-Plan des Eigentümers";
"rename" = "Rename";
11 changes: 9 additions & 2 deletions station/Resources/Strings/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -704,10 +704,17 @@ Your RuuviTag sensor is ready for use!";
"copy_details" = "Copy Details";
"name" = "Name:";
"mac_address" = "Mac Address:";
"go_to_sensor" = "Go to sensor card";
"unique_id" = "Unique ID:";
"firmware_version" = "Firmware Version:";
"close" = "Close";
"add_sensor_nfc_df3_error" = "This tag cannot be added with NFC due to old firmware. Please add the tag with Bluetooth and update firmware.";
"Close" = "Close";
"add_sensor_nfc_df3_error" = "This sensor cannot be added with NFC due to old firmware. Please add the sensor with Bluetooth and update firmware.";
"add_sensor_description" = "This page shows nearby Ruuvi sensors not yet added to the app. Tap a sensor to add it.";
"add_sensor_via_nfc" = "Alternatively, you can add a sensor using NFC by selecting Add with NFC and touching it with your phone.";
"unclaim_sensor" = "Unclaim sensor";
"unclaim" = "Unclaim";
"unclaim_sensor_description" = "Ownership of this sensor has been claimed to your Ruuvi account. Press Unclaim to remove this sensor's settings and related data from your Ruuvi account.";
"claim_sensor_ownership" = "Claim sensor ownership";
"do_you_own_sensor" = "Do you own this sensor?";
"owners_plan" = "Owner's Ruuvi Plan";
"rename" = "Rename";
33 changes: 20 additions & 13 deletions station/Resources/Strings/fi.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -698,16 +698,23 @@ RuuviTag on valmis käyttöön!";
"Defaults.HideNFC.title" = "Piilota NFC-vaihtoehto pakotetusta omistajuudenvaihdosta";
"settings_alert_sound_default" = "Järjestelmän oletus";
"settings_alert_sound_ruuvi_speak" = "Ruuvi hälytys";
"add_with_nfc" = "Add with NFC";
"sensor_details" = "Sensor Details";
"add_sensor" = "Add Sensor";
"copy_details" = "Copy Details";
"name" = "Name:";
"mac_address" = "Mac Address:";
"unique_id" = "Unique ID:";
"firmware_version" = "Firmware Version:";
"close" = "Close";
"add_sensor_nfc_df3_error" = "This tag cannot be added with NFC due to old firmware. Please add the tag with Bluetooth and update firmware.";
"unclaim_sensor" = "Unclaim sensor";
"unclaim" = "Unclaim";
"unclaim_sensor_description" = "Ownership of this sensor has been claimed to your Ruuvi account. Press Unclaim to remove this sensor's settings and related data from your Ruuvi account.";
"add_with_nfc" = "Lisää NFC:llä";
"sensor_details" = "Anturin tiedot";
"add_sensor" = "Lisää anturi";
"copy_details" = "Kopioi tiedot";
"name" = "Nimi:";
"mac_address" = "MAC-osoite:";
"go_to_sensor" = "Siirry anturikortille";
"unique_id" = "Yksilöivä tunniste:";
"firmware_version" = "Laiteohjelmistoversio:";
"Close" = "Sulje";
"add_sensor_nfc_df3_error" = "Vanha laiteohjelmisto ei salli anturin lisäämistä NFC:llä. Lisää anturi Bluetooth-yhteydellä ja päivitä laiteohjelmisto.";
"add_sensor_description" = "Tällä sivulla näet lähelläsi olevat Ruuvi-anturit, joita ei ole vielä lisätty sovellukseen. Lisää listattu anturi napauttamalla.";
"add_sensor_via_nfc" = "Voit vaihtoehtoisesti lisätä anturin sovellukseen NFC:llä napauttamalla Lisää NFC:llä painiketta ja koskettamalla sitä.";
"unclaim_sensor" = "Poista omistajuus";
"unclaim" = "Poista omistajuus";
"unclaim_sensor_description" = "Tämän anturin omistajuus on merkitty Ruuvi-tilillesi. Poista anturin asetukset ja anturin tiedot Ruuvi-tililtä valitsemalla Poista omistajuus.";
"claim_sensor_ownership" = "Vaadi anturin omistajuutta";
"do_you_own_sensor" = "Omistatko tämän anturin?";
"owners_plan" = "Omistajan Ruuvi-tilaus";
"rename" = "Rename";
Loading

0 comments on commit 069fe03

Please sign in to comment.