Checking the code in helper app and main app. The code is almost identical:
Helper app with a timer that runs every hour:
'do an update check if a week has passed since the last check
dim lastCheckDate as Date = getPrefDateFromMain(“Updates_LastCheck”, getApplicationBundleID)
if GetPrefBooleanFromMain(“Updates_CheckWeekly”, getApplicationBundleID) and not getMainProcess then
dim CheckDate as new Date
if (lastCheckDate = nil or CheckDate.TotalSeconds - lastCheckDate.TotalSeconds > 60 * 60* 24 * 7) then
dim AppName as String = Replace(app.ApplicationNameMBS, “.debug”, “”)
AppName = NthField(AppName, “.”, 1)
AppName = Trim(AppName)
dim theChecker as new KajuUpdateChecker(SpecialFolder.ApplicationData.Child(AppName), true)
theChecker.ServerPublicRSAKey = globals.RSA
theChecker.UpdateURL = globals.UpdateURL
theChecker.Execute
SetPrefDateToMain("Updates_LastCheck", CheckDate, getApplicationBundleID)
end if
end if
And main app:
'do an update check if a week has passed since the last check
if kMaxVersion = Globals.Version.Lite then Return
dim lastCheckDate as Date = Globals.thePrefs.GetPrefDate(“Updates_LastCheck”)
if Globals.thePrefs.GetPrefBoolean(“Updates_CheckWeekly”) then
dim CheckDate as new Date
if (lastCheckDate = nil or CheckDate.TotalSeconds - lastCheckDate.TotalSeconds > 60 * 60* 24 * 7) and not isArchiving then
dim AppName as String = Replace(app.ApplicationNameMBS, ".debug", "")
AppName = AppName.NthField(".", 1)
AppName = AppName.Trim
dim theChecker as new KajuUpdateChecker(SpecialFolder.ApplicationData.Child(AppName), true)
theChecker.ServerPublicRSAKey = globals.RSA
theChecker.UpdateURL = globals.UpdateURL
theChecker.ExecuteAsync
Globals.thePrefs.SetPrefDate("Updates_LastCheck", CheckDate)
end if
end if
Why do I have KajuUpdateChecker as local variable and not as property of App?