Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(UI): add Confetti effets to about views #535

Merged
merged 19 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions Easydict.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@
A0B65CA0F31AC8ECFB8347CC /* Pods_EasydictTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 378E73A7EA8FC8FB9C975A63 /* Pods_EasydictTests.framework */; };
B87AC7E36367075BA5D13234 /* Pods_Easydict.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6372B33DFF803C7096A82250 /* Pods_Easydict.framework */; };
C415C0AD2B450D4800A9D231 /* GeminiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C415C0AC2B450D4800A9D231 /* GeminiService.swift */; };
C4BFDD7A2BE61F550094026B /* Vortex in Frameworks */ = {isa = PBXBuildFile; productRef = C4BFDD792BE61F550094026B /* Vortex */; };
C4DD01E92B12B3C80025EE8E /* TencentService.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4DD01E82B12B3C80025EE8E /* TencentService.swift */; };
C4DD01EB2B12BA250025EE8E /* TencentResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4DD01EA2B12BA250025EE8E /* TencentResponse.swift */; };
C4DD01ED2B12BE9B0025EE8E /* TencentTranslateType.swift in Sources */ = {isa = PBXBuildFile; fileRef = C4DD01EC2B12BE9B0025EE8E /* TencentTranslateType.swift */; };
Expand Down Expand Up @@ -891,6 +892,7 @@
files = (
0AC8A84F2B6DFDD4006DA5CC /* SettingsAccess in Frameworks */,
03022F192B3591AE00B63209 /* GoogleGenerativeAI in Frameworks */,
C4BFDD7A2BE61F550094026B /* Vortex in Frameworks */,
2721E4D02AFE920700A059AC /* Alamofire in Frameworks */,
03022F1F2B36CF3100B63209 /* SwiftShell in Frameworks */,
038030952B4106800009230C /* CocoaLumberjack in Frameworks */,
Expand Down Expand Up @@ -2633,6 +2635,7 @@
03022F182B3591AE00B63209 /* GoogleGenerativeAI */,
0AC8A84E2B6DFDD4006DA5CC /* SettingsAccess */,
03779F192BB25797008D3C42 /* OpenAI */,
C4BFDD792BE61F550094026B /* Vortex */,
);
productName = Bob;
productReference = C99EEB182385796700FEE666 /* Easydict-debug.app */;
Expand Down Expand Up @@ -2696,6 +2699,7 @@
03022F172B3591AE00B63209 /* XCRemoteSwiftPackageReference "generative-ai-swift" */,
0AC8A84D2B6DFDD4006DA5CC /* XCRemoteSwiftPackageReference "SettingsAccess" */,
03779F182BB25797008D3C42 /* XCRemoteSwiftPackageReference "OpenAI" */,
C4BFDD782BE61F550094026B /* XCRemoteSwiftPackageReference "Vortex" */,
);
productRefGroup = C99EEB192385796700FEE666 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -3297,7 +3301,7 @@
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_PREFIX_HEADER = "$(SRCROOT)/Easydict/App/PrefixHeader.pch";
GENERATE_INFOPLIST_FILE = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 13.0;
tisfeng marked this conversation as resolved.
Show resolved Hide resolved
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.izual.EasydictTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -3322,7 +3326,7 @@
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
GCC_PREFIX_HEADER = "$(SRCROOT)/Easydict/App/PrefixHeader.pch";
GENERATE_INFOPLIST_FILE = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.izual.EasydictTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -3350,7 +3354,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 2.7.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.izual.EasydictHelper-debug";
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -3376,7 +3380,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 2.7.1;
PRODUCT_BUNDLE_IDENTIFIER = com.izual.EasydictHelper;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down Expand Up @@ -3441,7 +3445,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
ONLY_ACTIVE_ARCH = YES;
Expand Down Expand Up @@ -3501,7 +3505,7 @@
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
MACOSX_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
SDKROOT = macosx;
Expand Down Expand Up @@ -3537,7 +3541,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 2.7.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.izual.Easydict-debug";
PRODUCT_MODULE_NAME = Easydict;
Expand Down Expand Up @@ -3577,7 +3581,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 11.0;
MACOSX_DEPLOYMENT_TARGET = 13.0;
MARKETING_VERSION = 2.7.1;
PRODUCT_BUNDLE_IDENTIFIER = com.izual.Easydict;
PRODUCT_MODULE_NAME = Easydict;
Expand Down Expand Up @@ -3768,6 +3772,14 @@
minimumVersion = 4.2.0;
};
};
C4BFDD782BE61F550094026B /* XCRemoteSwiftPackageReference "Vortex" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/twostraws/Vortex";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.1;
};
};
EA3B81FA2B52555C004C0E8B /* XCRemoteSwiftPackageReference "Defaults" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/sindresorhus/Defaults.git";
Expand Down Expand Up @@ -3874,6 +3886,11 @@
package = 967712E82B5B913600105E0F /* XCRemoteSwiftPackageReference "KeyHolder" */;
productName = KeyHolder;
};
C4BFDD792BE61F550094026B /* Vortex */ = {
isa = XCSwiftPackageProductDependency;
package = C4BFDD782BE61F550094026B /* XCRemoteSwiftPackageReference "Vortex" */;
productName = Vortex;
};
EA3B81FB2B52555C004C0E8B /* Defaults */ = {
isa = XCSwiftPackageProductDependency;
package = EA3B81FA2B52555C004C0E8B /* XCRemoteSwiftPackageReference "Defaults" */;
Expand Down
11 changes: 10 additions & 1 deletion Easydict.xcworkspace/xcshareddata/swiftpm/Package.resolved
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"originHash" : "ca4d31aa1a70fb6a354fe9e139a2e74a189e4fcff55ed959a3adc71522905fc4",
"originHash" : "3fbe4aaa777ce32c89a8c0750e2e78cb417a4bf7e5ece00eb7338b15ca5d7f65",
"pins" : [
{
"identity" : "abseil-cpp-binary",
Expand Down Expand Up @@ -298,6 +298,15 @@
"version" : "5.1.0"
}
},
{
"identity" : "vortex",
"kind" : "remoteSourceControl",
"location" : "https://github.com/twostraws/Vortex",
"state" : {
"revision" : "bb48b128d3c13c68c68e83833c622eec9f6c701f",
"version" : "1.0.1"
}
},
{
"identity" : "ziparchive",
"kind" : "remoteSourceControl",
Expand Down
110 changes: 71 additions & 39 deletions Easydict/Swift/View/SettingView/Tabs/TabView/AboutTab.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
//

import SwiftUI
import Vortex

// MARK: - SettingsAboutTab

Expand All @@ -27,50 +28,81 @@ struct AboutTab: View {
// MARK: Internal

var body: some View {
HStack(alignment: .center, spacing: 30) {
Image(.logo)
.resizable()
.frame(width: 100, height: 100)
.padding()
.shadow(color: .gray, radius: 1, x: 0, y: 0.8)

VStack(alignment: .leading) {
VStack(alignment: .leading) {
Text(appName)
.font(.system(size: 35, weight: .medium))
.padding(.top, 25)
.padding(.bottom, 3)

Text("current_version \(version)")
.font(.system(size: 13))
.foregroundColor(.gray)

Text(copyrightInfo)
.font(.system(size: 11))
.foregroundColor(.gray)
.padding(.top, 25)
.padding(.bottom, 20)
}

HStack(spacing: 15) {
Button {
NSWorkspace.shared.open(URL(string: "https://github.com/tisfeng/Easydict")!)
} label: {
Label("github_link", systemImage: "star.fill")
.frame(width: 120, height: 20)
VortexViewReader { proxy in
GeometryReader { geometry in
ZStack {
VortexView(.confetti) {
Rectangle()
.fill(.white)
.frame(width: 16, height: 16)
.tag("square")

Circle()
.fill(.white)
.frame(width: 16)
.tag("circle")
}

Button {
NSWorkspace.shared
.open(URL(string: "https://github.com/tisfeng/Easydict/graphs/contributors")!)
} label: {
Label("contributor_link", systemImage: "person.3.sequence.fill")
.frame(width: 120, height: 20)
.frame(height: 220)

HStack(alignment: .center, spacing: 30) {
Image("logo") // Make sure to use the correct image name as a string
.resizable()
.renderingMode(.original)
.frame(width: 100, height: 100)
.shadow(color: .gray, radius: 1, x: 0, y: 0.8)
.padding(.bottom, 33)
.padding(.leading, 16)
.padding(.trailing, 16)
.onTapGesture {
proxy.move(
to: CGPoint(
// Unify x-point for Settings and Menubar About view
x: (geometry.size.width / 2) - 159.5,
y: 70
tisfeng marked this conversation as resolved.
Show resolved Hide resolved
)
)
proxy.burst()
}
VStack(alignment: .leading) {
VStack(alignment: .leading) {
Text(appName)
.font(.system(size: 35, weight: .medium))
.padding(.bottom, 3)

Text("current_version \(version)")
.font(.system(size: 13))
.foregroundColor(.gray)
.padding(.bottom, 29)

Text(copyrightInfo)
.font(.system(size: 11))
.foregroundColor(.gray)
.padding(.bottom, 20)
}

HStack(spacing: 15) {
Button {
NSWorkspace.shared.open(URL(string: "https://github.com/tisfeng/Easydict")!)
} label: {
Label("github_link", systemImage: "star.fill")
.frame(width: 120, height: 20)
}

Button {
NSWorkspace.shared
.open(URL(string: "https://github.com/tisfeng/Easydict/graphs/contributors")!)
} label: {
Label("contributor_link", systemImage: "person.3.sequence.fill")
.frame(width: 120, height: 20)
}
}
.padding(.bottom, 10)
}
}
.frame(maxWidth: .infinity)
}
}
}
.frame(maxWidth: .infinity)
}

// MARK: Private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ + (NSString *)getDeviceModel {

/// Get device UUID, 4F07896A-1580-5270-A0E8-D7FA9DFA6868
+ (NSString *)getDeviceUUID {
io_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
io_service_t platformExpert = IOServiceGetMatchingService(kIOMainPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
CFStringRef uuidString = (CFStringRef)IORegistryEntryCreateCFProperty(platformExpert, CFSTR("IOPlatformUUID"), kCFAllocatorDefault, 0);
NSString *uuid = (__bridge NSString *)(uuidString);
IOObjectRelease(platformExpert);
Expand Down