mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-22 15:19:27 +00:00
wired plugin repository download settings and fixed crash when initializing plugin host
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="MPPluginPreferencesController">
|
||||
<connections>
|
||||
<outlet property="addRemovePluginsControl" destination="B9Q-hq-K4N" id="Oqj-Ko-8UR"/>
|
||||
<outlet property="allowRemoteConnectionCheckButton" destination="K0z-aD-K2P" id="VDW-fd-evK"/>
|
||||
<outlet property="fallbackDescriptionTextField" destination="qPL-FR-ky7" id="xCb-ED-NIX"/>
|
||||
<outlet property="fallbackSettingsView" destination="wIk-iw-Tcz" id="dHl-zW-0aI"/>
|
||||
<outlet property="forceIncompatiblePluginsCheckButton" destination="XIl-03-JZP" id="Aj4-rc-Ao0"/>
|
||||
@@ -229,7 +230,7 @@
|
||||
<constraint firstItem="vBs-Ga-aq0" firstAttribute="leading" secondItem="fCk-fL-jU8" secondAttribute="trailing" constant="8" id="xNu-Sj-xQO"/>
|
||||
<constraint firstItem="aoG-FD-ds8" firstAttribute="top" secondItem="CqP-oK-S8k" secondAttribute="bottom" constant="8" symbolic="YES" id="zSW-h3-BrT"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="-111.5" y="71"/>
|
||||
<point key="canvasLocation" x="179" y="115"/>
|
||||
</customView>
|
||||
</objects>
|
||||
<resources>
|
||||
|
||||
@@ -42,6 +42,7 @@ typedef NS_ENUM(NSUInteger, MPPluginSegmentType) {
|
||||
|
||||
@interface MPPluginPreferencesController () <NSTableViewDataSource, NSTableViewDelegate>
|
||||
|
||||
@property (strong) IBOutlet NSButton *allowRemoteConnectionCheckButton;
|
||||
@property (strong) IBOutlet NSTableView *pluginTableView;
|
||||
@property (strong) IBOutlet NSView *settingsView;
|
||||
@property (strong) IBOutlet NSView *fallbackSettingsView;
|
||||
@@ -83,6 +84,10 @@ typedef NS_ENUM(NSUInteger, MPPluginSegmentType) {
|
||||
toObject:NSUserDefaultsController.sharedUserDefaultsController
|
||||
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyLoadIncompatiblePlugins]
|
||||
options:nil];
|
||||
[self.allowRemoteConnectionCheckButton bind:NSValueBinding
|
||||
toObject:NSUserDefaultsController.sharedUserDefaultsController
|
||||
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyAllowRemoteFetchOfPluginRepository]
|
||||
options:nil];
|
||||
[self.pluginTableView registerForDraggedTypes:@[(NSString *)kUTTypeFileURL]];
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ NSString *const MPPluginRepositoryDidUpdateAvailablePluginsNotification = @"com.
|
||||
if(self) {
|
||||
_isInitialized = NO;
|
||||
_lastDataFetchTime = NSDate.distantPast.timeIntervalSinceReferenceDate;
|
||||
[self _fetchRepositoryDataCompletionHandler:^(NSArray<MPPluginRepositoryItem *> * _Nonnull availablePlugins) {
|
||||
[self _fetchAppropriateRepositoryDataCompletionHandler:^(NSArray<MPPluginRepositoryItem *> * _Nonnull availablePlugins) {
|
||||
self.availablePlugins = availablePlugins;
|
||||
self.isInitialized = YES;
|
||||
}];
|
||||
@@ -69,7 +69,7 @@ NSString *const MPPluginRepositoryDidUpdateAvailablePluginsNotification = @"com.
|
||||
/* update cache on every read if it's older than 5 minutes */
|
||||
if((NSDate.timeIntervalSinceReferenceDate - self.lastDataFetchTime) > 60*5 ) {
|
||||
NSLog(@"%@: updating available plugins cache.", self.className);
|
||||
[self _fetchRepositoryDataCompletionHandler:^(NSArray<MPPluginRepositoryItem *> * _Nonnull availablePlugins) {
|
||||
[self _fetchAppropriateRepositoryDataCompletionHandler:^(NSArray<MPPluginRepositoryItem *> * _Nonnull availablePlugins) {
|
||||
self.availablePlugins = availablePlugins;
|
||||
}];
|
||||
}
|
||||
@@ -88,12 +88,18 @@ NSString *const MPPluginRepositoryDidUpdateAvailablePluginsNotification = @"com.
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_fetchAppropriateRepositoryDataCompletionHandler:(void (^)(NSArray<MPPluginRepositoryItem *> * _Nonnull))completionHandler {
|
||||
/* dispatch the call to allow for direct return and handle resutl later on */
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
BOOL allowRemoteConnection = [self _askForPluginRepositoryPermission];
|
||||
if(!allowRemoteConnection) {
|
||||
[self _fetchLocalFallbackRepositoryData:completionHandler];
|
||||
}
|
||||
[self _fetchRepositoryDataCompletionHandler:completionHandler];
|
||||
});
|
||||
}
|
||||
|
||||
- (void)_fetchRepositoryDataCompletionHandler:(void (^)(NSArray<MPPluginRepositoryItem *> * _Nonnull))completionHandler {
|
||||
BOOL allowRemoteConnection = [self _askForPluginRepositoryPermission];
|
||||
if(!allowRemoteConnection) {
|
||||
[self _fetchLocalFallbackRepositoryData:completionHandler];
|
||||
return;
|
||||
}
|
||||
NSString *urlString = NSBundle.mainBundle.infoDictionary[MPBundlePluginRepositoryURLKey];
|
||||
if(!urlString) {
|
||||
[self _fetchLocalFallbackRepositoryData:completionHandler];
|
||||
|
||||
@@ -37,6 +37,18 @@
|
||||
/* Action to add an entry via template */
|
||||
"ADD_TREMPLATE_ENTRY" = "Vorgabeeintrag erstellen";
|
||||
|
||||
/* Allow the download of the plugin repository file */
|
||||
"ALERT_ASK_FOR_PLUGIN_REPOSITORY_ALLOW_DOWNLOAD" = "Keine Daten herunterladen.";
|
||||
|
||||
/* Informative text displayed on the alert that shows up when MacPass asks for permssion to download the plugin repository JSON file */
|
||||
"ALERT_ASK_FOR_PLUGIN_REPOSITORY_CONNECTION_PERMISSION_INFORMATIVE_TEXT" = "Das Verzeichnis ist auf https://macpassapp.org hinterlegt. MacPass verbindet lädt die Defintionen herunter um sicher zu stellen, dass alle Daten auf dem neusten Stand sind.";
|
||||
|
||||
/* Message displayed on the alert that askf for permission to download the plugin repository JSON file */
|
||||
"ALERT_ASK_FOR_PLUGIN_REPOSITORY_CONNECTION_PERMISSION_MESSAGE" = "MacPass möchte das Pluginverzeichnis aktualisieren.";
|
||||
|
||||
/* Disallow the download of the plugin repository file */
|
||||
"ALERT_ASK_FOR_PLUGIN_REPOSITORY_DISALLOW_DOWNLOAD" = "Aktualisiere Daten online.";
|
||||
|
||||
/* Button in dialog to leave autotype disabled and continiue! */
|
||||
"ALERT_AUTOTYPE_MISSING_ACCESSIBILTY_PERMISSIONS_BUTTON_OK" = "Autotype deaktiviert lassen.";
|
||||
|
||||
|
||||
@@ -37,6 +37,18 @@
|
||||
/* Action to add an entry via template */
|
||||
"ADD_TREMPLATE_ENTRY" = "Create Template Entry";
|
||||
|
||||
/* Allow the download of the plugin repository file */
|
||||
"ALERT_ASK_FOR_PLUGIN_REPOSITORY_ALLOW_DOWNLOAD" = "Do not update defintions";
|
||||
|
||||
/* Informative text displayed on the alert that shows up when MacPass asks for permssion to download the plugin repository JSON file */
|
||||
"ALERT_ASK_FOR_PLUGIN_REPOSITORY_CONNECTION_PERMISSION_INFORMATIVE_TEXT" = "The plugin defintions are hosted online at https://macpassapp.org. MacPass would like to download those files to ensure the data is up to date.";
|
||||
|
||||
/* Message displayed on the alert that askf for permission to download the plugin repository JSON file */
|
||||
"ALERT_ASK_FOR_PLUGIN_REPOSITORY_CONNECTION_PERMISSION_MESSAGE" = "MacPass would like to check for updates of plugin defintions online";
|
||||
|
||||
/* Disallow the download of the plugin repository file */
|
||||
"ALERT_ASK_FOR_PLUGIN_REPOSITORY_DISALLOW_DOWNLOAD" = "Update definitions online";
|
||||
|
||||
/* Button in dialog to leave autotype disabled and continiue! */
|
||||
"ALERT_AUTOTYPE_MISSING_ACCESSIBILTY_PERMISSIONS_BUTTON_OK" = "Keep Autotype disabled.";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user