Skip to content

Commit

Permalink
Add App Clips
Browse files Browse the repository at this point in the history
  • Loading branch information
tigpt committed Mar 11, 2024
1 parent 09fad8d commit 1d66a15
Show file tree
Hide file tree
Showing 11 changed files with 611 additions and 5 deletions.
10 changes: 10 additions & 0 deletions ios/AWSaryAppClip/AWSaryAppClip.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.developer.parent-application-identifiers</key>
<array>
<string>$(AppIdentifierPrefix)pt.tig.awsary</string>
</array>
</dict>
</plist>
41 changes: 41 additions & 0 deletions ios/AWSaryAppClip/AWSaryAppClipApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// AWSaryAppClipApp.swift
// AWSaryAppClip
//
// Created by Tiago Rodrigues on 09/03/2024.
//

import SwiftUI
import RevenueCat

@main
struct AWSaryAppClipApp: App {

init(){
/* Enable debug logs before calling `configure`. */
Purchases.logLevel = .debug
/* Initialize the RevenueCat Purchases SDK. */
Purchases.configure(
with: Configuration.Builder(withAPIKey: Constants.apiKey)
.build()
)
/* Set the delegate to our shared instance of PurchasesDelegateHandler */
Purchases.shared.delegate = PurchasesDelegateHandler.shared
}


var body: some Scene {
WindowGroup {
ContentView()
.task {
do {
// Fetch the available offerings
UserViewModel.shared.offerings = try await Purchases.shared.offerings()
} catch {
print("Error fetching offerings: \(error)")
}
}
.accentColor(Color(red:1.0, green: 0.5, blue: 0.0))
}
}
}
191 changes: 191 additions & 0 deletions ios/AWSaryAppClip/AboutViewClipApp.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
//
// SettingsView.swift
// awsary
//
// Created by Tiago Rodrigues on 20/07/2022.
//

import SwiftUI
import StoreKit
import RevenueCat

struct AboutView: View {
@Environment(\.dismiss) var dismiss
@ObservedObject var userModel = UserViewModel.shared
@ObservedObject var awsServices = AwsServices()
@AppStorage("awsServiceLogoWithLabel") var awsServiceLogoWithLabel: Bool = false

var body: some View {
let randomAWSservice = awsServices.getRandomElement()

NavigationStack{
List{
Section(header: Text("Configure service logos")){
VStack{
Toggle(isOn: $awsServiceLogoWithLabel){
Text("Show name on service logo")
}
// .disabled(!self.userModel.subscriptionActive)
// Text("")
// Text("Drag-and-drop each of the icons bellow, to test it on your diagrams.\n\nTap to load a diferent random icon, purchange a subscription to enable on all logos.")
LazyVGrid(
columns: [GridItem(.adaptive(minimum: 110))], content: {

if (awsServiceLogoWithLabel){
AWSserviceImagePlaceHolderView(service: randomAWSservice, showLabel: false)
AWSserviceImagePlaceHolderView(service: randomAWSservice, showLabel: true)
.padding(.horizontal, 8)
.padding(.vertical, 6)
.background(Color(red:1.0, green: 0.5, blue: 0.0))
.cornerRadius(8.0)
}else{
AWSserviceImagePlaceHolderView(service: randomAWSservice, showLabel: false)
.padding(.horizontal, 8)
.padding(.vertical, 6)
.background(Color(red:1.0, green: 0.5, blue: 0.0))
.cornerRadius(8.0)
AWSserviceImagePlaceHolderView(service: randomAWSservice, showLabel: true)
}
}
).frame(minHeight: 160)
}
}
Section(header: Text("Feedback")){
// Label("Send Feedback", systemImage: "envelope")
Label {
VStack(alignment: .leading){
Text("Rate version \(Bundle.main.appVersionLong) of AWSary")
Text("Be like the 19 other beautiful people that have rated this version.").font(.footnote).opacity(0.6)
}
} icon:{
Image(systemName: "star.fill")
}.onTapGesture {
let appId = "1634871091"
let url_string = "itms-apps://itunes.apple.com/app/id\(appId)?mt=8&action=write-review"
guard let url = URL(string: url_string) else {
return
}
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}

Label {
VStack(alignment: .leading){
Text("Send Feedback")
Text("Feedback emails are lovely to read!").font(.footnote).opacity(0.6)
}
} icon:{
Image(systemName: "envelope")
}.onTapGesture {
let address = "[email protected]"
let subject = "Feedback on AWSary"

// Example email body with useful info for bug reports
let body = "\n\n--\nAWSary Version: \(Bundle.main.appVersionLong) (\(Bundle.main.appBuild))"

// Build the URL from its components
var components = URLComponents()
components.scheme = "mailto"
components.path = address
components.queryItems = [
URLQueryItem(name: "subject", value: subject),
URLQueryItem(name: "body", value: body)
]

guard let email_url = components.url else {
NSLog("Failed to create mailto URL")
return
}
UIApplication.shared.open(email_url) { success in
// handle success or failure
}
}

}
Section(header: Text("Why AWSary")){
Text("I'm an AWS Cloud Consultant and Trainer.\n\nNew AWS Services are released all the time, and sometimes you just want a quick dictionary definition.\n\nI also draw AWS Cloud Architecture diagrams daily on iPad, to explore ideas either with Colleagues, Clients or Students.\n\nGood drawing Applications don't have AWS services logos, so on top of this dictionary I enabled the drag and drop of the logos to 3rd party drawing tools.\n\n This App is a great AWS Cloud Consultant companion tool.\n\nHelp develop this app at [GitHub](https://github.com/tigpt/AWSary/).")
}
Section(header: Text("How to use AWSary")){
Text("Search for the name of an AWS service, you can open and look for the definition of it. You can also drag and drop the service logo to your favorite drawing application. (Check video below)")
MyYoutubePlayer(youtube_id: "c0SjbhRR3lk")
}
Section(){
Link("Terms of Use (EULA)", destination: URL(string: "https://www.apple.com/legal/internet-services/itunes/dev/stdeula")!)
Link("Privacy Policy", destination: URL(string: "https://tig.pt/awsary-privacy")!)
}
// Section(header: Text("AWSary.com")){
// Text("This is a hobby project from Tiago Rodrigues to help more people learn about Cloud, specialy AWS. Special tanks to tecRacer for supporting the backend.").lineLimit(100)
// }
// Section(header: Text("Help developing this app")){
// Text("Get involved in this application")
// }
// Section(header: Text("Contact & Help")){
// Text("FAQ - Frequently Asked Questions")
// }
// Section(header: Text("info")){
// Text("Acknowledgements")
// Text("Colophon")
// Text("Privacy Policy")
// }
// Section(header: Text("Icon")){
// Text("Icon 1")
// Text("Icon 2")
// Text("Icon 3")
// }
}
.navigationTitle("Settings")
.navigationBarTitleDisplayMode(.inline)
.toolbar {
ToolbarItem(placement: .confirmationAction){
Button("Done", action: {
dismiss()
})
}
}
}.accentColor(Color(red:1.0, green: 0.5, blue: 0.0))
}
// var body: some View {
// NavigationStack{
//// VStack{
//// HStack{
//// Spacer()
//// Button(action: {
//// dismiss()
//// }){
//// Text("Done").font(.title3 .bold()).padding(10)
//// }
//// }.background(Color .yellow)
//// ScrollView{
//// Text("AWSary.com").font(.largeTitle)
//// Text("Multiline \ntext \nis called \nTextEditor")
//// }.background(Color .red)
//// .font(.title)
//// Spacer()
//// }
// Text("hello world")
// }.background(Color .pink)
// .navigationTitle("Settings")
// .toolbar {
// Button("Done", action: {
// dismiss()
// })
// }
// }
}

