Giter Club home page Giter Club logo

press's Introduction

Press is a wysiwyg writer for crafting notes inspired by Bear. It uses markdown for styling and formatting text with a beautiful inline preview.

Press was created as a proof-of-concept for exploring Kotlin Multiplatform, as well as the author’s frustration from the lack of minimal markdown note taking apps that work on all platforms, especially Android and macOS. If you relate to either of these reasons, Press is looking for contributors.

Documentation

License

Copyright 2019 Saket Narayan.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

press's People

Contributors

angusholder avatar arkivanov avatar ben-whit-ley avatar carotkut94 avatar evowizz avatar hackertronix avatar iamanbansal avatar mchllngr avatar mr3y-the-programmer avatar msasikanth avatar msfjarvis avatar riyasvaliyadan avatar saket avatar yash-k9 avatar zianea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

press's Issues

Explore C interop with Kotlin/Native for sharing a common markdown parser

Press currently delegates parsing of markdown to platforms using expect/actual, but managing the expected class signature of parsed nodes is a pain right now. The K/N community is new so there isn't any markdown parser written in kotlin, but there are sufficient libraries written in C that Press can leverage through C interop with K/N: https://kotlinlang.org/docs/reference/native/c_interop.html

We could use cmark: https://github.com/commonmark/cmark

Replace JGit with git24j

JGit has a lot of bugs and its behavior often doesn't match with native git. It'd be nice to switch a library that uses native git wrapped with Java bindings so that the behavior/bugs are consistent across all platforms. git24j looks like the closest solution right now.

I tried my hands at adding git24j but I'm not very good with building native libraries: git24j/git24j#79

Setup a blank iOS app

Just getting a blank iOS app running would be a good first step towards bringing Press to iOS. Everything else can be wired later.

ADRs are more helpful when they are ADRs

The standard directory structure of /docs/arch/adr-001-xyz.md isn't really necessary, but it's cleaner and the integer helps enforce their immutable intention.

I'd consider the standard context / decision / status / consequences structure to be non-optional if you want your ADRs to remain meaningful months or years from now.

Sync failed but created multiple branches on the repo

I have created an empty repository without any master branch and then tried to sync notes. The app shows sync failed with an error but I see multiple branches being created on the repo. Is it necessary to create a repository with default master branch?

Here is the error log:

Syncing for the first time. Backing up notes to 'notes-backup-1603526100612' branch.
Unknown error. Will retry later. org.eclipse.jgit.api.errors.RefNotAdvertisedException: Remote origin did not advertise Ref for branch main. This Ref may not exist in the remote or may be hidden by permission settings.
	at org.eclipse.jgit.api.PullCommand.call(PullCommand.java:291)
	at me.saket.kgit.RealGitRepository.pull(RealGitRepository.kt:178)
	at me.saket.press.shared.sync.git.GitSyncer.pull(GitSyncer.kt:256)
	at me.saket.press.shared.sync.git.GitSyncer.sync$shared_release(GitSyncer.kt:111)
	at me.saket.press.shared.sync.RealSyncCoordinator$syncWithResult$1.invoke(SyncCoordinator.kt:44)
	at me.saket.press.shared.sync.RealSyncCoordinator$syncWithResult$1.invoke(SyncCoordinator.kt:27)
	at com.badoo.reaktive.completable.VariousKt$completableFromFunction$$inlined$completable$1.subscribe(Various.kt:61)
	at com.badoo.reaktive.completable.VariousKt$completableFromFunction$$inlined$completable$1.subscribe(Various.kt:7)
	at com.badoo.reaktive.completable.AsObservableKt$asObservable$$inlined$observable$1.subscribe(Various.kt:110)
	at com.badoo.reaktive.completable.AsObservableKt$asObservable$$inlined$observable$1.subscribe(Various.kt:7)
	at com.badoo.reaktive.observable.TakeUntilObservableKt$takeUntil$$inlined$observable$1.subscribe(Various.kt:129)
	at com.badoo.reaktive.observable.TakeUntilObservableKt$takeUntil$$inlined$observable$1.subscribe(Various.kt:7)
	at com.badoo.reaktive.observable.AsCompletableKt$asCompletable$$inlined$completable$1.subscribe(Various.kt:61)
	at com.badoo.reaktive.observable.AsCompletableKt$asCompletable$$inlined$completable$1.subscribe(Various.kt:7)
	at com.badoo.reaktive.completable.OnErrorCompleteKt$onErrorComplete$$inlined$completable$1.subscribe(Various.kt:61)
	at com.badoo.reaktive.completable.OnErrorCompleteKt$onErrorComplete$$inlined$completable$1.subscribe(Various.kt:7)
	at com.badoo.reaktive.observable.FlatMapCompletableObserver.onNext(FlatMapCompletable.kt:36)
	at com.badoo.reaktive.observable.SwitchMapKt$switchMap$$inlined$observable$1$1.onNext(ObservableByEmitter.kt:17)
	at com.badoo.reaktive.observable.SerializedObservableCallbacks.onNext(SerializedObservableCallbacks.kt:34)
	at com.badoo.reaktive.observable.SwitchMapKt$switchMap$$inlined$observable$1$lambda$1$2.onNext(Unknown Source:2)
	at com.badoo.reaktive.observable.IntervalKt$observableInterval$$inlined$observable$1$1.onNext(ObservableByEmitter.kt:17)
	at com.badoo.reaktive.observable.IntervalKt$observableInterval$$inlined$observable$1$lambda$1.invoke(Interval.kt:13)
	at com.badoo.reaktive.observable.IntervalKt$observableInterval$$inlined$observable$1$lambda$1.invoke(Unknown Source:0)
	at com.badoo.reaktive.scheduler.ExecutorServiceScheduler$ExecutorImpl$Companion$wrapSchedulerTaskSafe$1.run(ExecutorServiceScheduler.kt:102)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:307)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:302)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
	at java.lang.Thread.run(Thread.java:923)

