Skip to content

Commit 585da81

Browse files
Add option to appbox as default app for iap file
1 parent fe4e808 commit 585da81

8 files changed

Lines changed: 248 additions & 100 deletions

File tree

AppBox.xcodeproj/project.pbxproj

Lines changed: 51 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,14 @@
1515
5D20E6B57EA90CA7D6EA21F7 /* IPAUploadInfoTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E65C0AF09D32F39F4259167 /* IPAUploadInfoTests.m */; };
1616
6968AADC9DEB5554A06F19BD /* CocoaLumberjack in Frameworks */ = {isa = PBXBuildFile; productRef = 33146DD70AA7C380685E53AA /* CocoaLumberjack */; };
1717
771E1F8D4D831C50C1178A75 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 09E11F809EFA1C7844F25D6B /* Cocoa.framework */; };
18+
AA11BB22CC33DD44EE550011 /* NetworkHandlerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550001 /* NetworkHandlerTests.m */; };
19+
AA11BB22CC33DD44EE550012 /* MobileProvisionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550002 /* MobileProvisionTests.m */; };
20+
AA11BB22CC33DD44EE550013 /* KeychainHandlerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550003 /* KeychainHandlerTests.m */; };
21+
AA11BB22CC33DD44EE550014 /* UserDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550004 /* UserDataTests.m */; };
22+
AA11BB22CC33DD44EE550015 /* MailHandlerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550005 /* MailHandlerTests.m */; };
23+
AA11BB22CC33DD44EE550016 /* UpdateHandlerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550006 /* UpdateHandlerTests.m */; };
1824
AC4CF046F7F2B76CF56BF8E4 /* ObjectiveDropboxOfficial.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 656E98171CB7E85AA663AFE8 /* ObjectiveDropboxOfficial.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
25+
B472C718BB3B23CCB6C65599 /* DefaultAppHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = AE09E956E87164818B25F099 /* DefaultAppHandler.m */; };
1926
D9E5B24A6827FC5AD68D29D0 /* CommonTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 544B2D28AEC66102492FA05E /* CommonTests.m */; };
2027
DB04358B2E69628F005F0173 /* appboxcli in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB0435832E696255005F0173 /* appboxcli */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
2128
DB0435912E6962EA005F0173 /* CLISupportHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = DB0435902E6962EA005F0173 /* CLISupportHelper.m */; };
@@ -95,12 +102,6 @@
95102
E1D12EEE1EC320760065E59A /* HelpPreferencesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E1D12EED1EC320760065E59A /* HelpPreferencesViewController.xib */; };
96103
E1DC26001ECDBCA8001EF106 /* MBProgressHUD+ProgressHud.m in Sources */ = {isa = PBXBuildFile; fileRef = E1DC25FF1ECDBCA8001EF106 /* MBProgressHUD+ProgressHud.m */; };
97104
F6AEC01BE879A2BB998E829D /* ZipArchive in Frameworks */ = {isa = PBXBuildFile; productRef = EFE5EA7464F3539F2562A787 /* ZipArchive */; };
98-
AA11BB22CC33DD44EE550011 /* NetworkHandlerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550001 /* NetworkHandlerTests.m */; };
99-
AA11BB22CC33DD44EE550012 /* MobileProvisionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550002 /* MobileProvisionTests.m */; };
100-
AA11BB22CC33DD44EE550013 /* KeychainHandlerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550003 /* KeychainHandlerTests.m */; };
101-
AA11BB22CC33DD44EE550014 /* UserDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550004 /* UserDataTests.m */; };
102-
AA11BB22CC33DD44EE550015 /* MailHandlerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550005 /* MailHandlerTests.m */; };
103-
AA11BB22CC33DD44EE550016 /* UpdateHandlerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = AA11BB22CC33DD44EE550006 /* UpdateHandlerTests.m */; };
104105
/* End PBXBuildFile section */
105106

106107
/* Begin PBXContainerItemProxy section */
@@ -148,6 +149,7 @@
148149
/* End PBXCopyFilesBuildPhase section */
149150

