Flutter - App Store Connect rejection due to needing "functional link to the Terms of Use (EULA)" in "your app's binary" - flutter

Our flutter app, with a subscription membership in-app-purchase, is repeatedly being rejected by App Store Connect for the following reason :
Specifically, we were unable to find the following required
information in your app's binary:
– A functional link to the Terms of Use (EULA)
How do we update the app's binary to have a link to the EULA ?
Does anyone know what this message actually means ?
Note that we do show the EULA when the user first enters the app, and there is link to it - so this message doesn't appear to be about the actual functioning/UI in the app.
Note that this is a Flutter app, so bonus points on the answer if you can tell how to set the EULA in the binary in Flutter. ("bonus points" being an expression, I have no authority from SO to allocate extra points)

As far as I know, they need a button that opens the browser on a public page that contains your Terms of Use/Privacy Policy. This button should be available at all times, not only when the user first opens the app.
You can do that using the url_launcher package. Example:
ElevatedButton(
onPressed: () {
launch('https://policies.google.com/terms?hl=en-US');
},
child: Text('Terms of Use'),
),
I have implemented this a few times and haven't had issues publishing to the App Store.

Related

Flutter Web Firebase Auth's persistence doesn't work on PWA

I have developed a Flutter Web app that uses Firebase Authentication in order to sign in users to the app.
I've declared the Firebase Authentication persistence field so that the app will remember and auto-login the user when he revisits the Flutter Web app's URL, and won't be required to re-login every time he launches the URL.
It all works fine on a regular browser, but when the user generates a PWA (for example, clicking "Add to Home Screen" on iOS devices to save the website as PWA), the persistence feature stops working, and the user is required to re-login every time he opens the PWA.
Is there a way to add Firebase Authentication's persistence feature to a PWA? And if not, is there a way to prevent generating a PWA (and saving the Flutter Web app as a regular browser URL when clicking "Add to Home Screen" button on iOS, for example)?
Thank you!
To solve the persistence problem, add a listener:
FirebaseAuth.instance.idTokenChanges().listen((User? user) async {
if (user == null) {
// Function for user not logged in here. Do not write function to change page here.
} else {
// As it's a Future it will take a while to process the user's information, so it
will call the function after it's done.
Navigator.pushReplacement(
context, MaterialPageRoute(builder: (_) => Home()));
}
}
This is an example I made and it worked, use controllers to change the status, put some function to wait for the information to be processed.
Hope this helps. Any questions, at your disposal.

Flutter integration test firebase auth (email link or google sign in)

I'm adding integration testing (using the integration_test package) to my app but I am running into a problem.
Let me explain. The first step when my app launch is authentication for which I have 3 options: firebase email link, firebase google sign in, and firebase facebook sign in.
What is blocking me is that all these sign in methods require actions outside of the main app dart code and thus are not accessible by flutter driver.
Am I missing something here? And if not how should that case be handled?
Cheers!
To make the test less flaky i would recommend to not rely on an internet connection or a third party (like Firebase or Google login).
I would advise to use a Mock for this. So when you try to login to your test you send a fake response, and in that way you can continue using the app.
The following article explains how to use a mock:
https://medium.com/stuart-engineering/mocking-integration-tests-with-flutter-af3b6ba846c7
You can use Patrol – it lets you interact with native system UI from within your Flutter integration tests. Example:
import 'package:flutter_test/flutter_test.dart';
import 'package:patrol/patrol.dart';
void main() {
patrolTest(
'signs in',
nativeAutomation: true,
(PatrolTester $) async {
await $.native.enterText(
Selector(textContains: 'Email'),
text: 'tester#awesomeapp.pl'),
);
await $.native.enterText(
Selector(textContains: 'Password'),
text: 'ny4ncat'),
);
await $.native.tap(Selector(text: 'Continue'));
// you should be signed in
});
}
You can add the fourth way of signing in - using username and password. Firebase should support this kind of very common situation, so you can do it within lines of code.
If you do not want the end users to login by password, you can simply disable this method in production build and only enable it in debug build.
Another way is to mock your authentication system. In other words, when doing testing, you have a button called "fake sign in", and your integration test driver just click that button.

