d145ce52f7
* New sqlite3 libraries for new namespace * Rename top level module to SpeckleConnector3 * Register extension as v3 * Add new sqlite3 libraries for mac * Update bundle files for hybrid build mac/intel * Rename speckle_connector_loader for v3 * Rename file and folder * Rename loader
28 lines
811 B
Ruby
28 lines
811 B
Ruby
# frozen_string_literal: true
|
|
|
|
require_relative 'action'
|
|
require_relative '../accounts/accounts'
|
|
|
|
module SpeckleConnector3
|
|
module Actions
|
|
# Save stream.
|
|
# Currently it is not a state changer.
|
|
class SaveStream < Action
|
|
def initialize(stream_id)
|
|
super()
|
|
@stream_id = stream_id
|
|
end
|
|
|
|
# @param state [States::State] the current state of the {App::SpeckleConnectorApp}
|
|
# @return [States::State] the new updated state object
|
|
def update_state(state)
|
|
speckle_dict = state.sketchup_state.sketchup_model.attribute_dictionary('Speckle', true)
|
|
saved = speckle_dict['saved_streams'] || []
|
|
saved = saved.empty? ? [@stream_id] : saved.unshift(@stream_id)
|
|
speckle_dict['saved_streams'] = saved
|
|
state
|
|
end
|
|
end
|
|
end
|
|
end
|