Ordered lists doesn't auto complete

If I am at an item of an ordered list, then pressing enter should show the next number of the list by default. But this happens only if your previous item ends wjth a period (.) symbol.

You can reproduce it by doing two below tests.

  1. Type something

vs

  1. Type something.

Create a blank desktop app using Compose

The current (work-in-progress) macOS app is built using SwiftUI, but setting up different source-sets for parsing markdown and syncing through git on the JVM and kotlin/native is proving to be a bit painful. Let's use Compose for building the desktop app instead: https://jetbrains.com/lp/compose.

My plan is to ramp up the Android app a bit by adding support for folders and archiving notes, and then get the desktop app up and running.

Delete a note

As of now, the only available option to delete a note is by deleting its content (Or maybe there is another way but it's not promoted).

Can we maybe add 🤔

  • Delete option within the editor
  • Select multiple notes in the main view and perform a batch delete/archive?

Scary permissions being asked for GitHub sync

While syncing with GitHub, it simply asks for all my private and public repositories.

Here is a screenshot of how it looks:

20201025_092202.jpg

Though it might not be misused by the app, it would always be a great idea to have a custom message displayed at the app side before even going forward with syncing.

In this way, user knows what Press is going to do with all the repositories and why it is asking.

Android app crash java.lang.ClassCastException: android.content.res.Resources cannot be cast to me.saket.resourceinterceptor.InterceptibleResources

Android emulator API 25

Caused by: java.lang.ClassCastException: android.content.res.Resources cannot be cast to me.saket.resourceinterceptor.InterceptibleResources
        at press.widgets.ThemeAwareActivity.applyPaletteTheme(ThemeAwareActivity.kt:33)
        at press.widgets.ThemeAwareActivity.onCreate(ThemeAwareActivity.kt:21)
        at press.home.HomeActivity.onCreate(HomeActivity.kt:18)
        at android.app.Activity.performCreate(Activity.java:6679)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)

macOS version is not buildable

Is macOS version still buildable?
I have encountered a lot of build errors with ReaktiveInterop, ObservableNavigator etc.
Even after bumping some libs (kotlin-coroutines, kotlinx.serialization) and fixing all Swift errors, app is crashing on start with

ERROR - sqlite3_close(0x7f88d9e3bba0) failed: 5

Add macOS platform

The shared module currently only has Android and iOS platform targets. Although a macOS client app cannot happen until cashapp/sqldelight#1393 is merged to SQLDelight, it'd be nice to atleast setup things in preparation of it.

Multiplatform markdown parser

intellij-markdown has an experimental branch with support for kotlin multiplatform. It's used internally by JetBrains and by Dokka for generating markdown so it should be pretty stable. It's probably also the only option right now.

I tried contributing to the project by adding support for native, but quickly ran into issues mentioned here.

Issue with ktlint

I installed a clean version of IntelliJ IDEA 2021.3, then opened and ran a project and I get:

A problem occurred configuring root project 'Press'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve org.jlleitschuh.gradle:ktlint-gradle:10.0.0.
     Required by:
         project :
      > No cached version of org.jlleitschuh.gradle:ktlint-gradle:10.0.0 available for offline mode.
      > No cached version of org.jlleitschuh.gradle:ktlint-gradle:10.0.0 available for offline mode.
      > No cached version of org.jlleitschuh.gradle:ktlint-gradle:10.0.0 available for offline mode.
      > No cached version of org.jlleitschuh.gradle:ktlint-gradle:10.0.0 available for offline mode.
      > No cached version of org.jlleitschuh.gradle:ktlint-gradle:10.0.0 available for offline mode.

