Xojo Conferences

Platforms to show: All Mac Windows Linux Cross-Platform

Required plugins for this example: MBS MacBase Plugin, MBS MacExtras Plugin, MBS Main Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacExtras/Sparkle/TestApp
This example is the version from Thu, 6th Apr 2016.
Project "TestApp.rbp"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
EventHandler Sub Open() // please build this app and patch it so it has the framework inside dim f as FolderItem #if DebugBuild then #if Target64Bit then f = FindFile("Sparkle 64-bit").Child("Sparkle.framework") #elseif Target32Bit then f = FindFile("Sparkle 32-bit").Child("Sparkle.framework") #endif #else dim AppFile as FolderItem = app.ExecutableFile dim MacOSFolder as FolderItem = AppFile.parent dim ContentsFolder as FolderItem = MacOSFolder.parent dim FrameworksFolder as FolderItem = ContentsFolder.Child("Frameworks") f = FrameworksFolder.Child("Sparkle.framework") #endif if not SUUpdaterMBS.LoadFramework(f) then break MsgBox "Failed to load Sparkle framework" quit end if u=new MySUUpdater dim d as date dim lines(-1) as string lines.Append "Sparkle Status:" lines.Append "" dim b as NSBundleMBS = u.hostBundle if b = nil then lines.Append "HostBundle: ?" else lines.Append "HostBundle: "+b.bundlePath end if try lines.Append "FeedURL: "+u.feedURL catch n as NSExceptionMBS lines.Append "FeedURL: ?" end try d=u.lastUpdateCheckDate if d=nil then lines.Append "lastUpdateCheckDate: ?" else lines.Append "lastUpdateCheckDate: "+d.LongDate+" "+d.LongTime end if // shows information MsgBox Join(lines,EndOfLine) u.checkForUpdates exception e as NSExceptionMBS MsgBox e.message End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
Property Private u As mysuUpdater
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
Class MySUUpdater Inherits SUUpdaterMBS
EventHandler Sub didAbortWithError(error as NSErrorMBS) System.DebugLog CurrentMethodName System.DebugLog "Errorcode: "+str(error.Code) System.DebugLog "LocalizedDescription: "+error.LocalizedDescription System.DebugLog "LocalizedFailureReason: "+error.LocalizedFailureReason System.DebugLog "LocalizedRecoverySuggestion: "+error.LocalizedRecoverySuggestion End EventHandler
EventHandler Sub didFindValidUpdate(update as SUAppcastItemMBS) log "didFindValidUpdate" log "Title: "+update.title log "Version: "+update.displayVersionString log "DSASignature: "+update.DSASignature End EventHandler
EventHandler Sub didFinishLoadingAppcast(update as SUAppcastMBS) log "didFinishLoadingAppcast" 'MsgBox update.incrementalData End EventHandler
EventHandler Sub updaterDidNotFindUpdate() log "updaterDidNotFindUpdate" End EventHandler
EventHandler Sub willInstallUpdate(update as SUAppcastItemMBS) log "willInstallUpdate" End EventHandler
Private Sub log(s as string) System.DebugLog s window1.List.AddRow s End Sub
End Class
End Project

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS MacExtras Plugin.

MBS Xojo blog