Skip to content

Commit

Permalink
Bump version to 2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sieren committed Oct 29, 2023
1 parent bee73fe commit bdbf737
Show file tree
Hide file tree
Showing 12 changed files with 268 additions and 4 deletions.
19 changes: 19 additions & 0 deletions midile-widget/AppIntent.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//
// AppIntent.swift
// midile-widget
//
// Created by Matthias Frick on 29.10.23.
// Copyright © 2023 Matthias Frick. All rights reserved.
//

import WidgetKit
import AppIntents

struct ConfigurationAppIntent: WidgetConfigurationIntent {
static var title: LocalizedStringResource = "Configuration"
static var description = IntentDescription("This is an example widget.")

// An example configurable parameter.
@Parameter(title: "Favorite Emoji", default: "😃")
var favoriteEmoji: String
}
11 changes: 11 additions & 0 deletions midile-widget/Assets.xcassets/AccentColor.colorset/Contents.json
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 midile-widget/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 midile-widget/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
11 changes: 11 additions & 0 deletions midile-widget/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?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>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.widgetkit-extension</string>
</dict>
</dict>
</plist>
9 changes: 9 additions & 0 deletions midile-widget/MIDIActivityAttribute.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//
// MIDIActivityAttribute.swift
// midimittr
//
// Created by Matthias Frick on 29.10.23.
// Copyright © 2023 Matthias Frick. All rights reserved.
//

import Foundation
85 changes: 85 additions & 0 deletions midile-widget/midile_widget.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
//
// midile_widget.swift
// midile-widget
//
// Created by Matthias Frick on 29.10.23.
// Copyright © 2023 Matthias Frick. All rights reserved.
//

import WidgetKit
import SwiftUI

struct Provider: AppIntentTimelineProvider {
func placeholder(in context: Context) -> SimpleEntry {
SimpleEntry(date: Date(), configuration: ConfigurationAppIntent())
}

func snapshot(for configuration: ConfigurationAppIntent, in context: Context) async -> SimpleEntry {
SimpleEntry(date: Date(), configuration: configuration)
}

func timeline(for configuration: ConfigurationAppIntent, in context: Context) async -> Timeline<SimpleEntry> {
var entries: [SimpleEntry] = []

// Generate a timeline consisting of five entries an hour apart, starting from the current date.
let currentDate = Date()
for hourOffset in 0 ..< 5 {
let entryDate = Calendar.current.date(byAdding: .hour, value: hourOffset, to: currentDate)!
let entry = SimpleEntry(date: entryDate, configuration: configuration)
entries.append(entry)
}

return Timeline(entries: entries, policy: .atEnd)
}
}

struct SimpleEntry: TimelineEntry {
let date: Date
let configuration: ConfigurationAppIntent
}

struct midile_widgetEntryView : View {
var entry: Provider.Entry

var body: some View {
VStack {
Text("Time:")
Text(entry.date, style: .time)

Text("Favorite Emoji:")
Text(entry.configuration.favoriteEmoji)
}
}
}

struct midile_widget: Widget {
let kind: String = "midile_widget"

var body: some WidgetConfiguration {
AppIntentConfiguration(kind: kind, intent: ConfigurationAppIntent.self, provider: Provider()) { entry in
midile_widgetEntryView(entry: entry)
.containerBackground(.fill.tertiary, for: .widget)
}
}
}

extension ConfigurationAppIntent {
fileprivate static var smiley: ConfigurationAppIntent {
let intent = ConfigurationAppIntent()
intent.favoriteEmoji = "😀"
return intent
}

fileprivate static var starEyes: ConfigurationAppIntent {
let intent = ConfigurationAppIntent()
intent.favoriteEmoji = "🤩"
return intent
}
}