Possible solution:
 - Disable offline mode and rerun the build

It is trying to fetch this file which gives me a 502 bad gateway error:

https://dl.bintray.com/badoo/maven/org/jlleitschuh/gradle/ktlint-gradle/10.0.0/ktlint-gradle-10.0.0.pom

It is down for everyone it seems:
Screenshot 2021-12-20 at 22 18 57

Is there an alternative? Apparently dl.bintray.com will shut down next year.

Add more language

Please add more language support so that more people can use it easily。eg.chinese:speak_no_evil:

Add Bidirectional Links

Structuring notes as a graph has always been a favourite system of folks who choose to keep their notes in a wiki (or even just straight-up vanilla HTML). However, it seems that Roam Research has really convinced people that a directed graph (aka "one-way links") is a bad idea.

I'm inclined to agree. I think a lot of us wind up using multiple tools (wikis, mind maps, phone note apps, text files, paper) to do the work of one tool because this graph model is missing in most of our document-oriented tools like a paper notepad or Google Keep. Most note / outliner / journal tools make the mistake of organizing notes like Windows 3.1: instead of the completely insane metaphor of folders inside of folders inside of folders inside of folders we have the perhaps even more insane metaphor of sub-lists inside of sub-lists inside of sub-lists.

Hierarchies are bad. Or, at least, they're a bad default tool of organization.

Flat is better than nested.

Bidirectional links between notes turn your "list" of notes into a flat graph. ❤️

Syncing fails

The app is not able to sync anymore my modifications for many days.
It worked like a charm for months.

Here are the logs the app provides:
Screenshot_20220108-134247.png

The JGitInternalException message is : Checkout returned unexpected result LOCK_FAILURE

Detach Editor Code as Library?

I think the work you're doing is fantastic. Keeping the editor code as a library would be perfect so that everyone can use it the way they want.
I have scoured the internet and I couldn't find a decent Markdown editor until I came across your app. The only issue is, its a full app 😁 .
Do consider it.

Crash after v1.1 update, java.lang.NoSuchFieldException: No field mEdgeGlowTop in class Landroid/widget/ScrollView

Here is the complete logcat.

Device: Pixel 3,
OS: Android 10 (December security patch)

