Skip to content

Commit

Permalink
feat(Mobile): iOS application in progress...
Browse files Browse the repository at this point in the history
macmade committed Dec 8, 2024
1 parent b1d79e7 commit 750de4f
Showing 26 changed files with 832 additions and 37 deletions.
65 changes: 65 additions & 0 deletions SDO-Mobile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -7,13 +7,30 @@
objects = {

/* Begin PBXBuildFile section */
052DCA792D060135003F7891 /* ImageInfoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 052DCA782D060132003F7891 /* ImageInfoView.swift */; };
052DCA7B2D0603A7003F7891 /* ImageInfoDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 052DCA7A2D0603A5003F7891 /* ImageInfoDetailView.swift */; };
05957BDF2D060BD200E021AA /* VideoView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05957BDE2D060BCF00E021AA /* VideoView.swift */; };
05CE14112D05D30300C757FD /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 05CE140B2D05D30300C757FD /* Preview Assets.xcassets */; };
05CE14122D05D30300C757FD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 05CE140D2D05D30300C757FD /* Assets.xcassets */; };
05CE14132D05D30300C757FD /* ContentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CE140E2D05D30300C757FD /* ContentView.swift */; };
05CE14142D05D30300C757FD /* SDOApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CE140F2D05D30300C757FD /* SDOApp.swift */; };
05CE14722D05DADA00C757FD /* ImageInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CE146E2D05DADA00C757FD /* ImageInfo.swift */; };
05CE14732D05DADA00C757FD /* RuntimeError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CE146F2D05DADA00C757FD /* RuntimeError.swift */; };
05CE14742D05DADA00C757FD /* SDO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CE14702D05DADA00C757FD /* SDO.swift */; };
05CE14762D05DE6F00C757FD /* ImageData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CE14752D05DE6F00C757FD /* ImageData.swift */; };
05CE14782D05E14300C757FD /* ImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CE14772D05E14100C757FD /* ImageView.swift */; };
05CE147A2D05E22200C757FD /* ImageListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CE14792D05E21D00C757FD /* ImageListView.swift */; };
05CE147C2D05E31F00C757FD /* LoadingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CE147B2D05E31900C757FD /* LoadingView.swift */; };
05CE147F2D05E66000C757FD /* PreviewData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CE147E2D05E65B00C757FD /* PreviewData.swift */; };
05CE14812D05F38D00C757FD /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CE14802D05F38A00C757FD /* AboutView.swift */; };
05CE14852D05FD3600C757FD /* SymbolButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CE14842D05FD3100C757FD /* SymbolButton.swift */; };
05CE14872D05FEB600C757FD /* ImageTitleView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05CE14862D05FEB300C757FD /* ImageTitleView.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
052DCA782D060132003F7891 /* ImageInfoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageInfoView.swift; sourceTree = "<group>"; };
052DCA7A2D0603A5003F7891 /* ImageInfoDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageInfoDetailView.swift; sourceTree = "<group>"; };
05957BDE2D060BCF00E021AA /* VideoView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VideoView.swift; sourceTree = "<group>"; };
05CE13FA2D05D2BC00C757FD /* SDO.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SDO.app; sourceTree = BUILT_PRODUCTS_DIR; };
05CE140B2D05D30300C757FD /* Preview Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = "Preview Assets.xcassets"; sourceTree = "<group>"; };
05CE140D2D05D30300C757FD /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -66,6 +83,17 @@
05CE144A2D05D3A100C757FD /* Release - ccache.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Release - ccache.xcconfig"; sourceTree = "<group>"; };
05CE144B2D05D3A100C757FD /* Release - Library.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = "Release - Library.xcconfig"; sourceTree = "<group>"; };
05CE144D2D05D51900C757FD /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
05CE146E2D05DADA00C757FD /* ImageInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageInfo.swift; sourceTree = "<group>"; };
05CE146F2D05DADA00C757FD /* RuntimeError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuntimeError.swift; sourceTree = "<group>"; };
05CE14702D05DADA00C757FD /* SDO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SDO.swift; sourceTree = "<group>"; };
05CE14752D05DE6F00C757FD /* ImageData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageData.swift; sourceTree = "<group>"; };
05CE14772D05E14100C757FD /* ImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageView.swift; sourceTree = "<group>"; };
05CE14792D05E21D00C757FD /* ImageListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageListView.swift; sourceTree = "<group>"; };
05CE147B2D05E31900C757FD /* LoadingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadingView.swift; sourceTree = "<group>"; };
05CE147E2D05E65B00C757FD /* PreviewData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PreviewData.swift; sourceTree = "<group>"; };
05CE14802D05F38A00C757FD /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = "<group>"; };
05CE14842D05FD3100C757FD /* SymbolButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SymbolButton.swift; sourceTree = "<group>"; };
05CE14862D05FEB300C757FD /* ImageTitleView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageTitleView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
@@ -83,6 +111,7 @@
isa = PBXGroup;
children = (
05CE144C2D05D3A100C757FD /* xcconfig */,
05CE146C2D05DA9000C757FD /* Shared */,
05CE14102D05D30300C757FD /* SDO-Mobile */,
05CE13FB2D05D2BC00C757FD /* Products */,
);
@@ -99,6 +128,7 @@
05CE140C2D05D30300C757FD /* Preview Content */ = {
isa = PBXGroup;
children = (
05CE147E2D05E65B00C757FD /* PreviewData.swift */,
05CE140B2D05D30300C757FD /* Preview Assets.xcassets */,
);
path = "Preview Content";
@@ -244,12 +274,32 @@
05CE144F2D05D51D00C757FD /* Views */ = {
isa = PBXGroup;
children = (
05CE14802D05F38A00C757FD /* AboutView.swift */,
05CE140E2D05D30300C757FD /* ContentView.swift */,
052DCA7A2D0603A5003F7891 /* ImageInfoDetailView.swift */,
052DCA782D060132003F7891 /* ImageInfoView.swift */,
05CE14792D05E21D00C757FD /* ImageListView.swift */,
05CE14862D05FEB300C757FD /* ImageTitleView.swift */,
05CE14772D05E14100C757FD /* ImageView.swift */,
05CE147B2D05E31900C757FD /* LoadingView.swift */,
05CE140F2D05D30300C757FD /* SDOApp.swift */,
05CE14842D05FD3100C757FD /* SymbolButton.swift */,
05957BDE2D060BCF00E021AA /* VideoView.swift */,
);
path = Views;
sourceTree = "<group>";
};
05CE146C2D05DA9000C757FD /* Shared */ = {
isa = PBXGroup;
children = (
05CE14752D05DE6F00C757FD /* ImageData.swift */,
05CE146E2D05DADA00C757FD /* ImageInfo.swift */,
05CE146F2D05DADA00C757FD /* RuntimeError.swift */,
05CE14702D05DADA00C757FD /* SDO.swift */,
);
path = Shared;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
@@ -322,6 +372,7 @@
/* Begin PBXShellScriptBuildPhase section */
05CE146A2D05D8E300C757FD /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
@@ -344,8 +395,22 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
052DCA792D060135003F7891 /* ImageInfoView.swift in Sources */,
05CE147F2D05E66000C757FD /* PreviewData.swift in Sources */,
05CE14872D05FEB600C757FD /* ImageTitleView.swift in Sources */,
05CE147A2D05E22200C757FD /* ImageListView.swift in Sources */,
05CE14812D05F38D00C757FD /* AboutView.swift in Sources */,
05CE14722D05DADA00C757FD /* ImageInfo.swift in Sources */,
05CE14732D05DADA00C757FD /* RuntimeError.swift in Sources */,
05CE14742D05DADA00C757FD /* SDO.swift in Sources */,
052DCA7B2D0603A7003F7891 /* ImageInfoDetailView.swift in Sources */,
05CE14132D05D30300C757FD /* ContentView.swift in Sources */,
05CE14142D05D30300C757FD /* SDOApp.swift in Sources */,
05CE14782D05E14300C757FD /* ImageView.swift in Sources */,
05957BDF2D060BD200E021AA /* VideoView.swift in Sources */,
05CE14762D05DE6F00C757FD /* ImageData.swift in Sources */,
05CE147C2D05E31F00C757FD /* LoadingView.swift in Sources */,
05CE14852D05FD3600C757FD /* SymbolButton.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Binary file modified SDO-Mobile/Info.plist
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "Preview-2.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions SDO-Mobile/Preview Content/PreviewData.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2023, Jean-David Gadina - www.xs-labs.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the Software), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/

import SwiftUI

class PreviewData
{
private init()
{}

public static let images: [ ImageData ] = ImageInfo.all.map
{
let image = ImageData( info: $0 )
image.image = UIImage( named: "Sun" )

return image
}
}
52 changes: 52 additions & 0 deletions SDO-Mobile/Views/AboutView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2023, Jean-David Gadina - www.xs-labs.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the Software), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/

import SwiftUI

struct AboutView: View
{
var body: some View
{
VStack( alignment: .center, spacing: 5 )
{
Text( "This software is not affiliated with or endorsed by the NASA's Solar Dynamics Observatory." )
.multilineTextAlignment( .center )
.font( .caption2 )
.foregroundStyle( .secondary )
Text( "All data and images are courtesy of NASA/SDO and the AIA, EVE, and HMI science teams." )
.multilineTextAlignment( .center )
.font( .caption2 )
.foregroundStyle( .secondary )
Text( "Tap here to visit the official SDO website." )
.multilineTextAlignment( .center )
.font( .caption2 )
.foregroundStyle( .link )
}
}
}

#Preview
{
AboutView()
}
61 changes: 56 additions & 5 deletions SDO-Mobile/Views/ContentView.swift
Original file line number Diff line number Diff line change
@@ -26,16 +26,67 @@ import SwiftUI

struct ContentView: View
{
@State private var images: [ ImageData ] = []
@State private var lastRefresh = Date()

var body: some View
{
VStack
{
Image( systemName: "globe" )
.imageScale( .large )
.foregroundStyle( .tint )
Text( "Hello, world!" )
if self.images.isEmpty
{
LoadingView()
}
else
{
ImageListView( images: self.images )
{
self.refresh()
}
header:
{
HStack
{
Text( "Last Refresh: \( self.lastRefreshText )" )
.font( .caption2 )
.foregroundStyle( .secondary )
}
}
footer:
{
AboutView().padding()
}
}
}
.onAppear
{
self.refresh()
}
}

private func refresh()
{
self.images.removeAll()
SDO.shared?.downloadAll
{
self.lastRefresh = Date()

$0.forEach
{
self.images.append( $0 )
}
}
.padding()
}

private var lastRefreshText: String
{
let formatter = DateFormatter()

formatter.dateStyle = .short
formatter.timeStyle = .short
formatter.doesRelativeDateFormatting = true

return formatter.string( from: self.lastRefresh )
}
}

48 changes: 48 additions & 0 deletions SDO-Mobile/Views/ImageInfoDetailView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2023, Jean-David Gadina - www.xs-labs.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the Software), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
******************************************************************************/

import SwiftUI

struct ImageInfoDetailView: View
{
@State public var title: String
@State public var text: String

var body: some View
{
VStack( alignment: .leading )
{
Text( self.title )
.font( .caption )
.foregroundStyle( .secondary )
Text( self.text )
.font( .caption )
}
}
}

#Preview
{
ImageInfoDetailView( title: "Lorem ipsum:", text: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit" ).padding()
}
Loading

0 comments on commit 750de4f

Please sign in to comment.