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

Migrate code to Swift #898

Merged
merged 76 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
63ccd6d
Initial migration
LEOYoon-Tsaw May 11, 2024
89e57b1
Bug fixes
LEOYoon-Tsaw May 11, 2024
4286923
Continue to fix
LEOYoon-Tsaw May 11, 2024
d006dfd
Fix --build crash
LEOYoon-Tsaw May 11, 2024
2d6fdd7
Convert NSLog comments to debug print, disable app sandbox
LEOYoon-Tsaw May 11, 2024
c21446f
Fix IMKServer connection
eagleoflqj May 11, 2024
4e18a69
fix code mapping table
LEOYoon-Tsaw May 11, 2024
de9fa3f
save handling of CString to String conversion
LEOYoon-Tsaw May 11, 2024
3be453e
Update MacOSKeyCodes.swift
LEOYoon-Tsaw May 11, 2024
5ccd528
Properly initialize rime structs
LEOYoon-Tsaw May 11, 2024
f804045
fix
LEOYoon-Tsaw May 12, 2024
47b0df3
fix rime cstring assignment and input menu
LEOYoon-Tsaw May 12, 2024
63f9ebc
Fixed bug due to writingDirection attribute
LEOYoon-Tsaw May 12, 2024
546df86
fix color parsing
LEOYoon-Tsaw May 12, 2024
e81a8c5
Reenable sandbox and fix menu title in en
LEOYoon-Tsaw May 12, 2024
3ddb552
Fix a bug in shift + symbols
LEOYoon-Tsaw May 12, 2024
43f3a07
eliminate warnings
LEOYoon-Tsaw May 12, 2024
499f6ea
Bump version
LEOYoon-Tsaw May 12, 2024
485ef20
setup the flag STDBOOL
LEOYoon-Tsaw May 13, 2024
b95e539
move loading theme function to SquirrelTheme
LEOYoon-Tsaw May 13, 2024
63182f1
Fix inlineCandidate index out of bound bug
LEOYoon-Tsaw May 13, 2024
bf0eb51
Fix key modifier not properly handled bug
LEOYoon-Tsaw May 13, 2024
3327bb8
bump version
LEOYoon-Tsaw May 13, 2024
a60880a
Fix default text orientation to horizontal
LEOYoon-Tsaw May 13, 2024
01443c2
Fix mouse click bug & bump version
LEOYoon-Tsaw May 13, 2024
4130335
lint
LEOYoon-Tsaw May 14, 2024
79e9891
temporarily change librime to use std bool
LEOYoon-Tsaw May 14, 2024
90a5424
Update candidateFormat improve string interpolation
LEOYoon-Tsaw May 15, 2024
a071ad4
Add open temp dir menu item
LEOYoon-Tsaw May 15, 2024
b69528c
Gardening
LEOYoon-Tsaw May 15, 2024
b74e760
Reorganize code folder
LEOYoon-Tsaw May 15, 2024
2e585f5
preserve entitlement in codesign
LEOYoon-Tsaw May 15, 2024
fcdec58
Real entitlement, and real sandbox
LEOYoon-Tsaw May 15, 2024
c132f32
clean older tmp files
LEOYoon-Tsaw May 15, 2024
1ad8e16
Do not include entitlement by default
LEOYoon-Tsaw May 15, 2024
1de36a2
make inlineCandidate defaults to false
LEOYoon-Tsaw May 15, 2024
2344c5b
code gardening
LEOYoon-Tsaw May 15, 2024
e30aa63
Implement Sparkle SPUStandardUserDriverDelegate
LEOYoon-Tsaw May 15, 2024
346ed5d
bump version
LEOYoon-Tsaw May 15, 2024
4ffbd75
Fix fonts loading
LEOYoon-Tsaw May 16, 2024
f9698b9
fix candidate attributes
LEOYoon-Tsaw May 16, 2024
b3c5cf1
improve enable and select workflow
LEOYoon-Tsaw May 16, 2024
8ea02e2
better native color scheme
LEOYoon-Tsaw May 16, 2024
ebdafa9
Fix and optimize modifier key event
LEOYoon-Tsaw May 17, 2024
b869ed0
add env of PLUM_TAG to load specific formulae from plum
LEOYoon-Tsaw May 17, 2024
a742b94
Upgrade squirrel.yaml for new options
LEOYoon-Tsaw May 17, 2024
2920326
Update default theme
LEOYoon-Tsaw May 17, 2024
01f0589
Fix label and comment text not centered
LEOYoon-Tsaw May 17, 2024
6ba58fd
update archiving workflow
LEOYoon-Tsaw May 17, 2024
4464475
Dynamically add rime plugins
LEOYoon-Tsaw May 17, 2024
b592cb1
Update file titles
LEOYoon-Tsaw May 17, 2024
06587ad
Fix crash if client no longer exists
LEOYoon-Tsaw May 17, 2024
ea87031
Update Readme and Install instruction
LEOYoon-Tsaw May 17, 2024
5e37734
Update squirrel.yaml to 0.99
LEOYoon-Tsaw May 18, 2024
0938476
Fix line spacing bugs, and fix crash when panel size exceeds screen size
LEOYoon-Tsaw May 18, 2024
b12aeb6
Fix a bug that when loading new style, old one will have leftover
LEOYoon-Tsaw May 18, 2024
c3fba4a
remove disable-library-validation
LEOYoon-Tsaw May 18, 2024
7cfd961
Remove special handling of modifiers
LEOYoon-Tsaw May 18, 2024
0115cfa
reorganize inputSource, reduce repetitive calls
LEOYoon-Tsaw May 18, 2024
ff97af9
adopt RimeApi_stdbool
LEOYoon-Tsaw May 18, 2024
7f7ed6b
improve codesign
LEOYoon-Tsaw May 18, 2024
4f294bd
improve registration under sandbox
LEOYoon-Tsaw May 18, 2024
158c159
Bump squirrel.yaml version to 1.0
LEOYoon-Tsaw May 18, 2024
b248000
minor updates to build settings
LEOYoon-Tsaw May 18, 2024
f3aea6e
Update librime
LEOYoon-Tsaw May 19, 2024
5c4f85a
Fix a bug in enabling input source
LEOYoon-Tsaw May 19, 2024
346394b
input source command lines takes target source as extra arguments
LEOYoon-Tsaw May 19, 2024
a167c15
bump version
LEOYoon-Tsaw May 19, 2024
f63c5cb
make osxModifiersToRime takes NSEvent.ModifierFlags values
LEOYoon-Tsaw May 19, 2024
d094852
Add a help string
LEOYoon-Tsaw May 19, 2024
7532eb7
disable Sandbox
LEOYoon-Tsaw May 19, 2024
dde575c
Update release-ci
LEOYoon-Tsaw May 20, 2024
67bf288
Gracefully avoid linebreak within short candidates
LEOYoon-Tsaw May 21, 2024
a074cbb
Introduce ?= operator, only assign when righthand side is non-nil
LEOYoon-Tsaw May 22, 2024
4b6874d
Process modifier release before new modifier
LEOYoon-Tsaw May 23, 2024
bafeed5
do not showStatusMessage if no label has valid String
LEOYoon-Tsaw May 23, 2024
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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ lib/*
data/opencc/
data/plum/
download/
package/Squirrel.pkg
package/Squirrel*.pkg
package/sign/*.pem
package/test-*
package/sign_update
package/*.xml
*~
.*.swp
.DS_Store
60 changes: 0 additions & 60 deletions Base.lproj/MainMenu.xib

This file was deleted.

43 changes: 33 additions & 10 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

### Prerequisites

Install **Xcode 14.0 or above from App Store, to build Squirrel as a Universal
Install **Xcode 14.0** or above from App Store, to build Squirrel as a Universal
app.

Install **cmake**.
Expand Down Expand Up @@ -39,7 +39,7 @@ Optionally, checkout Rime plugins (a list of GitHub repo slugs):
bash librime/install-plugins.sh rime/librime-sample # ...
```

Popular plugins include [librime-lua](https://github.com/hchunhui/librime-lua) and [librime-octagram](https://github.com/lotem/librime-octagram)
Popular plugins include [librime-lua](https://github.com/hchunhui/librime-lua), [librime-octagram](https://github.com/lotem/librime-octagram) and [librime-predict](https://github.com/rime/librime-predict)

### Shortcut: get the latest librime release

Expand Down Expand Up @@ -100,20 +100,28 @@ port install boost -no_static
git submodule update --init --recursive
```

* There are a few environmental variables that you can define. Here's a list and possible values they may take:

``` sh
export BOOST_ROOT="path_to_boost" # required
export DEV_ID="Your Apple ID name" # include this to codesign, optional
export BUILD_UNIVERSAL=1 # set to build universal binary
export PLUM_TAG=":preset” # or ":extra", optional, build with a set of plum formulae
export ARCHS='arm64 x86_64' # optional, if not defined, only active arch is used
export MACOSX_DEPLOYMENT_TARGET='13.0' # optional, lower version than 13.0 is not tested and may not work properly
```

* With all dependencies ready, build `Squirrel.app`:

``` sh
make
```

To build only for the native architecture, and/or specify the lowest supported macOS version, pass variable `ARCHS` and/or `MACOSX_DEPLOYMENT_TARGET` to `make`:
* You can either define the environment variables in your shell/terminal, or append them as arguments to the make command. For example:

``` sh
# for Universal macOS App
make ARCHS='arm64 x86_64'

# for ARM macOS App
make ARCHS='arm64'
make ARCHS='arm64 x86_64' BUILD_UNIVERSAL=1
```

## Install it on your Mac
Expand All @@ -126,7 +134,7 @@ Just add `package` after `make`
make package ARCHS='arm64'
```

Define or echo `DEV_ID` to automatically handle code signing and [notarization](https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution) (Apple Developer ID needed)
Define `DEV_ID` to automatically handle code signing and [notarization](https://developer.apple.com/documentation/security/notarizing_macos_software_before_distribution) (Apple Developer ID needed)

To make this work, you need a `Developer ID Installer: (your name/org)` and set your name/org as `DEV_ID` env variable.

Expand All @@ -147,9 +155,24 @@ Once built, you can install and try it live on your Mac computer:
``` sh
# Squirrel as a Universal app
make install
```

## Clean Up Artifacts

After installation or after a failed attempt, you may want to start over. Before you do so, **make sure you have cleaned up artifacts from previous build.**

# for Intel-based Mac only
make ARCHS='x86_64' install
To clean **Squirrel** artifacts, without touching dependencies, run:

``` sh
make clean
```

To clean up **dependencies**, including librime, librime plugins, plum and sparkle, run:

``` sh
make clean-deps
```

If you want to clean both, do both.

That's it, a verbal journal. Thanks for riming with Squirrel.
14 changes: 9 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ DEPS_CHECK = $(RIME_LIBRARY) $(PLUM_DATA) $(OPENCC_DATA) $(SPARKLE_FRAMEWORK)

OPENCC_DATA_OUTPUT = librime/share/opencc/*.*
PLUM_DATA_OUTPUT = plum/output/*.*
PLUM_OPENCC_OUTPUT = plum/output/opencc/*.*
RIME_PACKAGE_INSTALLER = plum/rime-install

INSTALL_NAME_TOOL = $(shell xcrun -find install_name_tool)
Expand Down Expand Up @@ -62,6 +63,9 @@ $(OPENCC_DATA):

plum-data:
$(MAKE) -C plum
ifdef PLUM_TAG
rime_dir=plum/output bash plum/rime-install $(PLUM_TAG)
endif
$(MAKE) copy-plum-data

opencc-data:
Expand All @@ -76,6 +80,7 @@ copy-plum-data:
copy-opencc-data:
mkdir -p data/opencc
cp $(OPENCC_DATA_OUTPUT) data/opencc/
cp $(PLUM_OPENCC_OUTPUT) data/opencc/ > /dev/null 2>&1 || true

deps: librime data

Expand Down Expand Up @@ -112,17 +117,19 @@ $(SPARKLE_FRAMEWORK):

sparkle:
xcodebuild -project Sparkle/Sparkle.xcodeproj -configuration Release $(BUILD_SETTINGS) build
xcodebuild -project Sparkle/Sparkle.xcodeproj -scheme sign_update -configuration Release -derivedDataPath Sparkle/build $(BUILD_SETTINGS) build
$(MAKE) copy-sparkle-framework

copy-sparkle-framework:
mkdir -p Frameworks
cp -RP Sparkle/build/Release/Sparkle.framework Frameworks/
cp Sparkle/build/Build/Products/Release/sign_update package/

clean-sparkle:
rm -rf Frameworks/* > /dev/null 2>&1 || true
rm -rf Sparkle/build > /dev/null 2>&1 || true

.PHONY: package archive sign-archive
.PHONY: package archive

package: release
ifdef DEV_ID
Expand All @@ -140,10 +147,6 @@ endif
archive: package
bash package/make_archive

sign-archive:
[ -n "${checksum}" ] || (echo >&2 'ERROR: $$checksum not specified.'; false)
sign_key=sign/dsa_priv.pem bash package/make_archive

DSTROOT = /Library/Input Methods
SQUIRREL_APP_ROOT = $(DSTROOT)/Squirrel.app

Expand Down Expand Up @@ -176,4 +179,5 @@ clean:
clean-deps:
$(MAKE) -C plum clean
$(MAKE) -C librime clean
rm -rf librime/dist > /dev/null 2>&1 || true
$(MAKE) clean-sparkle
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
【鼠鬚管】輸入法
===
[![Download](https://img.shields.io/github/v/release/rime/squirrel)](https://github.com/rime/squirrel/releases/latest)
[![Build Status](https://travis-ci.org/rime/squirrel.svg)](https://travis-ci.org/rime/squirrel)
[![Build Status](https://github.com/rime/squirrel/actions/workflows/commit-ci.yml/badge.svg)](https://github.com/rime/squirrel/actions/workflows)
[![GitHub Tag](https://img.shields.io/github/tag/rime/squirrel.svg)](https://github.com/rime/squirrel)

式恕堂 版權所無
Expand All @@ -22,7 +22,7 @@

您可能還需要 Rime 用於其他操作系統的發行版:

* ibus-rimefcitx-rime 用於 Linux
* 【中州韻】(ibus-rimefcitx-rime用於 Linux
* 【小狼毫】用於 Windows

安裝輸入法
Expand Down Expand Up @@ -99,8 +99,7 @@
問題與反饋
---

發現程序有 BUG,或建議,或感想,請反饋到
https://github.com/rime/home/issues
發現程序有 BUG,或建議,或感想,請反饋到 [Rime 代碼之家討論區](https://github.com/rime/home/discussions)

聯繫方式
---
Expand Down
23 changes: 0 additions & 23 deletions Squirrel.entitlements

This file was deleted.

Loading