Skip to content

Commit

Permalink
docs: make the maui sample work on android
Browse files Browse the repository at this point in the history
  • Loading branch information
rdavisau committed Feb 8, 2023
1 parent 754cf02 commit 0dcbb53
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
8 changes: 8 additions & 0 deletions src/samples/maui/maui/MauiProgram.cs
Expand Up @@ -40,7 +40,15 @@ public static MauiApp CreateMauiApp()
private static async Task RunTbc(MauiApp app, IContainer container)
{
var rm = new ReloadManager(container);

// listen on a different port for android
// need to adb forward this
// and need it in the reload config
#if ANDROID
var ts = new Tbc.Target.TargetServer(TargetConfiguration.Default(port: 50130));
#else
var ts = new Tbc.Target.TargetServer(TargetConfiguration.Default(port: 50129));
#endif
await ts.Run(rm, x => Debug.WriteLine(x));
}

Expand Down
4 changes: 3 additions & 1 deletion src/samples/maui/readme.md
Expand Up @@ -2,7 +2,9 @@ run run-host.sh to start a host that will watch for the maui sample, then start

[quick video](https://rdavisau.blob.core.windows.net/zzz/tbc-maui.mp4?sv=2020-08-04&st=2023-01-12T05%3A07%3A25Z&se=2050-01-11T15%3A00%3A00Z&sr=b&sp=r&sig=ukrEaCJ15tyjn5pGd0wdMVxWsamVLLcZ20h6oB0B7lY%3D) - note video has rapid flashing colours for a few seconds at ~3:30 🚦

only tested ios, other platforms probably need changes in reload-config.json to support global usings
[android] (https://rdavisau.blob.core.windows.net/zzz/tbc-maui-android.mp4?sv=2020-08-04&st=2023-02-08T02%3A25%3A12Z&se=2050-02-09T02%3A25%3A00Z&sr=b&sp=r&sig=oRvblPXgJWBa6qNsMO8n%2FpCGrzTS6MpLuPccEslx6z0%3D)

on android, you need to `adb forward tcp:50130 tcp:50130` and wait for all dependencies to slowly be shuffled from the app to the host (and maybe one failed reload needs to trigger it?)

howto in general:

Expand Down
13 changes: 9 additions & 4 deletions src/samples/maui/reload-config.json
@@ -1,9 +1,14 @@
{
"ConsoleHost": {
"ExpectedClients": [{
"Address": "localhost",
"Port": 50129
}]
"Address": "localhost",
"Port": 50129
},
{
"Address": "localhost",
"Port": 50130
}
]
},
"FileWatcher": {
"RootPath": "maui",
Expand All @@ -25,7 +30,7 @@
}],
"GlobalUsingsSources": [{
"Kind": "SearchPath",
"Reference": "maui/obj/Debug/net7.0-ios",
"Reference": "./maui/",
"Context": "LastModified"
}],
"iOSDynamicRegistrationOptions": {
Expand Down

0 comments on commit 0dcbb53

Please sign in to comment.