Skip to content

Commit

Permalink
feat: Add Previews
Browse files Browse the repository at this point in the history
  • Loading branch information
iHTCboy committed Jun 24, 2023
1 parent 2b16265 commit 83bc891
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 57 deletions.
7 changes: 6 additions & 1 deletion iAppStore/components/rankLists/AppDetailContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,11 @@ struct AppDetailFooterCellView: View {

struct AppDetailContentView_Previews: PreviewProvider {
static var previews: some View {
AppDetailContentView()
let model = { () -> AppDetailModel in
let model = AppDetailModel()
model.searchAppData("1669437212", nil, "中国")
return model
}
AppDetailContentView(appModel: model())
}
}
22 changes: 5 additions & 17 deletions iAppStore/components/rankLists/AppDetailView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,13 @@ struct AppDetailView: View {

@StateObject private var appModel = AppDetailModel()

// @Environment(\.presentationMode) var presentationMode

var body: some View {

Group {
AppDetailContentView(appModel: appModel)
}
.navigationBarTitle(item?.imName.label ?? appModel.app?.trackName ?? "", displayMode: .large)
.navigationBarBackButtonHidden(false)
// .navigationBarItems(leading:
// Button(action: {
// self.presentationMode.wrappedValue.dismiss()
// }) {
// HStack {
// Image(systemName: "chevron.backward")
// }
// })
.navigationBarItems(trailing:
Link(destination: URL(string: appModel.app?.trackViewUrl ?? item?.id.label ?? "https://apple.com")!) {
Image(systemName: "paperplane").font(.subheadline)
Expand All @@ -46,10 +36,8 @@ struct AppDetailView: View {
}




//struct AppDetailView_Previews: PreviewProvider {
// static var previews: some View {
// AppDetailView()
// }
//}
struct AppDetailView_Previews: PreviewProvider {
static var previews: some View {
AppDetailView(appId: "1669437212", regionName: "中国")
}
}
25 changes: 20 additions & 5 deletions iAppStore/components/rankLists/RankCellView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,23 @@ struct RankCellView: View {
}
}

//struct RankCellView_Previews: PreviewProvider {
// static var previews: some View {
// RankCellView(index: <#T##Int#>, item: <#T##AppRank#>)
// }
//}
struct RankCellView_Previews: PreviewProvider {
static var previews: some View {
RankCellView(index: 0,
regionName: "中国",
item: AppRank(
category: Category(attributes: CategoryAttributes(imID: "6014", label: "游戏", scheme: "https://apps.apple.com/cn/genre/ios/id6014", term: "Games")),
id: ID(attributes: IDAttributes(imBundleID: "com.sy.frxxz", imID: "1669437212"), label: "https://apps.apple.com/cn/app/69437212"),
imArtist: IMArtist(attributes: IMArtistAttributes(href: "https://apps.apple.com/cn/developer/id1652830936"), label: "Anhui Leihu Network Technology Co., Ltd."),
imContentType: IMContentType(attributes: IMContentTypeAttributes(label: "Application", term: "程序")),
imImage: [IMImage(attributes: IMImageAttributes(height: "75"), label: "https://is4-ssl.mzstatic.com/image/thumb/Purple116/v4/d4/bc/9f/d4bc9fb3-fee8-d718-7e09-0a1d12e36c74/AppIcon-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/75x75bb.png")],
imName: Title(label: "凡人修仙传:人界篇-正版授权"),
imPrice: IMPrice(attributes: IMPriceAttributes(amount: "0.00", currency: "CNY"), label: "获取"),
imReleaseDate: IMReleaseDate(attributes: Title(label: "2023年05月23日"), label: "2023-05-23T00:00:00-07:00"),
summary: Title(label: "道法万千 ,皆可成仙!原著正版授权,无数凡人用户十年期待,2023年度3D国风修仙MMO手游巨作《凡人修仙传:人界篇》已然上线,诚邀道友一同在修仙大世界御剑飞仙!\r\n\r\n【仙界奇闻】\r\n本游戏由李连杰先生代言,接引各位道友;\r\n本游戏主题曲《凡非凡》由胡彦斌先生献唱;\r\n登陆即可领取仙界接引礼包(青竹蜂云剑、绝版称号助力修仙之旅)!\r\n\r\n\r\n【仙界特色】\r\n——由凡入仙 谱写凡人新篇章 ——\r\n岂闻韶华尽何年,回首沧桑,此恨绵绵,风月如剑,看我破天。道不尽仙凡殊途,尽人间!\r\n带你沉浸式体验道祖韩立修仙旅途,原著各大经典宗门任君选择,近百个记忆中的人物、法宝法器、名场面悉数呈现。\r\n\r\n—— 道法万千 自由搭配其乐无穷 ——\r\n创新海量功法设定,流派不同道法各异。剑、法、魔、体四系功法各有千秋,技能组合策略多变,进阶套路由你定义!可以根据个人不同仙缘、选择,成就属于你的无上大道,扬名立万,开宗立派!\r\n\r\n——自由探索 新修仙体验——\r\n若说无缘,三千大千世界,十万菩提众生,怎么单单与你想见?\r\n修仙绝不止修仙,除了打坐修炼破境界、渡劫飞升御心魔,还能呼朋引伴勇闯试炼,游历四方寻奇遇,更能收集法宝御灵宠、采集灵草炼灵丹!修仙人手艺在这里全面展现,多方位提升你的实力,凡人到仙人虽路途漫漫,也能自在成仙!\r\n\r\n——次世代品质 新视听感受——\r\n采用3D国风美术铺开立体丰满、宏大华丽的凡人大世界,人、灵、仙三界活灵活现,这是一场逍遥天地间的东方浪漫奇想之约,希望与你共赴沉醉其间!\r\n\r\n诚邀各位道友关注官方公众号【凡人修仙传人界篇】,即可获取仙界最新动态、最新八卦,最全的仙缘福利尽在掌握!"),
rights: Title(label: "© Anhui Leihu Network Technology Co., Ltd."),
title: Title(label: "凡人修仙传:人界篇-正版授权 - Anhui Leihu Network Technology Co., Ltd.")
)
)
}
}
33 changes: 5 additions & 28 deletions iAppStore/components/rankLists/RankHome.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,35 +96,12 @@ extension RankHome {
}
}

//struct BlurView: UIViewRepresentable {
//
// let style: UIBlurEffect.Style
//
// func makeUIView(context: UIViewRepresentableContext<BlurView>) -> UIView {
// let view = UIView(frame: .zero)
// view.backgroundColor = .clear
// let blurEffect = UIBlurEffect(style: style)
// let blurView = UIVisualEffectView(effect: blurEffect)
// blurView.translatesAutoresizingMaskIntoConstraints = false
// view.insertSubview(blurView, at: 0)
// NSLayoutConstraint.activate([
// blurView.heightAnchor.constraint(equalTo: view.heightAnchor),
// blurView.widthAnchor.constraint(equalTo: view.widthAnchor),
// ])
// return view
// }
//
// func updateUIView(_ uiView: UIView,
// context: UIViewRepresentableContext<BlurView>) {
//
// }
//}

//struct RankHome_Previews: PreviewProvider {
// static var previews: some View {
// RankHome()
// }
//}
struct RankHome_Previews: PreviewProvider {
static var previews: some View {
RankHome()
}
}



58 changes: 52 additions & 6 deletions iAppStore/components/search/SearchCellView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,55 @@ struct SearchCellView: View {
}



//struct SearchCellView_Previews: PreviewProvider {
// static var previews: some View {
// SearchCellView(index: 0, item: AppDetail(advisories: <#T##[String]?#>, appletvScreenshotUrls: <#T##[String]?#>, artistId: <#T##Int#>, artistName: <#T##String#>, artistViewUrl: <#T##String?#>, artworkUrl100: <#T##String#>, artworkUrl512: <#T##String#>, artworkUrl60: <#T##String#>, averageUserRating: <#T##Float#>, averageUserRatingForCurrentVersion: <#T##Float#>, bundleId: <#T##String#>, contentAdvisoryRating: <#T##String#>, currency: <#T##String#>, currentVersionReleaseDate: <#T##String#>, description: <#T##String#>, features: <#T##[String]#>, fileSizeBytes: <#T##String#>, formattedPrice: <#T##String?#>, genreIds: <#T##[String]#>, genres: <#T##[String]#>, ipadScreenshotUrls: <#T##[String]?#>, isGameCenterEnabled: <#T##Bool#>, isVppDeviceBasedLicensingEnabled: <#T##Bool#>, kind: <#T##String#>, languageCodesISO2A: <#T##[String]#>, minimumOsVersion: <#T##String#>, price: <#T##Double?#>, primaryGenreId: <#T##Int#>, primaryGenreName: <#T##String#>, releaseDate: <#T##String#>, releaseNotes: <#T##String?#>, screenshotUrls: <#T##[String]?#>, sellerName: <#T##String#>, sellerUrl: <#T##String?#>, supportedDevices: <#T##[String]#>, trackCensoredName: <#T##String#>, trackContentRating: <#T##String#>, trackId: <#T##Int#>, trackName: <#T##String#>, trackViewUrl: <#T##String#>, userRatingCount: <#T##Int#>, userRatingCountForCurrentVersion: <#T##Int#>, version: <#T##String#>, wrapperType: <#T##String#>))
// }
//}
struct SearchCellView_Previews: PreviewProvider {
static var previews: some View {
SearchCellView(index: 0,
item: AppDetail(
advisories: ["偶尔/轻微的成人或性暗示题材", "偶尔/轻微的色情内容或裸露", "频繁/强烈的竞赛", "偶尔/轻微的亵渎或低俗幽默", "赌博", "偶尔/轻微的卡通或幻想暴力", "偶尔/轻微的惊悚或恐怖题材"],
appletvScreenshotUrls: [],
artistId: 1170416082,
artistName: "Beijing Microlive Vision Technology Co., Ltd",
artistViewUrl: "https://apps.apple.com/cn/developer/id1170416082",
artworkUrl100: "https://is1-ssl.mzstatic.com/image/thumb/Purple116/v4/7a/08/16/7a081643-510b-acdb-d84b-088f8d877d8b/AppIcon-0-0-1x_U007emarketing-0-0-0-6-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/100x100bb.jpg",
artworkUrl512: "https://is1-ssl.mzstatic.com/image/thumb/Purple116/v4/7a/08/16/7a081643-510b-acdb-d84b-088f8d877d8b/AppIcon-0-0-1x_U007emarketing-0-0-0-6-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/512x512bb.jpg",
artworkUrl60: "https://is1-ssl.mzstatic.com/image/thumb/Purple116/v4/7a/08/16/7a081643-510b-acdb-d84b-088f8d877d8b/AppIcon-0-0-1x_U007emarketing-0-0-0-6-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/60x60bb.jpg",
averageUserRating: 4.88,
averageUserRatingForCurrentVersion: 4.88,
bundleId: "com.ss.iphone.ugc.Aweme",
contentAdvisoryRating: "17+",
currency: "CNY",
currentVersionReleaseDate: "2023-05-04T09:57:32Z",
description: "抖音是一个帮助用户表达自我,记录美好生活的短视频平台。\n\n● 记录美好在抖音\n智能匹配音乐、一键卡点视频,还有超多原创特效、滤镜、场景切换帮你一秒变大片,让你的生活轻松记录在抖音!\n● 实用内容在抖音\n生活妙招、美食做法、旅行攻略、科技知识、新闻时事、同城资讯,你需要的实用内容都在抖音!\n● 各行各业在抖音\n原创音乐人、京剧演员、非遗传承人、烧烤摊老板、快递小哥等,每个人真实的生活都在抖音!\n\n全民记录自我,生活的美好都在这里!",
features: ["iosUniversal"],
fileSizeBytes: "489774080",
formattedPrice: "免费",
genreIds: ["6016"],
genres: ["娱乐"],
ipadScreenshotUrls: [
"https://is4-ssl.mzstatic.com/image/thumb/Purple126/v4/10/4a/c0/104ac064-a13a-735a-ac7e-31a9a8be4c94/539c76eb-f80d-41e4-804e-ff2b366f5925_d40e52455be74f44b5e61e54777e4241.jpeg/552x414bb.jpg",
"https://is2-ssl.mzstatic.com/image/thumb/PurpleSource126/v4/b2/a7/dc/b2a7dc31-6caa-f4f5-582b-be4f0c625493/31a3e47b-94a9-4c17-8f00-e3bb3c44a6bf_eb631323700b461ea4ce005400628e0d.png/552x414bb.png"],
isGameCenterEnabled: false,
isVppDeviceBasedLicensingEnabled: true,
kind: "software",
languageCodesISO2A: ["EN", "ZH"],
minimumOsVersion: "11.0",
price: 0.00,
primaryGenreId: 6016,
primaryGenreName: "Entertainment",
releaseDate: "2016-09-26T03:28:56Z",
releaseNotes: "运用全新的功能,让使用更加安全便捷",
screenshotUrls: ["https://is1-ssl.mzstatic.com/image/thumb/Purple126/v4/7d/82/93/7d8293e9-795f-5500-eefc-27dc035f70d1/d8e59776-5c71-4d6e-bf7d-c093486df192_b8da317377c04a2b8c2b1f8c9b290603.png/392x696bb.png","https://is5-ssl.mzstatic.com/image/thumb/Purple126/v4/85/9e/d5/859ed5ee-069e-d3ad-c3f5-8962486ce554/9b590a24-b7b3-4c71-a48c-3a65d263db11_796abc123df44955afae0b597f59abea.png/392x696bb.png"],
sellerName: "Beijing Microlive Vision Technology Co., Ltd",
sellerUrl: nil,
supportedDevices: ["iPhone5s-iPhone5s", "iPadAir-iPadAir", "..."],
trackCensoredName: "抖音",
trackContentRating: "17+",
trackId: 1142110895,
trackName: "抖音",
trackViewUrl: "https://apps.apple.com/cn/app/id1142110895",
userRatingCount: 46105612,
userRatingCountForCurrentVersion: 46105612,
version: "24.8.0",
wrapperType: "software"))
}
}

0 comments on commit 83bc891

Please sign in to comment.