mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
WIP
This commit is contained in:
parent
c672132a3c
commit
9223423215
@ -55,9 +55,9 @@
|
|||||||
<key>INIntentDefinitionSystemVersion</key>
|
<key>INIntentDefinitionSystemVersion</key>
|
||||||
<string>20C69</string>
|
<string>20C69</string>
|
||||||
<key>INIntentDefinitionToolsBuildVersion</key>
|
<key>INIntentDefinitionToolsBuildVersion</key>
|
||||||
<string>12B45b</string>
|
<string>12C33</string>
|
||||||
<key>INIntentDefinitionToolsVersion</key>
|
<key>INIntentDefinitionToolsVersion</key>
|
||||||
<string>12.2</string>
|
<string>12.3</string>
|
||||||
<key>INIntents</key>
|
<key>INIntents</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
@ -70,7 +70,7 @@
|
|||||||
<key>INIntentIneligibleForSuggestions</key>
|
<key>INIntentIneligibleForSuggestions</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>INIntentLastParameterTag</key>
|
<key>INIntentLastParameterTag</key>
|
||||||
<integer>5</integer>
|
<integer>19</integer>
|
||||||
<key>INIntentName</key>
|
<key>INIntentName</key>
|
||||||
<string>SelectFriends</string>
|
<string>SelectFriends</string>
|
||||||
<key>INIntentParameters</key>
|
<key>INIntentParameters</key>
|
||||||
@ -202,7 +202,7 @@
|
|||||||
<key>INIntentParameterSupportsMultipleValues</key>
|
<key>INIntentParameterSupportsMultipleValues</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>INIntentParameterTag</key>
|
<key>INIntentParameterTag</key>
|
||||||
<integer>3</integer>
|
<integer>19</integer>
|
||||||
<key>INIntentParameterType</key>
|
<key>INIntentParameterType</key>
|
||||||
<string>Object</string>
|
<string>Object</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
@ -248,39 +248,51 @@ struct WidgetView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func peersView(geometry: GeometryProxy, peers: WidgetDataPeers) -> some View {
|
func peersView(geometry: GeometryProxy, peers: WidgetDataPeers) -> some View {
|
||||||
let defaultItemSize: CGFloat = 60.0
|
let columnCount: Int
|
||||||
let defaultPaddingFraction: CGFloat = 0.36
|
|
||||||
|
|
||||||
let rowCount: Int
|
let rowCount: Int
|
||||||
let rowHeight: CGFloat
|
|
||||||
let topOffset: CGFloat
|
let itemSizeFraction: CGFloat
|
||||||
|
let horizontalInsetFraction: CGFloat
|
||||||
|
let verticalInsetFraction: CGFloat
|
||||||
|
let horizontalSpacingFraction: CGFloat
|
||||||
|
let verticalSpacingFraction: CGFloat
|
||||||
|
|
||||||
switch self.widgetFamily {
|
switch self.widgetFamily {
|
||||||
case .systemLarge:
|
case .systemLarge:
|
||||||
|
itemSizeFraction = 0.1762917933
|
||||||
|
horizontalInsetFraction = 0.04863221884
|
||||||
|
verticalInsetFraction = 0.04863221884
|
||||||
|
horizontalSpacingFraction = 0.06079027356
|
||||||
|
verticalSpacingFraction = 0.06079027356
|
||||||
|
columnCount = 4
|
||||||
rowCount = 4
|
rowCount = 4
|
||||||
rowHeight = 80.0
|
|
||||||
topOffset = 10.0
|
|
||||||
case .systemMedium:
|
case .systemMedium:
|
||||||
|
itemSizeFraction = 0.1762917933
|
||||||
|
horizontalInsetFraction = 0.04863221884
|
||||||
|
verticalInsetFraction = 0.1032258065
|
||||||
|
horizontalSpacingFraction = 0.06079027356
|
||||||
|
verticalSpacingFraction = 0.07741935484
|
||||||
|
columnCount = 4
|
||||||
rowCount = 2
|
rowCount = 2
|
||||||
rowHeight = 70.0
|
|
||||||
topOffset = 0.0
|
|
||||||
case .systemSmall:
|
case .systemSmall:
|
||||||
|
itemSizeFraction = 0.335483871
|
||||||
|
horizontalInsetFraction = 0.1032258065
|
||||||
|
verticalInsetFraction = 0.1032258065
|
||||||
|
horizontalSpacingFraction = 0.1161290323
|
||||||
|
verticalSpacingFraction = 0.1161290323
|
||||||
|
columnCount = 2
|
||||||
rowCount = 2
|
rowCount = 2
|
||||||
rowHeight = 72.0
|
|
||||||
topOffset = 0.0
|
|
||||||
@unknown default:
|
@unknown default:
|
||||||
|
itemSizeFraction = 0.335483871
|
||||||
|
horizontalInsetFraction = 0.1032258065
|
||||||
|
verticalInsetFraction = 0.1032258065
|
||||||
|
horizontalSpacingFraction = 0.1161290323
|
||||||
|
verticalSpacingFraction = 0.1161290323
|
||||||
|
columnCount = 2
|
||||||
rowCount = 2
|
rowCount = 2
|
||||||
rowHeight = 72.0
|
|
||||||
topOffset = 0.0
|
|
||||||
}
|
}
|
||||||
let columnCount = Int(round(geometry.size.width / (defaultItemSize * (1.0 + defaultPaddingFraction))))
|
|
||||||
let itemSize = floor(geometry.size.width / (CGFloat(columnCount) + defaultPaddingFraction * CGFloat(columnCount - 1)))
|
|
||||||
|
|
||||||
let rowOffset: [CGFloat] = [
|
let itemSize = floor(geometry.size.width * itemSizeFraction)
|
||||||
topOffset + itemSize / 2.0,
|
|
||||||
topOffset + itemSize / 2.0 + rowHeight,
|
|
||||||
topOffset + itemSize / 2.0 + rowHeight * 2,
|
|
||||||
topOffset + itemSize / 2.0 + rowHeight * 3,
|
|
||||||
]
|
|
||||||
|
|
||||||
return ZStack {
|
return ZStack {
|
||||||
ForEach(0 ..< min(peers.peers.count, columnCount * rowCount), content: { i in
|
ForEach(0 ..< min(peers.peers.count, columnCount * rowCount), content: { i in
|
||||||
@ -291,7 +303,7 @@ struct WidgetView: View {
|
|||||||
itemSize: itemSize
|
itemSize: itemSize
|
||||||
).frame(width: itemSize, height: itemSize)
|
).frame(width: itemSize, height: itemSize)
|
||||||
}).frame(width: itemSize, height: itemSize)
|
}).frame(width: itemSize, height: itemSize)
|
||||||
.position(x: itemSize / 2.0 + floor(CGFloat(i % columnCount) * itemSize * (1.0 + defaultPaddingFraction)), y: rowOffset[i / columnCount])
|
.position(x: floor(horizontalInsetFraction * geometry.size.width + itemSize / 2.0 + CGFloat(i % columnCount) * (itemSize + horizontalSpacingFraction * geometry.size.width)), y: floor(verticalInsetFraction * geometry.size.height + itemSize / 2.0 + CGFloat(i / columnCount) * (itemSize + verticalSpacingFraction * geometry.size.height)))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -321,7 +333,7 @@ struct WidgetView: View {
|
|||||||
ZStack {
|
ZStack {
|
||||||
peerViews()
|
peerViews()
|
||||||
}
|
}
|
||||||
.padding(.all)
|
.padding(0.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,7 +429,7 @@ struct Static_Widget: Widget {
|
|||||||
return IntentConfiguration(kind: kind, intent: SelectFriendsIntent.self, provider: Provider(), content: { entry in
|
return IntentConfiguration(kind: kind, intent: SelectFriendsIntent.self, provider: Provider(), content: { entry in
|
||||||
WidgetView(data: getWidgetData(contents: entry.contents))
|
WidgetView(data: getWidgetData(contents: entry.contents))
|
||||||
})
|
})
|
||||||
.supportedFamilies([.systemSmall, .systemMedium, .systemLarge])
|
.supportedFamilies([.systemSmall, .systemMedium])
|
||||||
.configurationDisplayName(presentationData.widgetGalleryTitle)
|
.configurationDisplayName(presentationData.widgetGalleryTitle)
|
||||||
.description(presentationData.widgetGalleryDescription)
|
.description(presentationData.widgetGalleryDescription)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user