Giter VIP home page Giter VIP logo

titanium-alternate-icons's Introduction

Alternate App Icon Ti Module (iOS 10.3+)

Summary

Leverage the ability to change the app icon in iOS 10.3+.

WhiteIcon

Requirements

  • Titanium Mobile SDK 6.0.3.GA or later
  • iOS 10.3 or later
  • Xcode 8.3 or later

Download

Setup

Unzip the module in the modules/iphone/ folder of your project. Add the module requirement in your tiapp.xml file.

<modules>
    <module platform="iphone">ti.alternateicons</module>
</modules>

In order to use this module with Titanium you will need to disable app thinning by editing the adding the following property in your tiapp.xml:

<ios>
    <use-app-thinning>false</use-app-thinning>
</ios>

Alternatively, you can pass the hashed name of the icon to the methods. You can look up the generated names in build/iphone/Assets.xcassets.

Next, you have to declare the icons that you will use in your by adding the following to the tiapp.xml. The <key> named alloyIcon is the string that you will use to call the set​Alternate​Icon​Name method .

<ios>
    <dict>
        <key>CFBundleIcons</key>
        <dict>
            <key>CFBundleAlternateIcons</key>
            <dict>
                <key>alloyIcon</key>
                <dict>
                    <key>CFBundleIconFiles</key>
                    <array>
                        <string>alloy</string>
                    </array>
                </dict>
            </dict>
            <key>CFBundlePrimaryIcon</key>
            <dict>
                <key>CFBundleIconFiles</key>
                <array>
                    <string>AppIcon</string>
                </array>
            </dict>
        </dict>
    </dict>
</ios>

Copy your icons into the app/assets/ folder. You can try it out with [email protected] and [email protected] in the example folder of this repo.

Hyperloop

This module is also built in Hyperloop to demonstrate the native API access with JavaScript. You can simple require the ti.alternateicons.js in your application and run it!

Example

var AlternateIcons = require('ti.alternateicons');

if (AlternateIcons.isSupported()) {
    AlternateIcons.setAlternateIconName('alloyIcon', function(e) {
        if (!e.success) {
            Ti.API.error(e.error);
        }
    });
}

Methods

  • isSupported
  • supportsAlternateIcons
  • alternateIconName
  • set​Alternate​Icon​Name
  • setDefaultIconName

Author

Cesar Cavazos (@cesarcvz / Web)

License

Apache 2.0

Contributing

Code contributions are greatly appreciated, please submit a new pull request

Special Thanks

To Hans Knoechel because this module was created using titanium-review-dialog as a reference.

titanium-alternate-icons's People

Contributors

ccavazos avatar hansemannn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

titanium-alternate-icons's Issues

Icon not found using app-thinning

I have a problem when I enable <use-app-thinning>true</use-app-thinning> . The icon is not found.
Documentation says you can use the hashed name of the icon generated in build/iphone/Assets.xcassets but it is not clear to me how.

setting app icon causes error

I tested the example, but it doesn't work. I get this error when firing setDefaultIconName or setAlternateIconName.

[INFO] :   isSupported: true
[INFO] :   supportsAlternateIcons: true
[ERROR] :  Script Error {
[ERROR] :      column = 124;
[ERROR] :      line = 50;
[ERROR] :      message = "-[__NSCFString count]: unrecognized selector sent to instance 0x60000022bf60";
[ERROR] :      sourceURL = "file:///Users/arjanbrinkman/Library/Developer/CoreSimulator/Devices/08F09387-1F66-43F3-A17F-55B253EFFB18/data/Containers/Bundle/Application/6023B10F-6750-467E-A628-25A3A711498D/xxx.app/alloy/controllers/index.js";
[ERROR] :      stack = "[native code]\nfile:///Users/xxx/Library/Developer/CoreSimulator/Devices/08F09387-1F66-43F3-A17F-55B253EFFB18/data/Containers/Bundle/Application/6023B10F-6750-467E-A628-25A3A711498D/xxx.app/alloy/controllers/index.js:50:124";
[ERROR] :  }

SDK 6.1.0.GA

Build failed on device

Test on iPhone 6s iOS 10.3.2
Titanium SDK 6.1.0.GA
xCode 8.3.3

[INFO] :   Invoking xcodebuild
[ERROR] :  ** BUILD FAILED **
[ERROR] :  The following build commands failed:
[ERROR] :  	Ld build/Intermediates/Appname.build/Debug-iphoneos/Appname.build/Objects-normal/arm64/Appname normal arm64
[ERROR] :  (1 failure)

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.