Skip to content

Commit f88e621

Browse files
authored
Merge pull request #1263 from DimensionDev/feature/ios_media_screen
add media screen for status
2 parents 9558232 + b1fd0f0 commit f88e621

File tree

16 files changed

+421
-49
lines changed

16 files changed

+421
-49
lines changed

desktopApp/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ compose.desktop {
4949
nativeDistributions {
5050
targetFormats(TargetFormat.Pkg)
5151
packageName = "Flare"
52-
packageVersion = "1.0.0"
52+
packageVersion = "1.0.1"
5353
macOS {
5454
val file = project.file("signing.properties")
5555
val hasSigningProps = file.exists()
56-
packageBuildVersion = System.getenv("BUILD_NUMBER") ?: "24"
56+
packageBuildVersion = System.getenv("BUILD_NUMBER") ?: "26"
5757
bundleID = "dev.dimension.flare"
5858
minimumSystemVersion = "14.0"
5959
appStore = hasSigningProps

iosApp/Flare.xcodeproj/project.pbxproj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
0646B2622E7151A700535A3E /* Kingfisher in Frameworks */ = {isa = PBXBuildFile; productRef = 0646B2612E7151A700535A3E /* Kingfisher */; };
1111
068F7CD12E75405A00B5FB40 /* MarkdownUI in Frameworks */ = {isa = PBXBuildFile; productRef = 068F7CD02E75405A00B5FB40 /* MarkdownUI */; };
12+
06C7FC172E7D474900A0D01A /* LazyPager in Frameworks */ = {isa = PBXBuildFile; productRef = 06C7FC162E7D474900A0D01A /* LazyPager */; };
1213
/* End PBXBuildFile section */
1314

1415
/* Begin PBXFileReference section */
@@ -41,6 +42,7 @@
4142
isa = PBXFrameworksBuildPhase;
4243
buildActionMask = 2147483647;
4344
files = (
45+
06C7FC172E7D474900A0D01A /* LazyPager in Frameworks */,
4446
068F7CD12E75405A00B5FB40 /* MarkdownUI in Frameworks */,
4547
0646B2622E7151A700535A3E /* Kingfisher in Frameworks */,
4648
);
@@ -89,6 +91,7 @@
8991
packageProductDependencies = (
9092
0646B2612E7151A700535A3E /* Kingfisher */,
9193
068F7CD02E75405A00B5FB40 /* MarkdownUI */,
94+
06C7FC162E7D474900A0D01A /* LazyPager */,
9295
);
9396
productName = flare;
9497
productReference = 06E433FE2E6A9A2600CD0826 /* Flare.app */;
@@ -122,6 +125,7 @@
122125
0646B2602E7151A700535A3E /* XCRemoteSwiftPackageReference "Kingfisher" */,
123126
068F7CCF2E75405A00B5FB40 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */,
124127
06791BD42E7AA40000FF2050 /* XCRemoteSwiftPackageReference "SwiftLintPlugins" */,
128+
06C7FC152E7D474900A0D01A /* XCRemoteSwiftPackageReference "LazyPager" */,
125129
);
126130
preferredProjectObjectVersion = 77;
127131
productRefGroup = 06E433FF2E6A9A2600CD0826 /* Products */;
@@ -431,6 +435,14 @@
431435
version = 2.4.1;
432436
};
433437
};
438+
06C7FC152E7D474900A0D01A /* XCRemoteSwiftPackageReference "LazyPager" */ = {
439+
isa = XCRemoteSwiftPackageReference;
440+
repositoryURL = "https://github.com/gh123man/LazyPager";
441+
requirement = {
442+
kind = exactVersion;
443+
version = 1.1.13;
444+
};
445+
};
434446
/* End XCRemoteSwiftPackageReference section */
435447

436448
/* Begin XCSwiftPackageProductDependency section */
@@ -449,6 +461,11 @@
449461
package = 068F7CCF2E75405A00B5FB40 /* XCRemoteSwiftPackageReference "swift-markdown-ui" */;
450462
productName = MarkdownUI;
451463
};
464+
06C7FC162E7D474900A0D01A /* LazyPager */ = {
465+
isa = XCSwiftPackageProductDependency;
466+
package = 06C7FC152E7D474900A0D01A /* XCRemoteSwiftPackageReference "LazyPager" */;
467+
productName = LazyPager;
468+
};
452469
/* End XCSwiftPackageProductDependency section */
453470
};
454471
rootObject = 06E433F62E6A9A2600CD0826 /* Project object */;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
},
6+
"symbols" : [
7+
{
8+
"filename" : "fa-eye-slash.svg",
9+
"idiom" : "universal"
10+
}
11+
]
12+
}

iosApp/flare/Assets.xcassets/fa-eye-slash.symbolset/fa-eye-slash.svg

Lines changed: 84 additions & 0 deletions
Loading
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"info" : {
3+
"author" : "xcode",
4+
"version" : 1
5+
},
6+
"symbols" : [
7+
{
8+
"filename" : "fa-eye.svg",
9+
"idiom" : "universal"
10+
}
11+
]
12+
}

iosApp/flare/Assets.xcassets/fa-eye.symbolset/fa-eye.svg

Lines changed: 84 additions & 0 deletions
Loading

