Skip to content
This repository has been archived by the owner on Oct 6, 2024. It is now read-only.

Commit

Permalink
feat: Support for sub webviews
Browse files Browse the repository at this point in the history
  • Loading branch information
breautek committed May 16, 2024
1 parent c8ac348 commit 537ccb4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions BTFuse/BTFuse/BTFuseContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ limitations under the License.
- (nonnull NSString*) getAPISecret;
- (nonnull BTFuseLogger*) getLogger;
- (nonnull id<WKNavigationDelegate>) createWebviewNavigationDelegate;
- (nonnull NSString*) getHost;

@end

Expand Down
4 changes: 4 additions & 0 deletions BTFuse/src/BTFuseContext.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,8 @@ - (BTFuseLogger*) getLogger {
return [[BTFuseWebviewNavigationDelegate alloc] init: self keypair: [$apiServer getKeypair]];
}

- (nonnull NSString*) getHost {
return @"localhost";
}

@end
2 changes: 1 addition & 1 deletion BTFuse/src/BTFuseViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ - (void) viewDidLoad {
[self.view addSubview: self->$webview];

[self->$delegate onBeforeWebviewLoad];
NSURL* url = [NSURL URLWithString:@"btfuse://localhost/assets/index.html"];
NSURL* url = [NSURL URLWithString: [NSString stringWithFormat: @"btfuse://%@/assets/index.html", [self->$context getHost]]];
NSURLRequest* request = [NSURLRequest requestWithURL:url];
[self->$webview loadRequest:request];
});
Expand Down

0 comments on commit 537ccb4

Please sign in to comment.