Push service ionic 2

I have follow this tutorial (https://devdactic.com/ionic-2-push-notifications/#disqus_thread)
I do not receive notification (status sent on ionic.io) on physical iOS Device with TestFlight. (But the token is generated).
app.component.ts and app.module.ts file: https://pastebin.com/HB97KdWL
I have try official tutorial but same problem..
Thank you in advance !
So, there are a bunch of things that could go wrong, especially with ios. Here are some things to look at:
Managing the certificates for the APNS can be rough. If you have
access to an android device, start there since it's a little more
straightforward to get notifications up and running.
Since you're using apps.ionic.io, you have the advantage of checking
to see if you have a push token assigned to a user. (I'm assuming
that you're using auth?) In the Auth tab, select the
user->View->check the push tab to see the token. Also, use the push
service to send a generic push notification to the users to see if
it arrives.
If you have a problem with ios, there's a strong likelihood that
there's something wrong with the certificates... so check for
another tutorial on that. I'd recommend using the Ionic Cloud Services website instead of Devdactics since Ionic is more in-depth. You can find it here: https://docs.ionic.io/services/push/#prerequisites
Make sure that the "Background Notifications" and "Push
Notifications are selected on the General tab in the Xcode project.
Since you're using Ionic, changing anything with 'cordova platform
add ios' can overwrite it. Make sure it looks like this: ![enter
image description here]3
This might be an oversight?...in your code, you have this:
const cloudSettings: CloudSettings = {
'core': {
'app_id': 'XXXXXX' **<-- this should be a value. (not XXXXXX)**
},
'push': {
'sender_id': 'XXXXX', **<-- this should be a value. (not XXXXXX)**
'pluginConfig': {
'ios': {
'badge': true,
'sound': true
},
'android': {
'iconColor': '#ff0000'
}
}
}
};
app_id is something that is covered in the tutorial that you sent. It's under the IOS certificate section. It says, "After going through the Push guide you need to have your App Id from the Identifier you created inside your Apple profile. Copy that ID and open your config.xml and add your ID:" This is the same ID that you'll put in that section of code.
Unfortunately, there are a lot of things that can go wrong with the certificates. I would focus there since the errors that you get can be unannounced.

android facebook login button does not work

I'm following this tutorial "Facebook Login Flow for Android" (https://developers.facebook.com/docs/howtos/androidsdk/3.0/login-with-facebook/) to create a simple app containing only one facebook login button to test facebook login.
However, I've been having trouble logging in facebook with this button.... I've been following every step in this tutorial and I've double checked everything -- it is exactly the same as in this tutorial. I see other people who have similar problems are always because of incorrect debug hash code. But I've checked like a million times that I got the correct debug hash code. Some people say that if you wanna release an app, you need a release code. However, I'm not releasing my app -- I'm just testing it on an android device, so I guess I dont really need a release code to do that?
Also, I've checked that I've included my facebook application id for this app in the Android Manifest. So basically, everything I did was strictly following the tutorials on Facebook Developers.
I've seen some people suggesting to use the "keytool" in JDK 6 in stead of JDK 7. And I've checked that I actually did generate my debug hash code with the "keytool" in JDK 6.
So I've tried everything, but the problem still exists!
In that Android Tutorial, it suggests putting this in your code so that you can monitor your LogCat to see if your current state is logged in or logged out:
private void onSessionStateChange(Session session, SessionState state, Exception exception) {
if (state.isOpened()) {
Log.i(TAG, "Logged in...");
} else if (state.isClosed()) {
Log.i(TAG, "Logged out...");
}
}
In my case, no matter how many times I clicked Facebook Login Button, I always got "Logged out..." in my LogCat.
Also, the funny thing is, I can't even log in facebook using those sample apps coming with Facebook Android SDK 3.0.1 (eg. SessonLoginSample)!!!!! When I click the login button in those sample apps, nothing happens -- which means I'm not successfully logged in.
I really hope you guys out there can help me with this problem. It's weird I don't see other people with the exact same problem (as I said, those with similar problems are always because of incorrect debug code, but I've checked mine, it is 100% correct). THANK YOU SO MUCH!
It happened to me once. You might have added the export key hash in facebook developer setting.
Add these lines to your code to get your debugging key hash and then add to facebook.
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
}

Azure mobile facebook authentication with iPhone HTML5 in app (full screen) mode

I have an HTML5 application that uses Azure mobile services authentication to login (straight from the example code...provided below). It works fine in all desktop browsers and iPhone 5 in Safari. But from app / full screen mode, it does nothing (doesn't ask for permission to show a popup window like it does in safari and no popup windows shows up) and I can wait forever and nothing happens. If I invoke it a second time, it gives an error saying "Error: Unexpected failure"...perhaps because the 1st attempt is still running? Any help/insight is appreciated.
client.login ("facebook").done(function (results) {
alert("You are now logged in as: " + results.userId);
}, function (err) {
alert("Error: " + err);
});
edited update with more info and 2 potential ideas*
I did some more research and found a site that uses an approach that overcomes this problem and also solves two other side effects with the current Azure mobile approach to authentication. I think the Azure mobile team might be looking to do something similar because there are some hints of other authentication options in the code (although difficult to read and be sure because the minimized code is obsfucated). It might be just a matter of activating these in the code...
The "solution":
Go to http://m.bcwars.com/ and click on the Facebook login. You'll see it works perfectly in iPhone Safari in "app mode" becuase instead of doing a popup, it simply stays in the current browser window.
This approach solves two other problems with the current Azure mobile approach. First, the popup gets interpreted by most browsers as a potential ad and is either blocked automatically (desktop Chrome) ... and the user doesn't know why it's not working...or gives a warning which the user has to approve (iPhone Safari in "browser mode") which is a hassle. And if the user has a popup blocker, it gets more difficult and even more potential for the user not getting it to work properly. The bcwars.com method doesn't have this problem.
Second, in iPhone Safari, when the popup window auto closes, the original page doesn't get focus if there are other browser windows open in Safari. Instead, it's in the smaller/slide mode so they can choose which one to show. If this happens, the user has to go through one more sttep...click on the browser window to activate it and give it focus..again more of a pain and more potential for them to mess up and not do it correctly and need help. The m.bcwars.com doesn't have this problem.
Azure options:
Looking at the Azure mobile code it looks like may already have the solution. I can't read it easliy becuase it's minified/obsfucated, but it seems to have 4 options (including iFrame, etc.) for invoking the authentication, and only 1 (the "less ideal one" of a popup) is being used. An easy solution would be to set a property to allow one of the alternate authentications to work. But I can't read it well enough to figure it out. Another would be to hack the code (temporarily until a fix is put up by Microsoft).
Could I get some help there perhaps?
You can implement an authentication flow with Facebook that doesn't use a popup. The basic idea is to use the 'Web Flow' for doing the login, and once the window return from the login, use the access token to login the user in to Azure Mobile Services.
The Facebook documentation for doing this is here:
https://developers.facebook.com/docs/facebook-login/login-flow-for-web-no-jssdk/#step2
Some code samples to make it easier for you.
You would start by something like this:
(Remember to replace YOUR_APP_ID and YOUR_URL with something relevant to your site.
function logIn() {
window.location.replace('https://www.facebook.com/dialog/oauth?client_id=YOUR_APP_ID&redirect_uri=http%3A%2F%2FYOUR_URL&response_type=token')
}
This redirects the window to the Facebook page for the user to log in and authorize your app. When the user is done, Facebook will redirect the user back to YOUR_URL given above.
There you can handle the redirect and do the Mobile Services Login with something like this:
function handleLoginResponse() {
var frag = $.deparam.fragment();
if (frag.hasOwnProperty("access_token")) {
client.login("facebook", { access_token: frag.access_token }).then(function () {
// you're logged in
}, function (error) {
alert(error);
});
}
}
In here you parse the access token you get as a URL fragment and pass it as argument to the login call you make to Azure Mobile Services.
This code depends on the jquery BBQ plugin to handle the URL fragment easily.
Hope this solves your problem!