"),t.b("\n"+i),t.b(' | '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("lineNumber",c,p,0))),t.b("\n"+i),t.b(" | "),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.s(t.f("prefix",c,p,1),c,p,0,171,247,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' '),t.b(t.t(t.f("prefix",c,p,0))),t.b(""),t.b("\n"+i)}),c.pop()),t.s(t.f("content",c,p,1),c,p,0,279,353,"{{ }}")&&(t.rs(c,p,function(c,p,t){t.b(' '),t.b(t.t(t.f("content",c,p,0))),t.b(""),t.b("\n"+i)}),c.pop()),t.b(" "),t.b("\n"+i),t.b(" | "),t.b("\n"+i),t.b(""),t.fl()},partials:{},subs:{}}),global.browserTemplates["generic-wrapper"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(''),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("content",c,p,0))),t.b("\n"+i),t.b("
"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-added"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-changed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-deleted"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file-renamed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["icon-file"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('"),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-file-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(''),t.b("\n"+i),t.b(' "),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.t(t.f("diffs",c,p,0))),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.fl()},partials:{},subs:{}}),global.browserTemplates["line-by-line-numbers"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(''),t.b(t.v(t.f("oldNumber",c,p,0))),t.b("
"),t.b("\n"+i),t.b(''),t.b(t.v(t.f("newNumber",c,p,0))),t.b("
"),t.fl()},partials:{},subs:{}}),global.browserTemplates["side-by-side-file-diff"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b(''),t.b("\n"+i),t.b(' "),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.t(t.d("diffs.left",c,p,0))),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b('
'),t.b("\n"+i),t.b(' '),t.b("\n"+i),t.b(" "),t.b(t.t(t.d("diffs.right",c,p,0))),t.b("\n"+i),t.b(" "),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.b("\n"+i),t.b("
"),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-added"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('ADDED'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-changed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('CHANGED'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-deleted"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('DELETED'),t.fl()},partials:{},subs:{}}),global.browserTemplates["tag-file-renamed"]=new Hogan.Template({code:function(c,p,i){var t=this;return t.b(i=i||""),t.b('RENAMED'),t.fl()},partials:{},subs:{}}),module.exports=global.browserTemplates}()}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"hogan.js":4}],19:[function(require,module,exports){function Utils(){}var merge;merge=require("merge"),Utils.prototype.escape=function(str){return str.slice(0).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")},Utils.prototype.startsWith=function(str,start){if("object"!=typeof start)return str&&0===str.indexOf(start);var result=!1;return start.forEach(function(s){0===str.indexOf(s)&&(result=!0)}),result},Utils.prototype.valueOrEmpty=function(value){return value||""},Utils.prototype.safeConfig=function(cfg,defaultConfig){return merge.recursive(!0,defaultConfig,cfg)},module.exports.Utils=new Utils},{merge:6}]},{},[10]);
\ No newline at end of file
diff --git a/diff/src/main/assets/index.html b/diff/src/main/assets/index.html
new file mode 100644
index 00000000..d24b47fc
--- /dev/null
+++ b/diff/src/main/assets/index.html
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/diff/src/main/java/com/fastaccess/fasthub/diff/DiffViewerActivity.kt b/diff/src/main/java/com/fastaccess/fasthub/diff/DiffViewerActivity.kt
new file mode 100644
index 00000000..05749502
--- /dev/null
+++ b/diff/src/main/java/com/fastaccess/fasthub/diff/DiffViewerActivity.kt
@@ -0,0 +1,37 @@
+package com.fastaccess.fasthub.diff
+
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import android.widget.TextView
+import androidx.appcompat.widget.Toolbar
+import com.fastaccess.fasthub.dagger.annotations.ForActivity
+import com.fastaccess.github.base.BaseActivity
+import com.fastaccess.github.base.utils.EXTRA
+import kotlinx.android.synthetic.main.diff_patch_viewer_layout.*
+
+class DiffViewerActivity : BaseActivity() {
+
+ override fun layoutRes(): Int = R.layout.diff_patch_viewer_layout
+
+ override fun onActivityCreatedWithUser(savedInstanceState: Bundle?) {
+ title = ""
+ findViewById(R.id.toolbar).apply {
+ title = ""
+ findViewById(R.id.toolbarTitle).text = getString(R.string.commit)
+ setNavigationIcon(R.drawable.ic_clear)
+ setSupportActionBar(this)
+ }
+ intent?.getStringExtra(EXTRA)?.let {
+ webview.loadDiff(it)
+ } ?: run { finish() }
+ }
+
+ companion object {
+ fun startActivity(@ForActivity context: Context, patch: String) {
+ context.startActivity(Intent(context, DiffViewerActivity::class.java).apply {
+ putExtra(EXTRA, patch)
+ })
+ }
+ }
+}
\ No newline at end of file
diff --git a/diff/src/main/java/com/fastaccess/fasthub/diff/DiffWebView.kt b/diff/src/main/java/com/fastaccess/fasthub/diff/DiffWebView.kt
new file mode 100644
index 00000000..859cb364
--- /dev/null
+++ b/diff/src/main/java/com/fastaccess/fasthub/diff/DiffWebView.kt
@@ -0,0 +1,35 @@
+package com.fastaccess.fasthub.diff
+
+import android.annotation.SuppressLint
+import android.content.Context
+import android.util.AttributeSet
+import android.webkit.WebChromeClient
+import android.webkit.WebView
+import androidx.webkit.WebViewClientCompat
+import timber.log.Timber
+
+
+class DiffWebView : WebView {
+ constructor(context: Context?) : super(context)
+ constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
+ constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)
+
+ @SuppressLint("SetJavaScriptEnabled")
+ fun loadDiff(diff: String) {
+ settings.apply {
+ javaScriptEnabled = true
+ defaultTextEncodingName = "utf-8"
+ webChromeClient = WebChromeClient()
+ }
+ post {
+ webViewClient = object : WebViewClientCompat() {
+ override fun onPageFinished(view: WebView?, url: String?) {
+ super.onPageFinished(view, url)
+ Timber.e("here!")
+ loadUrl("javascript:loadDiff('$diff')")
+ }
+ }
+ loadUrl("file:///android_asset/index.html")
+ }
+ }
+}
\ No newline at end of file
diff --git a/diff/src/main/res/layout/diff_patch_viewer_layout.xml b/diff/src/main/res/layout/diff_patch_viewer_layout.xml
new file mode 100644
index 00000000..861a9b24
--- /dev/null
+++ b/diff/src/main/res/layout/diff_patch_viewer_layout.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
index 867fbde7..efac2040 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,4 +1,4 @@
-include ':app', ':data', ':domain', ':resources', ':extensions', ':markdown', ':editor'
+include ':app', ':data', ':domain', ':resources', ':extensions', ':markdown', ':editor', ':diff'
include ':commits'
include ':base'
include ':dagger'