Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

ensu ios: use real Rive animation for drawer and streaming

Prateek Sunal3c45999e92e5
diff --git a/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxproj b/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxproj
index c4caaf9d8d..ac8fcb2107 100644
--- a/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxproj
+++ b/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.pbxproj
@@ -17,6 +17,8 @@
DBA3E91D2F7A6B9000AA11BB /* SwiftMath in Frameworks (macOS) */ = {isa = PBXBuildFile; productRef = DBA3E91B2F7A6B9000AA11BB /* SwiftMath */; };
DB9F1C3C2F9D123400ABCD02 /* Markdown in Frameworks */ = {isa = PBXBuildFile; productRef = DB9F1C3B2F9D123400ABCD02 /* Markdown */; };
DB9F1C3D2F9D123400ABCD02 /* Markdown in Frameworks (macOS) */ = {isa = PBXBuildFile; productRef = DB9F1C3B2F9D123400ABCD02 /* Markdown */; };
+ DBC1A0032FD0123400ABCD02 /* RiveRuntime in Frameworks */ = {isa = PBXBuildFile; productRef = DBC1A0022FD0123400ABCD02 /* RiveRuntime */; };
+ DBC1A0042FD0123400ABCD02 /* RiveRuntime in Frameworks (macOS) */ = {isa = PBXBuildFile; productRef = DBC1A0022FD0123400ABCD02 /* RiveRuntime */; };
/* End PBXBuildFile section */
@@ -69,6 +71,7 @@
DAF584672E61BB8300F8A08F /* ZIPFoundation in Frameworks */,
DBA3E91C2F7A6B9000AA11BB /* SwiftMath in Frameworks */,
DB9F1C3C2F9D123400ABCD02 /* Markdown in Frameworks */,
+ DBC1A0032FD0123400ABCD02 /* RiveRuntime in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -81,6 +84,7 @@
DAF584682E61BB8300F8A08F /* ZIPFoundation in Frameworks (macOS) */,
DBA3E91D2F7A6B9000AA11BB /* SwiftMath in Frameworks (macOS) */,
DB9F1C3D2F9D123400ABCD02 /* Markdown in Frameworks (macOS) */,
+ DBC1A0042FD0123400ABCD02 /* RiveRuntime in Frameworks (macOS) */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -152,6 +156,7 @@
DAF584662E61BB8300F8A08F /* ZIPFoundation */,
DBA3E91B2F7A6B9000AA11BB /* SwiftMath */,
DB9F1C3B2F9D123400ABCD02 /* Markdown */,
+ DBC1A0022FD0123400ABCD02 /* RiveRuntime */,
);
productName = ensu;
productReference = DA72BC612E5F87A000D128FF /* ensu.app */;
@@ -180,6 +185,7 @@
DAF584662E61BB8300F8A08F /* ZIPFoundation */,
DBA3E91B2F7A6B9000AA11BB /* SwiftMath */,
DB9F1C3B2F9D123400ABCD02 /* Markdown */,
+ DBC1A0022FD0123400ABCD02 /* RiveRuntime */,
);
productName = Ensu;
productReference = 77E1DDDF900AB047CB554122 /* Ensu.app */;
@@ -266,6 +272,7 @@
DBA3E91A2F7A6B9000AA11BB /* XCRemoteSwiftPackageReference "SwiftMath" */,
DAF584652E61BB6300F8A08F /* XCRemoteSwiftPackageReference "ZIPFoundation" */,
DB9F1C3A2F9D123400ABCD02 /* XCRemoteSwiftPackageReference "swift-markdown" */,
+ DBC1A0012FD0123400ABCD02 /* XCRemoteSwiftPackageReference "rive-ios" */,
);
preferredProjectObjectVersion = 77;
productRefGroup = DA72BC622E5F87A000D128FF /* Products */;
@@ -902,6 +909,14 @@
minimumVersion = 1.7.3;
};
};
+ DBC1A0012FD0123400ABCD02 /* XCRemoteSwiftPackageReference "rive-ios" */ = {
+ isa = XCRemoteSwiftPackageReference;
+ repositoryURL = "https://github.com/rive-app/rive-ios.git";
+ requirement = {
+ kind = upToNextMajorVersion;
+ minimumVersion = 6.9.0;
+ };
+ };
/* End XCRemoteSwiftPackageReference section */
/* Begin XCSwiftPackageProductDependency section */
@@ -928,6 +943,11 @@
package = DB9F1C3A2F9D123400ABCD02 /* XCRemoteSwiftPackageReference "swift-markdown" */;
productName = Markdown;
};
+ DBC1A0022FD0123400ABCD02 /* RiveRuntime */ = {
+ isa = XCSwiftPackageProductDependency;
+ package = DBC1A0012FD0123400ABCD02 /* XCRemoteSwiftPackageReference "rive-ios" */;
+ productName = RiveRuntime;
+ };
/* End XCSwiftPackageProductDependency section */
};
rootObject = DA72BC592E5F87A000D128FF /* Project object */;
diff --git a/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
index d9313608e5..92ceb566dc 100644
--- a/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
+++ b/mobile/native/darwin/Apps/ensu/ensu.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -1,6 +1,15 @@
{
- "originHash" : "a291d59db9116c12b165f53ad1571f7fedc3d45784c5fb90ee54a4b50d191411",
+ "originHash" : "df4c339047e0bba04154f554ebecda553116891c5ddcb81d37ef7d8676e1f66d",
"pins" : [
+ {
+ "identity" : "rive-ios",
+ "kind" : "remoteSourceControl",
+ "location" : "https://github.com/rive-app/rive-ios.git",
+ "state" : {
+ "revision" : "388cebf85b8fc2258b93f86dd3e26a30fb070fd0",
+ "version" : "6.15.1"
+ }
+ },
{
"identity" : "swift-cmark",
"kind" : "remoteSourceControl",
@@ -29,21 +38,21 @@
}
},
{
- "identity" : "swiftmath",
+ "identity" : "swift-tagged",
"kind" : "remoteSourceControl",
- "location" : "https://github.com/mgriebling/SwiftMath.git",
+ "location" : "https://github.com/pointfreeco/swift-tagged.git",
"state" : {
- "revision" : "fa8244ed032f4a1ade4cb0571bf87d2f1a9fd2d7",
- "version" : "1.7.3"
+ "revision" : "3907a9438f5b57d317001dc99f3f11b46882272b",
+ "version" : "0.10.0"
}
},
{
- "identity" : "swift-tagged",
+ "identity" : "swiftmath",
"kind" : "remoteSourceControl",
- "location" : "https://github.com/pointfreeco/swift-tagged.git",
+ "location" : "https://github.com/mgriebling/SwiftMath.git",
"state" : {
- "revision" : "3907a9438f5b57d317001dc99f3f11b46882272b",
- "version" : "0.10.0"
+ "revision" : "fa8244ed032f4a1ade4cb0571bf87d2f1a9fd2d7",
+ "version" : "1.7.3"
}
},
{
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Chat/SessionDrawerView.swift b/mobile/native/darwin/Apps/ensu/ensu/Chat/SessionDrawerView.swift
index 9584ecec93..f63d29edf1 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Chat/SessionDrawerView.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Chat/SessionDrawerView.swift
@@ -79,7 +79,7 @@ struct SessionDrawerView: View {
}
private var drawerLogo: some View {
- EnsuBrandIllustration(width: 32, height: 32)
+ EnsuBrandIllustration(width: 124, height: 32)
}
private var headerControls: some View {
diff --git a/mobile/native/darwin/Apps/ensu/ensu/Components/EnsuBrandIllustration.swift b/mobile/native/darwin/Apps/ensu/ensu/Components/EnsuBrandIllustration.swift
index 17d1574cdc..50c1826bb7 100644
--- a/mobile/native/darwin/Apps/ensu/ensu/Components/EnsuBrandIllustration.swift
+++ b/mobile/native/darwin/Apps/ensu/ensu/Components/EnsuBrandIllustration.swift
@@ -1,33 +1,36 @@
import SwiftUI
+import RiveRuntime
struct EnsuBrandIllustration: View {
var width: CGFloat = 92
var height: CGFloat = 42
var animated: Bool = true
- @State private var isAnimating = false
+ @StateObject private var riveViewModel = RiveViewModel(
+ fileName: "ensu",
+ fit: .contain,
+ alignment: .centerLeft,
+ autoPlay: true
+ )
var body: some View {
- let activePhase = animated ? isAnimating : true
-
- Image("EnsuLogoForeground")
- .resizable()
- .scaledToFit()
+ riveViewModel
+ .view()
.frame(width: width, height: height, alignment: .leading)
- .scaleEffect(activePhase ? 1 : 0.94)
- .opacity(activePhase ? 1 : 0.84)
- .animation(
- animated
- ? .easeInOut(duration: 0.9).repeatForever(autoreverses: true)
- : nil,
- value: isAnimating
- )
+ .clipped()
.onAppear {
- guard animated else { return }
- isAnimating = true
+ if animated {
+ riveViewModel.play()
+ } else {
+ riveViewModel.pause()
+ }
}
- .onDisappear {
- isAnimating = false
+ .onChange(of: animated) { value in
+ if value {
+ riveViewModel.play()
+ } else {
+ riveViewModel.pause()
+ }
}
.accessibilityLabel("Ensu")
}
diff --git a/mobile/native/darwin/Apps/ensu/ensu/ensu.riv b/mobile/native/darwin/Apps/ensu/ensu/ensu.riv
new file mode 100644
index 0000000000..35f4f64d35
Binary files /dev/null and b/mobile/native/darwin/Apps/ensu/ensu/ensu.riv differ