-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into follow-is-as-follow-does
* origin/main: (45 commits) Added trans (#4890) Keep interstitial fresh on refresh (#4888) Include popcluster in suggestion ranking (#4887) Add logging of selected feed preference when displaying the following feed (#4789) [Video] Visibility detection view (#4741) [Videos] Video player - PR #2 - better web support (#4732) [Video] Authed video upload (#4885) Tweak feed manip to show cases of A -> B without further children (#4883) Show own replies before follows' replies in threads (#4882) Show more replies in Following (different heuristic) (#4880) [Persisted] Make broadcast subscriptions granular by key (#4874) [Persisted] Fix the race condition causing clobbered writes between tabs (#4873) [Persisted] Fork web and native, make it synchronous on the web (#4872) Show replies in context of their threads (#4871) Add `PlatformInfo` module (#4877) bskyweb: optional basic auth password middleware (#4759) tweak list header (#4870) Respect labels on feeds and lists (#4818) Only show replies in Following if following all involved actors (#4869) Always limit Following replies to the people you follow (#4868) ...
- Loading branch information
Showing
198 changed files
with
4,823 additions
and
2,042 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...ndroid/src/main/java/expo/modules/blueskyswissarmy/platforminfo/ExpoPlatformInfoModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package expo.modules.blueskyswissarmy.platforminfo | ||
|
||
import android.provider.Settings | ||
import expo.modules.kotlin.modules.Module | ||
import expo.modules.kotlin.modules.ModuleDefinition | ||
|
||
class ExpoPlatformInfoModule : Module() { | ||
override fun definition() = | ||
ModuleDefinition { | ||
Name("ExpoPlatformInfo") | ||
|
||
// See https://github.com/software-mansion/react-native-reanimated/blob/7df5fd57d608fe25724608835461cd925ff5151d/packages/react-native-reanimated/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java#L242 | ||
Function("getIsReducedMotionEnabled") { | ||
val resolver = appContext.reactContext?.contentResolver ?: return@Function false | ||
val scale = Settings.Global.getString(resolver, Settings.Global.TRANSITION_ANIMATION_SCALE) ?: return@Function false | ||
|
||
try { | ||
return@Function scale.toFloat() == 0f | ||
} catch (_: Error) { | ||
return@Function false | ||
} | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...main/java/expo/modules/blueskyswissarmy/visibilityview/ExpoBlueskyVisibilityViewModule.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package expo.modules.blueskyswissarmy.visibilityview | ||
|
||
import expo.modules.kotlin.modules.Module | ||
import expo.modules.kotlin.modules.ModuleDefinition | ||
|
||
class ExpoBlueskyVisibilityViewModule : Module() { | ||
override fun definition() = | ||
ModuleDefinition { | ||
Name("ExpoBlueskyVisibilityView") | ||
|
||
AsyncFunction("updateActiveViewAsync") { | ||
VisibilityViewManager.updateActiveView() | ||
} | ||
|
||
View(VisibilityView::class) { | ||
Events(arrayOf("onChangeStatus")) | ||
|
||
Prop("enabled") { view: VisibilityView, prop: Boolean -> | ||
view.isViewEnabled = prop | ||
} | ||
} | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...army/android/src/main/java/expo/modules/blueskyswissarmy/visibilityview/VisibilityView.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package expo.modules.blueskyswissarmy.visibilityview | ||
|
||
import android.content.Context | ||
import android.graphics.Rect | ||
import expo.modules.kotlin.AppContext | ||
import expo.modules.kotlin.viewevent.EventDispatcher | ||
import expo.modules.kotlin.views.ExpoView | ||
|
||
class VisibilityView( | ||
context: Context, | ||
appContext: AppContext, | ||
) : ExpoView(context, appContext) { | ||
var isViewEnabled: Boolean = false | ||
|
||
private val onChangeStatus by EventDispatcher() | ||
|
||
private var isCurrentlyActive = false | ||
|
||
override fun onAttachedToWindow() { | ||
super.onAttachedToWindow() | ||
VisibilityViewManager.addView(this) | ||
} | ||
|
||
override fun onDetachedFromWindow() { | ||
super.onDetachedFromWindow() | ||
VisibilityViewManager.removeView(this) | ||
} | ||
|
||
fun setIsCurrentlyActive(isActive: Boolean) { | ||
if (isCurrentlyActive == isActive) { | ||
return | ||
} | ||
|
||
this.isCurrentlyActive = isActive | ||
this.onChangeStatus( | ||
mapOf( | ||
"isActive" to isActive, | ||
), | ||
) | ||
} | ||
|
||
fun getPositionOnScreen(): Rect? { | ||
if (!this.isShown) { | ||
return null | ||
} | ||
|
||
val screenPosition = intArrayOf(0, 0) | ||
this.getLocationInWindow(screenPosition) | ||
return Rect( | ||
screenPosition[0], | ||
screenPosition[1], | ||
screenPosition[0] + this.width, | ||
screenPosition[1] + this.height, | ||
) | ||
} | ||
|
||
fun isViewableEnough(): Boolean { | ||
val positionOnScreen = this.getPositionOnScreen() ?: return false | ||
val visibleArea = positionOnScreen.width() * positionOnScreen.height() | ||
val totalArea = this.width * this.height | ||
return visibleArea >= 0.5 * totalArea | ||
} | ||
} |
82 changes: 82 additions & 0 deletions
82
...droid/src/main/java/expo/modules/blueskyswissarmy/visibilityview/VisibilityViewManager.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package expo.modules.blueskyswissarmy.visibilityview | ||
|
||
import android.graphics.Rect | ||
|
||
class VisibilityViewManager { | ||
companion object { | ||
private val views = HashMap<Int, VisibilityView>() | ||
private var currentlyActiveView: VisibilityView? = null | ||
private var prevCount = 0 | ||
|
||
fun addView(view: VisibilityView) { | ||
this.views[view.id] = view | ||
|
||
if (this.prevCount == 0) { | ||
this.updateActiveView() | ||
} | ||
this.prevCount = this.views.count() | ||
} | ||
|
||
fun removeView(view: VisibilityView) { | ||
this.views.remove(view.id) | ||
this.prevCount = this.views.count() | ||
} | ||
|
||
fun updateActiveView() { | ||
var activeView: VisibilityView? = null | ||
val count = this.views.count() | ||
|
||
if (count == 1) { | ||
val view = this.views.values.first() | ||
if (view.isViewableEnough()) { | ||
activeView = view | ||
} | ||
} else if (count > 1) { | ||
val views = this.views.values | ||
var mostVisibleView: VisibilityView? = null | ||
var mostVisiblePosition: Rect? = null | ||
|
||
views.forEach { view -> | ||
if (!view.isViewableEnough()) { | ||
return | ||
} | ||
|
||
val position = view.getPositionOnScreen() ?: return@forEach | ||
val topY = position.centerY() - (position.height() / 2) | ||
|
||
if (topY >= 150) { | ||
if (mostVisiblePosition == null) { | ||
mostVisiblePosition = position | ||
} | ||
|
||
if (position.centerY() <= mostVisiblePosition!!.centerY()) { | ||
mostVisibleView = view | ||
mostVisiblePosition = position | ||
} | ||
} | ||
} | ||
|
||
activeView = mostVisibleView | ||
} | ||
|
||
if (activeView == this.currentlyActiveView) { | ||
return | ||
} | ||
|
||
this.clearActiveView() | ||
if (activeView != null) { | ||
this.setActiveView(activeView) | ||
} | ||
} | ||
|
||
private fun clearActiveView() { | ||
this.currentlyActiveView?.setIsCurrentlyActive(false) | ||
this.currentlyActiveView = null | ||
} | ||
|
||
private fun setActiveView(view: VisibilityView) { | ||
view.setIsCurrentlyActive(true) | ||
this.currentlyActiveView = view | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,19 @@ | ||
{ | ||
"platforms": ["ios", "tvos", "android", "web"], | ||
"ios": { | ||
"modules": ["ExpoBlueskySharedPrefsModule", "ExpoBlueskyReferrerModule"] | ||
"modules": [ | ||
"ExpoBlueskySharedPrefsModule", | ||
"ExpoBlueskyReferrerModule", | ||
"ExpoBlueskyVisibilityViewModule", | ||
"ExpoPlatformInfoModule" | ||
] | ||
}, | ||
"android": { | ||
"modules": [ | ||
"expo.modules.blueskyswissarmy.sharedprefs.ExpoBlueskySharedPrefsModule", | ||
"expo.modules.blueskyswissarmy.referrer.ExpoBlueskyReferrerModule" | ||
"expo.modules.blueskyswissarmy.referrer.ExpoBlueskyReferrerModule", | ||
"expo.modules.blueskyswissarmy.visibilityview.ExpoBlueskyVisibilityViewModule", | ||
"expo.modules.blueskyswissarmy.platforminfo.ExpoPlatformInfoModule" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
import * as PlatformInfo from './src/PlatformInfo' | ||
import * as Referrer from './src/Referrer' | ||
import * as SharedPrefs from './src/SharedPrefs' | ||
import VisibilityView from './src/VisibilityView' | ||
|
||
export {Referrer, SharedPrefs} | ||
export {PlatformInfo, Referrer, SharedPrefs, VisibilityView} |
11 changes: 11 additions & 0 deletions
11
modules/expo-bluesky-swiss-army/ios/PlatformInfo/ExpoPlatformInfoModule.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import ExpoModulesCore | ||
|
||
public class ExpoPlatformInfoModule: Module { | ||
public func definition() -> ModuleDefinition { | ||
Name("ExpoPlatformInfo") | ||
|
||
Function("getIsReducedMotionEnabled") { | ||
return UIAccessibility.isReduceMotionEnabled | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
modules/expo-bluesky-swiss-army/ios/Visibility/ExpoBlueskyVisibilityViewModule.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import ExpoModulesCore | ||
|
||
public class ExpoBlueskyVisibilityViewModule: Module { | ||
public func definition() -> ModuleDefinition { | ||
Name("ExpoBlueskyVisibilityView") | ||
|
||
AsyncFunction("updateActiveViewAsync") { | ||
VisibilityViewManager.shared.updateActiveView() | ||
} | ||
|
||
View(VisibilityView.self) { | ||
Events([ | ||
"onChangeStatus" | ||
]) | ||
|
||
Prop("enabled") { (view: VisibilityView, prop: Bool) in | ||
view.enabled = prop | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.