Skip to content

Commit

Permalink
Merge pull request #104
Browse files Browse the repository at this point in the history
Bootstrap Safari App Extension project
  • Loading branch information
simeg authored Jul 14, 2018
2 parents 4089021 + 260b510 commit fdfe62d
Show file tree
Hide file tree
Showing 27 changed files with 3,663 additions and 35 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
-------------

### 2.0.0 (14/7/2018)
* vimari now exists as a Safari App Extension, making it compatible with Safari
version 12

### 1.13.0 (4/12/2017)
* New fresh icon
* Removed shift as default modifier key
Expand Down
36 changes: 1 addition & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,3 @@
:rotating_light: **Attention!** We are currently blocked from releasing new
version of this extension, and we have a proposal solving this problem
:rotating_light:

**Funding Progress**

![Funding progress](http://progressed.io/bar/100)

**For full context, read [the full proposal](/docs/crowdfunding.md).**

## Proposal

I propose we use [Ko-fi](https://ko-fi.com) as a crowdfunding platform in order
to collect $99 for a ADP membership to be registered in my name (Simon
Egersand).

## If we reach our goal

If we reach the goal and successfully raise all the money we need, what
happens? First of all, I will register my account for a ADP membership and then
make all the changes required to publish the extension to the Safari Extension
Gallery (some changes are required, see
[#100](https://github.com/guyht/vimari/issues/100)). But what happens after
that?

I commit to being active in maintaining this extension for the next year. That
means I will work on fixing bugs, developing new features, increasing test
coverage and generally improving the code. And I welcome everyone to join me!

---

**NOTE: If you have a pre 1.2 version of Vimari, you need to manually
update to the latest version as there is a bug in the auto-update code.
Versions post 1.2 will automatically update to the lastest version.**

Vimari - Keyboard Shortcuts extension for Safari
================================================

Expand All @@ -44,6 +9,7 @@ Vimari attempts to provide a lightweight port of vimium to Safari,
taking the best components of vimium and adapting them to Safari.

### Releases
- [Version 2.0.0](docs/safari_12.md) (Safari v12)
- [Version 1.12](https://github.com/guyht/vimari/releases/tag/v1.12)
- [Version 1.11](https://github.com/guyht/vimari/releases/tag/v1.11)
- [Version 1.10](https://github.com/guyht/vimari/releases/tag/v1.10)
Expand Down
79 changes: 79 additions & 0 deletions app_extension/vimari/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@

# Created by https://www.gitignore.io/api/swift

### Swift ###
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/

## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output


# End of https://www.gitignore.io/api/swift

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11134" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11134"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="SafariExtensionViewController" customModuleProvider="target">
<connections>
<outlet property="view" destination="c22-O7-iKe" id="vwT-Xx-Aiz"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="c22-O7-iKe">
<rect key="frame" x="0.0" y="0.0" width="330" height="119"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4Iy-aV-wGF">
<rect key="frame" x="103" y="82" width="124" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="extension" id="2Ec-kd-q2K">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
</customView>
</objects>
</document>
76 changes: 76 additions & 0 deletions app_extension/vimari/extension/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?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>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>vimari</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>2.0.0</string>
<key>CFBundleVersion</key>
<string>2</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSExtension</key>
<dict>
<key>SFSafariStyleSheet</key>
<array>
<dict>
<key>Style Sheet</key>
<string>injected.css</string>
</dict>
</array>
<key>NSExtensionPointIdentifier</key>
<string>com.apple.Safari.extension</string>
<key>NSExtensionPrincipalClass</key>
<string>$(PRODUCT_MODULE_NAME).SafariExtensionHandler</string>
<key>SFSafariContentScript</key>
<array>
<dict>
<key>Script</key>
<string>settings.js</string>
</dict>
<dict>
<key>Script</key>
<string>keyboard-utils.js</string>
</dict>
<dict>
<key>Script</key>
<string>vimium-scripts.js</string>
</dict>
<dict>
<key>Script</key>
<string>link-hints.js</string>
</dict>
<dict>
<key>Script</key>
<string>mousetrap.js</string>
</dict>
<dict>
<key>Script</key>
<string>injected.js</string>
</dict>
</array>
<key>SFSafariWebsiteAccess</key>
<dict>
<key>Level</key>
<string>All</string>
</dict>
</dict>
<key>NSHumanReadableCopyright</key>
<string>MIT license</string>
<key>NSHumanReadableDescription</key>
<string>Safari port of vimium</string>
</dict>
</plist>
34 changes: 34 additions & 0 deletions app_extension/vimari/extension/SafariExtensionHandler.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//
// SafariExtensionHandler.swift
// extension
//
// Created by Simon on 2018-07-13.
// Copyright © 2018 vimari. All rights reserved.
//

import SafariServices

class SafariExtensionHandler: SFSafariExtensionHandler {

override func messageReceived(withName messageName: String, from page: SFSafariPage, userInfo: [String : Any]?) {
// This method will be called when a content script provided by your extension calls safari.extension.dispatchMessage("message").
page.getPropertiesWithCompletionHandler { properties in
NSLog("The extension received a message (\(messageName)) from a script injected into (\(String(describing: properties?.url))) with userInfo (\(userInfo ?? [:]))")
}
}

override func toolbarItemClicked(in window: SFSafariWindow) {
// This method will be called when your toolbar item is clicked.
NSLog("The extension's toolbar item was clicked")
}

override func validateToolbarItem(in window: SFSafariWindow, validationHandler: @escaping ((Bool, String) -> Void)) {
// This is called when Safari's state changed in some way that would require the extension's toolbar item to be validated again.
validationHandler(true, "")
}

override func popoverViewController() -> SFSafariExtensionViewController {
return SafariExtensionViewController.shared
}

}
15 changes: 15 additions & 0 deletions app_extension/vimari/extension/SafariExtensionViewController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//
// SafariExtensionViewController.swift
// extension
//
// Created by Simon on 2018-07-13.
// Copyright © 2018 vimari. All rights reserved.
//

import SafariServices

class SafariExtensionViewController: SFSafariExtensionViewController {

static let shared = SafariExtensionViewController()

}
Loading

0 comments on commit fdfe62d

Please sign in to comment.