iosApp/flare/Localizable.xcstrings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,9 @@
914914
}
915915
}
916916
},
917+
"sensitive_button_show" : {
918+
"comment" : "Button to show sensitive media"
919+
},
917920
"settings_title" : {
918921
"localizations" : {
919922
"en" : {

iosApp/flare/UI/Component/MediaView.swift

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,44 @@
11
import SwiftUI
2+
import TipKit
23
import KotlinSharedUI
34

45
struct MediaView: View {
56
let data: UiMedia
7+
@State private var showAlt: Bool = false
68
var body: some View {
79
switch onEnum(of: data) {
810
case .image(let image):
911
NetworkImage(data: image.previewUrl)
1012
.overlay(alignment: .bottomTrailing) {
1113
if let alt = image.description_ {
12-
Text("ALT")
13-
.padding(8)
14-
.background(.black, in: .rect(cornerRadius: 16))
15-
.foregroundStyle(.white)
16-
.padding()
17-
.frame(alignment: .bottomTrailing)
14+
Button {
15+
showAlt.toggle()
16+
} label: {
17+
Text("ALT")
18+
}
19+
.popover(isPresented: $showAlt) {
20+
Text(alt)
21+
.padding()
22+
}
23+
.padding()
24+
.buttonStyle(.glass)
1825
}
1926
}
2027
case .video(let video):
2128
NetworkImage(data: video.thumbnailUrl)
2229
.overlay(alignment: .bottomTrailing) {
2330
if let alt = video.description_ {
24-
Text("ALT")
25-
.padding(8)
26-
.background(.black, in: .rect(cornerRadius: 16))
27-
.foregroundStyle(.white)
28-
.padding()
29-
.frame(alignment: .bottomTrailing)
31+
Button {
32+
showAlt.toggle()
33+
} label: {
34+
Text("ALT")
35+
}
36+
.popover(isPresented: $showAlt) {
37+
Text(alt)
38+
.padding()
39+
}
40+
.padding()
41+
.buttonStyle(.glass)
3042
}
3143
}
3244
.overlay(alignment: .bottomLeading) {
@@ -38,17 +50,22 @@ struct MediaView: View {
3850
.frame(alignment: .bottomLeading)
3951
}
4052
case .gif(let gif):
41-
NetworkImage(data: gif.previewUrl)
53+
NetworkImage(data: gif.url)
4254
.overlay(
4355
alignment: .bottomTrailing
4456
) {
4557
if let alt = gif.description_ {
46-
Text("ALT")
47-
.padding(8)
48-
.background(.black, in: .rect(cornerRadius: 16))
49-
.foregroundStyle(.white)
50-
.padding()
51-
.frame(alignment: .bottomTrailing)
58+
Button {
59+
showAlt.toggle()
60+
} label: {
61+
Text("ALT")
62+
}
63+
.popover(isPresented: $showAlt) {
64+
Text(alt)
65+
.padding()
66+
}
67+
.buttonStyle(.glass)
68+
.padding()
5269
}
5370
}
5471
case .audio(let audio):

iosApp/flare/UI/Component/NetworkImage.swift

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,25 @@ import Kingfisher
33

44
struct NetworkImage: View {
55
let data: URL?
6+
let placeholder: URL?
67
var body: some View {
7-
KFImage
8+
KFAnimatedImage
89
.url(data)
9-
.loadTransition(.blurReplace)
1010
.placeholder {
11-
Rectangle()
12-
.fill(.placeholder)
13-
.redacted(reason: .placeholder)
11+
if let placeholder {
12+
NetworkImage(data: placeholder)
13+
} else {
14+
Rectangle()
15+
.fill(.placeholder)
16+
.redacted(reason: .placeholder)
17+
}
1418
}
15-
.resizable()
19+
.if(placeholder == nil, if: { image in
20+
image.loadTransition(.blurReplace)
21+
}, else: { image in
22+
image
23+
})
24+
// .resizable()
1625
.scaledToFill()
1726
}
1827
}
@@ -21,4 +30,10 @@ extension NetworkImage {
2130
init(data: String) {
2231
self.init(data: .init(string: data))
2332
}
33+
init(data: String, placeholder: String) {
34+
self.init(data: .init(string: data), placeholder: .init(string: placeholder))
35+
}
36+
init(data: URL?) {
37+
self.init(data: data, placeholder: nil)
38+
}
2439
}

iosApp/flare/UI/Component/Status/StatusActionView.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,13 @@ struct StatusActionsView: View {
88
HStack {
99
ForEach(0..<data.count) { index in
1010
let item = data[index]
11-
if index == data.count - 1 {
12-
Spacer()
13-
}
1411
StatusActionView(data: item, useText: false, isFixedWidth: index != data.count - 1)
12+
.if(index == data.count - 1) { view in
13+
view.frame(maxWidth: .infinity, alignment: .trailing)
14+
} else: { view in
15+
view
16+
}
17+
1518
}
1619
}
1720
.labelIconToTitleSpacing(4)
@@ -130,7 +133,7 @@ extension StatusActionItem {
130133
switch colorized.color {
131134
case .contentColor: Color(.label)
132135
case .error: Color(.systemRed)
133-
case .primaryColor: Color.primary
136+
case .primaryColor: Color.accentColor
134137
case .red: Color(.systemRed)
135138
}
136139
} else {

0 commit comments

Comments
 (0)