150151
/* Begin PBXFileReference section */
152+
07AC024B5902E74BBBD280F9 /* DefaultAppHandler.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = DefaultAppHandler.h; sourceTree = "<group>"; };
151153
09E11F809EFA1C7844F25D6B /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; };
152154
3E65C0AF09D32F39F4259167 /* IPAUploadInfoTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = IPAUploadInfoTests.m; path = Model/IPAUploadInfoTests.m; sourceTree = "<group>"; };
153155
4410D18C26FF76A20046E5F9 /* DBAccountManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DBAccountManager.h; sourceTree = "<group>"; };
@@ -160,6 +162,13 @@
160162
44DCC66B25EEA1910074AB1E /* AppBox4.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = AppBox4.xcdatamodel; sourceTree = "<group>"; };
161163
544B2D28AEC66102492FA05E /* CommonTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = CommonTests.m; path = Common/CommonTests.m; sourceTree = "<group>"; };
162164
656E98171CB7E85AA663AFE8 /* ObjectiveDropboxOfficial.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = ObjectiveDropboxOfficial.xcframework; path = Frameworks/ObjectiveDropboxOfficial.xcframework; sourceTree = "<group>"; };
165+
AA11BB22CC33DD44EE550001 /* NetworkHandlerTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = NetworkHandlerTests.m; path = Common/NetworkHandler/NetworkHandlerTests.m; sourceTree = "<group>"; };
166+
AA11BB22CC33DD44EE550002 /* MobileProvisionTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MobileProvisionTests.m; path = Common/MobileProvision/MobileProvisionTests.m; sourceTree = "<group>"; };
167+
AA11BB22CC33DD44EE550003 /* KeychainHandlerTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = KeychainHandlerTests.m; path = Common/KeychainHandler/KeychainHandlerTests.m; sourceTree = "<group>"; };
168+
AA11BB22CC33DD44EE550004 /* UserDataTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = UserDataTests.m; path = Common/UserManager/UserDataTests.m; sourceTree = "<group>"; };
169+
AA11BB22CC33DD44EE550005 /* MailHandlerTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MailHandlerTests.m; path = Common/MailHandler/MailHandlerTests.m; sourceTree = "<group>"; };
170+
AA11BB22CC33DD44EE550006 /* UpdateHandlerTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = UpdateHandlerTests.m; path = Common/UpdateHandler/UpdateHandlerTests.m; sourceTree = "<group>"; };
171+
AE09E956E87164818B25F099 /* DefaultAppHandler.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = DefaultAppHandler.m; sourceTree = "<group>"; };
163172
DB0435832E696255005F0173 /* appboxcli */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = appboxcli; sourceTree = BUILT_PRODUCTS_DIR; };
164173
DB04358F2E6962EA005F0173 /* CLISupportHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CLISupportHelper.h; sourceTree = "<group>"; };
165174
DB0435902E6962EA005F0173 /* CLISupportHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CLISupportHelper.m; sourceTree = "<group>"; };
@@ -298,12 +307,6 @@
298307
E1DC25FE1ECDBCA8001EF106 /* MBProgressHUD+ProgressHud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MBProgressHUD+ProgressHud.h"; sourceTree = "<group>"; };
299308
E1DC25FF1ECDBCA8001EF106 /* MBProgressHUD+ProgressHud.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "MBProgressHUD+ProgressHud.m"; sourceTree = "<group>"; };
300309
E1FECA821E83EE5000C4E9AE /* HTTPStatusCode.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HTTPStatusCode.h; sourceTree = "<group>"; };
301-
AA11BB22CC33DD44EE550001 /* NetworkHandlerTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = NetworkHandlerTests.m; path = Common/NetworkHandler/NetworkHandlerTests.m; sourceTree = "<group>"; };
302-
AA11BB22CC33DD44EE550002 /* MobileProvisionTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MobileProvisionTests.m; path = Common/MobileProvision/MobileProvisionTests.m; sourceTree = "<group>"; };
303-
AA11BB22CC33DD44EE550003 /* KeychainHandlerTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = KeychainHandlerTests.m; path = Common/KeychainHandler/KeychainHandlerTests.m; sourceTree = "<group>"; };
304-
AA11BB22CC33DD44EE550004 /* UserDataTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = UserDataTests.m; path = Common/UserManager/UserDataTests.m; sourceTree = "<group>"; };
305-
AA11BB22CC33DD44EE550005 /* MailHandlerTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = MailHandlerTests.m; path = Common/MailHandler/MailHandlerTests.m; sourceTree = "<group>"; };
306-
AA11BB22CC33DD44EE550006 /* UpdateHandlerTests.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = UpdateHandlerTests.m; path = Common/UpdateHandler/UpdateHandlerTests.m; sourceTree = "<group>"; };
307310
/* End PBXFileReference section */
308311

309312
/* Begin PBXFileSystemSynchronizedGroupBuildPhaseMembershipExceptionSet section */
@@ -365,6 +368,15 @@
365368
/* End PBXFrameworksBuildPhase section */
366369

