Unverified Commit e56435e8 authored by jayd1860's avatar jayd1860 Committed by GitHub
Browse files

Remove config parameter "Last Checked For Update" from AppSettings.cfg and fix ishandles (#39)

* v1.29.10

-- Fix error when launching StimEditGUI because ishandles does not handle 'function_handle' type.

* v1.29.11

-- Remove config parameter "Last Checked For Update" from AppSettings.cfg. It should not be a user configurable param but simply a saved control file NOT under version control
parent bc1b3e8f
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -14,9 +14,6 @@ SNIRF
% Logging
On

% Last Checked For Update
25-Jan-2021 16:34:45

% Check For Updates
on

+9 −0
Original line number Diff line number Diff line
function dt = GetLastCheckForUpdates()
if ~ispathvalid([getAppDir, 'LastCheckForUpdates.dat'])
    dt = datetime - duration(200,0,0);
else
    fd = fopen([getAppDir, 'LastCheckForUpdates.dat'],'rt');
    dt = fgetl(fd);
    fclose(fd);
end
+11 −0
Original line number Diff line number Diff line
function SetLastCheckForUpdates(dt)
if ~exist('dt','var') && ispathvalid([getAppDir, 'LastCheckForUpdates.dat'])
    return;
end
if ~exist('dt','var')
    dt = datetime;
end
fd = fopen([getAppDir, 'LastCheckForUpdates.dat'],'wt');
fprintf(fd, '%s\n', dt);
fclose(fd);
+72 −78
Original line number Diff line number Diff line
@@ -6,19 +6,15 @@ function checkForHomerUpdates()
if (strcmp(cfg.GetValue('Check For Updates'),'on'))
    
    % If it has been a week since Homer checked for an update
         if (datetime - cfg.GetValue('Last Checked For Update') > duration(168,0,0))

    if (datetime - GetLastCheckForUpdates() > duration(168,0,0))        
        url = 'https://openfnirs.org/software/homer/homer3/';        
            promptFlag = false;

        [s,status] = urlread(url,'timeout',4);
        if (~status)
            % App is offline or server could not be reached
            fprintf('Server could not be reached to check for updates.')
            return
        end        

            cfg.SetValue('Last Checked For Update', datetime);
        SetLastCheckForUpdates(datetime);
        
        % Open a hidden web browser
        wb = com.mathworks.mde.webbrowser.WebBrowser.createBrowser;
@@ -55,17 +51,15 @@ function checkForHomerUpdates()
        
        pause(1);  % To ensure <script> is run
        close(wb);
            cfg.Save();
        
    end
    
end
    
cfg.Close();

end


% ------------------------------------------------------------------------------
function v1_greater = compareVernum(v1, v2)
v1_greater = false;
for i = 1:max([length(v1), length(v2)])
@@ -90,4 +84,4 @@ function v1_greater = compareVernum(v1, v2)
        return
    end
end
end
+1 −1
Original line number Diff line number Diff line
@@ -2,5 +2,5 @@ function vrnnum = getVernum()

vrnnum{1} = '1';   % Major version #
vrnnum{2} = '29';  % Major sub-version #
vrnnum{3} = '9';   % Minor version #
vrnnum{3} = '11';   % Minor version #
vrnnum{4} = '0';   % Minor sub-version # or patch #: 'p1', 'p2', etc
Loading