Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions AsyncSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@
E94F92C728D2505100D9E759 /* Ticketing.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94F92C628D2505100D9E759 /* Ticketing.swift */; };
E9E2A4D828CEC5680016AEFF /* WebView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9E2A4D728CEC5680016AEFF /* WebView.swift */; };
FBCCC4F32ACAB5BD00FFF26B /* SDWebImageSwiftUI in Frameworks */ = {isa = PBXBuildFile; productRef = FBCCC4F22ACAB5BD00FFF26B /* SDWebImageSwiftUI */; };
FBDEF9A32AD2A66600FF7028 /* GitHubStorageURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBDEF9A22AD2A66600FF7028 /* GitHubStorageURL.swift */; };
FBDEF9A42AD2A66600FF7028 /* GitHubStorageURL.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBDEF9A22AD2A66600FF7028 /* GitHubStorageURL.swift */; };
FBF437072AC9562B00B22B05 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FBF437062AC9562B00B22B05 /* WidgetKit.framework */; };
FBF437092AC9562B00B22B05 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FBF437082AC9562B00B22B05 /* SwiftUI.framework */; };
FBF4370C2AC9562B00B22B05 /* AsyncSwiftWidgetBundle.swift in Sources */ = {isa = PBXBuildFile; fileRef = FBF4370B2AC9562B00B22B05 /* AsyncSwiftWidgetBundle.swift */; };
Expand Down Expand Up @@ -138,6 +140,7 @@
E9171EFF28D15426002FAF52 /* TicketingView+Observed.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "TicketingView+Observed.swift"; sourceTree = "<group>"; };
E94F92C628D2505100D9E759 /* Ticketing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Ticketing.swift; sourceTree = "<group>"; };
E9E2A4D728CEC5680016AEFF /* WebView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebView.swift; sourceTree = "<group>"; };
FBDEF9A22AD2A66600FF7028 /* GitHubStorageURL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GitHubStorageURL.swift; sourceTree = "<group>"; };
FBF437052AC9562B00B22B05 /* AsyncSwiftWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = AsyncSwiftWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
FBF437062AC9562B00B22B05 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
FBF437082AC9562B00B22B05 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -255,6 +258,7 @@
children = (
C63D444B291BDCDC005D5AE6 /* KeyChainManager.swift */,
C69C13BE2913EC9400D9B47F /* FirebaseManager.swift */,
FBDEF9A22AD2A66600FF7028 /* GitHubStorageURL.swift */,
);
path = Managers;
sourceTree = "<group>";
Expand Down Expand Up @@ -457,6 +461,7 @@
C6AA71E828FC65680091A868 /* Text+.swift in Sources */,
C68DE94C28C76F3200CA4CC8 /* AppDelegate.swift in Sources */,
E94F92C728D2505100D9E759 /* Ticketing.swift in Sources */,
FBDEF9A32AD2A66600FF7028 /* GitHubStorageURL.swift in Sources */,
C69C13C1291418A000D9B47F /* ProfileEditView.swift in Sources */,
C63D4450291BDD2B005D5AE6 /* String+.swift in Sources */,
C63D444C291BDCDC005D5AE6 /* KeyChainManager.swift in Sources */,
Expand Down Expand Up @@ -504,6 +509,7 @@
FBF4370E2AC9562B00B22B05 /* AsyncSwiftWidget.swift in Sources */,
FBF4370C2AC9562B00B22B05 /* AsyncSwiftWidgetBundle.swift in Sources */,
FBF4371B2AC9588800B22B05 /* AsyncSwiftWidgetEntryView.swift in Sources */,
FBDEF9A42AD2A66600FF7028 /* GitHubStorageURL.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
21 changes: 21 additions & 0 deletions AsyncSwift/Managers/GitHubStorageURL.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// GitHubStorageURL.swift
// AsyncSwift
//
// Created by 김인섭 on 10/8/23.
//

import Foundation

enum GitHubStorageURL {

static let baseUrl = "https://async-swift.github.io/jsonstorage"
static let customDomain = "https://asyncswift.info/"

static let widgetLargeImage = customDomain + "/Images/widget-large.svg"
static let eventData = GitHubStorageURL.baseUrl + "/asyncswift.json"
static var stampImage: (String) -> String {{ event in
GitHubStorageURL.baseUrl + "/Images/Stamp/" + event + "/stamp.png"
}}
static let ticketingData = GitHubStorageURL.baseUrl + "/ticketing.json"
}
3 changes: 1 addition & 2 deletions AsyncSwift/Observed/EventView+Observed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ final class EventViewObserved: ObservableObject {
var cancellable = Set<AnyCancellable>()

func getEventData() {
let urlString = "https://async-swift.github.io/jsonstorage/asyncswift.json"
let url = URL(string: urlString)!
let url = URL(string: GitHubStorageURL.eventData)!
URLSession.shared.dataTaskPublisher(for: url)
.map(\.data)
.decode(type: Event.self, decoder: JSONDecoder())
Expand Down
4 changes: 1 addition & 3 deletions AsyncSwift/Observed/StampView+Observed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ extension StampView {
guard let self else { return }
let event = $0.element
let index = $0.offset

let urlString = "https://raw.githubusercontent.com/Async-Swift/jsonstorage/main/Images/Stamp/" + event + "/stamp.png"
let url = URL(string: urlString)!
let url = URL(string: GitHubStorageURL.stampImage(event))!

URLSession.shared.dataTaskPublisher(for: url)
.map(\.data)
Expand Down
3 changes: 1 addition & 2 deletions AsyncSwift/Observed/TicketingView+Observed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ extension TicketingView {
}

func getTicketingData() {
let urlString = "https://raw.githubusercontent.com/Async-Swift/jsonstorage/main/ticketing.json"
let url = URL(string: urlString)!
let url = URL(string: GitHubStorageURL.ticketingData)!
URLSession.shared.dataTaskPublisher(for: url)
.map(\.data)
.decode(type: Ticketing.self, decoder: JSONDecoder())
Expand Down
12 changes: 8 additions & 4 deletions AsyncSwiftWidget/AsyncSwiftWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ struct Provider: TimelineProvider {
}

func getRemoteImage() -> Data? {
let urlString = "https://raw.githubusercontent.com/Async-Swift/jsonstorage/a94eb982e9b9db90543de1d574a6dc5f0c637f5b/Images/widget-large.svg"
return try? Data(contentsOf: URL(string: urlString)!)
try? Data(contentsOf: URL(string: GitHubStorageURL.widgetLargeImage)!)
}
}

Expand All @@ -54,7 +53,12 @@ struct AsyncSwiftWidget: Widget {

struct AsyncSwiftWidget_Previews: PreviewProvider {
static var previews: some View {
AsyncSwiftWidgetEntryView(entry: SimpleEntry(date: Date(), imageData: nil))
.previewContext(WidgetPreviewContext(family: .systemSmall))
AsyncSwiftWidgetEntryView(
entry: SimpleEntry(
date: Date(),
imageData: try? Data(contentsOf: URL(string: GitHubStorageURL.widgetLargeImage)!)
)
)
.previewContext(WidgetPreviewContext(family: .systemSmall))
}
}