#Preview {
AboutView()
}

extension Bundle {
public var appName: String { getInfo("CFBundleName") }
public var displayName: String { getInfo("CFBundleDisplayName") }
public var language: String { getInfo("CFBundleDevelopmentRegion") }
public var identifier: String { getInfo("CFBundleIdentifier") }
public var copyright: String { getInfo("NSHumanReadableCopyright").replacingOccurrences(of: "\\\\n", with: "\n") }

public var appBuild: String { getInfo("CFBundleVersion") }
public var appVersionLong: String { getInfo("CFBundleShortVersionString") }
//public var appVersionShort: String { getInfo("CFBundleShortVersion") }

fileprivate func getInfo(_ str: String) -> String { infoDictionary?[str] as? String ?? "⚠️" }
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
13 changes: 13 additions & 0 deletions ios/AWSaryAppClip/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"images" : [
{
"idiom" : "universal",
"platform" : "ios",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions ios/AWSaryAppClip/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
13 changes: 13 additions & 0 deletions ios/AWSaryAppClip/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSAppClip</key>
<dict>
<key>NSAppClipRequestEphemeralUserNotification</key>
<false/>
<key>NSAppClipRequestLocationConfirmation</key>
<false/>
</dict>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
54 changes: 52 additions & 2 deletions ios/Shared/RevenueCat/Configuration.storekit
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,57 @@
"settings" : {
"_applicationInternalID" : "1634871091",
"_developerTeamID" : "67Z34DP7CK",
"_lastSynchronizedDate" : 712702402.05868304
"_failTransactionsEnabled" : false,
"_lastSynchronizedDate" : 712702402.05868304,
"_locale" : "en_US",
"_storefront" : "USA",
"_storeKitErrors" : [
{
"current" : null,
"enabled" : false,
"name" : "Load Products"
},
{
"current" : null,
"enabled" : false,
"name" : "Purchase"
},
{
"current" : null,
"enabled" : false,
"name" : "Verification"
},
{
"current" : null,
"enabled" : false,
"name" : "App Store Sync"
},
{
"current" : null,
"enabled" : false,
"name" : "Subscription Status"
},
{
"current" : null,
"enabled" : false,
"name" : "App Transaction"
},
{
"current" : null,
"enabled" : false,
"name" : "Manage Subscriptions Sheet"
},
{
"current" : null,
"enabled" : false,
"name" : "Refund Request Sheet"
},
{
"current" : null,
"enabled" : false,
"name" : "Offer Code Redeem Sheet"
}
]
},
"subscriptionGroups" : [
{
Expand Down Expand Up @@ -48,7 +98,7 @@
}
],
"version" : {
"major" : 2,
"major" : 3,
"minor" : 0
}
}
5 changes: 5 additions & 0 deletions ios/awsary (iOS).entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>
Loading

0 comments on commit 1d66a15

Please sign in to comment.