Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into UI
Browse files Browse the repository at this point in the history
  • Loading branch information
groverlynn committed Feb 26, 2024
2 parents 4ff6944 + 3975d10 commit 10c7dc1
Show file tree
Hide file tree
Showing 20 changed files with 3,539 additions and 2,458 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BasedOnStyle: Chromium
SortIncludes: false
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# apply clang format
ce94f9c4403b9c33d5e251fc7f1e15c44725d881

6 changes: 6 additions & 0 deletions .github/workflows/commit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ jobs:
with:
submodules: true

- name: Install clang-format
run: brew install clang-format

- name: Lint
run: make clang-format-lint

- name: Configure build environment
run: |
echo git_ref_name="$(git describe --always)" >> $GITHUB_ENV
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/pull-request-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ jobs:
with:
submodules: true

- name: Install clang-format
run: brew install clang-format

- name: Lint
run: make clang-format-lint

- name: Configure build environment
run: |
echo git_ref_name="$(git describe --always)" >> $GITHUB_ENV
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/release-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ jobs:
fetch-depth: 0
submodules: true

- name: Install clang-format
run: brew install clang-format

- name: Lint
run: make clang-format-lint

- name: Build Squirrel
run: ./action-build.sh archive

Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ copy-opencc-data:

deps: librime data

clang-format-lint:
find . -name '*.m' -o -name '*.h' -maxdepth 1 | xargs clang-format -Werror --dry-run || { echo Please lint your code by '"'"make clang-format-apply"'"'.; false; }

clang-format-apply:
find . -name '*.m' -o -name '*.h' -maxdepth 1 | xargs clang-format --verbose -i

ifdef ARCHS
BUILD_SETTINGS += ARCHS="$(ARCHS)"
BUILD_SETTINGS += ONLY_ACTIVE_ARCH=NO
Expand Down
20 changes: 20 additions & 0 deletions Squirrel.entitlements
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.temporary-exception.files.home-relative-path.read-write</key>
<array>
<string>/Library/Rime/</string>
</array>
<key>com.apple.security.temporary-exception.mach-register.global-name</key>
<string>Squirrel_1_Connection</string>
<key>com.apple.security.files.bookmarks.app-scope</key>
<true/>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.files.user-selected.read-write</key>
<true/>
<key>com.apple.security.network.client</key>
<true/>
</dict>
</plist>
4 changes: 4 additions & 0 deletions Squirrel.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
44F84AD614E94C490005D70B /* SquirrelPanel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SquirrelPanel.m; sourceTree = "<group>"; };
44FA4D891685997300116C1F /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = "<group>"; };
44FA4D8E16859B2900116C1F /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = "<group>"; };
5BCE17192B81D03D008C8D9E /* Squirrel.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Squirrel.entitlements; sourceTree = "<group>"; };
77AA67DC2588916300A592E2 /* HKVariants.ocd2 */ = {isa = PBXFileReference; lastKnownFileType = file; path = HKVariants.ocd2; sourceTree = "<group>"; };
77AA67DD2588916300A592E2 /* t2s.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = t2s.json; sourceTree = "<group>"; };
77AA67DE2588916300A592E2 /* t2tw.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = t2tw.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -361,6 +362,7 @@
29B97314FDCFA39411CA2CEA /* Squirrel */ = {
isa = PBXGroup;
children = (
5BCE17192B81D03D008C8D9E /* Squirrel.entitlements */,
442C648F1F7A40180027EFBE /* bin */,
44DA7A4214DD598900C1ED3B /* SharedSupport */,
080E96DDFE201D6D7F000001 /* Sources */,
Expand Down Expand Up @@ -619,6 +621,7 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_ENTITLEMENTS = Squirrel.entitlements;
CODE_SIGN_IDENTITY = "-";
CLANG_TIDY_BUGPRONE_REDUNDANT_BRANCH_CONDITION = YES;
CLANG_TIDY_MISC_REDUNDANT_EXPRESSION = YES;
Expand Down Expand Up @@ -675,6 +678,7 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES;
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
CODE_SIGN_ENTITLEMENTS = Squirrel.entitlements;
CODE_SIGN_IDENTITY = "-";
CLANG_TIDY_BUGPRONE_REDUNDANT_BRANCH_CONDITION = YES;
CLANG_TIDY_MISC_REDUNDANT_EXPRESSION = YES;
Expand Down
24 changes: 12 additions & 12 deletions SquirrelApplicationDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
@class SquirrelPanel;
@class SquirrelOptionSwitcher;

// Note: the SquirrelApplicationDelegate is instantiated automatically as an outlet of NSApp's instance
// Note: the SquirrelApplicationDelegate is instantiated automatically as an
// outlet of NSApp's instance
@interface SquirrelApplicationDelegate : NSObject <NSApplicationDelegate>

typedef NS_ENUM(NSUInteger, SquirrelNotificationPolicy) {
Expand All @@ -14,11 +15,11 @@ typedef NS_ENUM(NSUInteger, SquirrelNotificationPolicy) {
kShowNotificationsAlways = 2
};

@property(nonatomic, weak) IBOutlet NSMenu *menu;
@property(nonatomic, weak) IBOutlet SquirrelPanel *panel;
@property(nonatomic, weak) IBOutlet NSMenu* menu;
@property(nonatomic, weak) IBOutlet SquirrelPanel* panel;
@property(nonatomic, weak) IBOutlet id updater;

@property(nonatomic, strong, readonly) SquirrelConfig *config;
@property(nonatomic, strong, readonly) SquirrelConfig* config;
@property(nonatomic, readonly) SquirrelNotificationPolicy showNotifications;

- (IBAction)deploy:(id)sender;
Expand All @@ -29,21 +30,20 @@ typedef NS_ENUM(NSUInteger, SquirrelNotificationPolicy) {
- (void)setupRime;
- (void)startRimeWithFullCheck:(BOOL)fullCheck;
- (void)loadSettings;
- (void)loadSchemaSpecificSettings:(NSString *)schemaId
- (void)loadSchemaSpecificSettings:(NSString*)schemaId
withRimeSession:(RimeSessionId)sessionId;
- (void)loadSchemaSpecificLabels:(NSString *)schemaId;
- (void)loadSchemaSpecificLabels:(NSString*)schemaId;

@property(nonatomic, readonly) BOOL problematicLaunchDetected;

@end // SquirrelApplicationDelegate

@end // SquirrelApplicationDelegate

@interface NSApplication (SquirrelApp)

@property(nonatomic, strong, readonly) SquirrelApplicationDelegate *squirrelAppDelegate;

@end // NSApplication (SquirrelApp)
@property(nonatomic, strong, readonly)
SquirrelApplicationDelegate* squirrelAppDelegate;

@end // NSApplication (SquirrelApp)

// also used in main.m
extern void show_notification(const char *msg_text);
extern void show_notification(const char* msg_text);
Loading

0 comments on commit 10c7dc1

Please sign in to comment.