Giter Club home page Giter Club logo

rxappstate's Issues

about "application(_ app: UIApplication, open url: URL, options: ..."

Hi,
I have to open a resource specified by a URL.
The delegate "UIApplicationDelegate.application(_:open:options:)" is never call when I use your rx extension. (work fine otherwise)

So I tried to add it inside your extension like this :
public var applicationOpenURL: Observable<AppState> { return delegate.methodInvoked(#selector(UIApplicationDelegate.application(_:open:options:))) .map { _ in .active } } but that seems doesn't work.

FirstLaunchOfNewVersion

Hello,

I want to update information when user opens the app for the first time after a specific update, so I'm subscribing to firstLaunchOfNewVersionOnly as specified in the doc. But I never enter it even if I've changed the version number from 5.2 to 6.0. I'm using the version 1.1.0 of RxAppState.

Do you have any idea please ?

tvOS

Good to have tvOS support

isFirstLaunchOfNewVersion with first launch

Hello,

I would like to have an Observable with the same behavior as isFirstLaunchOfNewVersion, but which also emits true on first app launch.
The appVersion base observable is not enought to achieve this. This is because the AppVersion struct does not help distinguishing between the very first launch and "regular" app launches.

The workaround I have so far is something like:

Observable.zip(isFirstLaunch,isFirstLaunchOfNewVersion) { $0 || $1 }

Do you have a better idea how one could achieve this?

Maybe AppVersion could include some additional let isFirstLaunch: Bool attribute? This way it would fully represent the app state.

Crash while trying to forward method from RxApplicationDelegateProxy

I implemented UNUserNotificationCenterDelegate protocol in my AppDelegate,
then use UIApplication.shared.rx.appState.map...etc

Then after getting push from system RxApplicationDelegateProxy crashed with unrecognized selector at [RxAppState.RxApplicationDelegateProxy userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:]

After a bit of debugging it seems that forward delegate in RxCocoa's DelegateProxy is nil

screen shot 2017-11-23 at 14 36 51

RxSwift 6.0

Hello mates!, could You please update your Rx dependencies to 6.0 version

Support for extensions

Currently the framework cannot be imported in an extension because of the presence of UIApplication.shared in UIApplication.Rx.swift

extension RxAppState {
    /**
     For testing purposes
     */
    internal static func clearSharedObservables() {
        objc_setAssociatedObject(UIApplication.shared,
                                 &_sharedRxAppStateKey,
                                 nil,
                                 .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
    }
}

The problem would be resolved just by injecting the application in the method

internal static func clearSharedObservables(application: UIApplication) {
    objc_setAssociatedObject(application,
                             &_sharedRxAppStateKey,
                             nil,
                             .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
}

about "didFinishLaunchingWithOptions"

I need to start each time a user app running some initialization work, is in "didFinishLaunchingWithOptions" runs some initialization work.
I found it wrong to use "isFirstLaunch" because it only works when the app is first installed, not every time it runs.

Carthage Support only iOS 10.3

When using Carthage I get this error

MyProject/Classes/Models/Helpers/Helper.swift:11:8: Module file's minimum deployment target is ios10.3 v10.3: MyProject/Carthage/Build/iOS/RxAppState.framework/Modules/RxAppState.swiftmodule/x86_64.swiftmodule

Can you modify the deployment target for your module please ?

Unable to call AppDelegate

I am having an issue since I installed the RxAppState framework. I can no longer call this

 if let appDele = UIApplication.shared.delegate as? AppDelegate {
            
        }

This always fails now. If I try to force unwrap, it crashes with following error

Could not cast value of type 'RxAppState.RxApplicationDelegateProxy' (0x7f95fae20b20) to 'CustomApp.AppDelegate' (0x1099ec9e8).

Could anyone tell me a workaround to this issue?

Can't access AppDelegate

I need to access my AppDelegate, but when I do this let appDelegate = UIApplication.shared.delegate as! AppDelegate, an error occurs that I can't cast RxAppState.RxApplicationDelegateProxy to AppDelegate.

Crash unrecognized selector sent to instance

It was easy recreate this crash if you have objective-c app with code like this in app delegate

@implementation AppDelegate

+ (instancetype)sharedDelegate {
    return (AppDelegate*)[UIApplication sharedApplication].delegate;
}

Now any calls sharedDelegate in objective-c will return RxApplicationDelegateProxy and crash when you try access to any property of AppDelegate.

2019-08-17 21:20:08.183948+0300 CS DEV[3789:29536] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[RxAppState.RxApplicationDelegateProxy managedObjectContext]: unrecognized selector sent to instance 0x600003ed3240'

Originally posted by @Tayphoon in #11 (comment)

Upgrade to latest RxSwift version

Hello,

could it be possible to use latest RxSwift version in pod dependencies? This would not require any change in the code.

Thanks!

Potentially invalid App state if all Observables are not subscribed

Hello,

thank again for this great Pod!
I think there is a potential issue if you do not subscribe to all RxAppState Observable.
In my case, I have been using RxAppState since the public release of my App.
But first we only used the didOpenApp alike Observables, not the ones that involves UserDefaults such as isFirstLaunch, isFirstLaunchOfNewVersion, etc.
Therefore, if I start using isFirstLaunch in a new version of the App, then they will all trigger something wrong since the UserDefaults memory were not filled in the previous App versions since I never subscribed to them.

So I wonder whether it would not be better if RxAppState internally listen to AppDelegate notification and update its UserDefault memory internally, even if no Observables are subscribed.

I would be happy to have your opinion on this.

Do not use UserDefaults#synchronise - it’s officially bad (and potentially harmful)

At least since iOS 11 release last year, Apple recommends against using this - ever! They say: "this method is unnecessary and shouldn't be used" (https://developer.apple.com/documentation/foundation/userdefaults/1414005-synchronize)

Apple guarantees the synchronization will happen itself when needed. Using synchronize is bad because it's blocking and it writes to storage not just one change, but the whole dictionary which shouldn't be big, but can be. I still see a lot of guides on UserDefaults sort of advertising the synchronize and it's a pity. It became an anti-pattern.

In my opinion, this line should just be removed.

Please add PrivacyInfo

Hi, beginning with Mai 1st 2024 Apple requires that 3rd party SDK must habe a PrivacyInfo manifest included into there code.

https://developer.apple.com/support/third-party-SDK-requirements/
https://developer.apple.com/documentation/bundleresources/privacy_manifest_files

I've scanned my app with the following script (https://github.com/Wooder/ios_17_required_reason_api_scanner) for traces of code that requires action and your project was mentioned because if the usage of UserDefaults.

Can you please check it yourself and add a PrivacyInfo file?

Found potentially required reason API usage 'UserDefaults' in '...../Pods/RxAppState/Pod/Classes/UIApplication+Rx.swift'Line numbers: 91 305 319 325 336 Found potentially required reason API usage 'NSUserDefaults' in '...../Pods/RxAppState/Pod/Classes/UIApplication+Rx.swift' Line numbers: 91

Add previous/current version to Observables

When using firstLaunchOfNewVersionOnly, I'd like to tell know the previous and current versions of the app.

The intent is to give a user a "What's new" type into if the version was prior to x.x.x. If the previous version was later, the "What's new" flow will be skipped. This would help to determine if the user has previously been introduced to a new feature, and to avoid repeatedly introducing said feature.

If firstLaunchOfNewVersionOnly was of type Observable<(String, String)>, subscribers to next events would receive the required information. This would be simpler than retrieving the Strings from UserDefaults manually.

SPM Error

SPM Error is fixed in master branch, but there is no tag for it (probably 1.6.1)

isFirstLaunchOfNewVersion should be shared?

Hello,

first of all, thank you very much for your very convenient code!
I have a question about the Observables related to version number, like isFirstLaunchOfNewVersion.
My question is: would it be safer to share these observables by default, using a .share() operator?
The point is: if I subscribe twice to an observable like isFirstLaunchOfNewVersion, its side-effect code on the UserDefaults will be run twice, so one of the subscription will not work as expected.

Thank you very much,

Philippe

iOS 13 UISceneDelegate Support

Any interest in adding UISceneDelegate support? It seems that when you adopt the UISceneDelegate, some app lifecycle methods don't get called, instead the corresponding SceneDelegate methods are called. Example, sceneDidBecomeActive instead of applicationDidBecomeActive.

Potentially an issue with viewState if it is not subscribed immediately

(this issue is quite similar to #18)

Hello,

thanks again for this Pod. I have started using its UIViewController methods which are really great – in my opinion they definitely should be part of the RxSwift/RxCocoa "standard library".

I think that viewState behavior might be surprising in the case it is not subscribed to at the very beginning of the UIViewController creation. Indeed, for instance, if is subscribed to after the base method viewDidAppear() is invoked for the first, time, then viewState will not emit .viewDidAppear immediately, but will emit nothing until viewWillDisappear() is invoked.

Maybe viewState should behave like a state, not just like a combination of events: any time some observer subscribes to it, it should immediately get an event true or false.
To do so, there would be two things to do:

  • using a .share(replay: 1, scope: .forever) and a .startWith(xx).
  • subscribing it internally, so that is begins immediately to listen for the viewDidAppear , viewWillDisappear and similar Observables, even if externally there are no subscribers to it. Maybe using a .publish() and .connect() to do this kind of "pre-fetch", or using an internal DisposeBag property (maybe with something like NSObject-Rx?)

Thank you very much, I would be pleased to know your opinion on this.

P.S. : And to go a bit further, it might be interesting to expose it as a Driver instead of an Observable.

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.