multiplatform-settings icon indicating copy to clipboard operation
multiplatform-settings copied to clipboard

wasmJs support for multiplatform-settings-coroutines

Open ahna92 opened this issue 11 months ago • 13 comments

As wasm went stable, need support for multiplatform-settings-coroutines ,

Also kotlinx.coroutines supported wasm which was the blocker i think

Tired to support in https://github.com/russhwolf/multiplatform-settings/pull/187 , but i feel some configurations in BuildHelpers.kt blocked it

ahna92 avatar Mar 02 '24 01:03 ahna92

Wasm is not stable. But it is stable enough for kotlinx to include it, which is good enough for here.

Unfortunately, Turbine is also a blocker here.

There are some refactors in the 1.2 branch because the old BuildHelpers config is terrible. This will be trivial to add on top of the existing changes in 1.2.

russhwolf avatar Mar 05 '24 03:03 russhwolf

Great, thanks !

ahna92 avatar Mar 05 '24 04:03 ahna92

@russhwolf Is there any ETA for v1.2 and WASM support?

armond-avanes avatar Mar 05 '24 04:03 armond-avanes

@russhwolf Would be nice to know if this is in progress and if its gonna be released with 1.2 version. Thanks :)

shriharsha-srb avatar Mar 15 '24 08:03 shriharsha-srb

Turbine 1.1.0 now has wasmJs target

xxfast avatar Mar 16 '24 00:03 xxfast

Been traveling and otherwise busy, but my current goal is to get this out as part of 1.2 by the end of the month.

russhwolf avatar Mar 19 '24 14:03 russhwolf

@russhwolf Can you plz provide some updates here ? Also let me know if some snapshot version if available. That works as well.

shriharsha-srb avatar May 01 '24 21:05 shriharsha-srb

@shriharsha-srb I've published snapshot of 1.2.0 to my public maven repository. Feel free to use it while waiting for official release ☺️

Setup

Add maven In settings.gradle.kts (read more about versioning here)

dependencyResolutionManagement {
    repositories {
        maven(url = "https://pkgs.dev.azure.com/burnoo/maven/_packaging/public/maven/v1") {
            content {
                includeVersionByRegex(".*", ".*", ".*-beap[0-9]+")
            }
        }
    }
}

In your module:

implementation("com.russhwolf:multiplatform-settings:1.2.0-beap1")

burnoo avatar Jul 09 '24 14:07 burnoo

@burnoo Thanks for releasing this!

Unfortunately, it does not work at the moment, I always get: Could not find com.russhwolf:multiplatform-settings:1.2.0-beap1. Is it still available?

stephanepechard avatar Aug 21 '24 15:08 stephanepechard

@stephanepechard

Yes it's still available. Have you added my maven to settings.gradle.kts? You can check out similar configuration here

burnoo avatar Aug 21 '24 16:08 burnoo

@burnoo Thanks for your answer. I have copied the exact same config, with no much luck :-(

Screenshot 2024-08-21 at 18 17 13

stephanepechard avatar Aug 21 '24 16:08 stephanepechard

I've just checked it in my local environment and maven works as expected. Could you show the rest of the file and implementation usage?

burnoo avatar Aug 21 '24 18:08 burnoo

@burnoo Sure, but maybe not on this thread, can I write you an email? Thanks!

stephanepechard avatar Aug 21 '24 19:08 stephanepechard

Hi @burnoo thanks for publishing 1.2.0 !

I just added it to my project and tried to use it on wasmJs:

val settings = StorageSettings(localStorage).toFlowSettings()

But .toFlowSettings() does not work since StorageSettings does not inherit from ObservableSettings like the Android and iOS implementation.

This works on Android and iOS: val settings = SharedPreferencesSettings(sharedPreferences).toFlowSettings() val settings = NSUserDefaultsSettings(NSUserDefaults.standardUserDefaults()).toFlowSettings()

Is this already supported in 1.2.0 ?

@russhwolf Will there be an official release soon?

kit0kat avatar Aug 30 '24 10:08 kit0kat

Hi @kit0kat. 1.2.0 comes with the new artifact com.russhwolf:multiplatform-settings-make-observable that allows to observe StorageSettings at runtime. Important thing to mention is that it will only trigger updates for the current ObservableSettings instance (docs).

Artifact is published to my maven, so you can do the following

  1. Add com.russhwolf:multiplatform-settings-make-observable:1.2.0-beap1 to dependencies
  2. Use StorageSettings(localStorage).makeObservable().toFlowSettings()

burnoo avatar Aug 30 '24 10:08 burnoo

@burnoo Thank you! Now it works as expected. Many thanks!

kit0kat avatar Aug 30 '24 13:08 kit0kat

Sorry it took so long. This has now been released in version 1.2.0.

russhwolf avatar Sep 02 '24 03:09 russhwolf