12-10 07:26:59.636  5113  5113 W System.err: io.reactivex.exceptions.OnErrorNotImplementedException: The exception was not handled due to missing onError handler in the subscribe() method call. Further reading: https://github.com/ReactiveX/RxJava/wiki/Error-Handling | java.lang.NoSuchFieldException: No field mEdgeGlowTop in class Landroid/widget/ScrollView; (declaration of 'android.widget.ScrollView' appears in /system/framework/framework.jar!classes3.dex)
12-10 07:26:59.636  5113  5113 W System.err: 	at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:704)
12-10 07:26:59.636  5113  5113 W System.err: 	at io.reactivex.internal.functions.Functions$OnErrorMissingConsumer.accept(Functions.java:701)
12-10 07:26:59.637  5113  5113 W System.err: 	at io.reactivex.internal.observers.LambdaObserver.onError(LambdaObserver.java:77)
12-10 07:26:59.637  5113  5113 W System.err: 	at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:67)
12-10 07:26:59.637  5113  5113 W System.err: 	at io.reactivex.internal.util.HalfSerializer.onNext(HalfSerializer.java:107)
12-10 07:26:59.637  5113  5113 W System.err: 	at io.reactivex.internal.operators.observable.ObservableTakeUntil$TakeUntilMainObserver.onNext(ObservableTakeUntil.java:79)
12-10 07:26:59.637  5113  5113 W System.err: 	at io.reactivex.observers.SerializedObserver.onNext(SerializedObserver.java:111)
12-10 07:26:59.637  5113  5113 W System.err: 	at io.reactivex.internal.operators.observable.ObservableThrottleFirstTimed$DebounceTimedObserver.onNext(ObservableThrottleFirstTimed.java:82)
12-10 07:26:59.637  5113  5113 W System.err: 	at io.reactivex.internal.operators.observable.ObservableHide$HideDisposable.onNext(ObservableHide.java:67)
12-10 07:26:59.637  5113  5113 W System.err: 	at io.reactivex.subjects.PublishSubject$PublishDisposable.onNext(PublishSubject.java:308)
12-10 07:26:59.637  5113  5113 W System.err: 	at io.reactivex.subjects.PublishSubject.onNext(PublishSubject.java:228)
12-10 07:26:59.637  5113  5113 W System.err: 	at press.home.NoteAdapter$onCreateViewHolder$$inlined$apply$lambda$1.onClick(NoteAdapter.kt:25)
12-10 07:26:59.637  5113  5113 W System.err: 	at android.view.View.performClick(View.java:7259)
12-10 07:26:59.637  5113  5113 W System.err: 	at android.view.View.performClickInternal(View.java:7236)
12-10 07:26:59.637  5113  5113 W System.err: 	at android.view.View.access$3600(View.java:801)
12-10 07:26:59.637  5113  5113 W System.err: 	at android.view.View$PerformClick.run(View.java:27892)
12-10 07:26:59.637  5113  5113 W System.err: 	at android.os.Handler.handleCallback(Handler.java:883)
12-10 07:26:59.637  5113  5113 W System.err: 	at android.os.Handler.dispatchMessage(Handler.java:100)
12-10 07:26:59.637  5113  5113 W System.err: 	at android.os.Looper.loop(Looper.java:214)
12-10 07:26:59.637  5113  5113 W System.err: 	at android.app.ActivityThread.main(ActivityThread.java:7356)
12-10 07:26:59.637  5113  5113 W System.err: 	at java.lang.reflect.Method.invoke(Native Method)
12-10 07:26:59.637  5113  5113 W System.err: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
12-10 07:26:59.637  5113  5113 W System.err: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:930)
12-10 07:26:59.637  5113  5113 W System.err: Caused by: java.lang.NoSuchFieldException: No field mEdgeGlowTop in class Landroid/widget/ScrollView; (declaration of 'android.widget.ScrollView' appears in /system/framework/framework.jar!classes3.dex)
12-10 07:26:59.637  5113  5113 W System.err: 	at java.lang.Class.getDeclaredField(Native Method)
12-10 07:26:59.637  5113  5113 W System.err: 	at press.util.Reflection.field(Reflection.kt:20)
12-10 07:26:59.637  5113  5113 W System.err: 	at press.util.ReflectionKt.reflect(Reflection.kt:11)
12-10 07:26:59.637  5113  5113 W System.err: 	at press.theme.ThemedWidgetsKt.themed(ThemedWidgets.kt:64)
12-10 07:26:59.637  5113  5113 W System.err: 	at press.editor.EditorView.<init>(EditorView.kt:80)
12-10 07:26:59.637  5113  5113 W System.err: 	at press.editor.EditorView_AssistedFactory.create(EditorView_AssistedFactory.java:27)
12-10 07:26:59.637  5113  5113 W System.err: 	at press.home.HomeView$setupNoteEditorPage$createEditorView$1.invoke(HomeView.kt:144)
12-10 07:26:59.637  5113  5113 W System.err: 	at press.home.HomeView$setupNoteEditorPage$createEditorView$1.invoke(HomeView.kt:60)
12-10 07:26:59.637  5113  5113 W System.err: 	at press.home.HomeView$setupNoteEditorPage$1.accept(HomeView.kt:155)
12-10 07:26:59.637  5113  5113 W System.err: 	at press.home.HomeView$setupNoteEditorPage$1.accept(HomeView.kt:60)
12-10 07:26:59.637  5113  5113 W System.err: 	at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:63)

Sync notes through git

I've spent a lot of time thinking about this and I think the best way of offering syncing is by not maintaining my own syncing backend. Syncing is a hard problem. The plan is to piggyback on git for syncing notes to a remote git repository. It'll have some great benefits by letting users,

  • own their notes
  • use a different app on platforms unsupported by Press
  • and even move on to a different markdown app if they decide Press is crap

I understand that by doing this I'm effectively restricting Press to nerds but I'm okay with that. Press will let users login using their github/gitlab/bitbucket account for auto-adding an SSH key to their account.

Huawei device with Android 9 throws java.lang.NoSuchFieldException while calling reflect()

try {
      reflect(editor::class, "mSelectHandleCenter").set(editor, centerDrawable)
      reflect(editor::class, "mSelectHandleLeft").set(editor, leftDrawable)
      reflect(editor::class, "mSelectHandleRight").set(editor, rightDrawable)
    } catch (e : NoSuchFieldException) {
      Log.e("Huawei",e.message)
    }

This produces the following exception :

java.lang.NoSuchFieldException: No field mSelectHandleCenter in class Lhuawei/com/android/internal/widget/HwEditor; (declaration of 'huawei.com.android.internal.widget.HwEditor' appears in /system/framework/hwEmui.jar)

Possible freezing for Native

Hey, I just wanted to bring your attention to the possible freezes (and crashes) when you will be implementing iOS.

E.g. here presenter and/or repository will be frozen which might cause unexpected behaviour. Be ready to use threadLocal operator and/or subscribe(isThreadLocal=true,...). Also ensureNeverFrozen might be useful.

Option to use system font

Hi, love the app and it fills a big vacancy. Even though I like the custom font, I'd love the option to use Android's system font for a more cohesive experience.

Thanks for all you do!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.