Skip to content

Commit

Permalink
Merge pull request #1549 from ruuvi/beta
Browse files Browse the repository at this point in the history
v2.2.0
  • Loading branch information
priyonto authored Jul 17, 2023
2 parents 928b7fd + 605a354 commit 3943bd5
Show file tree
Hide file tree
Showing 114 changed files with 3,334 additions and 436 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
source "https://rubygems.org"

gem "fastlane"
gem "cocoapods", '1.11.3'
gem "cocoapods", '1.12.1'

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval_gemfile(plugins_path) if File.exist?(plugins_path)
Expand Down
56 changes: 27 additions & 29 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ GEM
specs:
CFPropertyList (3.0.6)
rexml
activesupport (6.1.7.2)
activesupport (7.0.5)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
Expand All @@ -17,43 +16,43 @@ GEM
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.760.0)
aws-sdk-core (3.171.1)
aws-partitions (1.780.0)
aws-sdk-core (3.175.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.64.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-kms (1.67.0)
aws-sdk-core (~> 3, >= 3.174.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.122.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-s3 (1.125.0)
aws-sdk-core (~> 3, >= 3.174.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sigv4 (1.5.2)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
claide (1.1.0)
cocoapods (1.11.3)
cocoapods (1.12.1)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.11.3)
cocoapods-core (= 1.12.1)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.4.0, < 2.0)
cocoapods-downloader (>= 1.6.0, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 1.0, < 3.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.11.3)
activesupport (>= 5.0, < 7)
cocoapods-core (1.12.1)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
Expand All @@ -75,7 +74,7 @@ GEM
colored2 (3.1.2)
commander (4.6.0)
highline (~> 2.0.0)
concurrent-ruby (1.2.0)
concurrent-ruby (1.2.2)
declarative (0.0.20)
digest-crc (0.6.4)
rake (>= 12.0.0, < 14.0.0)
Expand All @@ -86,7 +85,7 @@ GEM
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
excon (0.99.0)
excon (0.100.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -115,8 +114,8 @@ GEM
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.6)
fastlane (2.212.2)
fastimage (2.2.7)
fastlane (2.213.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand All @@ -140,7 +139,7 @@ GEM
json (< 3.0.0)
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
multipart-post (~> 2.0.0)
multipart-post (>= 2.0.0, < 3.0.0)
naturally (~> 2.2)
optparse (~> 0.1.1)
plist (>= 3.1.0, < 4.0.0)
Expand All @@ -155,12 +154,12 @@ GEM
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
fastlane-plugin-firebase_app_distribution (0.5.0)
fastlane-plugin-firebase_app_distribution (0.6.1)
ffi (1.15.5)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.41.0)
google-apis-androidpublisher_v3 (0.43.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.0)
addressable (~> 2.5, >= 2.5.1)
Expand Down Expand Up @@ -202,18 +201,18 @@ GEM
http-cookie (1.0.5)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (1.12.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.6.3)
jwt (2.7.0)
jwt (2.7.1)
memoist (0.16.2)
mini_magick (4.12.0)
mini_mime (1.1.2)
minitest (5.17.0)
minitest (5.18.1)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.0.0)
multipart-post (2.3.0)
nanaimo (0.3.0)
nap (1.1.0)
naturally (2.2.1)
Expand Down Expand Up @@ -272,16 +271,15 @@ GEM
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7)
zeitwerk (2.6.7)

PLATFORMS
ruby

DEPENDENCIES
cocoapods (= 1.11.3)
cocoapods (= 1.12.1)
fastlane
fastlane-plugin-firebase_app_distribution
i18n (~> 1.8)

