Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ios): update hippy demo, adapt to hippy3 #4140

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions examples/ios-demo/HippyDemo/TestModule.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@
*/

#import "TestModule.h"
#import "HippyRootView.h"
#import <hippy/HippyRootView.h>
#import <hippy/HippyBridge.h>
#import <hippy/HippyBridgeDelegate.h>
#import "AppDelegate.h"
#import "HippyBundleURLProvider.h"
#import "DemoConfigs.h"

@interface TestModule ()<HippyBridgeDelegate>

/// The debug bundle url
@property (nonatomic, strong) NSURL *debugBundleUrl;

@end

@implementation TestModule
Expand Down Expand Up @@ -78,6 +83,7 @@ - (dispatch_queue_t)methodQueue
}

NSURL *url = [NSURL URLWithString:urlString];
self.debugBundleUrl = url;
NSDictionary *launchOptions = @{@"EnableTurbo": @(DEMO_ENABLE_TURBO), @"DebugMode": @(YES)};
HippyBridge *bridge = [[HippyBridge alloc] initWithDelegate:self
bundleURL:url
Expand All @@ -101,7 +107,7 @@ - (BOOL)shouldStartInspector:(HippyBridge *)bridge {
}

- (NSURL *)inspectorSourceURLForBridge:(HippyBridge *)bridge {
return bridge.bundleURL;
return self.debugBundleUrl;
}

#pragma mark - Hippy Bridge Delegate
Expand Down
15 changes: 10 additions & 5 deletions examples/ios-demo/HippyDemo/ViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@
*/

#import "ViewController.h"
#import "HippyRootView.h"
#import "HippyLog.h"
#import "HippyBundleURLProvider.h"
#import "DemoConfigs.h"
#import "HippyBridge.h"
#import <hippy/HippyBundleURLProvider.h>
#import <hippy/HippyRootView.h>
#import <hippy/HippyLog.h>
#import <hippy/HippyBridge.h>
#import <hippy/HippyAssert.h>
#import <sys/utsname.h>


Expand All @@ -38,6 +39,9 @@ @interface ViewController () <HippyBridgeDelegate, HippyMethodInterceptorProtoco
/// Hippy Root View
@property (nonatomic, strong) HippyRootView *hippyRootView;

/// The debug bundle URL
@property (nonatomic, strong) NSURL *debugBundleUrl;

@end

static NSString *formatLog(NSDate *timestamp, HippyLogLevel level, NSString *fileName, NSNumber *lineNumber, NSString *message) {
Expand Down Expand Up @@ -92,6 +96,7 @@ - (void)viewDidLoad {
NSDictionary *launchOptions = @{@"EnableTurbo": @(DEMO_ENABLE_TURBO), @"DebugMode": @(YES)};
NSString *bundleStr = [HippyBundleURLProvider sharedInstance].bundleURLString;
NSURL *bundleUrl = [NSURL URLWithString:bundleStr];
self.debugBundleUrl = bundleUrl;
HippyBridge *bridge = [[HippyBridge alloc] initWithDelegate:self
bundleURL:bundleUrl
moduleProvider:nil
Expand Down Expand Up @@ -171,7 +176,7 @@ - (BOOL)shouldStartInspector:(HippyBridge *)bridge {
}

- (NSURL *)inspectorSourceURLForBridge:(HippyBridge *)bridge {
return bridge.bundleURL;
return self.debugBundleUrl;
}


Expand Down
Loading