Skip to content

Commit

Permalink
feat: Install software from the Psion Software Index (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbmorley committed Sep 14, 2024
1 parent b7f44b2 commit 61a0fb8
Show file tree
Hide file tree
Showing 5 changed files with 470 additions and 2 deletions.
4 changes: 4 additions & 0 deletions OpoLua.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
D8D6701527A72B2100D12E96 /* DestinationPickerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D6701427A72B2100D12E96 /* DestinationPickerViewController.swift */; };
D8D95504279B52370049A3C3 /* Localization.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D95503279B52370049A3C3 /* Localization.swift */; };
D8D95506279B7B100049A3C3 /* UIColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8D95505279B7B100049A3C3 /* UIColor.swift */; };
D8DAD5B92C8CEF1D00CFEF4A /* Library.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8DAD5B82C8CEF1D00CFEF4A /* Library.swift */; };
D8DCD03E277AC9B300760302 /* WindowServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8DCD03D277AC9B300760302 /* WindowServer.swift */; };
D8DCD040277ACD7800760302 /* CanvasSprite.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8DCD03F277ACD7800760302 /* CanvasSprite.swift */; };
D8EB6FFA275995DB00FC139F /* Dictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8EB6FF9275995DB00FC139F /* Dictionary.swift */; };
Expand Down Expand Up @@ -223,6 +224,7 @@
D8D6701427A72B2100D12E96 /* DestinationPickerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DestinationPickerViewController.swift; sourceTree = "<group>"; };
D8D95503279B52370049A3C3 /* Localization.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Localization.swift; sourceTree = "<group>"; };
D8D95505279B7B100049A3C3 /* UIColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIColor.swift; sourceTree = "<group>"; };
D8DAD5B82C8CEF1D00CFEF4A /* Library.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Library.swift; sourceTree = "<group>"; };
D8DCD03D277AC9B300760302 /* WindowServer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowServer.swift; sourceTree = "<group>"; };
D8DCD03F277ACD7800760302 /* CanvasSprite.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CanvasSprite.swift; sourceTree = "<group>"; };
D8EB6FF9275995DB00FC139F /* Dictionary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Dictionary.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -353,6 +355,7 @@
DB6B438327A55D1200625788 /* RootView.swift */,
D8553767278F535A00ED67C0 /* SettingsView.swift */,
D85F597027ACB682006AAF3B /* WizardFooterView.swift */,
D8DAD5B82C8CEF1D00CFEF4A /* Library.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -599,6 +602,7 @@
D80D65A8279DD2060020F994 /* Icon.swift in Sources */,
D8FE60052757177200711717 /* Settings.swift in Sources */,
D8C409632C3CF62900C9E857 /* OpoIoHandler_UIKit.swift in Sources */,
D8DAD5B92C8CEF1D00CFEF4A /* Library.swift in Sources */,
D81B875E2790DAAD00E71960 /* InstallerViewController.swift in Sources */,
D8DCD040277ACD7800760302 /* CanvasSprite.swift in Sources */,
D86724F22771672A009C7246 /* InterpreterThread.swift in Sources */,
Expand Down
29 changes: 29 additions & 0 deletions OpoLua/View Controllers/AllProgramsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ class AllProgramsViewController : UICollectionViewController {
return true
}

private lazy var addBarButtonItem: UIBarButtonItem = {
let barButtonItem = UIBarButtonItem(image: UIImage(systemName: "plus"),
style: .plain,
target: self,
action: #selector(addTapped(sender:)))
return barButtonItem
}()

lazy var wallpaperPixelView: PixelView = {
let image = settings.theme.wallpaper
let pixelView = PixelView(image: image)
Expand Down Expand Up @@ -91,6 +99,7 @@ class AllProgramsViewController : UICollectionViewController {
collectionView.backgroundView = wallpaperView
collectionView.dataSource = dataSource
title = "All Programs"
navigationItem.rightBarButtonItem = addBarButtonItem
navigationItem.largeTitleDisplayMode = .never
configureRefreshControl()
}
Expand Down Expand Up @@ -145,6 +154,12 @@ class AllProgramsViewController : UICollectionViewController {
updateWallpaper()
}

@objc func addTapped(sender: UIBarButtonItem) {
let softwareIndexViewController = SoftwareIndexViewController()
softwareIndexViewController.delegate = self
present(softwareIndexViewController, animated: true)
}

@objc func refreshControlDidChange(_ sender: UIRefreshControl) {
detector.update()
AppDelegate.shared.downloader.update()
Expand Down Expand Up @@ -276,3 +291,17 @@ extension AllProgramsViewController: ProgramDetectorDelegate {
}

}

extension AllProgramsViewController: SoftwareIndexViewControllerDelegate {

func softwareIndexViewCntrollerDidCancel(softwareIndexViewController: SoftwareIndexViewController) {
softwareIndexViewController.dismiss(animated: true)
}

func softwareIndexViewCntroller(softwareIndexViewCntroller: SoftwareIndexViewController, didSelectURL url: URL) {
softwareIndexViewCntroller.dismiss(animated: true) {
AppDelegate.shared.install(url: url)
}
}

}
1 change: 0 additions & 1 deletion OpoLua/View Controllers/LibraryViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ class LibraryViewController: UICollectionViewController {
present(documentPicker, animated: true)
}


func addUrl(_ url: URL) {
dispatchPrecondition(condition: .onQueue(.main))

Expand Down
Loading

0 comments on commit 61a0fb8

Please sign in to comment.