Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 13 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
bun-version: latest

- run: bun install

- run: bun lint

typecheck:
name: Typecheck
runs-on: ubuntu-latest
Expand All @@ -34,7 +34,7 @@ jobs:
bun-version: latest

- run: bun install

- run: bun typecheck

typecheck-example:
Expand All @@ -43,7 +43,7 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
Expand All @@ -59,7 +59,7 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
Expand All @@ -75,7 +75,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
Expand All @@ -91,7 +91,7 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
Expand All @@ -107,7 +107,7 @@ jobs:
timeout-minutes: 10
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
Expand All @@ -123,7 +123,7 @@ jobs:

- run: pod install
working-directory: apps/example/ios

- run: apps/example/ios/Pods/SwiftLint/swiftlint lint

swift-test:
Expand Down Expand Up @@ -166,19 +166,15 @@ jobs:
restore-keys: xcode-cache-deriveddata-${{ github.workflow }}-

- name: Set up Xcode version
run: sudo xcode-select -s /Applications/Xcode_16.2.app/Contents/Developer
run: sudo xcode-select -s /Applications/Xcode_16.4.app

- name: Check Swift version
run: swift --version

- run: pod install
working-directory: apps/example/ios

- run: cp .swiftlint.yml apps/example/ios

- run: xcodebuild test -workspace reactnativedeviceactivityexample.xcworkspace -scheme Tests -allowProvisioningUpdates -destination "platform=iOS Simulator,OS=latest,name=iPhone 16"
working-directory: apps/example/ios




- run: xcodebuild test -workspace reactnativedeviceactivityexample.xcworkspace -scheme Tests -allowProvisioningUpdates -destination "platform=iOS Simulator,OS=latest,name=iPhone 17"
working-directory: apps/example/ios
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ class NativeEventObserver {
registerListener(name: "intervalWillEndWarning")
registerListener(name: "eventWillReachThresholdWarning")
}

func unregister() {
CFNotificationCenterRemoveEveryObserver(notificationCenter, observer)
}
}

@available(iOS 15.0, *)
Expand Down Expand Up @@ -277,8 +281,6 @@ public class ReactNativeDeviceActivityModule: Module {
])
let fileManager = FileManager.default

let observer = NativeEventObserver(module: self)

var watchActivitiesHandle: Cancellable?
var onDeviceActivityDetectedHandle: Cancellable?

Expand Down Expand Up @@ -321,7 +323,10 @@ public class ReactNativeDeviceActivityModule: Module {
return to.absoluteString
}

var observer: NativeEventObserver?

OnStartObserving {
observer = NativeEventObserver(module: self)
onDeviceActivityDetectedHandle = AuthorizationCenter.shared.$authorizationStatus.sink {
status in
self.sendEvent(
Expand All @@ -341,6 +346,8 @@ public class ReactNativeDeviceActivityModule: Module {
}

OnStopObserving {
observer?.unregister()
observer = nil
watchActivitiesHandle?.cancel()
onDeviceActivityDetectedHandle?.cancel()
}
Expand Down Expand Up @@ -694,7 +701,7 @@ public class ReactNativeDeviceActivityModule: Module {

let activitySelection = parseActivitySelectionInput(input: familyActivitySelection)

try blockSelectedApps(
blockSelectedApps(
blockSelection: activitySelection,
triggeredBy: triggeredBy
)
Expand Down Expand Up @@ -816,15 +823,11 @@ public class ReactNativeDeviceActivityModule: Module {
}

Prop("footerText") { (view: ReactNativeDeviceActivityView, prop: String?) in

view.model.footerText = prop

}

Prop("headerText") { (view: ReactNativeDeviceActivityView, prop: String?) in

view.model.headerText = prop

}
}
}
Expand Down
Loading