Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

v0.8.0-rc1

Pre-release
Pre-release
Compare
Choose a tag to compare
@passsy passsy released this 09 Nov 10:44
· 513 commits to master since this release

Changelog 0.8.0-rc1

thirtyinch

New: TiPresenter lifecycle methods got renamed #26

The new naming is more convenient throughout most android MPV libraries.

  • onWakeUp() is now deprecated and can be replaced with onAttachView(TiView) which has the TiView as argument
  • onSleep() is now deprecated and can be replaced with onDetachView()
-    @Override
-    protected void onWakeUp() {
-        super.onWakeUp();
-    }
+    @Override
+    protected void onAttachView(@NonNull final HelloWorldView view) {
+        super.onAttachView(view);
+    }

-    @Override
-    protected void onSleep() {
-        super.onSleep();
-    }
+    @Override
+    protected void onDetachView() {
+        super.onDetachView();
+    }

New: TiPresenter#getView() is now @Nullable #26

getView() is now annotated with @Nullable and causes lint to hint a Nullable warning. This warning was missing and caused a lot of NPEs for Ti beginners. On the other hand, the view in onAttachView(TiView) is @NonNull. No unnecessary null checks are required

New: wait for view before executing code TiPresenter#sendToView(ViewAction<TiView>) #36

Sending events to the view although the view isn't attached is already possible with rx and .compose(rxUtils.deliverLatestCacheToView(this)) which caches all items until the view is attached and emits them in the same order. The same behavior is now back ported to pure java.

// TiPresenter
@Override
protected void onCreate() {
    super.onCreate();
    doNetworkCall(result -> {
        // getView() could be null
        // getView().showData(result);

        sendToView(view -> {
            // lambda will be executed when the view got attached (onAttachView(TiView))
            // view is never null
            view.showData(result);
        });
    });
}

New: TiLog logging API #14, #15

Before this library logged everything automatically. ThirtyInch is now silent by default. If you are interested in the logs register your own logger.

// logcat example
TiLog.setLogger(TiLog.LOGCAT);

// Timber example
Timber.plant(new Timber.DebugTree());
TiLog.setLogger(new TiLog.Logger() {
    @Override
    public void log(final int level, final String tag, final String msg) {
        Timber.tag(tag).log(level, msg);
    }
});

New: @DistinctUntilChanged uses now equals() for comparison instead of hashCode() (thx @fzymek) #19, #24

The new default implementation uses equals() instead of hashcode(). A DistinctComparator can be set as argument of the annotation @DistinctUntilChanged(comparator = EqualsComparator.class). Three different implementations exist:

  • EqualsComparator (default) - uses equals() for comparison and holds a strong reference to the previous arguements
  • WeakEqualsComparator - uses equals() for comparison and holds a weak reference to the previous arguments. Could call a method twice when gc() kicks in.
  • HashComparator - old implementation using hashCode() for comparison. Doesn't hold references to the arguments

New: The support library is now a provided instead of a compile dependency #23

Therefore it uses the AppCompat version you are compiling in your app. It isn't required anymore to exclude the support library for all Ti dependencies when your app is using an older AppCompat version.

Fix: Activity#recreate() (with useStaticSaviorToRetain=false) destroys the Presenter #35

When changing the configuration of an TiActivity without closing it (by calling recreate() or changing the orientation) the Presenter was destroyed although the Activity flag isChangingConfigurations was true resulting in a NPE when the TiActivity runs in onCreate. This only happened when useStaticSaviorToRetain was set to false.

thirtyinch-rx

Fix: view can be null before unsubscribing from Subscriptions #27

When using the RxTiPresenterSubscriptionHandler to automatically unsubscribe from views it can happen (multithreaded environment) that getView() returns null before Subscriptions#unsubscribe() is called.