BUNDLED WITH
2.4.5
2.4.13
2 changes: 1 addition & 1 deletion Modules/RuuviDiscover/RuuviDiscover.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RuuviDiscover'
s.version = '0.0.1'
s.version = '0.0.2'
s.summary = 'Ruuvi Discover'
s.homepage = 'https://ruuvi.com'
s.author = { 'Rinat Enikeev' => '[email protected]' }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,40 @@ class DiscoverPresenter: NSObject, RuuviDiscover {
var ruuviOwnershipService: RuuviServiceOwnership!

private weak var view: DiscoverViewInput?
private var ruuviTags = Set<RuuviTag>()
private var accessQueue = DispatchQueue(
label: "com.ruuviDiscover.accessQueue", attributes: .concurrent
)
private var _persistedSensors: [RuuviTagSensor] = []
private var persistedSensors: [RuuviTagSensor]! {
didSet {
updateViewDevices()
get {
return accessQueue.sync {
_persistedSensors
}
}
set {
accessQueue.async(flags: .barrier) {
self._persistedSensors = newValue
DispatchQueue.main.async {
self.updateViewDevices()
}
}
}
}

private var _ruuviTags = Set<RuuviTag>()
private var ruuviTags: Set<RuuviTag> {
get {
return accessQueue.sync {
_ruuviTags
}
}
set {
accessQueue.async(flags: .barrier) {
self._ruuviTags = newValue
}
}
}

private var reloadTimer: Timer?
private var scanToken: ObservationToken?
private var stateToken: ObservationToken?
Expand Down Expand Up @@ -196,7 +224,10 @@ extension DiscoverPresenter {
}

private func startReloading() {
reloadTimer = Timer.scheduledTimer(withTimeInterval: 3, repeats: true, block: { [weak self] (_) in
reloadTimer = Timer.scheduledTimer(
withTimeInterval: 3,
repeats: true,
block: { [weak self] (_) in
self?.updateViewDevices()
})
// don't wait for timer, reload after 0.5 sec
Expand Down
2 changes: 1 addition & 1 deletion Packages/RuuviCloud/RuuviCloud.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'RuuviCloud'
s.version = '0.0.7'
s.version = '0.0.8'
s.summary = 'Ruuvi Cloud'
s.homepage = 'https://ruuvi.com'
s.author = { 'Rinat Enikeev' => '[email protected]' }
Expand Down
15 changes: 14 additions & 1 deletion Packages/RuuviCloud/Sources/RuuviCloud/RuuviCloud.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public protocol RuuviCloud {
func registerPNToken(token: String,
type: String,
name: String?,
data: String?) -> Future<Int, RuuviCloudError>
data: String?,
params: [String: String]?) -> Future<Int, RuuviCloudError>

@discardableResult
func unregisterPNToken(token: String?,
Expand Down Expand Up @@ -61,6 +62,12 @@ public protocol RuuviCloud {
macId: MACIdentifier
) -> Future<MACIdentifier, RuuviCloudError>

@discardableResult
func contest(
macId: MACIdentifier,
secret: String
) -> Future<MACIdentifier, RuuviCloudError>

@discardableResult
func unclaim(macId: MACIdentifier) -> Future<MACIdentifier, RuuviCloudError>

Expand Down Expand Up @@ -145,6 +152,12 @@ public protocol RuuviCloud {
@discardableResult
func set(dashboardTapActionType: DashboardTapActionType) -> Future<DashboardTapActionType, RuuviCloudError>

@discardableResult
func set(emailAlert: Bool) -> Future<Bool, RuuviCloudError>

@discardableResult
func set(pushAlert: Bool) -> Future<Bool, RuuviCloudError>

@discardableResult
func update(
temperatureOffset: Double?,
Expand Down
5 changes: 5 additions & 0 deletions Packages/RuuviCloud/Sources/RuuviCloudApi/RuuviCloudApi.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public protocol RuuviCloudApi {
authorization: String
) -> Future<RuuviCloudApiClaimResponse, RuuviCloudApiError>

func contest(
_ requestModel: RuuviCloudApiContestRequest,
authorization: String
) -> Future<RuuviCloudApiContestResponse, RuuviCloudApiError>

func unclaim(
_ requestModel: RuuviCloudApiClaimRequest,
authorization: String
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import Foundation

public struct RuuviCloudApiContestRequest: Codable {
let sensor: String
let secret: String

public init(sensor: String, secret: String) {
self.sensor = sensor
self.secret = secret
}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
import Foundation

// swiftlint:disable:next type_name
public enum RuuviCloudPNTokenRegisterRequestParamsKey: String {
case sound = "soundFile"
}

public struct RuuviCloudPNTokenRegisterRequest: Encodable {
let token: String
let type: String
let name: String?
let data: String?
let params: [String: String]?

public init(token: String,
type: String,
name: String? = nil,
data: String? = nil) {
data: String? = nil,
params: [String: String]? = nil) {
self.token = token
self.type = type
self.name = name
self.data = data
self.params = params
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import Foundation

public struct RuuviCloudApiContestResponse: Decodable {
public let sensor: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public struct RuuviCloudApiSettings: Decodable, RuuviCloudSettings {
public var dashboardTapActionType: DashboardTapActionType? {
return dashboardTapActionTypeString?.ruuviCloudApiSettingsDashboardTapActionType
}
public var pushAlertEnabled: Bool? {
return pushAlertEnabledString?.ruuviCloudApiSettingBoolean
}
public var emailAlertEnabled: Bool? {
return emailAlertEnabledString?.ruuviCloudApiSettingBoolean
}

var unitTemperatureString: String?
var accuracyTemperatureString: String?
Expand All @@ -60,6 +66,8 @@ public struct RuuviCloudApiSettings: Decodable, RuuviCloudSettings {
var dashboardEnabledString: String?
var dashboardTypeString: String?
var dashboardTapActionTypeString: String?
var pushAlertEnabledString: String?
var emailAlertEnabledString: String?

enum CodingKeys: String, CodingKey {
case unitTemperatureString = "UNIT_TEMPERATURE"
Expand All @@ -75,5 +83,7 @@ public struct RuuviCloudApiSettings: Decodable, RuuviCloudSettings {
case dashboardEnabledString = "DASHBOARD_ENABLED"
case dashboardTypeString = "DASHBOARD_TYPE"
case dashboardTapActionTypeString = "DASHBOARD_TAP_ACTION"
case pushAlertEnabledString = "ALERT_PUSH_ENABLED"
case emailAlertEnabledString = "ALERT_EMAIL_ENABLED"
}
}
Loading

0 comments on commit 3943bd5

Please sign in to comment.