Skip to content

Commit e4cac5a

Browse files
committed
Support code injection !m!
1 parent 2da6a93 commit e4cac5a

File tree

5 files changed

+41
-8
lines changed

5 files changed

+41
-8
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,6 @@ fastlane/report.xml
4141
fastlane/Preview.html
4242

4343
Artsy/View_Controllers/App_Navigation/ARTopMenuViewController+DeveloperExtras.m
44-
Artsy/Eigen.playground/
44+
Artsy/Eigen.playground/
45+
46+
iOSInjectionProject/

Artsy/View_Controllers/App_Navigation/ARTopMenuViewController+DeveloperExtras.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
@interface ARTopMenuViewController (DeveloperExtras)
55

66
- (void)runDeveloperExtras;
7+
- (void)appHasBeenInjected:(NSNotification *)notification;
78

89
@end

Artsy/View_Controllers/App_Navigation/ARTopMenuViewController+DeveloperExtras.m

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,41 @@
11
#import "ARTopMenuViewController+DeveloperExtras.h"
2+
#import "Artsy-Swift.h"
23

3-
// You can tell git to ignore changes to this file by running
4-
//
5-
// git update-index --assume-unchanged Artsy/View_Controllers/App_Navigation/ARTopMenuViewController+DeveloperExtras.m
4+
// This file is for running developer specific code, either when
5+
// the app is loaded, or when you have injected fresh code in via
6+
// InjectionForXcode (which you can install via Alcatraz.)
7+
8+
// See: https://github.com/artsy/eigen/pull/1236
9+
10+
// It is put in gitignore as the current state of what you see now,
11+
// any changes you make will be erased when you switch branches.
612

713

814
@implementation ARTopMenuViewController (DeveloperExtras)
915

10-
// Use this function to run code once the app is loaded, useful for pushing a
11-
// specific VC etc.
16+
// Called when the app has been re-injected with some code,
17+
// the default here will pop the top view controller and
18+
// re-run the developerExtras
19+
20+
- (void)appHasBeenInjected:(NSNotification *)notification
21+
{
22+
[self.rootNavigationController popViewControllerAnimated:NO];
23+
[self runDeveloperExtras];
24+
}
25+
26+
// Use this to create a new ViewController and push it on to the stack
27+
//
28+
// @example
29+
//
30+
// id viewController = [[LiveAuctionViewController alloc] init];
31+
// [self pushViewController:viewController animated:YES];
32+
//
33+
// @example
34+
//
35+
// NSString *path = @"/artwork/helidon-xhixha-energia-delle-forme";
36+
// id viewController = [[ARSwitchBoard sharedInstance] loadPath:path];
37+
// [self pushViewController:viewController animated:YES];
38+
//
1239

1340
- (void)runDeveloperExtras
1441
{

Artsy/View_Controllers/App_Navigation/ARTopMenuViewController.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,8 @@ - (void)viewDidAppear:(BOOL)animated
318318
if ([ARAppStatus isRunningTests] == NO) {
319319
static dispatch_once_t onceToken;
320320
dispatch_once(&onceToken, ^{
321+
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appHasBeenInjected:) name:@"INJECTION_BUNDLE_NOTIFICATION" object:nil];
322+
321323
[self runDeveloperExtras];
322324
});
323325
}

CHANGELOG.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ upcoming:
99
- Added a switch between native and martsy works for you view - maxim
1010
- Made the searchbar larger in fair views on iPhone - maxim
1111
- Additional work on the auction title view - ash
12-
- Quicksilver is now accessible to non-Eigen devs - orta
12+
- Quicksilver is now accessible to non-Eigen devs - orta
1313
- Removes rotation support on refine auction listings view for iPhone - ash
1414
- Developers can choose to have a custom url for their staging environment - orta
1515
- Initial work on the Live Auctions view controller - orta
1616
- AuctionVC supports before state - orta
1717
- Initial working structure for Live Auctions with stubbed data - orta
1818
- Shows a lot of the main views on Live Auctions - orta
19-
19+
- AMAZING - Added support for dynamic code-injection - orta
20+
2021
notes:
2122
- Support breaking out of the router sandboxing when there's a link with ?eigen_escape_sandbox' - orta
2223
- Users may now refine sale artworks on native auction view by their low estimates - ash

0 commit comments

Comments
 (0)