367370
/* Begin PBXGroup section */
371+
704A0BB2FE5A7E33851F5FDB /* DefaultAppHandler */ = {
372+
isa = PBXGroup;
373+
children = (
374+
07AC024B5902E74BBBD280F9 /* DefaultAppHandler.h */,
375+
AE09E956E87164818B25F099 /* DefaultAppHandler.m */,
376+
);
377+
path = DefaultAppHandler;
378+
sourceTree = "<group>";
379+
};
368380
9BB2CCACA72911C65FE295AF /* OS X */ = {
369381
isa = PBXGroup;
370382
children = (
@@ -373,6 +385,20 @@
373385
name = "OS X";
374386
sourceTree = "<group>";
375387
};
388+
AA11BB22CC33DD44EE550021 /* Common */ = {
389+
isa = PBXGroup;
390+
children = (
391+
544B2D28AEC66102492FA05E /* CommonTests.m */,
392+
AA11BB22CC33DD44EE550022 /* NetworkHandler */,
393+
AA11BB22CC33DD44EE550023 /* MobileProvision */,
394+
AA11BB22CC33DD44EE550024 /* KeychainHandler */,
395+
AA11BB22CC33DD44EE550025 /* UserManager */,
396+
AA11BB22CC33DD44EE550027 /* MailHandler */,
397+
AA11BB22CC33DD44EE550028 /* UpdateHandler */,
398+
);
399+
name = Common;
400+
sourceTree = "<group>";
401+
};
376402
AA11BB22CC33DD44EE550022 /* NetworkHandler */ = {
377403
isa = PBXGroup;
378404
children = (
@@ -405,6 +431,14 @@
405431
name = UserManager;
406432
sourceTree = "<group>";
407433
};
434+
AA11BB22CC33DD44EE550026 /* Model */ = {
435+
isa = PBXGroup;
436+
children = (
437+
3E65C0AF09D32F39F4259167 /* IPAUploadInfoTests.m */,
438+
);
439+
name = Model;
440+
sourceTree = "<group>";
441+
};
408442
AA11BB22CC33DD44EE550027 /* MailHandler */ = {
409443
isa = PBXGroup;
410444
children = (
@@ -421,28 +455,6 @@
421455
name = UpdateHandler;
422456
sourceTree = "<group>";
423457
};
424-
AA11BB22CC33DD44EE550021 /* Common */ = {
425-
isa = PBXGroup;
426-
children = (
427-
544B2D28AEC66102492FA05E /* CommonTests.m */,
428-
AA11BB22CC33DD44EE550022 /* NetworkHandler */,
429-
AA11BB22CC33DD44EE550023 /* MobileProvision */,
430-
AA11BB22CC33DD44EE550024 /* KeychainHandler */,
431-
AA11BB22CC33DD44EE550025 /* UserManager */,
432-
AA11BB22CC33DD44EE550027 /* MailHandler */,
433-
AA11BB22CC33DD44EE550028 /* UpdateHandler */,
434-
);
435-
name = Common;
436-
sourceTree = "<group>";
437-
};
438-
AA11BB22CC33DD44EE550026 /* Model */ = {
439-
isa = PBXGroup;
440-
children = (
441-
3E65C0AF09D32F39F4259167 /* IPAUploadInfoTests.m */,
442-
);
443-
name = Model;
444-
sourceTree = "<group>";
445-
};
446458
AECBA8D5D0C166DA17FF6ED0 /* AppBoxTests */ = {
447459
isa = PBXGroup;
448460
children = (
@@ -963,11 +975,13 @@
963975
E1CFC65B1D7E7FD9005872BE /* Common */ = {
964976
isa = PBXGroup;
965977
children = (
978+
E13161EF1E97775100586052 /* CLIIPAUpload */,
966979
DB04358E2E6962DB005F0173 /* CLISupportHelper */,
980+
DB2629821F961F3100C4C647 /* DBErrorHandler */,
981+
704A0BB2FE5A7E33851F5FDB /* DefaultAppHandler */,
982+
DB425C021F8A514E008CB032 /* DefaultSettings */,
967983
E1902B611E1662E300C3E0F6 /* KeychainHandler */,
968984
E11633961E558609005EAB31 /* MobileProvision */,
969-
E13161EF1E97775100586052 /* CLIIPAUpload */,
970-
DB2629821F961F3100C4C647 /* DBErrorHandler */,
971985
DBDCFBBB1F99C7860022097B /* UploadManager */,
972986
E1902B4C1E16617B00C3E0F6 /* NetworkHandler */,
973987
E19473FC205FD3B700CF12F9 /* UISubClasses */,
@@ -977,7 +991,6 @@
977991
E1902B4B1E16617B00C3E0F6 /* MailHandler */,
978992
E1DC25FA1ECDBC16001EF106 /* ProgressHUD */,
979993
E1902B4F1E16617B00C3E0F6 /* UpdateHandler */,
980-
DB425C021F8A514E008CB032 /* DefaultSettings */,
981994
E1DC25F91ECD826C001EF106 /* OtherServicesKeys.h */,
982995
E16018F11DEC0EB700E3A377 /* Constants.h */,
983996
E1CFC65C1D7E7FEA005872BE /* Common.h */,
@@ -1240,6 +1253,7 @@
12401253
E18186E21E8A47D60002509F /* HelpPreferencesViewController.m in Sources */,
12411254
E18186CE1E8A3BC00002509F /* PreferencesTabViewController.m in Sources */,
12421255
E16BB8C9202873FA002E9B5A /* AccountCellView.m in Sources */,
1256+
B472C718BB3B23CCB6C65599 /* DefaultAppHandler.m in Sources */,
12431257
);
12441258
runOnlyForDeploymentPostprocessing = 0;
12451259
};

AppBox/AppBoxPrefixHeader.pch

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
#import "NetworkHandler.h"
3535
#import "KeychainHandler.h"
3636
#import "CLISupportHelper.h"
37+
#import "DefaultAppHandler.h"
3738
#import "NSApplication+MenuHandler.h"
3839

3940
#import "NSURL+URL.h"

AppBox/AppDelegate.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636

3737
+(AppDelegate *)appDelegate;
3838
+(void)terminateWithExitCode:(NSInteger)code;
39-
+(BOOL)isDefaultIPAHandler;
40-
+(BOOL)setAsDefaultIPAHandler;
41-
+(void)removeAsDefaultIPAHandler;
4239
-(void)openLatestLogFile;
4340
-(void)openFileWithPath:(NSString *)filePath;
4441

AppBox/AppDelegate.m

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -131,32 +131,6 @@ -(void)openFileWithPath:(NSString *)filePath{
131131
}
132132
}
133133

134-
//MARK: - Default Application
135-
+(BOOL)isDefaultIPAHandler {
136-
NSString *bundleId = [[NSBundle mainBundle] bundleIdentifier];
137-
CFStringRef defaultHandler = LSCopyDefaultRoleHandlerForContentType(CFSTR("com.apple.itunes.ipa"), kLSRolesAll);
138-
if (defaultHandler == NULL) return NO;
139-
BOOL isDefault = [(__bridge_transfer NSString *)defaultHandler isEqualToString:bundleId];
140-
return isDefault;
141-
}
142-
143-
+(BOOL)setAsDefaultIPAHandler {
144-
NSString *bundleId = [[NSBundle mainBundle] bundleIdentifier];
145-
OSStatus status = LSSetDefaultRoleHandlerForContentType(CFSTR("com.apple.itunes.ipa"), kLSRolesAll, (__bridge CFStringRef)bundleId);
146-
if (status != noErr) {
147-
DDLogError(@"Failed to set AppBox as default IPA handler (error %d).", (int)status);
148-
return NO;
149-
}
150-
DDLogInfo(@"AppBox set as default application for .ipa files.");
151-
return YES;
152-
}
153-
154-
+(void)removeAsDefaultIPAHandler {
155-
// Reset to system default by setting handler to empty — this effectively removes our claim
156-
LSSetDefaultRoleHandlerForContentType(CFSTR("com.apple.itunes.ipa"), kLSRolesAll, CFSTR(""));
157-
DDLogInfo(@"AppBox removed as default application for .ipa files.");
158-
}
159-
160134
//MARK: - AppDelegate Helper
161135

162136
+(AppDelegate *)appDelegate{
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//
2+
// DefaultAppHandler.h
3+
// AppBox
4+
//
5+
// Created by Vineet Choudhary on 07/06/26.
6+
// Copyright © 2026 Developer Insider. All rights reserved.
7+
//
8+
9+
#import <Foundation/Foundation.h>
10+
11+
extern NSNotificationName const ABDefaultIPAHandlerDidChangeNotification;
12+
13+
@interface DefaultAppHandler : NSObject
14+
15+
+ (BOOL)isDefaultIPAHandler;
16+
+ (void)setAsDefaultIPAHandler;
17+
+ (void)removeAsDefaultIPAHandler;
18+
19+
@end

0 commit comments

Comments
 (0)