Skip to content

Commit

Permalink
feat: 添加统计功能 (#56)
Browse files Browse the repository at this point in the history
* feat: 统计输入

* feat: 关闭首选项窗口之后,释放内存

* feat: 添加清除统计数据的能力,可选择启用是否启用数据统计

* fix: 移除sqlite.swift依赖

* fix: 修复统计设置不生效的问题

* feat: 添加数据库迁移能力

* fix: 移除过时的依赖项

* feat: 使用sqlcipher加密数据库

Co-authored-by: qwertyyb <qwertyyb@qq.com>
  • Loading branch information
qwertyyb and qwertyyb authored May 28, 2022
1 parent 8cf4de8 commit b01d305
Show file tree
Hide file tree
Showing 18 changed files with 724 additions and 60 deletions.
53 changes: 47 additions & 6 deletions Fire.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
45577E502543F03F0064325B /* build.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45577E4F2543F03F0064325B /* build.swift */; };
45577E562543F4060064325B /* wb_table.txt in Resources */ = {isa = PBXBuildFile; fileRef = 45577E552543F4060064325B /* wb_table.txt */; };
45577E6225442E240064325B /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 45577E6125442E240064325B /* main.cpp */; };
45577E6925442EED0064325B /* libsqlite3.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 45577E6825442EED0064325B /* libsqlite3.tbd */; };
45577E8425443E290064325B /* TableBuilder in CopyFiles */ = {isa = PBXBuildFile; fileRef = 45577E5F25442E240064325B /* TableBuilder */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
45577E92254448B80064325B /* py_table.txt in Resources */ = {isa = PBXBuildFile; fileRef = 45577E91254448B80064325B /* py_table.txt */; };
45577EA1254552110064325B /* ThesaurusPane.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45577EA0254552110064325B /* ThesaurusPane.swift */; };
Expand All @@ -31,13 +30,16 @@
45DB6EC927E609CB00A39925 /* ThemePane.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45DB6EC827E609CB00A39925 /* ThemePane.swift */; };
45DCE62226A31F140009FED1 /* ApplicationSettingCache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45DCE62126A31F140009FED1 /* ApplicationSettingCache.swift */; };
45E85F742573BE1800F71024 /* wb_98_table.txt in Resources */ = {isa = PBXBuildFile; fileRef = 45E85F732573BE1800F71024 /* wb_98_table.txt */; };
45EBB54E283A073000A56CBA /* Statistics.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45EBB54D283A073000A56CBA /* Statistics.swift */; };
45EBB550283A311C00A56CBA /* StatisticsPane.swift in Sources */ = {isa = PBXBuildFile; fileRef = 45EBB54F283A311C00A56CBA /* StatisticsPane.swift */; };
673A400C253D9FE70003901E /* InputSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673A400B253D9FE70003901E /* InputSource.swift */; };
673C416925468A4800F462A3 /* FireMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673C416825468A4800F462A3 /* FireMenu.swift */; };
673C417225468FFA00F462A3 /* ModifierKeyUpChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673C417125468FFA00F462A3 /* ModifierKeyUpChecker.swift */; };
673C4178254697E400F462A3 /* TipsWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 673C4177254697E400F462A3 /* TipsWindow.swift */; };
677A0874254BD47D000B58D4 /* ToastWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 677A0873254BD47D000B58D4 /* ToastWindow.swift */; };
67E8B515233B97FD00D7CE80 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 67E8B517233B97FD00D7CE80 /* InfoPlist.strings */; };
67E8B521233C537B00D7CE80 /* fire.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 67E8B51E233C537B00D7CE80 /* fire.pdf */; };
AD9F20E5BBFCFE438EB5AADC /* libPods-TableBuilder.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F201F29A49FB26FAD4B666CC /* libPods-TableBuilder.a */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -85,7 +87,6 @@
45577E552543F4060064325B /* wb_table.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wb_table.txt; sourceTree = "<group>"; };
45577E5F25442E240064325B /* TableBuilder */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TableBuilder; sourceTree = BUILT_PRODUCTS_DIR; };
45577E6125442E240064325B /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = "<group>"; };
45577E6825442EED0064325B /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = usr/lib/libsqlite3.tbd; sourceTree = SDKROOT; };
45577E91254448B80064325B /* py_table.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = py_table.txt; sourceTree = "<group>"; };
45577EA0254552110064325B /* ThesaurusPane.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThesaurusPane.swift; sourceTree = "<group>"; };
45577EAF254575480064325B /* types.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = types.swift; sourceTree = "<group>"; };
Expand All @@ -94,11 +95,15 @@
45752EBD253C98AB0009F2F0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
459DE98E232EB26500A3ACD1 /* CandidatesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CandidatesView.swift; sourceTree = "<group>"; };
459DE98F232EB26500A3ACD1 /* CandidatesWindow.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CandidatesWindow.swift; sourceTree = "<group>"; };
45ACDE1A2841C52500658F46 /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; };
45D996A9253C5232001460A8 /* GeneralPane.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralPane.swift; sourceTree = "<group>"; };
45DB6EC627E5B8FE00A39925 /* ThemeConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemeConfig.swift; sourceTree = "<group>"; };
45DB6EC827E609CB00A39925 /* ThemePane.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemePane.swift; sourceTree = "<group>"; };
45DCE62126A31F140009FED1 /* ApplicationSettingCache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApplicationSettingCache.swift; sourceTree = "<group>"; };
45E85F732573BE1800F71024 /* wb_98_table.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = wb_98_table.txt; sourceTree = "<group>"; };
45EBB54D283A073000A56CBA /* Statistics.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Statistics.swift; sourceTree = "<group>"; };
45EBB54F283A311C00A56CBA /* StatisticsPane.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatisticsPane.swift; sourceTree = "<group>"; };
63CA87FF28AC32324A6D50A5 /* Pods-TableBuilder.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TableBuilder.release.xcconfig"; path = "Target Support Files/Pods-TableBuilder/Pods-TableBuilder.release.xcconfig"; sourceTree = "<group>"; };
673A400B253D9FE70003901E /* InputSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InputSource.swift; sourceTree = "<group>"; };
673C416825468A4800F462A3 /* FireMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FireMenu.swift; sourceTree = "<group>"; };
673C417125468FFA00F462A3 /* ModifierKeyUpChecker.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModifierKeyUpChecker.swift; sourceTree = "<group>"; };
Expand All @@ -109,8 +114,10 @@
67E8B518233B994000D7CE80 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
67E8B51E233C537B00D7CE80 /* fire.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = fire.pdf; sourceTree = "<group>"; };
79993C01BC909D0DEEFF5E1F /* Pods-Fire.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Fire.debug.xcconfig"; path = "Target Support Files/Pods-Fire/Pods-Fire.debug.xcconfig"; sourceTree = "<group>"; };
84E31A001A3B997360EE5A42 /* Pods-TableBuilder.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-TableBuilder.debug.xcconfig"; path = "Target Support Files/Pods-TableBuilder/Pods-TableBuilder.debug.xcconfig"; sourceTree = "<group>"; };
C9B35A5256409EF1557C898C /* Pods-Fire.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Fire.release.xcconfig"; path = "Target Support Files/Pods-Fire/Pods-Fire.release.xcconfig"; sourceTree = "<group>"; };
FEC7043EB25D21E0E0098AA7 /* libPods-Fire.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Fire.a"; sourceTree = BUILT_PRODUCTS_DIR; };
E5C980F68E92FC39F4BB0E86 /* libPods-Fire.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Fire.a"; sourceTree = BUILT_PRODUCTS_DIR; };
F201F29A49FB26FAD4B666CC /* libPods-TableBuilder.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-TableBuilder.a"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -126,7 +133,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
45577E6925442EED0064325B /* libsqlite3.tbd in Frameworks */,
AD9F20E5BBFCFE438EB5AADC /* libPods-TableBuilder.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand All @@ -138,6 +145,8 @@
children = (
79993C01BC909D0DEEFF5E1F /* Pods-Fire.debug.xcconfig */,
C9B35A5256409EF1557C898C /* Pods-Fire.release.xcconfig */,
84E31A001A3B997360EE5A42 /* Pods-TableBuilder.debug.xcconfig */,
63CA87FF28AC32324A6D50A5 /* Pods-TableBuilder.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
Expand Down Expand Up @@ -185,16 +194,17 @@
45587F2C24E8FBFB005F291B /* Utils.swift */,
673A400B253D9FE70003901E /* InputSource.swift */,
45577EAF254575480064325B /* types.swift */,
45ACDE1A2841C52500658F46 /* Bridging-Header.h */,
);
path = Fire;
sourceTree = "<group>";
};
451E6057232E2786007B0463 /* Frameworks */ = {
isa = PBXGroup;
children = (
45577E6825442EED0064325B /* libsqlite3.tbd */,
451E6058232E2787007B0463 /* InputMethodKit.framework */,
FEC7043EB25D21E0E0098AA7 /* libPods-Fire.a */,
E5C980F68E92FC39F4BB0E86 /* libPods-Fire.a */,
F201F29A49FB26FAD4B666CC /* libPods-TableBuilder.a */,
);
name = Frameworks;
sourceTree = "<group>";
Expand Down Expand Up @@ -233,6 +243,7 @@
45577EB3254576720064325B /* FirePreferencesController.swift */,
450B7D9926A2847D00808A4D /* ApplicationPane.swift */,
45DB6EC827E609CB00A39925 /* ThemePane.swift */,
45EBB54F283A311C00A56CBA /* StatisticsPane.swift */,
);
path = Preferences;
sourceTree = "<group>";
Expand All @@ -252,6 +263,7 @@
673C4177254697E400F462A3 /* TipsWindow.swift */,
677A0873254BD47D000B58D4 /* ToastWindow.swift */,
45DCE62126A31F140009FED1 /* ApplicationSettingCache.swift */,
45EBB54D283A073000A56CBA /* Statistics.swift */,
);
path = Utils;
sourceTree = "<group>";
Expand Down Expand Up @@ -285,6 +297,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 45577E6325442E240064325B /* Build configuration list for PBXNativeTarget "TableBuilder" */;
buildPhases = (
C7675FA4C92181CC4346D885 /* [CP] Check Pods Manifest.lock */,
45577E5B25442E240064325B /* Sources */,
45577E5C25442E240064325B /* Frameworks */,
45577E5D25442E240064325B /* CopyFiles */,
Expand Down Expand Up @@ -400,6 +413,28 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
C7675FA4C92181CC4346D885 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-TableBuilder-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
F59BCE8B8FEBA89F5AC70F62 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -431,10 +466,12 @@
45587F2D24E8FBFB005F291B /* Utils.swift in Sources */,
45577E502543F03F0064325B /* build.swift in Sources */,
45D996AA253C5232001460A8 /* GeneralPane.swift in Sources */,
45EBB54E283A073000A56CBA /* Statistics.swift in Sources */,
673C416925468A4800F462A3 /* FireMenu.swift in Sources */,
451E6048232E227B007B0463 /* AppDelegate.swift in Sources */,
45DB6EC927E609CB00A39925 /* ThemePane.swift in Sources */,
673A400C253D9FE70003901E /* InputSource.swift in Sources */,
45EBB550283A311C00A56CBA /* StatisticsPane.swift in Sources */,
459DE991232EB26600A3ACD1 /* CandidatesWindow.swift in Sources */,
45577EB0254575480064325B /* types.swift in Sources */,
45577EB4254576720064325B /* FirePreferencesController.swift in Sources */,
Expand Down Expand Up @@ -625,6 +662,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.qwertyyb.inputmethod.Fire;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "$SRCROOT/Fire/Bridging-Header.h";
SWIFT_VERSION = 5.0;
SYMROOT = build;
};
Expand Down Expand Up @@ -654,13 +692,15 @@
PRODUCT_BUNDLE_IDENTIFIER = com.qwertyyb.inputmethod.Fire;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "$SRCROOT/Fire/Bridging-Header.h";
SWIFT_VERSION = 5.0;
SYMROOT = build;
};
name = Release;
};
45577E6425442E240064325B /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 84E31A001A3B997360EE5A42 /* Pods-TableBuilder.debug.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
Expand All @@ -675,6 +715,7 @@
};
45577E6525442E240064325B /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 63CA87FF28AC32324A6D50A5 /* Pods-TableBuilder.release.xcconfig */;
buildSettings = {
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
Expand Down
84 changes: 84 additions & 0 deletions Fire.xcodeproj/xcshareddata/xcschemes/build-dict.xcscheme
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1330"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "451E6043232E227B007B0463"
BuildableName = "Fire.app"
BlueprintName = "Fire"
ReferencedContainer = "container:Fire.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "451E6043232E227B007B0463"
BuildableName = "Fire.app"
BlueprintName = "Fire"
ReferencedContainer = "container:Fire.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<CommandLineArguments>
<CommandLineArgument
argument = "--build-dict"
isEnabled = "YES">
</CommandLineArgument>
</CommandLineArguments>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "451E6043232E227B007B0463"
BuildableName = "Fire.app"
BlueprintName = "Fire"
ReferencedContainer = "container:Fire.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
2 changes: 2 additions & 0 deletions Fire/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import InputMethodKit
class AppDelegate: NSObject, NSApplicationDelegate {

var fire: Fire!
var statistics: Statistics!

func installInputSource() {
print("install input source")
Expand Down Expand Up @@ -44,6 +45,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}
NSLog("[Fire] app is running")
fire = Fire.shared
statistics = Statistics.shared
}

func applicationWillTerminate(_ aNotification: Notification) {
Expand Down
14 changes: 14 additions & 0 deletions Fire/Bridging-Header.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// Bridging-Header.h
// Fire
//
// Created by 虚幻 on 2022/5/28.
// Copyright © 2022 qwertyyb. All rights reserved.
//

#ifndef Bridging_Header_h
#define Bridging_Header_h

#import "SQLCipher/sqlite3.h"

#endif /* Bridging_Header_h */
7 changes: 5 additions & 2 deletions Fire/Fire.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import Cocoa
import InputMethodKit
import SQLite3
import Sparkle
import Defaults

Expand All @@ -28,11 +27,15 @@ extension UserDefaults {
internal let SQLITE_TRANSIENT = unsafeBitCast(-1, to: sqlite3_destructor_type.self)

class Fire: NSObject {
// SwiftUI 界面事件
static let candidateSelected = Notification.Name("Fire.candidateSelected")
static let candidateListUpdated = Notification.Name("Fire.candidateListUpdated")
static let nextPageBtnTapped = Notification.Name("Fire.nextPageBtnTapped")
static let prevPageBtnTapped = Notification.Name("Fire.prevPageBtnTapped")

// 逻辑
static let candidateInserted = Notification.Name("Fire.candidateInserted")

private var database: OpaquePointer?
private var queryStatement: OpaquePointer?
private var preferencesObserver: Defaults.Observation!
Expand Down Expand Up @@ -156,7 +159,7 @@ class Fire: NSObject {
candidates = Array(candidates.prefix(count))

if candidates.isEmpty {
candidates.append(Candidate(code: origin, text: origin, type: "wb"))
candidates.append(Candidate(code: origin, text: origin, type: "wb", isPlaceholder: true))
}

return (candidates, hasNext: allCount > count)
Expand Down
Loading

0 comments on commit b01d305

Please sign in to comment.