cloudrealmdemo's People
Forkers
johndpopecloudrealmdemo's Issues
[1D] Attribute 저장방식 정의
Attribute를 내부적으로 어떻게 저장할지 정의
[1W] Diff 구현 필요
Cloud 사이에 메모가 잘 왔다갔다하는지 보기위해 2명이 동시에 editing을 하는 상황을 구현해보았는데
현재 Diff3로는 해결 못하는 경우를 발견하였습니다.
제가 사용하고 있는 Diff3의 경우는 현재 open되어있는 diff3 커맨드의 c버전을 포팅한게 아닌
pseudo-code버전입니다.
문제는 cloud가 처음 merge conflict가 발생했을때 알아서 ancestor record를 주지 않는다는 것입니다ㅠㅠ
(한번 머지를 하고 난 뒤에 ancestor를 저장하는 방식으로 동작하는것 같습니다.)
Opensource Diff3
- Original <-> A 를 Diff, Original <-> B를 Diff (여기서 Diff는 두 string사이의 변경 감지)
- Step 1에서 받은 결과를 바탕으로 Diff3 수행
Pseudo-code Diff3
처음부터 Original, A, B를 다받아서 세 string을 한번에 훑으면서 merge.
Diff따로 구현 안하고 바로 할 수 있을것같아서 Pseudo-code버전으로 구현했는데
결국엔 opensource 버전으로 다시 구현해야될것 같네요...... 다음마일스톤에서 해결해보겠습니다ㅠㅠ
[1D]Diff3 improvements
현재 Insertion에대한 conflict는 잘잡는데
deletion에대한 conflict는 잘 못잡고있다.
알고리즘을 더잘정리해놓은 https://www.guiffy.com/SureMergeWP.html 를 더참고해봐야겠음
[4H]CKRecord metadata save
Realm 모델에 CKRecord의 메타데이타를 저장하는 로직 필요
!! Cloud share test
Cloud 로직 정리된후 예상된 flow대로 흘러가는지 확인
[1D] tag형식으로 데이터구조 변환
기존의 폴더 방식에서 태그방식으로 Data structure 변환
NSAttachment의 구조
@WGCEO @JangDoRiOS
기존의 TextView가 image attachment를 그리는방식이 비효율적(타이핑 할때마다 redraw)이여서 현재까지 몇가지 방법을 시도해보았는데 여러가지 문제가있습니다. 방법을 나열해보자면
- NSLayoutManager subclass
drawGlyphs 메소드를 직접 오버라이드 하여 본인이 속한 textView의 visibleRect영역이 아닌경우에 이미지 Draw를 할경우 이미지를 그리지 않는 방법
let textStorage = NSTextStorage()
let layoutManager = CustomLayoutManager()
// 1. Create a text container
let containerSize = CGSize(width: view.bounds.width, height: view.bounds.height)
let container = NSTextContainer(size: containerSize)
container.widthTracksTextView = true
layoutManager.addTextContainer(container)
textStorage.addLayoutManager(layoutManager)
// 2. Create a UITextView
textView = UITextView(frame: newTextViewRect, textContainer: container)
view.addSubview(textView)
- 장점: drawGlyphs메소드를 override가능. 이를통해 NSAttachment를 만들때 textView의 존재를 몰라도 된다.
- 단점: Textkit의 치명적인 버그로인해 storyboard 사용불가
치명적인 버그 -> (Textview가 만들어진후 LayoutManager replace 불가능)
- NSTextAttachment subclass (현재 사용중)
drawGlyphs메소드가 attachment의 image(for bounds: ...)메소드를 호출하는것에서 착안.
image(for bounds: ) 메소드를 오버라이드하여 textView의 visibleRect내에 본인의 bounds가 포함되면 이미지를 아니면 nil을 리턴하는 방식
override open func image(forBounds imageBounds: CGRect, textContainer: NSTextContainer?, characterIndex charIndex: Int) -> UIImage? {
let image = delegate?.image(for: self, bounds: imageBounds, range: NSMakeRange(charIndex, 1))
if (delegate?.textViewIsScrolling() ?? false){
return image
} else if delegate?.visibleBoundsOfTextView().intersects(imageBounds) ?? false {
return image
} else {
return nil
}
}
- 장점: Textkit의 버그 회피가능. Storyboard 사용가능!!
- 단점: TextAttachment가 delegate의 형식으로 textView를 reference하고 있어야한다. 이는 Attribute를 생성할 때 textView의 존재를 알아야하는 단점이있다.
ex) purestring, attribute 파서가 NSAttributedString을 생성하는데 textView를 알고있어야하는 이상한구조.
- Method Swizzling
Obj-c기반 셀렉터를 바꿔치기하여 셀렉터가 반응하는 함수를 바꿔주는 기법
ex) TextView는 기존과 같이 drawGlyphs메소드를 사용했는데 swizzledDrawGlyphs메소드가 실행된다!
- 장점: Textkit의 버그 회피, TextAttachment와 textView사이의 의존성도 해결
- 단점: iOS가 업데이트할때마다 selector가 변하지 않았는지 확인해 주어야한다. 다른 프레임워크가 layoutmanager를 사용한다면 프레임워크가 제대로 동작하지 않을 수 있다(swizzled 메소드가 돌기때문에 동작을 보장 할 수 없다.)
일단 현재 문제를 해결할 수 있는 가장 이상적인 방법은 3안이긴한데.... 문제가 100%해결인 느낌은 아니라서ㅠㅠ 다들 의견 어떠신가요?
[2D] Font manager
Piano Formatter에서 같이사용할 font manager
[4D] Realm Cloud Sync
현재 렘DB와 클라우드 킷사이의 동기화를 보고있습니다.
이슈
-
Shared 된 메모는 shared DB에 존재하는데 폴더개념의 Category record는 privateDB에 존재
따라서 CKReference를 만들어줄 수 없음Shared DB의 zoneID와 recordName을 CKValue로 갖는 새로운 CKRecordType을 만들어 해결 예정.
[4H] UI단에서의 Model Wrapper
Subissue
UI단에서 사용할 저장, 로드 wrapper 만들기
UI 단에서는 이게 Realm에저장되는지 cloud에저장되는지 알필요 없기 때문에
코드를 간단하게 쓰기위한 Wrapper 필요
Note Datamodel 이슈
노트를 rtf format string으로 저장할지, purestring으로 저장하고 attributes는 따로 저장할지
git이 사용하고있는 3-way merge알고리즘을 적용하면 save conflict를 잘 해결 할 수 있을 것 같습니다.
문제는 저희가 노트를 rtf format 으로 저장하고있어서 이알고리즘을 적용하기가 어려울 것 같습니다.
-
방안 1. merge할때 rtf string을 nsattributed string으로 변환 후 merge.
이후 attribute는 각각 attributed string으로부터 추출후 삽입 -
방안 2. purestring으로 저장후 merge attribute는 json포맷으로 따로저장
어떤 방식이 좋을까요ㅜㅜ 또 다른 좋은 방안이 떠오르신다면 코멘트 남겨주세요
[2D] Pasteboard 커스텀
이슈
-
paste할 경우 이미지가 클라우드에 올라갈 수 있도록 url생성 및 NSTextAttachment를 커스텀된 FastTextAttachment로 변환
-
copy할 경우 기존의 FastTextAttachment를 NSTextAttachment로 변환후 rtfd포맷으로 Pasteboard에 저장
-
paste 할 경우 rtfd포맷 외의 (html 등) 포맷들을 rtfd로 알맞게 변환 뒤 paste
[1D] Search engine
Search로 노트 검색
[2D] relationship handler
#1
Sub issue
렘 모델들을 위한 Relationship event handler 필요
(ex. 자식 모델이 부모모델보다 먼저 저장되어 부모모델의 필드에 append할 수 없을경우 handler에 등록. handler는 부모 모델이 저장되었을때 동작)
[2D] Diff3 merge algorithm
Diff3를 swift에적용하여 string, attribute 머지
[1D] Image deletion
메모를 나갈때 삭제된 이미지들에대해 반영
[4H] iCloud user change 처리
아이클라우드 계정이 바뀌었을경우 내부디비 change 및 cloud sync
[1D]Attribute merge
#9
Diff3 알고리즘을 사용하면 머지된 string을 얻을 수 있지만 attribute도 같이 고려 할 필요가있다.
또 textView.text = mergedString
이렇게 대입하기보다는 변화한 부분에 대해서만 insertText하는 방식이 더 효율 적일 것 같으므로, 이방식으로 update를 하는게 좋을 것 같다.
Notification을 이용할 수 있을 것같은데 더 좋은 방법을 생각해봐야함
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.