#Preview(as: .systemSmall) {
midile_widget()
} timeline: {
SimpleEntry(date: .now, configuration: .smiley)
SimpleEntry(date: .now, configuration: .starEyes)
}
18 changes: 18 additions & 0 deletions midile-widget/midile_widgetBundle.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// midile_widgetBundle.swift
// midile-widget
//
// Created by Matthias Frick on 29.10.23.
// Copyright © 2023 Matthias Frick. All rights reserved.
//

import WidgetKit
import SwiftUI

@main
struct midile_widgetBundle: WidgetBundle {
var body: some Widget {
midile_widget()
midile_widgetLiveActivity()
}
}
81 changes: 81 additions & 0 deletions midile-widget/midile_widgetLiveActivity.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
//
// midile_widgetLiveActivity.swift
// midile-widget
//
// Created by Matthias Frick on 29.10.23.
// Copyright © 2023 Matthias Frick. All rights reserved.
//

import ActivityKit
import WidgetKit
import SwiftUI

struct midile_widgetAttributes: ActivityAttributes {
public struct ContentState: Codable, Hashable {
// Dynamic stateful properties about your activity go here!
var emoji: String
}

// Fixed non-changing properties about your activity go here!
var name: String
}

struct midile_widgetLiveActivity: Widget {
var body: some WidgetConfiguration {
ActivityConfiguration(for: midile_widgetAttributes.self) { context in
// Lock screen/banner UI goes here
VStack {
Text("Hello \(context.state.emoji)")
}
.activityBackgroundTint(Color.cyan)
.activitySystemActionForegroundColor(Color.black)

} dynamicIsland: { context in
DynamicIsland {
// Expanded UI goes here. Compose the expanded UI through
// various regions, like leading/trailing/center/bottom
DynamicIslandExpandedRegion(.leading) {
Text("Leading")
}
DynamicIslandExpandedRegion(.trailing) {
Text("Trailing")
}
DynamicIslandExpandedRegion(.bottom) {
Text("Bottom \(context.state.emoji)")
// more content
}
} compactLeading: {
Text("L")
} compactTrailing: {
Text("T \(context.state.emoji)")
} minimal: {
Text(context.state.emoji)
}
.widgetURL(URL(string: "http://www.apple.com"))
.keylineTint(Color.red)
}
}
}

extension midile_widgetAttributes {
fileprivate static var preview: midile_widgetAttributes {
midile_widgetAttributes(name: "World")
}
}

extension midile_widgetAttributes.ContentState {
fileprivate static var smiley: midile_widgetAttributes.ContentState {
midile_widgetAttributes.ContentState(emoji: "😀")
}

fileprivate static var starEyes: midile_widgetAttributes.ContentState {
midile_widgetAttributes.ContentState(emoji: "🤩")
}
}

#Preview("Notification", as: .content, using: midile_widgetAttributes.preview) {
midile_widgetLiveActivity()
} contentStates: {
midile_widgetAttributes.ContentState.smiley
midile_widgetAttributes.ContentState.starEyes
}
8 changes: 4 additions & 4 deletions midimittr.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 66;
CURRENT_PROJECT_VERSION = 67;
DEVELOPMENT_TEAM = VEESE9857L;
ENABLE_NS_ASSERTIONS = YES;
ENABLE_STRICT_OBJC_MSGSEND = NO;
Expand All @@ -517,7 +517,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.2;
MARKETING_VERSION = 2.4;
OTHER_CFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.matt.MIDI-LE";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -540,7 +540,7 @@
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 66;
CURRENT_PROJECT_VERSION = 67;
DEVELOPMENT_TEAM = VEESE9857L;
ENABLE_NS_ASSERTIONS = YES;
ENABLE_STRICT_OBJC_MSGSEND = NO;
Expand All @@ -556,7 +556,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 2.2;
MARKETING_VERSION = 2.4;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PRODUCT_BUNDLE_IDENTIFIER = "com.matt.MIDI-LE";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
Binary file not shown.

0 comments on commit bdbf737

Please sign in to comment.