Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
70b53ca771 | |||
d073604cc7 | |||
2ed74e70f1 | |||
d683a9e260 | |||
adbeaad69e | |||
7a14815c20 | |||
553335d8dc | |||
747491944f | |||
6a8022e177 | |||
4626b6f45b | |||
674c67a317 |
21
README.md
@ -1,7 +1,7 @@
|
||||
|
||||
# <img width="64" src="https://user-images.githubusercontent.com/7277662/167775086-0b234f28-dee4-44f6-aae4-14a28ed4bbb6.png"> Hacki for Hacker News
|
||||
|
||||
A simple noiseless Hacker News reader made with Flutter that is just enough.
|
||||
A simple noiseless [Hacker News](https://news.ycombinator.com/) client made with Flutter that is just enough.
|
||||
|
||||
[](https://apps.apple.com/us/app/hacki/id1602043763)
|
||||
[](https://play.google.com/store/apps/details?id=com.jiaqifeng.hacki&hl=en_US&gl=US)
|
||||
@ -11,24 +11,27 @@ A simple noiseless Hacker News reader made with Flutter that is just enough.
|
||||
|
||||
<noscript><a href="https://liberapay.com/jfeng_for_open_source/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a></noscript>
|
||||
|
||||
[<img src="images/app_store_badge.png" height="50">](https://apps.apple.com/us/app/hacki/id1602043763) [<img src="images/google_play_badge.png" height="50">](https://play.google.com/store/apps/details?id=com.jiaqifeng.hacki&hl=en_US&gl=US)
|
||||
[<img src="assets/images/app_store_badge.png" height="50">](https://apps.apple.com/us/app/hacki/id1602043763) [<img src="assets/images/google_play_badge.png" height="50">](https://play.google.com/store/apps/details?id=com.jiaqifeng.hacki&hl=en_US&gl=US) [<img src="assets/images/f_droid_badge.png" height="50">](https://f-droid.org/en/packages/com.jiaqifeng.hacki/)
|
||||
|
||||
|
||||
Features:
|
||||
- Log in using your Hacker News account.
|
||||
- Browse stories from various categories.
|
||||
- Submit links.
|
||||
- Leave comments on stories.
|
||||
- View and participate in polls.
|
||||
- Search for stories.
|
||||
- Submit stories.
|
||||
- Pin stories.
|
||||
- Mark stories as favorite.
|
||||
- Browse comments and stories you have posted in the past.
|
||||
- Search for stories on Hacker News.
|
||||
- Leave comments.
|
||||
- Collapse comments.
|
||||
- View parent comments without scrolling up.
|
||||
- View and participate in polls.
|
||||
- Browse comments and stories you have posted.
|
||||
- Vote on comments or stories.
|
||||
- Pin stories to the top of home page.
|
||||
- Get in-app notification when there is new reply to your stories or comments.
|
||||
- Download stories for offline reading.
|
||||
- Download stories and comments for offline reading.
|
||||
- Pick up where you left off.
|
||||
- Synced favorites and pins across devices. (iOS only)
|
||||
- Launch from system share sheet.
|
||||
- And more...
|
||||
|
||||
|
||||
|
@ -42,6 +42,12 @@
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="*/*" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<!-- Don't delete the meta-data below.
|
||||
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
BIN
assets/images/comment_tile_left_slide.png
Normal file
After Width: | Height: | Size: 548 KiB |
BIN
assets/images/comment_tile_right_slide.png
Normal file
After Width: | Height: | Size: 571 KiB |
BIN
assets/images/comment_tile_top_tap.png
Normal file
After Width: | Height: | Size: 592 KiB |
BIN
assets/images/f_droid_badge.png
Normal file
After Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 30 KiB |
4
fastlane/metadata/android/en-US/changelogs/40.txt
Normal file
@ -0,0 +1,4 @@
|
||||
- You can now participate in polls.
|
||||
- Pick up where you left off.
|
||||
- Swipe left on comment tile to view its parents without scrolling all the way up.
|
||||
- Huge performance boost.
|
4
fastlane/metadata/android/en-US/changelogs/41.txt
Normal file
@ -0,0 +1,4 @@
|
||||
- You can now participate in polls.
|
||||
- Pick up where you left off.
|
||||
- Swipe left on comment tile to view its parents without scrolling all the way up.
|
||||
- Huge performance boost.
|
4
fastlane/metadata/android/en-US/changelogs/42.txt
Normal file
@ -0,0 +1,4 @@
|
||||
- You can now participate in polls.
|
||||
- Pick up where you left off.
|
||||
- Swipe left on comment tile to view its parents without scrolling all the way up.
|
||||
- Huge performance boost.
|
4
fastlane/metadata/android/en-US/changelogs/43.txt
Normal file
@ -0,0 +1,4 @@
|
||||
- You can now participate in polls.
|
||||
- Pick up where you left off.
|
||||
- Swipe left on comment tile to view its parents without scrolling all the way up.
|
||||
- Huge performance boost.
|
4
fastlane/metadata/android/en-US/changelogs/44.txt
Normal file
@ -0,0 +1,4 @@
|
||||
- You can now participate in polls.
|
||||
- Pick up where you left off.
|
||||
- Swipe left on comment tile to view its parents without scrolling all the way up.
|
||||
- Huge performance boost.
|
@ -1,16 +1,18 @@
|
||||
Features:
|
||||
- Log in using your Hacker News account.
|
||||
- Browse stories from various categories.
|
||||
- Submit links.
|
||||
- Leave comments on stories.
|
||||
- View and participate in polls.
|
||||
- Search for stories.
|
||||
- Submit stories.
|
||||
- Pin stories.
|
||||
- Mark stories as favorite.
|
||||
- Browse comments and stories you have posted in the past.
|
||||
- Search for stories on Hacker News.
|
||||
- Leave comments.
|
||||
- Collapse comments.
|
||||
- View parent comments without scrolling up.
|
||||
- View and participate in polls.
|
||||
- Browse comments and stories you have posted.
|
||||
- Vote on comments or stories.
|
||||
- Pin stories to the top of home page.
|
||||
- Get in-app notification when there is new reply to your stories or comments.
|
||||
- Download stories for offline reading.
|
||||
- Download stories and comments for offline reading.
|
||||
- Pick up where you left off.
|
||||
- Launch from system share sheet.
|
||||
- And more...
|
||||
|
Before Width: | Height: | Size: 393 KiB After Width: | Height: | Size: 393 KiB |
Before Width: | Height: | Size: 696 KiB After Width: | Height: | Size: 696 KiB |
Before Width: | Height: | Size: 250 KiB After Width: | Height: | Size: 250 KiB |
Before Width: | Height: | Size: 231 KiB After Width: | Height: | Size: 231 KiB |
Before Width: | Height: | Size: 903 KiB After Width: | Height: | Size: 903 KiB |
Before Width: | Height: | Size: 931 KiB After Width: | Height: | Size: 931 KiB |
Before Width: | Height: | Size: 298 KiB After Width: | Height: | Size: 298 KiB |
Before Width: | Height: | Size: 247 KiB After Width: | Height: | Size: 247 KiB |
Before Width: | Height: | Size: 496 KiB After Width: | Height: | Size: 496 KiB |
@ -1 +1 @@
|
||||
Hacki is a simple noiseless Hacker News reader that is just enough.
|
||||
Hacki is a simple noiseless Hacker News client that is just enough.
|
10
ios/Action Extension/Action Extension.entitlements
Normal file
@ -0,0 +1,10 @@
|
||||
<?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.application-groups</key>
|
||||
<array>
|
||||
<string>group.com.jiaqi.hacki</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
89
ios/Action Extension/ActionViewController.swift
Normal file
@ -0,0 +1,89 @@
|
||||
//
|
||||
// ActionViewController.swift
|
||||
// Action Extension
|
||||
//
|
||||
// Created by Jiaqi Feng on 5/22/22.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MobileCoreServices
|
||||
import UniformTypeIdentifiers
|
||||
|
||||
class ActionViewController: UIViewController {
|
||||
let hostAppBundleIdentifier = "com.jiaqi.hacki"
|
||||
let sharedKey = "ShareKey"
|
||||
var sharedText: [String] = []
|
||||
let urlContentType = kUTTypeURL as String
|
||||
@IBOutlet weak var imageView: UIImageView!
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
if let content = extensionContext!.inputItems[0] as? NSExtensionItem {
|
||||
if let contents = content.attachments {
|
||||
for (index, attachment) in (contents).enumerated() {
|
||||
handleUrl(content: content, attachment: attachment, index: index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func handleUrl (content: NSExtensionItem, attachment: NSItemProvider, index: Int) {
|
||||
attachment.loadItem(forTypeIdentifier: urlContentType, options: nil) { [weak self] data, error in
|
||||
|
||||
if error == nil, let item = data as? URL, let this = self {
|
||||
this.sharedText.append(item.absoluteString)
|
||||
|
||||
// If this is the last item, save imagesData in userDefaults and redirect to host app
|
||||
if index == (content.attachments?.count)! - 1 {
|
||||
let userDefaults = UserDefaults(suiteName: "group.\(this.hostAppBundleIdentifier)")
|
||||
userDefaults?.set(this.sharedText, forKey: this.sharedKey)
|
||||
userDefaults?.synchronize()
|
||||
print(this.sharedText)
|
||||
this.redirectToHostApp()
|
||||
}
|
||||
|
||||
} else {
|
||||
self?.dismissWithError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func dismissWithError() {
|
||||
print("[ERROR] Error loading data!")
|
||||
let alert = UIAlertController(title: "Error", message: "Error loading data", preferredStyle: .alert)
|
||||
|
||||
let action = UIAlertAction(title: "Error", style: .cancel) { _ in
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
alert.addAction(action)
|
||||
present(alert, animated: true, completion: nil)
|
||||
extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
|
||||
}
|
||||
|
||||
private func redirectToHostApp() {
|
||||
let url = URL(string: "ShareMedia://dataUrl=\(sharedKey)#text")
|
||||
var responder = self as UIResponder?
|
||||
let selectorOpenURL = sel_registerName("openURL:")
|
||||
|
||||
while (responder != nil) {
|
||||
if let application = responder as? UIApplication {
|
||||
application.performSelector(inBackground: selectorOpenURL, with: url)
|
||||
}
|
||||
|
||||
responder = responder!.next
|
||||
}
|
||||
extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
|
||||
}
|
||||
|
||||
@IBAction func done() {
|
||||
// Return any edited content to the host app.
|
||||
// This template doesn't do anything, so we just echo the passed in items.
|
||||
self.extensionContext!.completeRequest(returningItems: self.extensionContext!.inputItems, completionHandler: nil)
|
||||
}
|
||||
|
||||
}
|
53
ios/Action Extension/Base.lproj/MainInterface.storyboard
Normal file
@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="ObA-dk-sSI">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Image-->
|
||||
<scene sceneID="7MM-of-jgj">
|
||||
<objects>
|
||||
<viewController title="Image" id="ObA-dk-sSI" customClass="ActionViewController" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="zMn-AG-sqS">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="528"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<navigationBar contentMode="scaleToFill" horizontalCompressionResistancePriority="751" verticalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="NOA-Dm-cuz">
|
||||
<items>
|
||||
<navigationItem id="3HJ-uW-3hn">
|
||||
<barButtonItem key="leftBarButtonItem" title="Done" style="done" id="WYi-yp-eM6">
|
||||
<connections>
|
||||
<action selector="done" destination="ObA-dk-sSI" id="Qdu-qn-U6V"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
</items>
|
||||
</navigationBar>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="9ga-4F-77Z"/>
|
||||
</subviews>
|
||||
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<constraints>
|
||||
<constraint firstItem="VVe-Uw-JpX" firstAttribute="trailing" secondItem="NOA-Dm-cuz" secondAttribute="trailing" id="A05-Pj-hrr"/>
|
||||
<constraint firstItem="9ga-4F-77Z" firstAttribute="top" secondItem="NOA-Dm-cuz" secondAttribute="bottom" id="Fps-3D-QQW"/>
|
||||
<constraint firstItem="NOA-Dm-cuz" firstAttribute="leading" secondItem="VVe-Uw-JpX" secondAttribute="leading" id="HxO-8t-aoh"/>
|
||||
<constraint firstItem="VVe-Uw-JpX" firstAttribute="trailing" secondItem="9ga-4F-77Z" secondAttribute="trailing" id="Ozw-Hg-0yh"/>
|
||||
<constraint firstItem="9ga-4F-77Z" firstAttribute="leading" secondItem="VVe-Uw-JpX" secondAttribute="leading" id="XH5-ld-ONA"/>
|
||||
<constraint firstItem="VVe-Uw-JpX" firstAttribute="bottom" secondItem="9ga-4F-77Z" secondAttribute="bottom" id="eQg-nn-Zy4"/>
|
||||
<constraint firstItem="NOA-Dm-cuz" firstAttribute="top" secondItem="VVe-Uw-JpX" secondAttribute="top" id="we0-1t-bgp"/>
|
||||
</constraints>
|
||||
<viewLayoutGuide key="safeArea" id="VVe-Uw-JpX"/>
|
||||
</view>
|
||||
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
|
||||
<size key="freeformSize" width="320" height="528"/>
|
||||
<connections>
|
||||
<outlet property="imageView" destination="9ga-4F-77Z" id="5y6-5w-9QO"/>
|
||||
<outlet property="view" destination="zMn-AG-sqS" id="Qma-de-2ek"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="X47-rx-isc" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
33
ios/Action Extension/Info.plist
Normal file
@ -0,0 +1,33 @@
|
||||
<?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>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionAttributes</key>
|
||||
<dict>
|
||||
<key>NSExtensionActivationRule</key>
|
||||
<dict>
|
||||
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
|
||||
<integer>1</integer>
|
||||
<key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>NSExtensionServiceAllowsFinderPreviewItem</key>
|
||||
<true/>
|
||||
<key>NSExtensionServiceAllowsTouchBarItem</key>
|
||||
<true/>
|
||||
<key>NSExtensionServiceFinderPreviewIconName</key>
|
||||
<string>NSActionTemplate</string>
|
||||
<key>NSExtensionServiceTouchBarBezelColorName</key>
|
||||
<string>TouchBarBezel</string>
|
||||
<key>NSExtensionServiceTouchBarIconName</key>
|
||||
<string>NSActionTemplate</string>
|
||||
</dict>
|
||||
<key>NSExtensionMainStoryboard</key>
|
||||
<string>MainInterface</string>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.ui-services</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
@ -0,0 +1,176 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "Bakery"
|
||||
},
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x",
|
||||
"filename" : "notification40.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x",
|
||||
"filename" : "notification60.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x",
|
||||
"filename" : "settings58.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "29x29",
|
||||
"scale" : "3x",
|
||||
"filename" : "settings87.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x",
|
||||
"filename" : "spotlight80.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "40x40",
|
||||
"scale" : "3x",
|
||||
"filename" : "spotlight120.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "2x",
|
||||
"filename" : "iphone120.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"size" : "60x60",
|
||||
"scale" : "3x",
|
||||
"filename" : "iphone180.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "1x",
|
||||
"filename" : "ipadNotification20.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "20x20",
|
||||
"scale" : "2x",
|
||||
"filename" : "ipadNotification40.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "1x",
|
||||
"filename" : "ipadSettings29.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "29x29",
|
||||
"scale" : "2x",
|
||||
"filename" : "ipadSettings58.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "1x",
|
||||
"filename" : "ipadSpotlight40.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "40x40",
|
||||
"scale" : "2x",
|
||||
"filename" : "ipadSpotlight80.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "1x",
|
||||
"filename" : "ipad76.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "76x76",
|
||||
"scale" : "2x",
|
||||
"filename" : "ipad152.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"size" : "83.5x83.5",
|
||||
"scale" : "2x",
|
||||
"filename" : "ipadPro167.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"size" : "1024x1024",
|
||||
"scale" : "1x",
|
||||
"filename" : "appstore1024.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "16x16",
|
||||
"scale" : "1x",
|
||||
"filename" : "mac16.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "16x16",
|
||||
"scale" : "2x",
|
||||
"filename" : "mac32.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "32x32",
|
||||
"scale" : "1x",
|
||||
"filename" : "mac32.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "32x32",
|
||||
"scale" : "2x",
|
||||
"filename" : "mac64.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "128x128",
|
||||
"scale" : "1x",
|
||||
"filename" : "mac128.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "128x128",
|
||||
"scale" : "2x",
|
||||
"filename" : "mac256.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"scale" : "1x",
|
||||
"filename" : "mac256.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "256x256",
|
||||
"scale" : "2x",
|
||||
"filename" : "mac512.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"scale" : "1x",
|
||||
"filename" : "mac512.png"
|
||||
},
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"size" : "512x512",
|
||||
"scale" : "2x",
|
||||
"filename" : "mac1024.png"
|
||||
}
|
||||
]
|
||||
}
|
After Width: | Height: | Size: 32 KiB |
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 566 B |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 2.8 KiB |
After Width: | Height: | Size: 744 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 3.0 KiB |
After Width: | Height: | Size: 60 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 502 B |
After Width: | Height: | Size: 8.2 KiB |
After Width: | Height: | Size: 835 B |
After Width: | Height: | Size: 21 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.3 KiB |
6
ios/Action Extension/Media.xcassets/Contents.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "mac",
|
||||
"color" : {
|
||||
"reference" : "systemPurpleColor"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
@ -21,6 +21,8 @@ PODS:
|
||||
- path_provider_ios (0.0.1):
|
||||
- Flutter
|
||||
- ReachabilitySwift (5.0.0)
|
||||
- receive_sharing_intent (0.0.1):
|
||||
- Flutter
|
||||
- shared_preferences_ios (0.0.1):
|
||||
- Flutter
|
||||
- sqflite (0.0.2):
|
||||
@ -46,6 +48,7 @@ DEPENDENCIES:
|
||||
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
|
||||
- flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`)
|
||||
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
||||
- receive_sharing_intent (from `.symlinks/plugins/receive_sharing_intent/ios`)
|
||||
- shared_preferences_ios (from `.symlinks/plugins/shared_preferences_ios/ios`)
|
||||
- sqflite (from `.symlinks/plugins/sqflite/ios`)
|
||||
- synced_shared_preferences (from `.symlinks/plugins/synced_shared_preferences/ios`)
|
||||
@ -74,6 +77,8 @@ EXTERNAL SOURCES:
|
||||
:path: ".symlinks/plugins/flutter_secure_storage/ios"
|
||||
path_provider_ios:
|
||||
:path: ".symlinks/plugins/path_provider_ios/ios"
|
||||
receive_sharing_intent:
|
||||
:path: ".symlinks/plugins/receive_sharing_intent/ios"
|
||||
shared_preferences_ios:
|
||||
:path: ".symlinks/plugins/shared_preferences_ios/ios"
|
||||
sqflite:
|
||||
@ -101,6 +106,7 @@ SPEC CHECKSUMS:
|
||||
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
|
||||
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
||||
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
|
||||
receive_sharing_intent: c0d87310754e74c0f9542947e7cbdf3a0335a3b1
|
||||
shared_preferences_ios: 548a61f8053b9b8a49ac19c1ffbc8b92c50d68ad
|
||||
sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904
|
||||
synced_shared_preferences: f722742b06d65c7315b8e9f56b794c9fbd5597f7
|
||||
|
@ -13,11 +13,36 @@
|
||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
|
||||
E51D52B0283B464E00FC8DD8 /* ShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E51D52AF283B464E00FC8DD8 /* ShareViewController.swift */; };
|
||||
E51D52B3283B464E00FC8DD8 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E51D52B1283B464E00FC8DD8 /* MainInterface.storyboard */; };
|
||||
E51D52B7283B464E00FC8DD8 /* Share Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = E51D52AD283B464E00FC8DD8 /* Share Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
E530B1A8283B54DA004E8EB6 /* UniformTypeIdentifiers.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E530B1A7283B54DA004E8EB6 /* UniformTypeIdentifiers.framework */; };
|
||||
E530B1AB283B54DA004E8EB6 /* Media.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E530B1AA283B54DA004E8EB6 /* Media.xcassets */; };
|
||||
E530B1AD283B54DA004E8EB6 /* ActionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E530B1AC283B54DA004E8EB6 /* ActionViewController.swift */; };
|
||||
E530B1B0283B54DA004E8EB6 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E530B1AE283B54DA004E8EB6 /* MainInterface.storyboard */; };
|
||||
E530B1B4283B54DA004E8EB6 /* Action Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = E530B1A6283B54DA004E8EB6 /* Action Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
|
||||
E54B4753282B3B8900579261 /* HackiCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = E54B4752282B3B8900579261 /* HackiCore.swift */; };
|
||||
E575B6F127EBC6DB002B1508 /* CloudKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E575B6F027EBC6DA002B1508 /* CloudKit.framework */; };
|
||||
FC507E94AA7767C155787DB3 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFB5AA41D6C22D228077D166 /* Pods_Runner.framework */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
E51D52B5283B464E00FC8DD8 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = E51D52AC283B464E00FC8DD8;
|
||||
remoteInfo = "Share Extension";
|
||||
};
|
||||
E530B1B2283B54DA004E8EB6 /* PBXContainerItemProxy */ = {
|
||||
isa = PBXContainerItemProxy;
|
||||
containerPortal = 97C146E61CF9000F007C117D /* Project object */;
|
||||
proxyType = 1;
|
||||
remoteGlobalIDString = E530B1A5283B54DA004E8EB6;
|
||||
remoteInfo = "Action Extension";
|
||||
};
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
@ -29,6 +54,18 @@
|
||||
name = "Embed Frameworks";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
E51D52B8283B464E00FC8DD8 /* Embed App Extensions */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 13;
|
||||
files = (
|
||||
E51D52B7283B464E00FC8DD8 /* Share Extension.appex in Embed App Extensions */,
|
||||
E530B1B4283B54DA004E8EB6 /* Action Extension.appex in Embed App Extensions */,
|
||||
);
|
||||
name = "Embed App Extensions";
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
@ -49,9 +86,21 @@
|
||||
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
BFB5AA41D6C22D228077D166 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
DF5D5FFF325B7D5DFEE88A3F /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||
E51D52AD283B464E00FC8DD8 /* Share Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Share Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E51D52AF283B464E00FC8DD8 /* ShareViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShareViewController.swift; sourceTree = "<group>"; };
|
||||
E51D52B2283B464E00FC8DD8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
|
||||
E51D52B4283B464E00FC8DD8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
E530B1A6283B54DA004E8EB6 /* Action Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "Action Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E530B1A7283B54DA004E8EB6 /* UniformTypeIdentifiers.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UniformTypeIdentifiers.framework; path = System/Library/Frameworks/UniformTypeIdentifiers.framework; sourceTree = SDKROOT; };
|
||||
E530B1AA283B54DA004E8EB6 /* Media.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Media.xcassets; sourceTree = "<group>"; };
|
||||
E530B1AC283B54DA004E8EB6 /* ActionViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionViewController.swift; sourceTree = "<group>"; };
|
||||
E530B1AF283B54DA004E8EB6 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = "<group>"; };
|
||||
E530B1B1283B54DA004E8EB6 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
E530B1B9283B54E4004E8EB6 /* Action Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Action Extension.entitlements"; sourceTree = "<group>"; };
|
||||
E54B4752282B3B8900579261 /* HackiCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HackiCore.swift; sourceTree = "<group>"; };
|
||||
E575B6EF27EBC6C6002B1508 /* Runner.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Runner.entitlements; sourceTree = "<group>"; };
|
||||
E575B6F027EBC6DA002B1508 /* CloudKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CloudKit.framework; path = System/Library/Frameworks/CloudKit.framework; sourceTree = SDKROOT; };
|
||||
E59F28EE283B477D00512089 /* Share Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Share Extension.entitlements"; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@ -64,6 +113,21 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
E51D52AA283B464E00FC8DD8 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
E530B1A3283B54DA004E8EB6 /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E530B1A8283B54DA004E8EB6 /* UniformTypeIdentifiers.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
@ -83,6 +147,8 @@
|
||||
children = (
|
||||
9740EEB11CF90186004384FC /* Flutter */,
|
||||
97C146F01CF9000F007C117D /* Runner */,
|
||||
E51D52AE283B464E00FC8DD8 /* Share Extension */,
|
||||
E530B1A9283B54DA004E8EB6 /* Action Extension */,
|
||||
97C146EF1CF9000F007C117D /* Products */,
|
||||
D79CD63C88FF49EF451AFDDF /* Pods */,
|
||||
B3F4F49CF582C662A01499C0 /* Frameworks */,
|
||||
@ -93,6 +159,8 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
97C146EE1CF9000F007C117D /* Runner.app */,
|
||||
E51D52AD283B464E00FC8DD8 /* Share Extension.appex */,
|
||||
E530B1A6283B54DA004E8EB6 /* Action Extension.appex */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@ -119,6 +187,7 @@
|
||||
children = (
|
||||
E575B6F027EBC6DA002B1508 /* CloudKit.framework */,
|
||||
BFB5AA41D6C22D228077D166 /* Pods_Runner.framework */,
|
||||
E530B1A7283B54DA004E8EB6 /* UniformTypeIdentifiers.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
@ -133,6 +202,29 @@
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E51D52AE283B464E00FC8DD8 /* Share Extension */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E59F28EE283B477D00512089 /* Share Extension.entitlements */,
|
||||
E51D52AF283B464E00FC8DD8 /* ShareViewController.swift */,
|
||||
E51D52B1283B464E00FC8DD8 /* MainInterface.storyboard */,
|
||||
E51D52B4283B464E00FC8DD8 /* Info.plist */,
|
||||
);
|
||||
path = "Share Extension";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E530B1A9283B54DA004E8EB6 /* Action Extension */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E530B1B9283B54E4004E8EB6 /* Action Extension.entitlements */,
|
||||
E530B1AA283B54DA004E8EB6 /* Media.xcassets */,
|
||||
E530B1AC283B54DA004E8EB6 /* ActionViewController.swift */,
|
||||
E530B1AE283B54DA004E8EB6 /* MainInterface.storyboard */,
|
||||
E530B1B1283B54DA004E8EB6 /* Info.plist */,
|
||||
);
|
||||
path = "Action Extension";
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
@ -148,22 +240,60 @@
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
7714A105B2069B720D0DF18E /* [CP] Embed Pods Frameworks */,
|
||||
E51D52B8283B464E00FC8DD8 /* Embed App Extensions */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
E51D52B6283B464E00FC8DD8 /* PBXTargetDependency */,
|
||||
E530B1B3283B54DA004E8EB6 /* PBXTargetDependency */,
|
||||
);
|
||||
name = Runner;
|
||||
productName = Runner;
|
||||
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
E51D52AC283B464E00FC8DD8 /* Share Extension */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = E51D52BC283B464E00FC8DD8 /* Build configuration list for PBXNativeTarget "Share Extension" */;
|
||||
buildPhases = (
|
||||
E51D52A9283B464E00FC8DD8 /* Sources */,
|
||||
E51D52AA283B464E00FC8DD8 /* Frameworks */,
|
||||
E51D52AB283B464E00FC8DD8 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "Share Extension";
|
||||
productName = "Share Extension";
|
||||
productReference = E51D52AD283B464E00FC8DD8 /* Share Extension.appex */;
|
||||
productType = "com.apple.product-type.app-extension";
|
||||
};
|
||||
E530B1A5283B54DA004E8EB6 /* Action Extension */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = E530B1B8283B54DA004E8EB6 /* Build configuration list for PBXNativeTarget "Action Extension" */;
|
||||
buildPhases = (
|
||||
E530B1A2283B54DA004E8EB6 /* Sources */,
|
||||
E530B1A3283B54DA004E8EB6 /* Frameworks */,
|
||||
E530B1A4283B54DA004E8EB6 /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = "Action Extension";
|
||||
productName = "Action Extension";
|
||||
productReference = E530B1A6283B54DA004E8EB6 /* Action Extension.appex */;
|
||||
productType = "com.apple.product-type.app-extension";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
97C146E61CF9000F007C117D /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastSwiftUpdateCheck = 1330;
|
||||
LastUpgradeCheck = 1300;
|
||||
ORGANIZATIONNAME = "";
|
||||
TargetAttributes = {
|
||||
@ -171,6 +301,12 @@
|
||||
CreatedOnToolsVersion = 7.3.1;
|
||||
LastSwiftMigration = 1100;
|
||||
};
|
||||
E51D52AC283B464E00FC8DD8 = {
|
||||
CreatedOnToolsVersion = 13.3;
|
||||
};
|
||||
E530B1A5283B54DA004E8EB6 = {
|
||||
CreatedOnToolsVersion = 13.3;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
|
||||
@ -187,6 +323,8 @@
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
97C146ED1CF9000F007C117D /* Runner */,
|
||||
E51D52AC283B464E00FC8DD8 /* Share Extension */,
|
||||
E530B1A5283B54DA004E8EB6 /* Action Extension */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
@ -203,6 +341,23 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
E51D52AB283B464E00FC8DD8 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E51D52B3283B464E00FC8DD8 /* MainInterface.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
E530B1A4283B54DA004E8EB6 /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E530B1AB283B54DA004E8EB6 /* Media.xcassets in Resources */,
|
||||
E530B1B0283B54DA004E8EB6 /* MainInterface.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXShellScriptBuildPhase section */
|
||||
@ -286,8 +441,37 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
E51D52A9283B464E00FC8DD8 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E51D52B0283B464E00FC8DD8 /* ShareViewController.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
E530B1A2283B54DA004E8EB6 /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E530B1AD283B54DA004E8EB6 /* ActionViewController.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXTargetDependency section */
|
||||
E51D52B6283B464E00FC8DD8 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = E51D52AC283B464E00FC8DD8 /* Share Extension */;
|
||||
targetProxy = E51D52B5283B464E00FC8DD8 /* PBXContainerItemProxy */;
|
||||
};
|
||||
E530B1B3283B54DA004E8EB6 /* PBXTargetDependency */ = {
|
||||
isa = PBXTargetDependency;
|
||||
target = E530B1A5283B54DA004E8EB6 /* Action Extension */;
|
||||
targetProxy = E530B1B2283B54DA004E8EB6 /* PBXContainerItemProxy */;
|
||||
};
|
||||
/* End PBXTargetDependency section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
97C146FA1CF9000F007C117D /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
@ -305,6 +489,22 @@
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E51D52B1283B464E00FC8DD8 /* MainInterface.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
E51D52B2283B464E00FC8DD8 /* Base */,
|
||||
);
|
||||
name = MainInterface.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
E530B1AE283B54DA004E8EB6 /* MainInterface.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
E530B1AF283B54DA004E8EB6 /* Base */,
|
||||
);
|
||||
name = MainInterface.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
@ -362,12 +562,13 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 11;
|
||||
CURRENT_PROJECT_VERSION = 2;
|
||||
DEVELOPMENT_TEAM = QMWX3X2NF7;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@ -376,7 +577,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 0.2.5;
|
||||
MARKETING_VERSION = 0.2.8;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.jiaqi.hacki;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@ -498,12 +699,13 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 11;
|
||||
CURRENT_PROJECT_VERSION = 2;
|
||||
DEVELOPMENT_TEAM = QMWX3X2NF7;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@ -512,7 +714,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 0.2.5;
|
||||
MARKETING_VERSION = 0.2.8;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.jiaqi.hacki;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@ -528,12 +730,13 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 11;
|
||||
CURRENT_PROJECT_VERSION = 2;
|
||||
DEVELOPMENT_TEAM = QMWX3X2NF7;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@ -542,7 +745,7 @@
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 0.2.5;
|
||||
MARKETING_VERSION = 0.2.8;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.jiaqi.hacki;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
@ -553,6 +756,234 @@
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
E51D52B9283B464E00FC8DD8 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = QMWX3X2NF7;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = "Share Extension/Info.plist";
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "Share Extension";
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.4;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.jiaqi.hacki.Share-Extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
E51D52BA283B464E00FC8DD8 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = QMWX3X2NF7;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = "Share Extension/Info.plist";
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "Share Extension";
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.4;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.jiaqi.hacki.Share-Extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
E51D52BB283B464E00FC8DD8 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_ENTITLEMENTS = "Share Extension/Share Extension.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = QMWX3X2NF7;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = "Share Extension/Info.plist";
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "Share Extension";
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.4;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.jiaqi.hacki.Share-Extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
E530B1B5283B54DA004E8EB6 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIconExtension;
|
||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "";
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_ENTITLEMENTS = "Action Extension/Action Extension.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = QMWX3X2NF7;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = "Action Extension/Info.plist";
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "Open in Hacki";
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.4;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.jiaqi.hacki.Action-Extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
E530B1B6283B54DA004E8EB6 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIconExtension;
|
||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "";
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_ENTITLEMENTS = "Action Extension/Action Extension.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = QMWX3X2NF7;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = "Action Extension/Info.plist";
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "Open in Hacki";
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.4;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.jiaqi.hacki.Action-Extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
E530B1B7283B54DA004E8EB6 /* Profile */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIconExtension;
|
||||
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "";
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CODE_SIGN_ENTITLEMENTS = "Action Extension/Action Extension.entitlements";
|
||||
CODE_SIGN_IDENTITY = "Apple Development";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = QMWX3X2NF7;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = "Action Extension/Info.plist";
|
||||
INFOPLIST_KEY_CFBundleDisplayName = "Open in Hacki";
|
||||
INFOPLIST_KEY_NSHumanReadableCopyright = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 15.4;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@executable_path/../../Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "com.jiaqi.hacki.Action-Extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SKIP_INSTALL = YES;
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
SWIFT_VERSION = 5.0;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Profile;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
@ -576,6 +1007,26 @@
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
E51D52BC283B464E00FC8DD8 /* Build configuration list for PBXNativeTarget "Share Extension" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
E51D52B9283B464E00FC8DD8 /* Debug */,
|
||||
E51D52BA283B464E00FC8DD8 /* Release */,
|
||||
E51D52BB283B464E00FC8DD8 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
E530B1B8283B54DA004E8EB6 /* Build configuration list for PBXNativeTarget "Action Extension" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
E530B1B5283B54DA004E8EB6 /* Debug */,
|
||||
E530B1B6283B54DA004E8EB6 /* Release */,
|
||||
E530B1B7283B54DA004E8EB6 /* Profile */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 97C146E61CF9000F007C117D /* Project object */;
|
||||
|
@ -26,6 +26,17 @@
|
||||
<string>$(MARKETING_VERSION)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>ShareMedia</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(CURRENT_PROJECT_VERSION)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
@ -51,5 +62,9 @@
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>com.apple.developer.associated-domains</key>
|
||||
<array>
|
||||
<string>applinks:example.com</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -18,5 +18,9 @@
|
||||
</array>
|
||||
<key>com.apple.developer.ubiquity-kvstore-identifier</key>
|
||||
<string>$(TeamIdentifierPrefix)$(CFBundleIdentifier)</string>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>group.com.jiaqi.hacki</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
24
ios/Share Extension/Base.lproj/MainInterface.storyboard
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="j1y-V4-xli">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Share View Controller-->
|
||||
<scene sceneID="ceB-am-kn3">
|
||||
<objects>
|
||||
<viewController id="j1y-V4-xli" customClass="ShareViewController" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" opaque="NO" contentMode="scaleToFill" id="wbc-yd-nQP">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<viewLayoutGuide key="safeArea" id="1Xd-am-t49"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="CEy-Cv-SGf" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
21
ios/Share Extension/Info.plist
Normal file
@ -0,0 +1,21 @@
|
||||
<?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>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionAttributes</key>
|
||||
<dict>
|
||||
<key>NSExtensionActivationRule</key>
|
||||
<dict>
|
||||
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>NSExtensionMainStoryboard</key>
|
||||
<string>MainInterface</string>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.share-services</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
10
ios/Share Extension/Share Extension.entitlements
Normal file
@ -0,0 +1,10 @@
|
||||
<?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.application-groups</key>
|
||||
<array>
|
||||
<string>group.com.jiaqi.hacki</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
334
ios/Share Extension/ShareViewController.swift
Normal file
@ -0,0 +1,334 @@
|
||||
import UIKit
|
||||
import Social
|
||||
import MobileCoreServices
|
||||
import Photos
|
||||
|
||||
class ShareViewController: SLComposeServiceViewController {
|
||||
let hostAppBundleIdentifier = "com.jiaqi.hacki"
|
||||
let sharedKey = "ShareKey"
|
||||
var sharedMedia: [SharedMediaFile] = []
|
||||
var sharedText: [String] = []
|
||||
let imageContentType = kUTTypeImage as String
|
||||
let videoContentType = kUTTypeMovie as String
|
||||
let textContentType = kUTTypeText as String
|
||||
let urlContentType = kUTTypeURL as String
|
||||
let fileURLType = kUTTypeFileURL as String;
|
||||
|
||||
override func isContentValid() -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad();
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
super.viewDidAppear(animated)
|
||||
|
||||
// This is called after the user selects Post. Do the upload of contentText and/or NSExtensionContext attachments.
|
||||
if let content = extensionContext!.inputItems[0] as? NSExtensionItem {
|
||||
if let contents = content.attachments {
|
||||
for (index, attachment) in (contents).enumerated() {
|
||||
if attachment.hasItemConformingToTypeIdentifier(imageContentType) {
|
||||
handleImages(content: content, attachment: attachment, index: index)
|
||||
} else if attachment.hasItemConformingToTypeIdentifier(textContentType) {
|
||||
handleText(content: content, attachment: attachment, index: index)
|
||||
} else if attachment.hasItemConformingToTypeIdentifier(fileURLType) {
|
||||
handleFiles(content: content, attachment: attachment, index: index)
|
||||
} else if attachment.hasItemConformingToTypeIdentifier(urlContentType) {
|
||||
handleUrl(content: content, attachment: attachment, index: index)
|
||||
} else if attachment.hasItemConformingToTypeIdentifier(videoContentType) {
|
||||
handleVideos(content: content, attachment: attachment, index: index)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override func didSelectPost() {
|
||||
print("didSelectPost");
|
||||
}
|
||||
|
||||
override func configurationItems() -> [Any]! {
|
||||
// To add configuration options via table cells at the bottom of the sheet, return an array of SLComposeSheetConfigurationItem here.
|
||||
return []
|
||||
}
|
||||
|
||||
private func handleText (content: NSExtensionItem, attachment: NSItemProvider, index: Int) {
|
||||
attachment.loadItem(forTypeIdentifier: textContentType, options: nil) { [weak self] data, error in
|
||||
|
||||
if error == nil, let item = data as? String, let this = self {
|
||||
|
||||
this.sharedText.append(item)
|
||||
|
||||
// If this is the last item, save imagesData in userDefaults and redirect to host app
|
||||
if index == (content.attachments?.count)! - 1 {
|
||||
let userDefaults = UserDefaults(suiteName: "group.\(this.hostAppBundleIdentifier)")
|
||||
userDefaults?.set(this.sharedText, forKey: this.sharedKey)
|
||||
userDefaults?.synchronize()
|
||||
this.redirectToHostApp(type: .text)
|
||||
}
|
||||
|
||||
} else {
|
||||
self?.dismissWithError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func handleUrl (content: NSExtensionItem, attachment: NSItemProvider, index: Int) {
|
||||
attachment.loadItem(forTypeIdentifier: urlContentType, options: nil) { [weak self] data, error in
|
||||
|
||||
if error == nil, let item = data as? URL, let this = self {
|
||||
|
||||
this.sharedText.append(item.absoluteString)
|
||||
|
||||
// If this is the last item, save imagesData in userDefaults and redirect to host app
|
||||
if index == (content.attachments?.count)! - 1 {
|
||||
let userDefaults = UserDefaults(suiteName: "group.\(this.hostAppBundleIdentifier)")
|
||||
userDefaults?.set(this.sharedText, forKey: this.sharedKey)
|
||||
userDefaults?.synchronize()
|
||||
this.redirectToHostApp(type: .text)
|
||||
}
|
||||
|
||||
} else {
|
||||
self?.dismissWithError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func handleImages (content: NSExtensionItem, attachment: NSItemProvider, index: Int) {
|
||||
attachment.loadItem(forTypeIdentifier: imageContentType, options: nil) { [weak self] data, error in
|
||||
|
||||
if error == nil, let url = data as? URL, let this = self {
|
||||
|
||||
// Always copy
|
||||
let fileName = this.getFileName(from: url, type: .image)
|
||||
let newPath = FileManager.default
|
||||
.containerURL(forSecurityApplicationGroupIdentifier: "group.\(this.hostAppBundleIdentifier)")!
|
||||
.appendingPathComponent(fileName)
|
||||
let copied = this.copyFile(at: url, to: newPath)
|
||||
if(copied) {
|
||||
this.sharedMedia.append(SharedMediaFile(path: newPath.absoluteString, thumbnail: nil, duration: nil, type: .image))
|
||||
}
|
||||
|
||||
// If this is the last item, save imagesData in userDefaults and redirect to host app
|
||||
if index == (content.attachments?.count)! - 1 {
|
||||
let userDefaults = UserDefaults(suiteName: "group.\(this.hostAppBundleIdentifier)")
|
||||
userDefaults?.set(this.toData(data: this.sharedMedia), forKey: this.sharedKey)
|
||||
userDefaults?.synchronize()
|
||||
this.redirectToHostApp(type: .media)
|
||||
}
|
||||
|
||||
} else {
|
||||
self?.dismissWithError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func handleVideos (content: NSExtensionItem, attachment: NSItemProvider, index: Int) {
|
||||
attachment.loadItem(forTypeIdentifier: videoContentType, options: nil) { [weak self] data, error in
|
||||
|
||||
if error == nil, let url = data as? URL, let this = self {
|
||||
|
||||
// Always copy
|
||||
let fileName = this.getFileName(from: url, type: .video)
|
||||
let newPath = FileManager.default
|
||||
.containerURL(forSecurityApplicationGroupIdentifier: "group.\(this.hostAppBundleIdentifier)")!
|
||||
.appendingPathComponent(fileName)
|
||||
let copied = this.copyFile(at: url, to: newPath)
|
||||
if(copied) {
|
||||
guard let sharedFile = this.getSharedMediaFile(forVideo: newPath) else {
|
||||
return
|
||||
}
|
||||
this.sharedMedia.append(sharedFile)
|
||||
}
|
||||
|
||||
// If this is the last item, save imagesData in userDefaults and redirect to host app
|
||||
if index == (content.attachments?.count)! - 1 {
|
||||
let userDefaults = UserDefaults(suiteName: "group.\(this.hostAppBundleIdentifier)")
|
||||
userDefaults?.set(this.toData(data: this.sharedMedia), forKey: this.sharedKey)
|
||||
userDefaults?.synchronize()
|
||||
this.redirectToHostApp(type: .media)
|
||||
}
|
||||
|
||||
} else {
|
||||
self?.dismissWithError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func handleFiles (content: NSExtensionItem, attachment: NSItemProvider, index: Int) {
|
||||
attachment.loadItem(forTypeIdentifier: fileURLType, options: nil) { [weak self] data, error in
|
||||
|
||||
if error == nil, let url = data as? URL, let this = self {
|
||||
|
||||
// Always copy
|
||||
let fileName = this.getFileName(from :url, type: .file)
|
||||
let newPath = FileManager.default
|
||||
.containerURL(forSecurityApplicationGroupIdentifier: "group.\(this.hostAppBundleIdentifier)")!
|
||||
.appendingPathComponent(fileName)
|
||||
let copied = this.copyFile(at: url, to: newPath)
|
||||
if (copied) {
|
||||
this.sharedMedia.append(SharedMediaFile(path: newPath.absoluteString, thumbnail: nil, duration: nil, type: .file))
|
||||
}
|
||||
|
||||
if index == (content.attachments?.count)! - 1 {
|
||||
let userDefaults = UserDefaults(suiteName: "group.\(this.hostAppBundleIdentifier)")
|
||||
userDefaults?.set(this.toData(data: this.sharedMedia), forKey: this.sharedKey)
|
||||
userDefaults?.synchronize()
|
||||
this.redirectToHostApp(type: .file)
|
||||
}
|
||||
|
||||
} else {
|
||||
self?.dismissWithError()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func dismissWithError() {
|
||||
print("[ERROR] Error loading data!")
|
||||
let alert = UIAlertController(title: "Error", message: "Error loading data", preferredStyle: .alert)
|
||||
|
||||
let action = UIAlertAction(title: "Error", style: .cancel) { _ in
|
||||
self.dismiss(animated: true, completion: nil)
|
||||
}
|
||||
|
||||
alert.addAction(action)
|
||||
present(alert, animated: true, completion: nil)
|
||||
extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
|
||||
}
|
||||
|
||||
private func redirectToHostApp(type: RedirectType) {
|
||||
let url = URL(string: "ShareMedia://dataUrl=\(sharedKey)#\(type)")
|
||||
var responder = self as UIResponder?
|
||||
let selectorOpenURL = sel_registerName("openURL:")
|
||||
|
||||
while (responder != nil) {
|
||||
if (responder?.responds(to: selectorOpenURL))! {
|
||||
let _ = responder?.perform(selectorOpenURL, with: url)
|
||||
}
|
||||
responder = responder!.next
|
||||
}
|
||||
extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
|
||||
}
|
||||
|
||||
enum RedirectType {
|
||||
case media
|
||||
case text
|
||||
case file
|
||||
}
|
||||
|
||||
func getExtension(from url: URL, type: SharedMediaType) -> String {
|
||||
let parts = url.lastPathComponent.components(separatedBy: ".")
|
||||
var ex: String? = nil
|
||||
if (parts.count > 1) {
|
||||
ex = parts.last
|
||||
}
|
||||
|
||||
if (ex == nil) {
|
||||
switch type {
|
||||
case .image:
|
||||
ex = "PNG"
|
||||
case .video:
|
||||
ex = "MP4"
|
||||
case .file:
|
||||
ex = "TXT"
|
||||
}
|
||||
}
|
||||
return ex ?? "Unknown"
|
||||
}
|
||||
|
||||
func getFileName(from url: URL, type: SharedMediaType) -> String {
|
||||
var name = url.lastPathComponent
|
||||
|
||||
if (name.isEmpty) {
|
||||
name = UUID().uuidString + "." + getExtension(from: url, type: type)
|
||||
}
|
||||
|
||||
return name
|
||||
}
|
||||
|
||||
func copyFile(at srcURL: URL, to dstURL: URL) -> Bool {
|
||||
do {
|
||||
if FileManager.default.fileExists(atPath: dstURL.path) {
|
||||
try FileManager.default.removeItem(at: dstURL)
|
||||
}
|
||||
try FileManager.default.copyItem(at: srcURL, to: dstURL)
|
||||
} catch (let error) {
|
||||
print("Cannot copy item at \(srcURL) to \(dstURL): \(error)")
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
private func getSharedMediaFile(forVideo: URL) -> SharedMediaFile? {
|
||||
let asset = AVAsset(url: forVideo)
|
||||
let duration = (CMTimeGetSeconds(asset.duration) * 1000).rounded()
|
||||
let thumbnailPath = getThumbnailPath(for: forVideo)
|
||||
|
||||
if FileManager.default.fileExists(atPath: thumbnailPath.path) {
|
||||
return SharedMediaFile(path: forVideo.absoluteString, thumbnail: thumbnailPath.absoluteString, duration: duration, type: .video)
|
||||
}
|
||||
|
||||
var saved = false
|
||||
let assetImgGenerate = AVAssetImageGenerator(asset: asset)
|
||||
assetImgGenerate.appliesPreferredTrackTransform = true
|
||||
// let scale = UIScreen.main.scale
|
||||
assetImgGenerate.maximumSize = CGSize(width: 360, height: 360)
|
||||
do {
|
||||
let img = try assetImgGenerate.copyCGImage(at: CMTimeMakeWithSeconds(600, preferredTimescale: Int32(1.0)), actualTime: nil)
|
||||
try UIImage.pngData(UIImage(cgImage: img))()?.write(to: thumbnailPath)
|
||||
saved = true
|
||||
} catch {
|
||||
saved = false
|
||||
}
|
||||
|
||||
return saved ? SharedMediaFile(path: forVideo.absoluteString, thumbnail: thumbnailPath.absoluteString, duration: duration, type: .video) : nil
|
||||
|
||||
}
|
||||
|
||||
private func getThumbnailPath(for url: URL) -> URL {
|
||||
let fileName = Data(url.lastPathComponent.utf8).base64EncodedString().replacingOccurrences(of: "==", with: "")
|
||||
let path = FileManager.default
|
||||
.containerURL(forSecurityApplicationGroupIdentifier: "group.\(hostAppBundleIdentifier)")!
|
||||
.appendingPathComponent("\(fileName).jpg")
|
||||
return path
|
||||
}
|
||||
|
||||
class SharedMediaFile: Codable {
|
||||
var path: String; // can be image, video or url path. It can also be text content
|
||||
var thumbnail: String?; // video thumbnail
|
||||
var duration: Double?; // video duration in milliseconds
|
||||
var type: SharedMediaType;
|
||||
|
||||
|
||||
init(path: String, thumbnail: String?, duration: Double?, type: SharedMediaType) {
|
||||
self.path = path
|
||||
self.thumbnail = thumbnail
|
||||
self.duration = duration
|
||||
self.type = type
|
||||
}
|
||||
|
||||
// Debug method to print out SharedMediaFile details in the console
|
||||
func toString() {
|
||||
print("[SharedMediaFile] \n\tpath: \(self.path)\n\tthumbnail: \(self.thumbnail)\n\tduration: \(self.duration)\n\ttype: \(self.type)")
|
||||
}
|
||||
}
|
||||
|
||||
enum SharedMediaType: Int, Codable {
|
||||
case image
|
||||
case video
|
||||
case file
|
||||
}
|
||||
|
||||
func toData(data: [SharedMediaFile]) -> Data {
|
||||
let encodedData = try? JSONEncoder().encode(data)
|
||||
return encodedData!
|
||||
}
|
||||
}
|
||||
|
||||
extension Array {
|
||||
subscript (safe index: UInt) -> Element? {
|
||||
return Int(index) < count ? self[Int(index)] : nil
|
||||
}
|
||||
}
|
@ -10,8 +10,15 @@ abstract class Constants {
|
||||
static const String googlePlayLink =
|
||||
'https://play.google.com/store/apps/details?id=com.jiaqifeng.hacki&hl=en_US&gl=US';
|
||||
|
||||
static const String hackerNewsLogoPath = 'images/hacker_news_logo.png';
|
||||
static const String hackiIconPath = 'images/hacki_icon.png';
|
||||
static const String _imagePath = 'assets/images';
|
||||
static const String hackerNewsLogoPath = '$_imagePath/hacker_news_logo.png';
|
||||
static const String hackiIconPath = '$_imagePath/hacki_icon.png';
|
||||
static const String commentTileLeftSlidePath =
|
||||
'$_imagePath/comment_tile_left_slide.png';
|
||||
static const String commentTileRightSlidePath =
|
||||
'$_imagePath/comment_tile_right_slide.png';
|
||||
static const String commentTileTopTapPath =
|
||||
'$_imagePath/comment_tile_top_tap.png';
|
||||
|
||||
/// Feature ids for feature discovery.
|
||||
static const String featureAddStoryToFavList = 'add_story_to_fav_list';
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:hacki/repositories/repositories.dart';
|
||||
import 'package:hacki/services/services.dart';
|
||||
@ -18,5 +19,8 @@ Future<void> setUpLocator() async {
|
||||
..registerSingleton<CacheRepository>(CacheRepository())
|
||||
..registerSingleton<CacheService>(CacheService())
|
||||
..registerSingleton<LocalNotification>(LocalNotification())
|
||||
..registerSingleton<Logger>(Logger());
|
||||
..registerSingleton<Logger>(Logger())
|
||||
..registerSingleton<RouteObserver<ModalRoute<dynamic>>>(
|
||||
RouteObserver<ModalRoute<dynamic>>(),
|
||||
);
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:hacki/config/locator.dart';
|
||||
@ -15,21 +17,74 @@ class CollapseCubit extends Cubit<CollapseState> {
|
||||
|
||||
final int _commentId;
|
||||
final CacheService _cacheService;
|
||||
late final StreamSubscription<Map<int, Set<int>>> _streamSubscription;
|
||||
|
||||
void init() {
|
||||
_streamSubscription =
|
||||
_cacheService.hiddenComments.listen(hiddenCommentsStreamListener);
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
collapsedCount: _cacheService.totalHidden(_commentId),
|
||||
collapsed: _cacheService.isCollapsed(_commentId),
|
||||
hidden: _cacheService.isHidden(_commentId),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void collapse() {
|
||||
_cacheService.updateCollapsedComments(_commentId);
|
||||
emit(
|
||||
state.copyWith(
|
||||
collapsed: !state.collapsed,
|
||||
),
|
||||
);
|
||||
if (state.collapsed) {
|
||||
_cacheService.uncollapse(_commentId);
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
collapsed: false,
|
||||
collapsedCount: 0,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
final int count = _cacheService.collapse(_commentId);
|
||||
|
||||
emit(
|
||||
state.copyWith(
|
||||
collapsed: true,
|
||||
collapsedCount: state.collapsed ? 0 : count,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void hiddenCommentsStreamListener(Map<int, Set<int>> event) {
|
||||
for (final int key in event.keys) {
|
||||
if (key == _commentId && !isClosed) {
|
||||
emit(
|
||||
state.copyWith(
|
||||
collapsedCount: event[key]?.length ?? 0,
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (final Set<int> val in event.values) {
|
||||
if (val.contains(_commentId) && !isClosed) {
|
||||
emit(
|
||||
state.copyWith(hidden: true),
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isClosed) {
|
||||
emit(
|
||||
state.copyWith(hidden: false),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> close() async {
|
||||
await _streamSubscription.cancel();
|
||||
await super.close();
|
||||
}
|
||||
}
|
||||
|
@ -1,18 +1,37 @@
|
||||
part of 'collapse_cubit.dart';
|
||||
|
||||
class CollapseState extends Equatable {
|
||||
const CollapseState({required this.collapsed});
|
||||
const CollapseState({
|
||||
required this.collapsed,
|
||||
required this.hidden,
|
||||
required this.collapsedCount,
|
||||
});
|
||||
|
||||
const CollapseState.init() : collapsed = false;
|
||||
const CollapseState.init()
|
||||
: collapsed = false,
|
||||
hidden = false,
|
||||
collapsedCount = 0;
|
||||
|
||||
final bool collapsed;
|
||||
final bool hidden;
|
||||
final int collapsedCount;
|
||||
|
||||
CollapseState copyWith({bool? collapsed}) {
|
||||
CollapseState copyWith({
|
||||
bool? collapsed,
|
||||
bool? hidden,
|
||||
int? collapsedCount,
|
||||
}) {
|
||||
return CollapseState(
|
||||
collapsed: collapsed ?? this.collapsed,
|
||||
hidden: hidden ?? this.hidden,
|
||||
collapsedCount: collapsedCount ?? this.collapsedCount,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => <Object?>[collapsed];
|
||||
List<Object?> get props => <Object?>[
|
||||
collapsed,
|
||||
hidden,
|
||||
collapsedCount,
|
||||
];
|
||||
}
|
||||
|
@ -153,8 +153,10 @@ class CommentsCubit extends Cubit<CommentsState> {
|
||||
|
||||
void _onCommentFetched(Comment? comment) {
|
||||
if (comment != null) {
|
||||
_cacheService.cacheComment(comment);
|
||||
_sembastRepository.saveComment(comment);
|
||||
_cacheService
|
||||
..addKid(comment.id, to: comment.parent)
|
||||
..cacheComment(comment);
|
||||
_sembastRepository.cacheComment(comment);
|
||||
final List<Comment> updatedComments = <Comment>[
|
||||
...state.comments,
|
||||
comment
|
||||
|
@ -97,31 +97,35 @@ class NotificationCubit extends Cubit<NotificationState> {
|
||||
}
|
||||
}
|
||||
|
||||
await _fetchReplies().whenComplete(() {
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: NotificationStatus.loaded,
|
||||
),
|
||||
);
|
||||
_initializeTimer();
|
||||
}).onError((Object? error, StackTrace stackTrace) {
|
||||
_initializeTimer();
|
||||
return null;
|
||||
});
|
||||
await _fetchReplies().whenComplete(_initializeTimer);
|
||||
}
|
||||
|
||||
void markAsRead(int id) {
|
||||
if (state.unreadCommentsIds.contains(id)) {
|
||||
final List<int> updatedUnreadIds = <int>[...state.unreadCommentsIds]
|
||||
..remove(id);
|
||||
_preferenceRepository.updateUnreadCommentsIds(updatedUnreadIds);
|
||||
emit(state.copyWith(unreadCommentsIds: updatedUnreadIds));
|
||||
}
|
||||
Future.doWhile(() {
|
||||
if (state.status != NotificationStatus.loading) {
|
||||
if (state.unreadCommentsIds.contains(id)) {
|
||||
final List<int> updatedUnreadIds = <int>[...state.unreadCommentsIds]
|
||||
..remove(id);
|
||||
_preferenceRepository.updateUnreadCommentsIds(updatedUnreadIds);
|
||||
emit(state.copyWith(unreadCommentsIds: updatedUnreadIds));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
void markAllAsRead() {
|
||||
emit(state.copyWith(unreadCommentsIds: <int>[]));
|
||||
_preferenceRepository.updateUnreadCommentsIds(<int>[]);
|
||||
Future.doWhile(() {
|
||||
if (state.status != NotificationStatus.loading) {
|
||||
emit(state.copyWith(unreadCommentsIds: <int>[]));
|
||||
_preferenceRepository.updateUnreadCommentsIds(<int>[]);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> refresh() async {
|
||||
@ -134,22 +138,7 @@ class NotificationCubit extends Cubit<NotificationState> {
|
||||
|
||||
_timer?.cancel();
|
||||
|
||||
await _fetchReplies().whenComplete(() {
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: NotificationStatus.loaded,
|
||||
),
|
||||
);
|
||||
_initializeTimer();
|
||||
}).onError((Object? error, StackTrace stackTrace) {
|
||||
emit(
|
||||
state.copyWith(
|
||||
status: NotificationStatus.loaded,
|
||||
),
|
||||
);
|
||||
_initializeTimer();
|
||||
return null;
|
||||
});
|
||||
await _fetchReplies().whenComplete(_initializeTimer);
|
||||
} else {
|
||||
emit(
|
||||
state.copyWith(
|
||||
@ -247,6 +236,10 @@ class NotificationCubit extends Cubit<NotificationState> {
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}).whenComplete(
|
||||
() => emit(
|
||||
state.copyWith(status: NotificationStatus.loaded),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -10,23 +10,26 @@ part 'poll_state.dart';
|
||||
|
||||
class PollCubit extends Cubit<PollState> {
|
||||
PollCubit({
|
||||
required Story story,
|
||||
StoriesRepository? storiesRepository,
|
||||
}) : _storiesRepository =
|
||||
}) : _story = story,
|
||||
_storiesRepository =
|
||||
storiesRepository ?? locator.get<StoriesRepository>(),
|
||||
super(PollState.init());
|
||||
|
||||
final StoriesRepository _storiesRepository;
|
||||
final Story _story;
|
||||
|
||||
Future<void> init({
|
||||
required Story story,
|
||||
bool refresh = false,
|
||||
}) async {
|
||||
emit(state.copyWith(status: PollStatus.loading));
|
||||
|
||||
List<int> pollOptionsIds = story.parts;
|
||||
List<int> pollOptionsIds = _story.parts;
|
||||
|
||||
if (pollOptionsIds.isEmpty) {
|
||||
if (pollOptionsIds.isEmpty || refresh) {
|
||||
final Story? updatedStory =
|
||||
await _storiesRepository.fetchStoryBy(story.id);
|
||||
await _storiesRepository.fetchStoryBy(_story.id);
|
||||
|
||||
if (updatedStory != null) {
|
||||
pollOptionsIds = updatedStory.parts;
|
||||
@ -69,13 +72,7 @@ class PollCubit extends Cubit<PollState> {
|
||||
}
|
||||
}
|
||||
|
||||
void select(int id) {
|
||||
emit(state.copyWith(selections: <int>{...state.selections, id}));
|
||||
}
|
||||
|
||||
void unselect(int id) {
|
||||
emit(state.copyWith(selections: <int>{...state.selections}..remove(id)));
|
||||
}
|
||||
void refresh() => init(refresh: true);
|
||||
|
||||
double _calculateRatio(int totalVotes, int votes) =>
|
||||
totalVotes == 0 ? 0 : votes / totalVotes;
|
||||
|
@ -1,13 +1,20 @@
|
||||
import 'package:bloc/bloc.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:hacki/config/locator.dart';
|
||||
import 'package:hacki/screens/screens.dart';
|
||||
import 'package:hacki/services/services.dart';
|
||||
|
||||
part 'split_view_state.dart';
|
||||
|
||||
class SplitViewCubit extends Cubit<SplitViewState> {
|
||||
SplitViewCubit() : super(const SplitViewState.init());
|
||||
SplitViewCubit({CacheService? cacheService})
|
||||
: _cacheService = cacheService ?? locator.get<CacheService>(),
|
||||
super(const SplitViewState.init());
|
||||
|
||||
final CacheService _cacheService;
|
||||
|
||||
void updateStoryScreenArgs(StoryScreenArgs args) {
|
||||
_cacheService.resetCollapsedComments();
|
||||
emit(state.copyWith(storyScreenArgs: args));
|
||||
}
|
||||
|
||||
|
@ -24,14 +24,14 @@ class TimeMachineCubit extends Cubit<TimeMachineState> {
|
||||
|
||||
final List<Comment> parents = <Comment>[];
|
||||
Comment? parent = _cacheService.getComment(comment.parent);
|
||||
parent ??= await _sembastRepository.getComment(id: comment.parent);
|
||||
parent ??= await _sembastRepository.getCachedComment(id: comment.parent);
|
||||
|
||||
while (parent != null) {
|
||||
parents.insert(0, parent);
|
||||
|
||||
final int parentId = parent.parent;
|
||||
parent = _cacheService.getComment(parentId);
|
||||
parent ??= await _sembastRepository.getComment(id: parentId);
|
||||
parent ??= await _sembastRepository.getCachedComment(id: parentId);
|
||||
}
|
||||
|
||||
emit(state.copyWith(parents: parents));
|
||||
|
@ -1,5 +1,7 @@
|
||||
export 'date_time_extension.dart';
|
||||
export 'int_extension.dart';
|
||||
export 'list_extension.dart';
|
||||
export 'object_extension.dart';
|
||||
export 'state_extension.dart';
|
||||
export 'string_extension.dart';
|
||||
export 'widget_extension.dart';
|
||||
|
5
lib/extensions/int_extension.dart
Normal file
@ -0,0 +1,5 @@
|
||||
extension IntExtension on int {
|
||||
Iterable<int> to(int other, {bool inclusive = true}) => other > this
|
||||
? <int>[for (int i = this; i < other; i++) i, if (inclusive) other]
|
||||
: <int>[for (int i = this; i > other; i--) i, if (inclusive) other];
|
||||
}
|
7
lib/extensions/string_extension.dart
Normal file
@ -0,0 +1,7 @@
|
||||
extension StringExtension on String {
|
||||
int? getItemId() {
|
||||
final RegExp regex = RegExp(r'\d+$');
|
||||
final String match = regex.stringMatch(this) ?? '';
|
||||
return int.tryParse(match);
|
||||
}
|
||||
}
|
@ -4,17 +4,20 @@ import 'dart:io';
|
||||
import 'package:adaptive_theme/adaptive_theme.dart';
|
||||
import 'package:feature_discovery/feature_discovery.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'package:hacki/blocs/blocs.dart';
|
||||
import 'package:hacki/config/custom_router.dart';
|
||||
import 'package:hacki/config/locator.dart';
|
||||
import 'package:hacki/cubits/cubits.dart';
|
||||
import 'package:hacki/repositories/repositories.dart' show PreferenceRepository;
|
||||
import 'package:hacki/screens/screens.dart';
|
||||
import 'package:hacki/services/fetcher.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'package:rxdart/rxdart.dart' show BehaviorSubject;
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:workmanager/workmanager.dart';
|
||||
|
||||
// For receiving payload event from local notifications.
|
||||
@ -63,6 +66,9 @@ Future<void> main() async {
|
||||
await setUpLocator();
|
||||
|
||||
final AdaptiveThemeMode? savedThemeMode = await AdaptiveTheme.getThemeMode();
|
||||
final SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
final bool trueDarkMode =
|
||||
prefs.getBool(PreferenceRepository.trueDarkModeKey) ?? false;
|
||||
|
||||
// Uncomment code below for running with logging.
|
||||
// BlocOverrides.runZoned(
|
||||
@ -79,6 +85,7 @@ Future<void> main() async {
|
||||
runApp(
|
||||
HackiApp(
|
||||
savedThemeMode: savedThemeMode,
|
||||
trueDarkMode: trueDarkMode,
|
||||
),
|
||||
);
|
||||
}
|
||||
@ -87,9 +94,11 @@ class HackiApp extends StatelessWidget {
|
||||
const HackiApp({
|
||||
super.key,
|
||||
this.savedThemeMode,
|
||||
required this.trueDarkMode,
|
||||
});
|
||||
|
||||
final AdaptiveThemeMode? savedThemeMode;
|
||||
final bool trueDarkMode;
|
||||
|
||||
static final GlobalKey<NavigatorState> navigatorKey =
|
||||
GlobalKey<NavigatorState>();
|
||||
@ -166,6 +175,7 @@ class HackiApp extends StatelessWidget {
|
||||
dark: ThemeData(
|
||||
brightness: Brightness.dark,
|
||||
primarySwatch: Colors.orange,
|
||||
canvasColor: trueDarkMode ? Colors.black : null,
|
||||
),
|
||||
initial: savedThemeMode ?? AdaptiveThemeMode.system,
|
||||
builder: (ThemeData theme, ThemeData darkTheme) {
|
||||
@ -174,20 +184,38 @@ class HackiApp extends StatelessWidget {
|
||||
primarySwatch: Colors.orange,
|
||||
canvasColor: Colors.black,
|
||||
);
|
||||
return BlocBuilder<PreferenceCubit, PreferenceState>(
|
||||
buildWhen: (PreferenceState previous, PreferenceState current) =>
|
||||
previous.useTrueDark != current.useTrueDark,
|
||||
builder: (BuildContext context, PreferenceState prefState) {
|
||||
return FeatureDiscovery(
|
||||
child: MaterialApp(
|
||||
title: 'Hacki',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: prefState.useTrueDark ? trueDarkTheme : theme,
|
||||
darkTheme: prefState.useTrueDark ? trueDarkTheme : darkTheme,
|
||||
navigatorKey: navigatorKey,
|
||||
onGenerateRoute: CustomRouter.onGenerateRoute,
|
||||
initialRoute: HomeScreen.routeName,
|
||||
),
|
||||
return FutureBuilder<AdaptiveThemeMode?>(
|
||||
future: AdaptiveTheme.getThemeMode(),
|
||||
builder: (
|
||||
BuildContext context,
|
||||
AsyncSnapshot<AdaptiveThemeMode?> snapshot,
|
||||
) {
|
||||
final AdaptiveThemeMode? mode = snapshot.data;
|
||||
return BlocBuilder<PreferenceCubit, PreferenceState>(
|
||||
buildWhen:
|
||||
(PreferenceState previous, PreferenceState current) =>
|
||||
previous.useTrueDark != current.useTrueDark,
|
||||
builder: (BuildContext context, PreferenceState prefState) {
|
||||
final bool useTrueDark = prefState.useTrueDark &&
|
||||
(mode == AdaptiveThemeMode.dark ||
|
||||
(mode == AdaptiveThemeMode.system &&
|
||||
SchedulerBinding
|
||||
.instance.window.platformBrightness ==
|
||||
Brightness.dark));
|
||||
return FeatureDiscovery(
|
||||
child: MaterialApp(
|
||||
title: 'Hacki',
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: useTrueDark ? trueDarkTheme : theme,
|
||||
navigatorKey: navigatorKey,
|
||||
navigatorObservers: <NavigatorObserver>[
|
||||
locator.get<RouteObserver<ModalRoute<dynamic>>>(),
|
||||
],
|
||||
onGenerateRoute: CustomRouter.onGenerateRoute,
|
||||
initialRoute: HomeScreen.routeName,
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -1,6 +1,8 @@
|
||||
import 'package:hacki/models/models.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
|
||||
/// [CacheRepository] is for storing stories and comments for offline reading.
|
||||
/// It's using [Hive] as its database which is being stored in temp directory.
|
||||
class CacheRepository {
|
||||
CacheRepository({
|
||||
Future<Box<List<int>>>? storyIdBox,
|
||||
@ -116,4 +118,10 @@ class CacheRepository {
|
||||
final LazyBox<Map<dynamic, dynamic>> box = await _commentBox;
|
||||
return box.clear();
|
||||
}
|
||||
|
||||
Future<int> deleteAll() async {
|
||||
return deleteAllStoryIds()
|
||||
.whenComplete(deleteAllStories)
|
||||
.whenComplete(deleteAllComments);
|
||||
}
|
||||
}
|
||||
|
@ -20,11 +20,14 @@ class PreferenceRepository {
|
||||
static const String _pinnedStoriesIdsKey = 'pinnedStoriesIds';
|
||||
static const String _unreadCommentsIdsKey = 'unreadCommentsIds';
|
||||
static const String _lastReadStoryIdKey = 'lastReadStoryId';
|
||||
static const String _isFirstLaunchKey = 'isFirstLaunch';
|
||||
|
||||
static const String _notificationModeKey = 'notificationMode';
|
||||
static const String _trueDarkModeKey = 'trueDarkMode';
|
||||
static const String _readerModeKey = 'readerMode';
|
||||
|
||||
/// Exposing this val for main func.
|
||||
static const String trueDarkModeKey = 'trueDarkMode';
|
||||
|
||||
/// The key of a boolean value deciding whether or not the story
|
||||
/// tile should display link preview. Defaults to true.
|
||||
static const String _displayModeKey = 'displayMode';
|
||||
@ -42,6 +45,7 @@ class PreferenceRepository {
|
||||
static const bool _trueDarkModeDefaultValue = false;
|
||||
static const bool _readerModeDefaultValue = true;
|
||||
static const bool _markReadStoriesModeDefaultValue = true;
|
||||
static const bool _isFirstLaunchKeyDefaultValue = true;
|
||||
|
||||
final SyncedSharedPreferences _syncedPrefs;
|
||||
final Future<SharedPreferences> _prefs;
|
||||
@ -53,6 +57,16 @@ class PreferenceRepository {
|
||||
|
||||
Future<String?> get password async => _secureStorage.read(key: _passwordKey);
|
||||
|
||||
Future<bool> get isFirstLaunch async {
|
||||
final SharedPreferences prefs = await _prefs;
|
||||
final bool val =
|
||||
prefs.getBool(_isFirstLaunchKey) ?? _isFirstLaunchKeyDefaultValue;
|
||||
|
||||
await prefs.setBool(_isFirstLaunchKey, false);
|
||||
|
||||
return val;
|
||||
}
|
||||
|
||||
Future<List<String>> get blocklist async => _prefs.then(
|
||||
(SharedPreferences prefs) =>
|
||||
prefs.getStringList(_blocklistKey) ?? <String>[],
|
||||
@ -99,7 +113,7 @@ class PreferenceRepository {
|
||||
|
||||
Future<bool> get trueDarkMode async => _prefs.then(
|
||||
(SharedPreferences prefs) =>
|
||||
prefs.getBool(_trueDarkModeKey) ?? _trueDarkModeDefaultValue,
|
||||
prefs.getBool(trueDarkModeKey) ?? _trueDarkModeDefaultValue,
|
||||
);
|
||||
|
||||
Future<bool> get readerMode async => _prefs.then(
|
||||
@ -247,8 +261,8 @@ class PreferenceRepository {
|
||||
Future<void> toggleTrueDarkMode() async {
|
||||
final SharedPreferences prefs = await _prefs;
|
||||
final bool currentMode =
|
||||
prefs.getBool(_trueDarkModeKey) ?? _trueDarkModeDefaultValue;
|
||||
await prefs.setBool(_trueDarkModeKey, !currentMode);
|
||||
prefs.getBool(trueDarkModeKey) ?? _trueDarkModeDefaultValue;
|
||||
await prefs.setBool(trueDarkModeKey, !currentMode);
|
||||
}
|
||||
|
||||
Future<void> toggleReaderMode() async {
|
||||
|
@ -6,6 +6,8 @@ import 'package:path_provider/path_provider.dart';
|
||||
import 'package:sembast/sembast.dart';
|
||||
import 'package:sembast/sembast_io.dart';
|
||||
|
||||
/// [SembastRepository] is for storing stories and comments for faster loading.
|
||||
/// It's using Sembast as its database which is being stored in doc directory.
|
||||
class SembastRepository {
|
||||
SembastRepository({Database? database}) {
|
||||
if (database == null) {
|
||||
@ -18,6 +20,7 @@ class SembastRepository {
|
||||
Database? _database;
|
||||
List<int>? _idsOfCommentsRepliedToMe;
|
||||
|
||||
static const String _cachedCommentsKey = 'cachedComments';
|
||||
static const String _commentsKey = 'comments';
|
||||
static const String _idsOfCommentsRepliedToMeKey = 'idsOfCommentsRepliedToMe';
|
||||
|
||||
@ -31,6 +34,38 @@ class SembastRepository {
|
||||
return db;
|
||||
}
|
||||
|
||||
//#region Cached comments for time machine feature.
|
||||
Future<Map<String, Object?>> cacheComment(Comment comment) async {
|
||||
final Database db = _database ?? await initializeDatabase();
|
||||
final StoreRef<int, Map<String, Object?>> store =
|
||||
intMapStoreFactory.store(_cachedCommentsKey);
|
||||
return store.record(comment.id).put(db, comment.toJson());
|
||||
}
|
||||
|
||||
Future<Comment?> getCachedComment({required int id}) async {
|
||||
final Database db = _database ?? await initializeDatabase();
|
||||
final StoreRef<int, Map<String, Object?>> store =
|
||||
intMapStoreFactory.store(_cachedCommentsKey);
|
||||
final RecordSnapshot<int, Map<String, Object?>>? snapshot =
|
||||
await store.record(id).getSnapshot(db);
|
||||
if (snapshot != null) {
|
||||
final Comment comment = Comment.fromJson(snapshot.value);
|
||||
return comment;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Future<int> deleteAllCachedComments() async {
|
||||
final Database db = _database ?? await initializeDatabase();
|
||||
final StoreRef<int, Map<String, Object?>> store =
|
||||
intMapStoreFactory.store(_cachedCommentsKey);
|
||||
return store.delete(db);
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
//#region Saved comments for notification feature.
|
||||
Future<Map<String, Object?>> saveComment(Comment comment) async {
|
||||
final Database db = _database ?? await initializeDatabase();
|
||||
final StoreRef<int, Map<String, Object?>> store =
|
||||
@ -137,6 +172,8 @@ class SembastRepository {
|
||||
return kids;
|
||||
}
|
||||
|
||||
//#endregion
|
||||
|
||||
Future<FileSystemEntity> deleteAll() async {
|
||||
final Directory dir = await getApplicationDocumentsDirectory();
|
||||
await dir.create(recursive: true);
|
||||
|
@ -1,5 +1,6 @@
|
||||
// ignore_for_file: lines_longer_than_80_chars
|
||||
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:badges/badges.dart';
|
||||
@ -22,6 +23,7 @@ import 'package:hacki/screens/screens.dart';
|
||||
import 'package:hacki/screens/widgets/widgets.dart';
|
||||
import 'package:hacki/services/services.dart';
|
||||
import 'package:hacki/utils/utils.dart';
|
||||
import 'package:receive_sharing_intent/receive_sharing_intent.dart';
|
||||
import 'package:responsive_builder/responsive_builder.dart';
|
||||
|
||||
class HomeScreen extends StatefulWidget {
|
||||
@ -41,11 +43,29 @@ class HomeScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _HomeScreenState extends State<HomeScreen>
|
||||
with SingleTickerProviderStateMixin {
|
||||
with SingleTickerProviderStateMixin, RouteAware {
|
||||
final CacheService cacheService = locator.get<CacheService>();
|
||||
final Throttle featureDiscoveryDismissThrottle = Throttle(
|
||||
delay: _throttleDelay,
|
||||
);
|
||||
|
||||
late final TabController tabController;
|
||||
late final StreamSubscription<String> intentDataStreamSubscription;
|
||||
late final StreamSubscription<String?> notificationStreamSubscription;
|
||||
|
||||
int currentIndex = 0;
|
||||
|
||||
static const Duration _throttleDelay = Duration(seconds: 1);
|
||||
|
||||
@override
|
||||
void didPopNext() {
|
||||
if (context.read<StoriesBloc>().deviceScreenType ==
|
||||
DeviceScreenType.mobile) {
|
||||
cacheService.resetCollapsedComments();
|
||||
}
|
||||
super.didPopNext();
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@ -58,42 +78,34 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
// Constants.featurePinToTop,
|
||||
// ]);
|
||||
|
||||
ReceiveSharingIntent.getInitialText().then(onShareExtensionTapped);
|
||||
|
||||
intentDataStreamSubscription =
|
||||
ReceiveSharingIntent.getTextStream().listen(onShareExtensionTapped);
|
||||
|
||||
if (!selectNotificationSubject.hasListener) {
|
||||
selectNotificationSubject.stream.listen((String? payload) async {
|
||||
if (payload == null) return;
|
||||
|
||||
final Map<String, dynamic> payloadJson =
|
||||
jsonDecode(payload) as Map<String, dynamic>;
|
||||
|
||||
final int? storyId = payloadJson['storyId'] as int?;
|
||||
final int? commentId = payloadJson['commentId'] as int?;
|
||||
|
||||
if (storyId != null && commentId != null) {
|
||||
context.read<NotificationCubit>().markAsRead(commentId);
|
||||
|
||||
await locator
|
||||
.get<StoriesRepository>()
|
||||
.fetchStoryBy(storyId)
|
||||
.then((Story? story) {
|
||||
if (story == null) {
|
||||
showSnackBar(content: 'Something went wrong...');
|
||||
return;
|
||||
}
|
||||
final StoryScreenArgs args = StoryScreenArgs(story: story);
|
||||
goToStoryScreen(args: args);
|
||||
});
|
||||
}
|
||||
});
|
||||
notificationStreamSubscription =
|
||||
selectNotificationSubject.stream.listen(onNotificationTapped);
|
||||
}
|
||||
|
||||
SchedulerBinding.instance.addPostFrameCallback((_) {
|
||||
FeatureDiscovery.discoverFeatures(
|
||||
context,
|
||||
const <String>{
|
||||
Constants.featureLogIn,
|
||||
},
|
||||
);
|
||||
});
|
||||
SchedulerBinding.instance
|
||||
..addPostFrameCallback((_) {
|
||||
FeatureDiscovery.discoverFeatures(
|
||||
context,
|
||||
const <String>{
|
||||
Constants.featureLogIn,
|
||||
},
|
||||
);
|
||||
})
|
||||
..addPostFrameCallback((_) {
|
||||
final ModalRoute<dynamic>? route = ModalRoute.of(context);
|
||||
|
||||
if (route == null) return;
|
||||
|
||||
locator
|
||||
.get<RouteObserver<ModalRoute<dynamic>>>()
|
||||
.subscribe(this, route);
|
||||
});
|
||||
|
||||
tabController = TabController(vsync: this, length: 6)
|
||||
..addListener(() {
|
||||
@ -114,6 +126,15 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
featureDiscoveryDismissThrottle.dispose();
|
||||
tabController.dispose();
|
||||
intentDataStreamSubscription.cancel();
|
||||
notificationStreamSubscription.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final BlocBuilder<PreferenceCubit, PreferenceState> homeScreen =
|
||||
@ -258,6 +279,12 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
child: DescribedFeatureOverlay(
|
||||
onBackgroundTap: onFeatureDiscoveryDismissed,
|
||||
onDismiss: onFeatureDiscoveryDismissed,
|
||||
onComplete: () async {
|
||||
ScaffoldMessenger.of(context).clearSnackBars();
|
||||
unawaited(HapticFeedback.lightImpact());
|
||||
showOnboarding();
|
||||
return true;
|
||||
},
|
||||
overflowMode: OverflowMode.extendBackground,
|
||||
targetColor: Theme.of(context).primaryColor,
|
||||
tapTarget: const Icon(
|
||||
@ -372,8 +399,12 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
}
|
||||
|
||||
Future<bool> onFeatureDiscoveryDismissed() {
|
||||
ScaffoldMessenger.of(context).clearSnackBars();
|
||||
showSnackBar(content: 'Tap on icon to continue');
|
||||
featureDiscoveryDismissThrottle.run(() {
|
||||
HapticFeedback.lightImpact();
|
||||
ScaffoldMessenger.of(context).clearSnackBars();
|
||||
showSnackBar(content: 'Tap on icon to continue');
|
||||
});
|
||||
|
||||
return Future<bool>.value(false);
|
||||
}
|
||||
|
||||
@ -383,7 +414,7 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
final bool useReader = context.read<PreferenceCubit>().state.useReader;
|
||||
final bool offlineReading =
|
||||
context.read<StoriesBloc>().state.offlineReading;
|
||||
final bool firstTimeReading = cacheService.isFirstTimeReading(story.id);
|
||||
final bool hasRead = context.read<StoriesBloc>().hasRead(story);
|
||||
final bool splitViewEnabled = context.read<SplitViewCubit>().state.enabled;
|
||||
|
||||
// If a story is a job story and it has a link to the job posting,
|
||||
@ -411,10 +442,8 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
}
|
||||
}
|
||||
|
||||
if (!offlineReading &&
|
||||
(isJobWithLink || (showWebFirst && firstTimeReading))) {
|
||||
if (!offlineReading && (isJobWithLink || (showWebFirst && !hasRead))) {
|
||||
LinkUtil.launchUrl(story.url, useReader: useReader);
|
||||
cacheService.store(story.id);
|
||||
}
|
||||
|
||||
context.read<StoriesBloc>().add(
|
||||
@ -423,6 +452,61 @@ class _HomeScreenState extends State<HomeScreen>
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void showOnboarding() {
|
||||
Navigator.push<dynamic>(
|
||||
context,
|
||||
MaterialPageRoute<dynamic>(
|
||||
builder: (BuildContext context) => const OnboardingView(),
|
||||
fullscreenDialog: true,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void onShareExtensionTapped(String? event) {
|
||||
if (event == null) return;
|
||||
|
||||
final int? id = event.getItemId();
|
||||
|
||||
if (id != null) {
|
||||
locator
|
||||
.get<StoriesRepository>()
|
||||
.fetchParentStory(id: id)
|
||||
.then((Story? story) {
|
||||
if (mounted) {
|
||||
if (story != null) {
|
||||
goToStoryScreen(args: StoryScreenArgs(story: story));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> onNotificationTapped(String? payload) async {
|
||||
if (payload == null) return;
|
||||
|
||||
final Map<String, dynamic> payloadJson =
|
||||
jsonDecode(payload) as Map<String, dynamic>;
|
||||
|
||||
final int? storyId = payloadJson['storyId'] as int?;
|
||||
final int? commentId = payloadJson['commentId'] as int?;
|
||||
|
||||
if (storyId != null && commentId != null) {
|
||||
context.read<NotificationCubit>().markAsRead(commentId);
|
||||
|
||||
await locator
|
||||
.get<StoriesRepository>()
|
||||
.fetchStoryBy(storyId)
|
||||
.then((Story? story) {
|
||||
if (story == null) {
|
||||
showSnackBar(content: 'Something went wrong...');
|
||||
return;
|
||||
}
|
||||
final StoryScreenArgs args = StoryScreenArgs(story: story);
|
||||
goToStoryScreen(args: args);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class _MobileHomeScreenBuilder extends StatelessWidget {
|
||||
|
@ -4,6 +4,7 @@ import 'package:adaptive_theme/adaptive_theme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:hacki/blocs/blocs.dart';
|
||||
import 'package:hacki/config/constants.dart';
|
||||
@ -357,7 +358,9 @@ class _ProfileScreenState extends State<ProfileScreen>
|
||||
),
|
||||
SwitchListTile(
|
||||
title: const Text('True Dark Mode'),
|
||||
subtitle: const Text('real dark.'),
|
||||
subtitle: const Text(
|
||||
'you might need to restart the app.',
|
||||
),
|
||||
value: preferenceState.useTrueDark,
|
||||
onChanged: (bool val) {
|
||||
HapticFeedback.lightImpact();
|
||||
@ -368,17 +371,16 @@ class _ProfileScreenState extends State<ProfileScreen>
|
||||
activeColor: Colors.orange,
|
||||
),
|
||||
ListTile(
|
||||
title: Text(
|
||||
title: const Text(
|
||||
'Theme',
|
||||
style: TextStyle(
|
||||
decoration: preferenceState.useTrueDark
|
||||
? TextDecoration.lineThrough
|
||||
: null,
|
||||
),
|
||||
),
|
||||
onTap: () => showThemeSettingDialog(
|
||||
useTrueDarkMode: preferenceState.useTrueDark,
|
||||
onTap: showThemeSettingDialog,
|
||||
),
|
||||
ListTile(
|
||||
title: const Text(
|
||||
'Clear Data',
|
||||
),
|
||||
onTap: showClearDataDialog,
|
||||
),
|
||||
ListTile(
|
||||
title: const Text('About'),
|
||||
@ -388,7 +390,7 @@ class _ProfileScreenState extends State<ProfileScreen>
|
||||
showAboutDialog(
|
||||
context: context,
|
||||
applicationName: 'Hacki',
|
||||
applicationVersion: 'v0.2.5',
|
||||
applicationVersion: 'v0.2.8',
|
||||
applicationIcon: ClipRRect(
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(12),
|
||||
@ -577,13 +579,7 @@ class _ProfileScreenState extends State<ProfileScreen>
|
||||
);
|
||||
}
|
||||
|
||||
void showThemeSettingDialog({bool useTrueDarkMode = false}) {
|
||||
if (useTrueDarkMode) {
|
||||
showSnackBar(
|
||||
content: "Can't choose theme when using true dark mode.",
|
||||
);
|
||||
return;
|
||||
}
|
||||
void showThemeSettingDialog() {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
@ -620,6 +616,61 @@ class _ProfileScreenState extends State<ProfileScreen>
|
||||
);
|
||||
}
|
||||
|
||||
void showClearDataDialog() {
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
builder: (_) {
|
||||
return AlertDialog(
|
||||
title: const Text('Clear Data?'),
|
||||
content: const Text(
|
||||
'Clear all cached images, stories and comments.',
|
||||
),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text(
|
||||
'Cancel',
|
||||
style: TextStyle(
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
locator
|
||||
.get<SembastRepository>()
|
||||
.deleteAllCachedComments()
|
||||
.whenComplete(
|
||||
locator.get<SembastRepository>().deleteAllCachedComments,
|
||||
)
|
||||
.whenComplete(
|
||||
locator.get<PreferenceRepository>().clearAllReadStories,
|
||||
)
|
||||
.whenComplete(
|
||||
DefaultCacheManager().emptyCache,
|
||||
)
|
||||
.whenComplete(() {
|
||||
showSnackBar(content: 'Data cleared!');
|
||||
});
|
||||
},
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(Colors.deepOrange),
|
||||
),
|
||||
child: const Text(
|
||||
'Yes',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void onCommentTapped(Comment comment, {VoidCallback? then}) {
|
||||
throttle.run(() {
|
||||
locator
|
||||
|
@ -77,7 +77,7 @@ class StoryScreen extends StatefulWidget {
|
||||
if (args.story.isPoll)
|
||||
BlocProvider<PollCubit>(
|
||||
create: (BuildContext context) =>
|
||||
PollCubit()..init(story: args.story),
|
||||
PollCubit(story: args.story)..init(),
|
||||
),
|
||||
],
|
||||
child: StoryScreen(
|
||||
@ -104,7 +104,7 @@ class StoryScreen extends StatefulWidget {
|
||||
if (args.story.isPoll)
|
||||
BlocProvider<PollCubit>(
|
||||
create: (BuildContext context) =>
|
||||
PollCubit()..init(story: args.story),
|
||||
PollCubit(story: args.story)..init(),
|
||||
),
|
||||
],
|
||||
child: StoryScreen(
|
||||
@ -132,8 +132,17 @@ class _StoryScreenState extends State<StoryScreen> {
|
||||
initialRefreshStatus: RefreshStatus.refreshing,
|
||||
);
|
||||
final FocusNode focusNode = FocusNode();
|
||||
final Throttle throttle = Throttle(delay: const Duration(seconds: 2));
|
||||
final String happyFace = Constants.happyFaces.pickRandomly()!;
|
||||
final Throttle storyLinkTapThrottle = Throttle(
|
||||
delay: _storyLinkTapThrottleDelay,
|
||||
);
|
||||
final Throttle featureDiscoveryDismissThrottle = Throttle(
|
||||
delay: _featureDiscoveryDismissThrottleDelay,
|
||||
);
|
||||
|
||||
static const Duration _storyLinkTapThrottleDelay = Duration(seconds: 2);
|
||||
static const Duration _featureDiscoveryDismissThrottleDelay =
|
||||
Duration(seconds: 1);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -164,7 +173,8 @@ class _StoryScreenState extends State<StoryScreen> {
|
||||
refreshController.dispose();
|
||||
commentEditingController.dispose();
|
||||
scrollController.dispose();
|
||||
throttle.dispose();
|
||||
storyLinkTapThrottle.dispose();
|
||||
featureDiscoveryDismissThrottle.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@ -251,6 +261,7 @@ class _StoryScreenState extends State<StoryScreen> {
|
||||
HapticFeedback.lightImpact();
|
||||
locator.get<CacheService>().resetComments();
|
||||
context.read<CommentsCubit>().refresh();
|
||||
context.read<PollCubit>().refresh();
|
||||
},
|
||||
onLoading: () {
|
||||
context.read<CommentsCubit>().loadMore();
|
||||
@ -378,7 +389,6 @@ class _StoryScreenState extends State<StoryScreen> {
|
||||
),
|
||||
if (widget.story.isPoll)
|
||||
PollView(
|
||||
story: widget.story,
|
||||
onLoginTapped: onLoginTapped,
|
||||
),
|
||||
],
|
||||
@ -559,8 +569,11 @@ class _StoryScreenState extends State<StoryScreen> {
|
||||
}
|
||||
|
||||
Future<bool> onFeatureDiscoveryDismissed() {
|
||||
ScaffoldMessenger.of(context).clearSnackBars();
|
||||
showSnackBar(content: 'Tap on icon to continue');
|
||||
featureDiscoveryDismissThrottle.run(() {
|
||||
HapticFeedback.lightImpact();
|
||||
ScaffoldMessenger.of(context).clearSnackBars();
|
||||
showSnackBar(content: 'Tap on icon to continue');
|
||||
});
|
||||
return Future<bool>.value(false);
|
||||
}
|
||||
|
||||
@ -614,10 +627,10 @@ class _StoryScreenState extends State<StoryScreen> {
|
||||
in state.parents) ...<Widget>[
|
||||
CommentTile(
|
||||
comment: c,
|
||||
loadKids: false,
|
||||
myUsername:
|
||||
context.read<AuthBloc>().state.username,
|
||||
onStoryLinkTapped: onStoryLinkTapped,
|
||||
actionable: false,
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
@ -640,11 +653,9 @@ class _StoryScreenState extends State<StoryScreen> {
|
||||
}
|
||||
|
||||
Future<void> onStoryLinkTapped(String link) async {
|
||||
final RegExp regex = RegExp(r'\d+$');
|
||||
final String match = regex.stringMatch(link) ?? '';
|
||||
final int? id = int.tryParse(match);
|
||||
final int? id = link.getItemId();
|
||||
if (id != null) {
|
||||
throttle.run(() {
|
||||
storyLinkTapThrottle.run(() {
|
||||
locator
|
||||
.get<StoriesRepository>()
|
||||
.fetchParentStory(id: id)
|
||||
@ -655,7 +666,7 @@ class _StoryScreenState extends State<StoryScreen> {
|
||||
StoryScreen.routeName,
|
||||
arguments: StoryScreenArgs(story: story),
|
||||
);
|
||||
} else {}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:feature_discovery/feature_discovery.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@ -26,6 +28,10 @@ class FavIconButton extends StatelessWidget {
|
||||
icon: DescribedFeatureOverlay(
|
||||
onBackgroundTap: onBackgroundTap,
|
||||
onDismiss: onDismiss,
|
||||
onComplete: () async {
|
||||
unawaited(HapticFeedback.lightImpact());
|
||||
return true;
|
||||
},
|
||||
overflowMode: OverflowMode.extendBackground,
|
||||
targetColor: Theme.of(context).primaryColor,
|
||||
tapTarget: Icon(
|
||||
|
@ -1,5 +1,8 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:feature_discovery/feature_discovery.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:hacki/config/constants.dart';
|
||||
import 'package:hacki/utils/utils.dart';
|
||||
|
||||
@ -21,6 +24,10 @@ class LinkIconButton extends StatelessWidget {
|
||||
icon: DescribedFeatureOverlay(
|
||||
onBackgroundTap: onBackgroundTap,
|
||||
onDismiss: onDismiss,
|
||||
onComplete: () async {
|
||||
unawaited(HapticFeedback.lightImpact());
|
||||
return true;
|
||||
},
|
||||
overflowMode: OverflowMode.extendBackground,
|
||||
targetColor: Theme.of(context).primaryColor,
|
||||
tapTarget: const Icon(
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'dart:async';
|
||||
import 'dart:math';
|
||||
|
||||
import 'package:feature_discovery/feature_discovery.dart';
|
||||
@ -33,6 +34,10 @@ class PinIconButton extends StatelessWidget {
|
||||
icon: DescribedFeatureOverlay(
|
||||
onBackgroundTap: onBackgroundTap,
|
||||
onDismiss: onDismiss,
|
||||
onComplete: () async {
|
||||
unawaited(HapticFeedback.lightImpact());
|
||||
return true;
|
||||
},
|
||||
overflowMode: OverflowMode.extendBackground,
|
||||
targetColor: Theme.of(context).primaryColor,
|
||||
tapTarget: Icon(
|
||||
|
@ -9,11 +9,9 @@ import 'package:hacki/models/models.dart';
|
||||
class PollView extends StatelessWidget {
|
||||
const PollView({
|
||||
super.key,
|
||||
required this.story,
|
||||
required this.onLoginTapped,
|
||||
});
|
||||
|
||||
final Story story;
|
||||
final VoidCallback onLoginTapped;
|
||||
|
||||
@override
|
||||
|
@ -5,6 +5,7 @@ import 'package:flutter_linkify/flutter_linkify.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:hacki/blocs/blocs.dart';
|
||||
import 'package:hacki/cubits/cubits.dart';
|
||||
import 'package:hacki/extensions/extensions.dart';
|
||||
import 'package:hacki/models/models.dart';
|
||||
import 'package:hacki/utils/utils.dart';
|
||||
|
||||
@ -19,7 +20,7 @@ class CommentTile extends StatelessWidget {
|
||||
this.onEditTapped,
|
||||
this.onTimeMachineActivated,
|
||||
this.opUsername,
|
||||
this.loadKids = true,
|
||||
this.actionable = true,
|
||||
this.level = 0,
|
||||
});
|
||||
|
||||
@ -27,7 +28,7 @@ class CommentTile extends StatelessWidget {
|
||||
final String? opUsername;
|
||||
final Comment comment;
|
||||
final int level;
|
||||
final bool loadKids;
|
||||
final bool actionable;
|
||||
final Function(Comment)? onReplyTapped;
|
||||
final Function(Comment)? onMoreTapped;
|
||||
final Function(Comment)? onEditTapped;
|
||||
@ -43,6 +44,8 @@ class CommentTile extends StatelessWidget {
|
||||
)..init(),
|
||||
child: BlocBuilder<CollapseCubit, CollapseState>(
|
||||
builder: (BuildContext context, CollapseState state) {
|
||||
if (actionable && state.hidden) return const SizedBox.shrink();
|
||||
|
||||
return BlocBuilder<PreferenceCubit, PreferenceState>(
|
||||
builder: (BuildContext context, PreferenceState prefState) {
|
||||
return BlocBuilder<BlocklistCubit, BlocklistState>(
|
||||
@ -56,7 +59,7 @@ class CommentTile extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Slidable(
|
||||
startActionPane: loadKids
|
||||
startActionPane: actionable
|
||||
? ActionPane(
|
||||
motion: const StretchMotion(),
|
||||
children: <Widget>[
|
||||
@ -90,7 +93,7 @@ class CommentTile extends StatelessWidget {
|
||||
],
|
||||
)
|
||||
: null,
|
||||
endActionPane: loadKids && level != 0
|
||||
endActionPane: actionable && level != 0
|
||||
? ActionPane(
|
||||
motion: const StretchMotion(),
|
||||
children: <Widget>[
|
||||
@ -104,16 +107,19 @@ class CommentTile extends StatelessWidget {
|
||||
],
|
||||
)
|
||||
: null,
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
HapticFeedback.lightImpact();
|
||||
context.read<CollapseCubit>().collapse();
|
||||
},
|
||||
child: Padding(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
if (comment.deleted || comment.dead) return;
|
||||
|
||||
if (actionable) {
|
||||
HapticFeedback.lightImpact();
|
||||
context.read<CollapseCubit>().collapse();
|
||||
}
|
||||
},
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 6,
|
||||
right: 6,
|
||||
@ -146,86 +152,95 @@ class CommentTile extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
if (comment.deleted)
|
||||
const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
child: Text(
|
||||
'deleted',
|
||||
style: TextStyle(color: Colors.grey),
|
||||
if (comment.deleted)
|
||||
const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: 12),
|
||||
child: Text(
|
||||
'deleted',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (comment.dead)
|
||||
const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: 12),
|
||||
child: Text(
|
||||
'dead',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (blocklistState.blocklist
|
||||
.contains(comment.by))
|
||||
const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: 12),
|
||||
child: Text(
|
||||
'blocked',
|
||||
style: TextStyle(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (actionable && state.collapsed)
|
||||
Center(
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(bottom: 12),
|
||||
child: Text(
|
||||
'collapsed '
|
||||
'(${state.collapsedCount + 1})',
|
||||
style: const TextStyle(
|
||||
color: Colors.orangeAccent,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 8,
|
||||
right: 8,
|
||||
top: 6,
|
||||
bottom: 12,
|
||||
),
|
||||
child: SelectableLinkify(
|
||||
key: ObjectKey(comment),
|
||||
text: comment.text,
|
||||
style: TextStyle(
|
||||
fontSize: MediaQuery.of(context)
|
||||
.textScaleFactor *
|
||||
15,
|
||||
),
|
||||
linkStyle: TextStyle(
|
||||
fontSize: MediaQuery.of(context)
|
||||
.textScaleFactor *
|
||||
15,
|
||||
color: Colors.orange,
|
||||
),
|
||||
onOpen: (LinkableElement link) {
|
||||
if (link.url.contains(
|
||||
'news.ycombinator.com/item',
|
||||
)) {
|
||||
onStoryLinkTapped.call(link.url);
|
||||
} else {
|
||||
LinkUtil.launchUrl(link.url);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (comment.dead)
|
||||
const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
child: Text(
|
||||
'dead',
|
||||
style: TextStyle(color: Colors.grey),
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (blocklistState.blocklist
|
||||
.contains(comment.by))
|
||||
const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
child: Text(
|
||||
'blocked',
|
||||
style: TextStyle(color: Colors.grey),
|
||||
),
|
||||
),
|
||||
)
|
||||
else if (state.collapsed)
|
||||
const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 12),
|
||||
child: Text(
|
||||
'collapsed',
|
||||
style:
|
||||
TextStyle(color: Colors.orangeAccent),
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 8,
|
||||
right: 8,
|
||||
top: 6,
|
||||
bottom: 12,
|
||||
),
|
||||
child: SelectableLinkify(
|
||||
key: ObjectKey(comment),
|
||||
text: comment.text,
|
||||
style: TextStyle(
|
||||
fontSize: MediaQuery.of(context)
|
||||
.textScaleFactor *
|
||||
15,
|
||||
),
|
||||
linkStyle: TextStyle(
|
||||
fontSize: MediaQuery.of(context)
|
||||
.textScaleFactor *
|
||||
15,
|
||||
color: Colors.orange,
|
||||
),
|
||||
onOpen: (LinkableElement link) {
|
||||
if (link.url.contains(
|
||||
'news.ycombinator.com/item',
|
||||
)) {
|
||||
onStoryLinkTapped.call(link.url);
|
||||
} else {
|
||||
LinkUtil.launchUrl(link.url);
|
||||
}
|
||||
},
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
),
|
||||
const Divider(
|
||||
height: 0,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@ -251,10 +266,7 @@ class CommentTile extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
for (final int i in List<int>.generate(
|
||||
level,
|
||||
(int index) => level - index,
|
||||
)) {
|
||||
for (final int i in level.to(0, inclusive: false)) {
|
||||
final Color wrapperBorderColor = _getColor(i);
|
||||
final bool shouldHighlight = isMyComment && i == level;
|
||||
wrapper = Container(
|
||||
|
138
lib/screens/widgets/onboarding_view.dart
Normal file
@ -0,0 +1,138 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:hacki/config/constants.dart';
|
||||
import 'package:hacki/screens/widgets/widgets.dart';
|
||||
import 'package:hacki/utils/utils.dart';
|
||||
|
||||
class OnboardingView extends StatefulWidget {
|
||||
const OnboardingView({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<OnboardingView> createState() => _OnboardingViewState();
|
||||
}
|
||||
|
||||
class _OnboardingViewState extends State<OnboardingView> {
|
||||
final PageController pageController = PageController();
|
||||
final Throttle throttle = Throttle(delay: _throttleDelay);
|
||||
|
||||
static const Duration _throttleDelay = Duration(milliseconds: 100);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Theme.of(context).brightness == Brightness.light
|
||||
? Colors.orange
|
||||
: Theme.of(context).canvasColor,
|
||||
elevation: 0,
|
||||
leading: IconButton(
|
||||
icon: const Icon(
|
||||
Icons.close,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () => Navigator.pop(context),
|
||||
),
|
||||
),
|
||||
backgroundColor: Theme.of(context).brightness == Brightness.light
|
||||
? Colors.orange
|
||||
: null,
|
||||
body: Stack(
|
||||
children: <Widget>[
|
||||
Positioned(
|
||||
top: 40,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: SizedBox(
|
||||
height: 550,
|
||||
child: PageView(
|
||||
controller: pageController,
|
||||
scrollDirection: Axis.vertical,
|
||||
children: const <Widget>[
|
||||
_PageViewChild(
|
||||
path: Constants.commentTileRightSlidePath,
|
||||
description: 'Swipe right to leave a comment or vote.',
|
||||
),
|
||||
_PageViewChild(
|
||||
path: Constants.commentTileLeftSlidePath,
|
||||
description: 'Swipe left to view all the parent comments.',
|
||||
),
|
||||
_PageViewChild(
|
||||
path: Constants.commentTileTopTapPath,
|
||||
description: 'Tap on the top of comment tile to collapse.',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 40,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
HapticFeedback.lightImpact();
|
||||
if (pageController.page! >= 2) {
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
throttle.run(() {
|
||||
pageController.nextPage(
|
||||
duration: const Duration(milliseconds: 600),
|
||||
curve: SpringCurve.underDamped,
|
||||
);
|
||||
});
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
shape: const CircleBorder(),
|
||||
primary: Colors.orange,
|
||||
padding: const EdgeInsets.all(18),
|
||||
),
|
||||
child: const Icon(
|
||||
Icons.arrow_drop_down_circle_outlined,
|
||||
size: 24,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _PageViewChild extends StatelessWidget {
|
||||
const _PageViewChild({
|
||||
Key? key,
|
||||
required this.path,
|
||||
required this.description,
|
||||
}) : super(key: key);
|
||||
|
||||
final String path;
|
||||
final String description;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
height: 400,
|
||||
child: Image.asset(path),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 24,
|
||||
vertical: 24,
|
||||
),
|
||||
child: Text(
|
||||
description,
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
fontSize: 16,
|
||||
color: Colors.white,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ export 'items_list_view.dart';
|
||||
export 'link_preview/link_preview.dart';
|
||||
export 'link_preview/link_preview.dart';
|
||||
export 'offline_banner.dart';
|
||||
export 'onboarding_view.dart';
|
||||
export 'spring_curve.dart';
|
||||
export 'stories_list_view.dart';
|
||||
export 'story_tile.dart';
|
||||
|
@ -1,25 +1,82 @@
|
||||
import 'package:hacki/models/models.dart' show Comment;
|
||||
import 'package:rxdart/rxdart.dart';
|
||||
|
||||
class CacheService {
|
||||
static final Set<int> _tappedStories = <int>{};
|
||||
static final Map<int, Comment> _comments = <int, Comment>{};
|
||||
static final Set<int> _commentsCollapsed = <int>{};
|
||||
static final Map<int, String> _drafts = <int, String>{};
|
||||
static final Map<int, Set<int>> _kids = <int, Set<int>>{};
|
||||
static final Set<int> _collapsed = <int>{};
|
||||
static final Map<int, Set<int>> _hidden = <int, Set<int>>{};
|
||||
final PublishSubject<Map<int, Set<int>>> _hiddenCommentsSubject =
|
||||
PublishSubject<Map<int, Set<int>>>();
|
||||
|
||||
bool isFirstTimeReading(int storyId) => !_tappedStories.contains(storyId);
|
||||
Stream<Map<int, Set<int>>> get hiddenComments =>
|
||||
_hiddenCommentsSubject.stream;
|
||||
|
||||
bool isCollapsed(int commentId) => _commentsCollapsed.contains(commentId);
|
||||
void addKid(int commentId, {required int to}) {
|
||||
_kids[to] = <int>{...?_kids[to], commentId};
|
||||
addIfParentIsHiddenOrCollapsed(commentId, to);
|
||||
}
|
||||
|
||||
void store(int storyId) => _tappedStories.add(storyId);
|
||||
int collapse(int commentId) {
|
||||
_collapsed.add(commentId);
|
||||
|
||||
void updateCollapsedComments(int commentId) {
|
||||
if (_commentsCollapsed.contains(commentId)) {
|
||||
_commentsCollapsed.remove(commentId);
|
||||
} else {
|
||||
_commentsCollapsed.add(commentId);
|
||||
Set<int> findHiddenComments(int commentId) {
|
||||
final Set<int> directKids = <int>{...?_kids[commentId]};
|
||||
final Set<int> temp = <int>{...directKids};
|
||||
|
||||
for (final int i in temp) {
|
||||
directKids.addAll(findHiddenComments(i));
|
||||
}
|
||||
|
||||
return directKids;
|
||||
}
|
||||
|
||||
final Set<int> hiddenComments = findHiddenComments(commentId);
|
||||
|
||||
_hidden[commentId] = hiddenComments;
|
||||
|
||||
_hiddenCommentsSubject.add(_hidden);
|
||||
|
||||
return hiddenComments.length;
|
||||
}
|
||||
|
||||
void uncollapse(int commentId) {
|
||||
_collapsed.remove(commentId);
|
||||
|
||||
_hidden.remove(commentId);
|
||||
|
||||
_hiddenCommentsSubject.add(_hidden);
|
||||
}
|
||||
|
||||
bool isHidden(int commentId) {
|
||||
for (final Set<int> val in _hidden.values) {
|
||||
if (val.contains(commentId)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void addIfParentIsHiddenOrCollapsed(int commentId, int parentId) {
|
||||
for (final int key in _hidden.keys) {
|
||||
if (key == parentId || (_hidden[key]?.contains(parentId) ?? false)) {
|
||||
_hidden[key]?.add(commentId);
|
||||
_hiddenCommentsSubject.add(_hidden);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void resetCollapsedComments() {
|
||||
_kids.clear();
|
||||
_collapsed.clear();
|
||||
_hidden.clear();
|
||||
_hiddenCommentsSubject.add(_hidden);
|
||||
}
|
||||
|
||||
bool isCollapsed(int commentId) => _collapsed.contains(commentId);
|
||||
|
||||
int totalHidden(int commentId) => _hidden[commentId]?.length ?? 0;
|
||||
|
||||
void cacheComment(Comment comment) => _comments[comment.id] = comment;
|
||||
|
||||
Comment? getComment(int id) => _comments[id];
|
||||
|
37
pubspec.lock
@ -14,7 +14,7 @@ packages:
|
||||
name: adaptive_theme
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.3.1"
|
||||
version: "3.0.0"
|
||||
analyzer:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -70,7 +70,7 @@ packages:
|
||||
name: cached_network_image
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.2.0"
|
||||
version: "3.2.1"
|
||||
cached_network_image_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -105,7 +105,7 @@ packages:
|
||||
name: chewie
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.2"
|
||||
version: "1.3.3"
|
||||
chewie_audio:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -256,9 +256,11 @@ packages:
|
||||
feature_discovery:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: feature_discovery
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
path: "."
|
||||
ref: flutter3_compatibility
|
||||
resolved-ref: "896306d04130f870c7ce99ce832fd977283b2392"
|
||||
url: "https://github.com/livinglist/feature_discovery"
|
||||
source: git
|
||||
version: "0.14.1"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
@ -294,7 +296,7 @@ packages:
|
||||
source: hosted
|
||||
version: "0.6.8"
|
||||
flutter_cache_manager:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_cache_manager
|
||||
url: "https://pub.dartlang.org"
|
||||
@ -418,7 +420,7 @@ packages:
|
||||
name: flutter_slidable
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.2.1"
|
||||
flutter_svg:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -761,9 +763,11 @@ packages:
|
||||
pull_to_refresh:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: pull_to_refresh
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
path: "."
|
||||
ref: master
|
||||
resolved-ref: "6d7fbdd5b3cde242a474d66da312aac4aa892b9b"
|
||||
url: "https://github.com/livinglist/flutter_pulltorefresh"
|
||||
source: git
|
||||
version: "2.0.0"
|
||||
quiver:
|
||||
dependency: transitive
|
||||
@ -772,6 +776,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
receive_sharing_intent:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: receive_sharing_intent
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.4.5"
|
||||
responsive_builder:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1231,7 +1242,7 @@ packages:
|
||||
name: workmanager
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.1"
|
||||
version: "0.5.0"
|
||||
xdg_directories:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1255,4 +1266,4 @@ packages:
|
||||
version: "3.1.0"
|
||||
sdks:
|
||||
dart: ">=2.17.0 <3.0.0"
|
||||
flutter: ">=2.10.0"
|
||||
flutter: ">=3.0.0"
|
||||
|
27
pubspec.yaml
@ -1,26 +1,31 @@
|
||||
name: hacki
|
||||
description: A Hacker News reader.
|
||||
version: 0.2.5+39
|
||||
version: 0.2.8+44
|
||||
publish_to: none
|
||||
|
||||
environment:
|
||||
sdk: ">=2.17.0 <3.0.0"
|
||||
|
||||
dependencies:
|
||||
adaptive_theme: ^2.3.0
|
||||
adaptive_theme: ^3.0.0
|
||||
badges: ^2.0.2
|
||||
bloc: ^8.0.3
|
||||
cached_network_image: ^3.2.0
|
||||
cached_network_image: ^3.2.1
|
||||
clipboard: ^0.1.3
|
||||
collection:
|
||||
connectivity_plus: ^2.2.1
|
||||
dio: ^4.0.4
|
||||
equatable: 2.0.3
|
||||
fast_gbk: ^1.0.0
|
||||
feature_discovery: ^0.14.0
|
||||
# feature_discovery: ^0.14.0
|
||||
feature_discovery:
|
||||
git:
|
||||
url: https://github.com/livinglist/feature_discovery
|
||||
ref: flutter3_compatibility
|
||||
flutter:
|
||||
sdk: flutter
|
||||
flutter_bloc: ^8.0.1
|
||||
flutter_cache_manager: ^3.3.0
|
||||
flutter_fadein: ^2.0.0
|
||||
flutter_feather_icons: 2.0.0+1
|
||||
flutter_html: ^2.2.1
|
||||
@ -28,7 +33,7 @@ dependencies:
|
||||
flutter_linkify: ^5.0.2
|
||||
flutter_local_notifications: ^9.5.0
|
||||
flutter_secure_storage: ^5.0.2
|
||||
flutter_slidable: ^1.2.0
|
||||
flutter_slidable: ^1.2.1
|
||||
font_awesome_flutter: ^9.2.0
|
||||
gbk_codec: ^0.4.0
|
||||
get_it: 7.2.0
|
||||
@ -42,7 +47,12 @@ dependencies:
|
||||
path_provider: ^2.0.8
|
||||
path_provider_android: ^2.0.8
|
||||
path_provider_ios: ^2.0.8
|
||||
pull_to_refresh: ^2.0.0
|
||||
# pull_to_refresh: ^2.0.0
|
||||
pull_to_refresh:
|
||||
git:
|
||||
url: https://github.com/livinglist/flutter_pulltorefresh
|
||||
ref: master
|
||||
receive_sharing_intent: ^1.4.5
|
||||
responsive_builder: ^0.4.2
|
||||
rxdart: ^0.27.3
|
||||
sembast: ^3.1.1+1
|
||||
@ -56,7 +66,7 @@ dependencies:
|
||||
universal_platform: ^1.0.0+1
|
||||
url_launcher: ^6.0.10
|
||||
wakelock: ^0.6.1+2
|
||||
workmanager: ^0.4.1
|
||||
workmanager: ^0.5.0
|
||||
|
||||
dev_dependencies:
|
||||
bloc_test: ^9.0.3
|
||||
@ -70,7 +80,6 @@ flutter:
|
||||
generate: true
|
||||
|
||||
assets:
|
||||
- images/hacki_icon.png
|
||||
- images/hacker_news_logo.png
|
||||
- assets/images/
|
||||
|
||||
|
||||
|
@ -9,6 +9,7 @@ void main() {
|
||||
await tester.pumpWidget(
|
||||
const HackiApp(
|
||||
savedThemeMode: AdaptiveThemeMode.light,
|
||||
trueDarkMode: false,
|
||||
),
|
||||
);
|
||||
|
||||
|